Implement per-character position attribute lookup based on [1]:
- convert "x" and "y" attributes to arrays
- introduce ScopedPosResolver to handle positioning attribute lookup
and fallback
- push a new resolver every time we enter a text positioning element
scope (<text>, <tspan>, etc).
- flush/reposition a new text chunk every time we encounter explicit
absolute positions
The position attribute fallback logic is complex enough to warrant a
unit test.
[1] https://www.w3.org/TR/SVG11/text.html#TSpanElementXAttribute
Bug: skia:10840
Change-Id: I66c478fea4a179fdb8b1a6a9ff00c4dd9509f8d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345161
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
We also include the CHANGELOG in the release notes.
Change-Id: Icbdedf124c114c2f4be757f408a437fda71c40ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345288
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Instead of relying on RenderContext to pass text rendering options
downstack, introduce a dedicated virtual (onRenderText) and pass options
explicitly.
Root text nodes bridge from onRender() -> onRenderText().
This removes some complexity from RenderContext and incidentally fixes
xml:space = preserve (the value was being dropped during local ctx
copying).
Bug: skia:10840
Change-Id: Ic5fd9e0f9382f52f65108521574fcb2a422b97aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344559
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
When the filter units are objectBoundingBox, values are fractions/pcts
of the object's bounding box, which we were miscomputing.
Also adding in a small tweak to return bounds for <polygon> elements
(will be needed for future filter tests).
Bug: skia:10841
Change-Id: I7fcac21258570d872672c42e99a9739a65c53e30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343520
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This probably isn't ideal, but it's a step to keep it compiling while we
get this utility up and running in a more permanent way.
Change-Id: I98f56fe28b98862000a134f697bb441d87e47f30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344176
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Some of the SVG libraries, there appear to be some SYScalls
(getStreamFromFD) that are no longer included in an emsdk 2.0.10 build.
Change-Id: Ib6ac4c20186e79316cd5b2566ed2deb2d3e3d0af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344076
Reviewed-by: Kevin Lubick <kjlubick@google.com>
By using npm ci, we can make sure the versions of the helper
libraries (e.g. Karma, Jasmine) we are testing with locally
is the same as the versions we are using in the continuous
integration system.
The copying is needed because our docker recipe forces us
to run as not root, and this was causing some issues. As a
result, I changed the canvaskit test/perf to not re-use the
same file as pathkit does so copying was easier and the
dependencies between the two modules is broken.
Bug: skia:11077
Change-Id: Ib05890d666d3507d4f724a4ae298484629c7932a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343503
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Update pathkit too. I want to make sure we are up to date with testing
harnesses that could support testing as ES6 modules.
Bug: skia:11077
Change-Id: I1ecd8acbdf6ad47a5877aa7dbb6772406d2edb54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343501
Reviewed-by: Kevin Lubick <kjlubick@google.com>
- Add primitiveUnits attribute to SkSVGFilter class
- Add optional x, y, width, height attributes to filter effect base
class (SkSVGFe)
- Add function to return list of inputs for all filter effects
- Add function to compute filter primitive subregion and use it in all
filter effect classes.
Currently the "primitive subregion" just returns the entire filter
effect region, so there should be no diffs on gold with this change.
Bug: skia:10841
Change-Id: I1de283bebe302c0710d6b09d62a2472787820a49
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343107
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
- Consolidate SVGColor resolution into one method in render context, now
that it's a shared type.
- Remove all instances of `~TypeName() override = default;`. The only
thing this provides is slight/unreliable protection against someone
inadvertently removing 'virtual' from the base class destructor. In
our case that is SkRefCnt, which I'm assuming has very low risk of
that happening.
- Clean up some .h copy/paste issues of the form
`#endif // Typename_DEFINED`
Change-Id: I67fb40b2828b010fb7fdd83046bc1eae1a476267
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343421
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Several related W3C tests still won't pass until we implement the filter
primitive subregion.
Bug: skia:10841
Change-Id: I9e4beb9da8aa769f23a979ad5116a38fcda85ca4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343105
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Expand existing SkottieColorizeGM to also handle text properties and
add text-focused instance.
Update layer names in one of the json assets to match expected demo
prefix ($).
TBR=
Change-Id: I076229067523fe597be66c611a8653897f995bc8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342916
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This reverts commit ff7bfea4ab.
Reason for revert: several broken bots, e.g.
../SRC/skia/modules/skparagraph/src/TextLine.cpp:309:21: error: non-const lvalue reference to type 'skia::textlayout::TextLine::TextBlobRecord' cannot bind to a temporary of type 'void'
TextBlobRecord& record = fTextBlobCache.emplace_back();
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Original change's description:
> Cache text blobs computed by TextLine::paintText
>
> Change-Id: I7d4414fb64b14a714623e4c20199cab06e6ed18c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342297
> Commit-Queue: Jason Simmons <jsimmons@google.com>
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
TBR=jsimmons@google.com,jlavrova@google.com
Change-Id: I467c61eead7b0d8c190cb2f883b05537de97a08e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342856
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
These are somewhat the first presentation attributes of their kind,
in that they are non-inherited but also not applied via canvas layers.
Implementation-wise the main difference is that these attributes are
not propagated through the fInherited field of the render context's
presentation attribute list.
Change-Id: I0909507b0ecbd21732b3f80c46a343f5a0a9bf7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340661
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This color type will be shared in paint, stop-color, and flood-color
attributes (mainly so they can use 'currentColor').
Change-Id: Ib4200ea729a91a0db5da069c68d64e5e8e3f5010
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340617
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Introduce proper text shaping via SkShaper/drawTextBlob (to replace
SkTextUtils::DrawString).
Also add basic text layout support (text chunk alignment and default
fragment advances -- see [1]).
[1] https://www.w3.org/TR/SVG11/text.html#TextLayoutIntroduction
Bug: skia:10840
Change-Id: I246f899d2926d1e365dac06b414c8e1ab4371e1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341736
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
These print out all the time when I'm testing things locally. :/
Change-Id: I110a80c5b59c3fa024bee99f1516853b1dfd05d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341797
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Introduce classes to support text node nesting:
- TextContainer -- base class for nestable text containers
(<text>, <tspan> etc)
- TextLiteral -- actual text string/payload
Example structure mapping:
<text>Foo<tspan>Bar</tspan>Baz</text>
TextContainer[text]
TextLiteral["Foo"]
TextContainer[tspan]
TextLiteral["Bar"]
TextLiteral["Baz"]
Also add text layout state (SkSVGTextContenxt) to SkSVGRenderContext.
This will be used to track layout across a text subtree.
For now we don't touch rendering, so the output is quite garbled for
non-trivial text (no advance propagation -> things draw on top of each
other).
Bug: skia:10840
Change-Id: Ic6d3990ec8635b586f5d3d226be070fbf134e391
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341236
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
I kept in an array of Color (Float32Array) because it's very convenient
and not worth the hassle of removing.
Change-Id: I34c430c2b5112b6d073b049a81994e946428f21c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340797
Reviewed-by: Nathaniel Nifong <nifong@google.com>
We can now remove kInherit from all of the SVG types, but this CL does
just a few to get us started / prove the concept.
SkSVGPaint, SkSVGClip and SkSVGLineCap now do not contain kInherit as an
enum value. Also, SkSVGLineCap (and eventually others) can be a bare
enum class now.
Change-Id: I7de001459bcb1f5586d66b975f92fecedb125dde
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335827
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Expand the SkImageAsset API to support controlling sampling options and
pass an additional transform.
Bug: skia:10944, skia:10942
Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Currently, new/delete is not on for Google3. After this
CL new/delete will be used on all platforms.
Change-Id: Idfc6217b809c9eb986e618ffa575004893b3aa0f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339859
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This is another necessary step in order to remove kInherit from all of
the base SVG type enums.
Change-Id: I2185e744f7b27369f7bad36591f896d3a9982b42
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335817
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Previously, any builtin functions would be optimized as a side-effect of
optimizing programs that used them. Now that shared elements aren't
being optimized in that way, we explicitly optimize any shared modules
when they are first created. We don't remove dead elements, but we
we do substitute settings, simplify, and inline.
Bug: skia:10905
Change-Id: I701b5e9f52fb880ef3e6f4c67694d08602f47e95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/336440
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>