Title: [216088] trunk
- Revision
- 216088
- Author
- mmaxfi...@apple.com
- Date
- 2017-05-02 12:35:25 -0700 (Tue, 02 May 2017)
Log Message
REGRESSION (r211382): Partial right-to-left text runs are painted at an offset (breaks Find indicators, Look Up, and custom ::selection style)
https://bugs.webkit.org/show_bug.cgi?id=169517
<rdar://problem/30652443>
Reviewed by Dean Jackson.
Source/WebCore:
FontCascade::getGlyphsAndAdvancesForComplexText() is tasked with calculating paint advances for a
subrange of RTL text. It does this by creating a ComplexTextController, telling it to iterate to
the beginning of the subrange (outputting to a GlyphBuffer), then telling it to iterate to the end
of the subrange (outputting to another GlyphBuffer). Because the text is RTL, the sum of the
advances gathered so far is the distance from the right edge of the text to the left edge of the
subrange (because we advance in logical order). Therefore, the x-coordinate we are at now is the
total width minus the sum of both of the GlyphBuffers. For some reason, when I wrote this code I
forgot to add in the contribution from the first GlyphBuffer. Unfortunately, this particular
codepath is rarely hit in practice and completely untested, which made me miss it when I wrote it.
Test: fast/text/complex-text-selection.html
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
LayoutTests:
* fast/text/complex-text-selection-expected.html: Added.
* fast/text/complex-text-selection.html: Added.
* platform/ios/TestExpectations:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (216087 => 216088)
--- trunk/LayoutTests/ChangeLog 2017-05-02 19:22:42 UTC (rev 216087)
+++ trunk/LayoutTests/ChangeLog 2017-05-02 19:35:25 UTC (rev 216088)
@@ -1,3 +1,15 @@
+2017-05-02 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ REGRESSION (r211382): Partial right-to-left text runs are painted at an offset (breaks Find indicators, Look Up, and custom ::selection style)
+ https://bugs.webkit.org/show_bug.cgi?id=169517
+ <rdar://problem/30652443>
+
+ Reviewed by Dean Jackson.
+
+ * fast/text/complex-text-selection-expected.html: Added.
+ * fast/text/complex-text-selection.html: Added.
+ * platform/ios/TestExpectations:
+
2017-05-02 Joseph Pecoraro <pecor...@apple.com>
[Mac] WK1: http/tests/inspector/network/resource-sizes tests are failing
Added: trunk/LayoutTests/fast/text/complex-text-selection-expected.html (0 => 216088)
--- trunk/LayoutTests/fast/text/complex-text-selection-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/complex-text-selection-expected.html 2017-05-02 19:35:25 UTC (rev 216088)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div>Selection is <span style="color: green;">green</span></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/complex-text-selection.html (0 => 216088)
--- trunk/LayoutTests/fast/text/complex-text-selection.html (rev 0)
+++ trunk/LayoutTests/fast/text/complex-text-selection.html 2017-05-02 19:35:25 UTC (rev 216088)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ ::selection { color: green; }
+</style>
+</head>
+<body>
+<bdo id=target dir=rtl>neerg si noitceleS</bdo>
+<script>
+ let textNode = document.getElementById("target").firstChild;
+ getSelection().setBaseAndExtent(textNode, 0, textNode, 5)
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (216087 => 216088)
--- trunk/LayoutTests/platform/ios/TestExpectations 2017-05-02 19:22:42 UTC (rev 216087)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2017-05-02 19:35:25 UTC (rev 216088)
@@ -2946,3 +2946,6 @@
# auto-sizing produces inconsistent image results
css3/viewport-percentage-lengths/vh-auto-size.html [ ImageOnlyFailure ]
+
+# This test relies on the ::selection pseudoclass which isn't honored on iOS.
+webkit.org/b/169517 fast/text/complex-text-selection.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (216087 => 216088)
--- trunk/Source/WebCore/ChangeLog 2017-05-02 19:22:42 UTC (rev 216087)
+++ trunk/Source/WebCore/ChangeLog 2017-05-02 19:35:25 UTC (rev 216088)
@@ -1,3 +1,26 @@
+2017-05-02 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ REGRESSION (r211382): Partial right-to-left text runs are painted at an offset (breaks Find indicators, Look Up, and custom ::selection style)
+ https://bugs.webkit.org/show_bug.cgi?id=169517
+ <rdar://problem/30652443>
+
+ Reviewed by Dean Jackson.
+
+ FontCascade::getGlyphsAndAdvancesForComplexText() is tasked with calculating paint advances for a
+ subrange of RTL text. It does this by creating a ComplexTextController, telling it to iterate to
+ the beginning of the subrange (outputting to a GlyphBuffer), then telling it to iterate to the end
+ of the subrange (outputting to another GlyphBuffer). Because the text is RTL, the sum of the
+ advances gathered so far is the distance from the right edge of the text to the left edge of the
+ subrange (because we advance in logical order). Therefore, the x-coordinate we are at now is the
+ total width minus the sum of both of the GlyphBuffers. For some reason, when I wrote this code I
+ forgot to add in the contribution from the first GlyphBuffer. Unfortunately, this particular
+ codepath is rarely hit in practice and completely untested, which made me miss it when I wrote it.
+
+ Test: fast/text/complex-text-selection.html
+
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
+
2017-05-02 Chris Dumez <cdu...@apple.com>
[macOS] Flaky Crash under EventTarget::fireEventListeners on imported/blink/paint/deprecatedpaintlayer/non-self-painting-layer-overrides-visibility.html
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (216087 => 216088)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2017-05-02 19:22:42 UTC (rev 216087)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2017-05-02 19:35:25 UTC (rev 216088)
@@ -522,6 +522,8 @@
// Exploit the fact that the sum of the paint advances is equal to
// the sum of the layout advances.
initialAdvance = controller.totalWidth();
+ for (unsigned i = 0; i < dummyGlyphBuffer.size(); ++i)
+ initialAdvance -= dummyGlyphBuffer.advanceAt(i).width();
for (unsigned i = 0; i < glyphBuffer.size(); ++i)
initialAdvance -= glyphBuffer.advanceAt(i).width();
glyphBuffer.reverse(0, glyphBuffer.size());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes