Title: [209410] trunk
Revision
209410
Author
mmaxfi...@apple.com
Date
2016-12-06 11:54:49 -0800 (Tue, 06 Dec 2016)

Log Message

[Cocoa] REGRESSION(r205396): Intermediate CTRuns with initial advances get double counted when glyph origins are enabled
https://bugs.webkit.org/show_bug.cgi?id=165084

Reviewed by Simon Fraser.

Source/WebCore:

When glyph origins are not enabled, an intermediate CTRun's initial advance is simply added
to the previous glyph's advance. However, when glyph origins are enabled, this shouldn't
occur.

Test: fast/text/initial-advance-in-intermediate-run-complex.html

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):

LayoutTests:

* fast/text/initial-advance-in-intermediate-run-complex-expected.html: Added.
* fast/text/initial-advance-in-intermediate-run-complex.html: Added.
* platform/ios-simulator/TestExpectations: Disable the test on iOS because it relies
on Arial being used to draw Arabic, which we explicitly don't allow.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209409 => 209410)


--- trunk/LayoutTests/ChangeLog	2016-12-06 19:39:32 UTC (rev 209409)
+++ trunk/LayoutTests/ChangeLog	2016-12-06 19:54:49 UTC (rev 209410)
@@ -1,3 +1,15 @@
+2016-12-06  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] REGRESSION(r205396): Intermediate CTRuns with initial advances get double counted when glyph origins are enabled
+        https://bugs.webkit.org/show_bug.cgi?id=165084
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/initial-advance-in-intermediate-run-complex-expected.html: Added.
+        * fast/text/initial-advance-in-intermediate-run-complex.html: Added.
+        * platform/ios-simulator/TestExpectations: Disable the test on iOS because it relies
+        on Arial being used to draw Arabic, which we explicitly don't allow.
+
 2016-12-06  Simon Fraser  <simon.fra...@apple.com>
 
         Enable visual viewports by default on Mac, and iOS Wk2

Added: trunk/LayoutTests/fast/text/initial-advance-in-intermediate-run-complex-expected.html (0 => 209410)


--- trunk/LayoutTests/fast/text/initial-advance-in-intermediate-run-complex-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/initial-advance-in-intermediate-run-complex-expected.html	2016-12-06 19:54:49 UTC (rev 209410)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<p>This test makes sure a CTRun with an initial advance doesn't get incorporated incorrectly when glyph origins are used. The test passes if the lower dots do not appear too low.</p>
+<div style="position: relative;">
+<span style="font-family: Helvetica, Arial, sans-serif;" dir="RTL">AAA <span>&#x634;&#x633;&#x6cc;&#x634;&#x633;&#x6cc;</span> <span>&#x634;&#x633;&#x6cc;&#x634;&#x633;&#x6cc;</span> <span>&#x634;&#x633;&#x6cc;&#x634;&#x633;&#x6cc;</span> <span>&#x6af;&#x632;&#x6cc;&#x646;&#x647;&#x654;</span> <span>&#x634;&#x633;&#x6cc;&#x634;&#x633;&#x6cc;&#x02e;</span>
+<div style="position: absolute; left: 0px; top: -2px; width: 100px; height: 25px; background: black;"></div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/text/initial-advance-in-intermediate-run-complex.html (0 => 209410)


--- trunk/LayoutTests/fast/text/initial-advance-in-intermediate-run-complex.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/initial-advance-in-intermediate-run-complex.html	2016-12-06 19:54:49 UTC (rev 209410)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<p>This test makes sure a CTRun with an initial advance doesn't get incorporated incorrectly when glyph origins are used. The test passes if the lower dots do not appear too low.</p>
+<div style="position: relative;">
+<span style="font-family: Helvetica, Arial, sans-serif;" dir="RTL">AAA &#x634;&#x633;&#x6cc;&#x634;&#x633;&#x6cc; &#x634;&#x633;&#x6cc;&#x634;&#x633;&#x6cc; &#x634;&#x633;&#x6cc;&#x634;&#x633;&#x6cc; &#x6af;&#x632;&#x6cc;&#x646;&#x647;&#x654; &#x634;&#x633;&#x6cc;&#x634;&#x633;&#x6cc;&#x02e;</span>
+<div style="position: absolute; left: 0px; top: -2px; width: 100px; height: 25px; background: black;"></div>
+</div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (209409 => 209410)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-12-06 19:39:32 UTC (rev 209409)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-12-06 19:54:49 UTC (rev 209410)
@@ -2736,3 +2736,7 @@
 
 # Test relies on window.scrollTo
 fast/zooming/client-rect-in-fixed-zoomed.html [ Skip ]
