DescriptionIntroduce support for text-decoration-skip: ink
In addition to the "objects" default value, support value "ink" for
text-decoration-skip. The spec [1] describes this as:
"Skip over where glyphs are drawn: interrupt the decoration line to
let the shape of the text show through where the text decoration
would otherwise cross over a glyph. The UA must skip a small
distance to either side of the glyph outline."
This CL supports this for all underline, overline, and line-through and
all text-decoration-style styles: solid, double, dashed, dotted, wavy.
The implementation approach is: If ink skipping is requested, clip
rectangles are calculated for the text intercepts. The vertical bounds
for those clip rectangles are computed from the extends of the underline
style: For example tight bounds of a Bezier curve are calculated for the
wavy underline style. Using these vertical boundaries, the text
intercepts are retrieved from Skia, via GraphicsContext. Skia computes
them from the glyph shapes and two distances, the vertical bounds that
were previously calculated. The rectangles are inflated in the baseline
direction by the underline thickness itself, same as WebKit. These clip
rectangles are then used to clip out painting an underline at the
calculated positions.
Known issue at this point: Due to the way we draw upright in vertical
text, currently there is no correct way of computing the ink skip
rectangles in this case, tracked in crbug.com/655154
[1] https://drafts.csswg.org/css-text-decor-3/#text-decoration-skip-property
BUG=649700, 581456
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Committed: https://crrev.com/c0fd99aa9f08fd23c5cf35e4f29b2e650fcace92
Cr-Commit-Position: refs/heads/master@{#433415}
Patch Set 1 #
Total comments: 10
Patch Set 2 : Reduce font size in test #Patch Set 3 : Adressing some of Emil's review comments #Patch Set 4 : Remove sketch comments #Patch Set 5 : Vertical text artifacts fixed #Patch Set 6 : Model dependency to multiple decorations painting #Patch Set 7 : Fix wavy offset #Patch Set 8 : Perhaps generic test expectations are enough? #Patch Set 9 : Falling back to adding rebaseline expectation #Messages
Total messages: 48 (31 generated)
|