RESOLVED FIXED Bug 168601
Add support for CSS properties paint-order, stroke-linecap, and stroke-linejoin in text rendering.
https://bugs.webkit.org/show_bug.cgi?id=168601
Summary Add support for CSS properties paint-order, stroke-linecap, and stroke-linejo...
Per Arne Vollan
Reported 2017-02-20 08:47:29 PST
This is needed for rendering of video captions.
Attachments
Patch (491.25 KB, patch)
2017-02-20 08:53 PST, Per Arne Vollan
no flags
Patch (22.31 KB, patch)
2017-02-21 04:55 PST, Per Arne Vollan
no flags
Patch (25.27 KB, patch)
2017-02-21 06:53 PST, Per Arne Vollan
no flags
Archive of layout-test-results from ews123 for ios-simulator-wk2 (848.80 KB, application/zip)
2017-02-21 08:22 PST, Build Bot
no flags
Patch (24.69 KB, patch)
2017-02-21 11:53 PST, Per Arne Vollan
simon.fraser: review+
Per Arne Vollan
Comment 1 2017-02-20 08:53:05 PST
Simon Fraser (smfr)
Comment 2 2017-02-20 11:08:18 PST
Comment on attachment 302149 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=302149&action=review Things i think you need to test: Shadow respects stroke. What happens to shadow with colored stroke but clear fill. Shadow painting with non-standard paint-order. You need to get creative with tests here. Tests with image results aren't useful, because no-one runs pixel tests. You need to create tests that can be ref tests, which you can do by masking/obscuring parts of the text, either with -webkit-clip-path or overlaying divs to just reveal solid blocks of color for the bits you care about. Code is good, but tests need beefing up. > Source/WebCore/ChangeLog:7 > + Reviewed by NOBODY (OOPS!). > + I would like to see some more description here of what you did. > Source/WebCore/rendering/TextPainter.cpp:133 > + for (unsigned i = 0; i < paintOrder.size(); ++i) { > + switch (paintOrder.at(i)) { You can use a modern loop here. > Source/WebCore/rendering/TextPainter.cpp:136 > + paintTextWithShadows(shadow, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom, 0, false); Is this going to paint the shadow in each phase? I think that's wrong; you should just paint the shadow once. > Source/WebCore/rendering/TextPainter.cpp:141 > + paintTextWithShadows(shadow, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom, 0, paintStyle.strokeWidth > 0); Same here. > Source/WebCore/rendering/style/RenderStyleConstants.h:743 > + PaintOrderNormal = 0, > + PaintOrderFill = 1, > + PaintOrderFillMarkers = 2, > + PaintOrderStroke = 3, > + PaintOrderStrokeMarkers = 4, > + PaintOrderMarkers = 5, > + PaintOrderMarkersStroke = 6 No need to give values if they are contiguous.
zalan
Comment 3 2017-02-20 11:15:06 PST
Comment on attachment 302149 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=302149&action=review > Source/WebCore/rendering/style/RenderStyleConstants.h:736 > +enum PaintOrder { enum class > Source/WebCore/rendering/style/RenderStyleConstants.h:746 > +enum PaintType { enum class
Per Arne Vollan
Comment 4 2017-02-21 04:55:51 PST
Sam Weinig
Comment 5 2017-02-21 06:51:08 PST
Comment on attachment 302250 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=302250&action=review > Source/WebCore/rendering/style/RenderStyleConstants.h:744 > +enum class PaintOrder { > + PaintOrderNormal, > + PaintOrderFill, > + PaintOrderFillMarkers, > + PaintOrderStroke, > + PaintOrderStrokeMarkers, > + PaintOrderMarkers, > + PaintOrderMarkersStroke > +}; > + > +enum class PaintType { > + PaintTypeFill, > + PaintTypeStroke, > + PaintTypeMarkers > +}; When using enum class, there is no need to prefix each of the values, since you always use the qualified form.
Per Arne Vollan
Comment 6 2017-02-21 06:53:22 PST
Per Arne Vollan
Comment 7 2017-02-21 06:57:08 PST
(In reply to comment #6) > Created attachment 302253 [details] > Patch Thanks for reviewing! Updated patch.
Build Bot
Comment 8 2017-02-21 08:22:41 PST
Comment on attachment 302253 [details] Patch Attachment 302253 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/3166037 New failing tests: fast/css/paint-order-shadow.html
Build Bot
Comment 9 2017-02-21 08:22:45 PST
Created attachment 302261 [details] Archive of layout-test-results from ews123 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews123 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Per Arne Vollan
Comment 10 2017-02-21 11:53:44 PST
Simon Fraser (smfr)
Comment 11 2017-02-21 12:08:05 PST
Comment on attachment 302292 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=302292&action=review > Source/WebCore/rendering/TextPainter.cpp:134 > + for (auto i : paintOrder) { > + switch (i) { I would not call this i (it's not an index). Call it 'order' or something. > Source/WebCore/rendering/TextPainter.cpp:144 > + case PaintType::Stroke: > + m_context.setTextDrawingMode(textDrawingMode & ~TextModeFill); > + paintTextWithShadows(paintShadow ? shadow : nullptr, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom, 0, paintStyle.strokeWidth > 0); > + paintShadow = false; So if the stroke comes first, is it right to just shadow the stroke?
Per Arne Vollan
Comment 12 2017-02-21 12:53:50 PST
Per Arne Vollan
Comment 13 2017-02-21 22:59:57 PST
Jon Lee
Comment 14 2018-02-23 11:12:44 PST
*** Bug 183077 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.