+
+# This test relies on Arial being used to draw Arabic. However, on iOS,
+# we explicitly disallow this because this font is too slow.
+fast/text/initial-advance-in-intermediate-run-complex.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (209409 => 209410)


--- trunk/Source/WebCore/ChangeLog	2016-12-06 19:39:32 UTC (rev 209409)
+++ trunk/Source/WebCore/ChangeLog	2016-12-06 19:54:49 UTC (rev 209410)
@@ -1,3 +1,19 @@
+2016-12-06  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] REGRESSION(r205396): Intermediate CTRuns with initial advances get double counted when glyph origins are enabled
+        https://bugs.webkit.org/show_bug.cgi?id=165084
+
+        Reviewed by Simon Fraser.
+
+        When glyph origins are not enabled, an intermediate CTRun's initial advance is simply added
+        to the previous glyph's advance. However, when glyph origins are enabled, this shouldn't
+        occur.
+
+        Test: fast/text/initial-advance-in-intermediate-run-complex.html
+
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
+
 2016-12-06  Simon Fraser  <simon.fra...@apple.com>
 
         Enable visual viewports by default on Mac, and iOS Wk2

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (209409 => 209410)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2016-12-06 19:39:32 UTC (rev 209409)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2016-12-06 19:54:49 UTC (rev 209410)
@@ -664,14 +664,14 @@
     bool runForbidsTrailingExpansion = (m_run.expansionBehavior() & TrailingExpansionMask) == ForbidTrailingExpansion;
 
     // We are iterating in glyph order, not string order. Compare this to WidthIterator::advanceInternal()
-    for (size_t r = 0; r < runCount; ++r) {
-        ComplexTextRun& complexTextRun = *m_complexTextRuns[r];
+    for (size_t runIndex = 0; runIndex < runCount; ++runIndex) {
+        ComplexTextRun& complexTextRun = *m_complexTextRuns[runIndex];
         unsigned glyphCount = complexTextRun.glyphCount();
         const Font& font = complexTextRun.font();
 
         // Represent the initial advance for a text run by adjusting the advance
         // of the last glyph of the previous text run in the glyph buffer.
-        if (r && m_adjustedBaseAdvances.size()) {
+        if (!complexTextRun.glyphOrigins() && runIndex && m_adjustedBaseAdvances.size()) {
             CGSize previousAdvance = m_adjustedBaseAdvances.last();
             previousAdvance.width += complexTextRun.initialAdvance().width;
             previousAdvance.height -= complexTextRun.initialAdvance().height;
@@ -685,7 +685,7 @@
         const CGGlyph* glyphs = complexTextRun.glyphs();
         const CGSize* advances = complexTextRun.baseAdvances();
 
-        bool lastRun = r + 1 == runCount;
+        bool lastRun = runIndex + 1 == runCount;
         float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset();
         const UChar* cp = complexTextRun.characters();
         CGPoint glyphOrigin = CGPointZero;
@@ -709,7 +709,7 @@
             else if (i + 1 < glyphCount)
                 nextCh = *(cp + complexTextRun.indexAt(i + 1));
             else
-                nextCh = *(m_complexTextRuns[r + 1]->characters() + m_complexTextRuns[r + 1]->indexAt(0));
+                nextCh = *(m_complexTextRuns[runIndex + 1]->characters() + m_complexTextRuns[runIndex + 1]->indexAt(0));
 
             bool treatAsSpace = FontCascade::treatAsSpace(ch);
             CGGlyph glyph = treatAsSpace ? font.spaceGlyph() : glyphs[i];
@@ -771,7 +771,7 @@
                         afterExpansion = false;
 
                     // Account for word-spacing.
-                    if (treatAsSpace && (ch != '\t' || !m_run.allowTabs()) && (characterIndex > 0 || r > 0) && m_font.wordSpacing())
+                    if (treatAsSpace && (ch != '\t' || !m_run.allowTabs()) && (characterIndex > 0 || runIndex > 0) && m_font.wordSpacing())
                         advance.width += m_font.wordSpacing();
                 } else
                     afterExpansion = false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to