Title: [254898] trunk
Revision
254898
Author
[email protected]
Date
2020-01-21 17:59:34 -0800 (Tue, 21 Jan 2020)

Log Message

A partially selected RTL text is placed at a wrong vertical position if it has a vertical initial advance
https://bugs.webkit.org/show_bug.cgi?id=205990

Reviewed by Darin Adler.

Source/WebCore:

FontCascade::getGlyphsAndAdvancesForComplexText returned only X
position of the first glyph, but Y position.

Because GlyphBuffer is using glyph advances instead glyph
positions, it's not simple to get the first glyph position of the
part of a RTL texts.
FontCascade::getGlyphsAndAdvancesForComplexText is calculating the
X position of it by subtracting right side part width from the
total width. It should do same for Y position.

macOS and iOS ports don't use the code to draw selected texts.

Test: fast/text/initial-advance-selected-text.html

* platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::offsetForPosition):
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
* platform/graphics/ComplexTextController.h: Replaced m_totalWidth with m_totalAdvance.
(WebCore::ComplexTextController::totalWidth const): Removed.
(WebCore::ComplexTextController::totalAdvance const): Added.
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::glyphBufferForTextRun const): Changed the return type from float to FloatSize.
(WebCore::FontCascade::drawText const):
(WebCore::FontCascade::displayListForTextRun const):
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const): Changed the return type from float to FloatSize.
(WebCore::FontCascade::drawGlyphBuffer const):
(WebCore::FontCascade::floatWidthForComplexText const):
(WebCore::FontCascade::adjustSelectionRectForComplexText const):
(WebCore::FontCascade::drawEmphasisMarksForComplexText const):
(WebCore::FontCascade::dashesForIntersectionsWithRect const):
* platform/graphics/FontCascade.h:
* platform/graphics/GlyphBuffer.h:
(WebCore::toFloatSize): Added.

Tools:

* TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
Replaced all "controller.totalWidth()" with "controller.totalAdvance().width()".

LayoutTests:

* fast/text/initial-advance-selected-text-expected.html: Added.
* fast/text/initial-advance-selected-text.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (254897 => 254898)


--- trunk/LayoutTests/ChangeLog	2020-01-22 01:54:38 UTC (rev 254897)
+++ trunk/LayoutTests/ChangeLog	2020-01-22 01:59:34 UTC (rev 254898)
@@ -1,3 +1,13 @@
+2020-01-21  Fujii Hironori  <[email protected]>
+
+        A partially selected RTL text is placed at a wrong vertical position if it has a vertical initial advance
+        https://bugs.webkit.org/show_bug.cgi?id=205990
+
+        Reviewed by Darin Adler.
+
+        * fast/text/initial-advance-selected-text-expected.html: Added.
+        * fast/text/initial-advance-selected-text.html: Added.
+
 2020-01-21  Jiewen Tan  <[email protected]>
 
         [WebAuthn] Incorporate more detailed UnknownError messages for LocalAuthenticator

Added: trunk/LayoutTests/fast/text/initial-advance-selected-text-expected.html (0 => 254898)


--- trunk/LayoutTests/fast/text/initial-advance-selected-text-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/initial-advance-selected-text-expected.html	2020-01-22 01:59:34 UTC (rev 254898)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<style>
+    div {
+        font-size: 200px;
+    }
+</style>
+<script>
+    _onload_ = () => {
+        const span = document.querySelector('div span');
+        const selection = window.getSelection();
+        const range = document.createRange();
+        range.selectNodeContents(span);
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+</script>
+
+<div><span>&#x628;-&#x0628;&#x0651;</span>-&#x628;</div>

Added: trunk/LayoutTests/fast/text/initial-advance-selected-text.html (0 => 254898)


--- trunk/LayoutTests/fast/text/initial-advance-selected-text.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/initial-advance-selected-text.html	2020-01-22 01:59:34 UTC (rev 254898)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<style>
+    div {
+        font-size: 200px;
+    }
+</style>
+<script>
+    _onload_ = () => {
+        const textNode = document.querySelector('div').childNodes[0];
+        const selection = window.getSelection();
+        const range = document.createRange();
+        range.setStart(textNode, 0);
+        range.setEnd(textNode, 4);
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+</script>
+
+<div>&#x628;-&#x0628;&#x0651;-&#x628;</div>

Modified: trunk/Source/WebCore/ChangeLog (254897 => 254898)


--- trunk/Source/WebCore/ChangeLog	2020-01-22 01:54:38 UTC (rev 254897)
+++ trunk/Source/WebCore/ChangeLog	2020-01-22 01:59:34 UTC (rev 254898)
@@ -1,3 +1,44 @@
+2020-01-21  Fujii Hironori  <[email protected]>
+
+        A partially selected RTL text is placed at a wrong vertical position if it has a vertical initial advance
+        https://bugs.webkit.org/show_bug.cgi?id=205990
+
+        Reviewed by Darin Adler.
+
+        FontCascade::getGlyphsAndAdvancesForComplexText returned only X
+        position of the first glyph, but Y position.
+
+        Because GlyphBuffer is using glyph advances instead glyph
+        positions, it's not simple to get the first glyph position of the
+        part of a RTL texts.
+        FontCascade::getGlyphsAndAdvancesForComplexText is calculating the
+        X position of it by subtracting right side part width from the
+        total width. It should do same for Y position.
+
+        macOS and iOS ports don't use the code to draw selected texts.
+
+        Test: fast/text/initial-advance-selected-text.html
+
+        * platform/graphics/ComplexTextController.cpp:
+        (WebCore::ComplexTextController::offsetForPosition):
+        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
+        * platform/graphics/ComplexTextController.h: Replaced m_totalWidth with m_totalAdvance.
+        (WebCore::ComplexTextController::totalWidth const): Removed.
+        (WebCore::ComplexTextController::totalAdvance const): Added.
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::glyphBufferForTextRun const): Changed the return type from float to FloatSize.
+        (WebCore::FontCascade::drawText const):
+        (WebCore::FontCascade::displayListForTextRun const):
+        (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const): Changed the return type from float to FloatSize.
+        (WebCore::FontCascade::drawGlyphBuffer const):
+        (WebCore::FontCascade::floatWidthForComplexText const):
+        (WebCore::FontCascade::adjustSelectionRectForComplexText const):
+        (WebCore::FontCascade::drawEmphasisMarksForComplexText const):
+        (WebCore::FontCascade::dashesForIntersectionsWithRect const):
+        * platform/graphics/FontCascade.h:
+        * platform/graphics/GlyphBuffer.h:
+        (WebCore::toFloatSize): Added.
+
 2020-01-21  Jer Noble  <[email protected]>
 
         [EME] Only emit an array of persistent-usage-records when we discover > 1

Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp (254897 => 254898)


--- trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2020-01-22 01:54:38 UTC (rev 254897)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2020-01-22 01:59:34 UTC (rev 254898)
@@ -163,7 +163,7 @@
 
 unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGlyphs)
 {
-    if (h >= m_totalWidth)
+    if (h >= m_totalAdvance.width())
         return m_run.ltr() ? m_end : 0;
 
     if (h < 0)
@@ -733,7 +733,7 @@
             FloatSize advance = treatAsSpace ? FloatSize(spaceWidth, advances[i].height()) : advances[i];
 
             if (ch == '\t' && m_run.allowTabs())
-                advance.setWidth(m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalWidth));
+                advance.setWidth(m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalAdvance.width()));
             else if (FontCascade::treatAsZeroWidthSpace(ch) && !treatAsSpace) {
                 advance.setWidth(0);
                 glyph = font.spaceGlyph();
@@ -784,7 +784,7 @@
                                 complexTextRun.growInitialAdvanceHorizontally(m_expansionPerOpportunity);
                             } else {
                                 m_adjustedBaseAdvances.last().expand(m_expansionPerOpportunity, 0);
-                                m_totalWidth += m_expansionPerOpportunity;
+                                m_totalAdvance.expand(m_expansionPerOpportunity, 0);
                             }
                         }
                         if (expandRight) {
@@ -802,7 +802,7 @@
                     afterExpansion = false;
             }
 
-            m_totalWidth += advance.width();
+            m_totalAdvance += advance;
 
             // FIXME: Combining marks should receive a text emphasis mark if they are combine with a space.
             if (m_forTextEmphasis && (!FontCascade::canReceiveTextEmphasis(ch) || (U_GET_GC_MASK(ch) & U_GC_M_MASK)))

Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.h (254897 => 254898)


--- trunk/Source/WebCore/platform/graphics/ComplexTextController.h	2020-01-22 01:54:38 UTC (rev 254897)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.h	2020-01-22 01:59:34 UTC (rev 254898)
@@ -65,7 +65,7 @@
     // Returns the width of everything we've consumed so far.
     float runWidthSoFar() const { return m_runWidthSoFar; }
 
-    float totalWidth() const { return m_totalWidth; }
+    FloatSize totalAdvance() const { return m_totalAdvance; }
 
     float minGlyphBoundingBoxX() const { return m_minGlyphBoundingBoxX; }
     float maxGlyphBoundingBoxX() const { return m_maxGlyphBoundingBoxX; }
@@ -215,7 +215,7 @@
     unsigned m_currentCharacter { 0 };
     unsigned m_end { 0 };
 
-    float m_totalWidth { 0 };
+    FloatSize m_totalAdvance;
     float m_runWidthSoFar { 0 };
     unsigned m_numGlyphsSoFar { 0 };
     unsigned m_currentRun { 0 };

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (254897 => 254898)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-01-22 01:54:38 UTC (rev 254897)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-01-22 01:59:34 UTC (rev 254898)
@@ -273,10 +273,10 @@
     m_requiresShaping = computeRequiresShaping();
 }
 
-float FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer) const
+FloatSize FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer) const
 {
     if (codePathToUse != Complex)
-        return getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer);
+        return { getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer), 0 };
     return getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
 }
 
@@ -284,14 +284,14 @@
 {
     unsigned destination = to.valueOr(run.length());
     GlyphBuffer glyphBuffer;
-    float startX = point.x() + glyphBufferForTextRun(codePath(run, from, to), run, from, destination, glyphBuffer);
+    FloatPoint startPoint = point + glyphBufferForTextRun(codePath(run, from, to), run, from, destination, glyphBuffer);
     // We couldn't generate any glyphs for the run. Give up.
     if (glyphBuffer.isEmpty())
         return 0;
     // Draw the glyph buffer now at the starting point returned in startX.
-    FloatPoint startPoint(startX, point.y());
+    float oldStartX = startPoint.x();
     drawGlyphBuffer(context, glyphBuffer, startPoint, customFontNotReadyAction);
-    return startPoint.x() - startX;
+    return startPoint.x() - oldStartX;
 }
 
 void FontCascade::drawEmphasisMarks(GraphicsContext& context, const TextRun& run, const AtomString& mark, const FloatPoint& point, unsigned from, Optional<unsigned> to) const
@@ -317,7 +317,7 @@
         codePathToUse = Complex;
     
     GlyphBuffer glyphBuffer;
-    float startX = glyphBufferForTextRun(codePathToUse, run, from, destination, glyphBuffer);
+    FloatPoint startPoint = toFloatPoint(glyphBufferForTextRun(codePathToUse, run, from, destination, glyphBuffer));
     // We couldn't generate any glyphs for the run. Give up.
     if (glyphBuffer.isEmpty())
         return nullptr;
@@ -327,7 +327,6 @@
         return makeUnique<DisplayList::Recorder>(displayListContext, *displayList, context.state(), FloatRect(), AffineTransform());
     });
     
-    FloatPoint startPoint(startX, 0);
     drawGlyphBuffer(recordingContext, glyphBuffer, startPoint, customFontNotReadyAction);
     return displayList;
 }
@@ -1383,9 +1382,9 @@
     return initialAdvance;
 }
 
-float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
+FloatSize FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
 {
-    float initialAdvance;
+    FloatSize initialAdvance;
 
     ComplexTextController controller(*this, run, false, 0, forTextEmphasis);
     GlyphBuffer dummyGlyphBuffer;
@@ -1393,21 +1392,21 @@
     controller.advance(to, &glyphBuffer);
 
     if (glyphBuffer.isEmpty())
-        return 0;
+        return { };
 
     if (run.rtl()) {
         // Exploit the fact that the sum of the paint advances is equal to
         // the sum of the layout advances.
-        initialAdvance = controller.totalWidth();
+        initialAdvance = controller.totalAdvance();
         for (unsigned i = 0; i < dummyGlyphBuffer.size(); ++i)
-            initialAdvance -= dummyGlyphBuffer.advanceAt(i).width();
+            initialAdvance -= toFloatSize(dummyGlyphBuffer.advanceAt(i));
         for (unsigned i = 0; i < glyphBuffer.size(); ++i)
-            initialAdvance -= glyphBuffer.advanceAt(i).width();
+            initialAdvance -= toFloatSize(glyphBuffer.advanceAt(i));
         glyphBuffer.reverse(0, glyphBuffer.size());
     } else {
-        initialAdvance = dummyGlyphBuffer.initialAdvance().width();
+        initialAdvance = toFloatSize(dummyGlyphBuffer.initialAdvance());
         for (unsigned i = 0; i < dummyGlyphBuffer.size(); ++i)
-            initialAdvance += dummyGlyphBuffer.advanceAt(i).width();
+            initialAdvance += toFloatSize(dummyGlyphBuffer.advanceAt(i));
     }
 
     return initialAdvance;
@@ -1436,7 +1435,7 @@
 {
     // Draw each contiguous run of glyphs that use the same font data.
     const Font* fontData = glyphBuffer.fontAt(0);
-    FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height());
+    FloatPoint startPoint = point;
     float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width();
     float nextY = startPoint.y() + glyphBuffer.advanceAt(0).height();
     unsigned lastFrom = 0;
@@ -1530,9 +1529,9 @@
         glyphOverflow->top = std::max<int>(glyphOverflow->top, ceilf(-controller.minGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascent()));
         glyphOverflow->bottom = std::max<int>(glyphOverflow->bottom, ceilf(controller.maxGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().descent()));
         glyphOverflow->left = std::max<int>(0, ceilf(-controller.minGlyphBoundingBoxX()));
-        glyphOverflow->right = std::max<int>(0, ceilf(controller.maxGlyphBoundingBoxX() - controller.totalWidth()));
+        glyphOverflow->right = std::max<int>(0, ceilf(controller.maxGlyphBoundingBoxX() - controller.totalAdvance().width()));
     }
-    return controller.totalWidth();
+    return controller.totalAdvance().width();
 }
 
 void FontCascade::adjustSelectionRectForSimpleText(const TextRun& run, LayoutRect& selectionRect, unsigned from, unsigned to) const
@@ -1563,7 +1562,7 @@
     float afterWidth = controller.runWidthSoFar();
 
     if (run.rtl())
-        selectionRect.move(controller.totalWidth() - afterWidth, 0);
+        selectionRect.move(controller.totalAdvance().width() - afterWidth, 0);
     else
         selectionRect.move(beforeWidth, 0);
     selectionRect.setWidth(LayoutUnit::fromFloatCeil(afterWidth - beforeWidth));
@@ -1636,12 +1635,12 @@
 void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomString& mark, const FloatPoint& point, unsigned from, unsigned to) const
 {
     GlyphBuffer glyphBuffer;
-    float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
+    auto initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
 
     if (glyphBuffer.isEmpty())
         return;
 
-    drawEmphasisMarks(context, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
+    drawEmphasisMarks(context, glyphBuffer, mark, point + initialAdvance);
 }
 
 struct GlyphIterationState {
@@ -1779,7 +1778,7 @@
     if (codePath(run) != FontCascade::Complex)
         deltaX = getGlyphsAndAdvancesForSimpleText(run, 0, run.length(), glyphBuffer);
     else
-        deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer);
+        deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer).width();
 
     if (!glyphBuffer.size())
         return DashArray();

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (254897 => 254898)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2020-01-22 01:54:38 UTC (rev 254897)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2020-01-22 01:59:34 UTC (rev 254898)
@@ -203,7 +203,7 @@
 private:
     enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis };
 
-    float glyphBufferForTextRun(CodePath, const TextRun&, unsigned from, unsigned to, GlyphBuffer&) const;
+    FloatSize glyphBufferForTextRun(CodePath, const TextRun&, unsigned from, unsigned to, GlyphBuffer&) const;
     // Returns the initial in-stream advance.
     float getGlyphsAndAdvancesForSimpleText(const TextRun&, unsigned from, unsigned to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
     void drawEmphasisMarksForSimpleText(GraphicsContext&, const TextRun&, const AtomString& mark, const FloatPoint&, unsigned from, unsigned to) const;
@@ -219,7 +219,7 @@
     static bool canExpandAroundIdeographsInComplexText();
 
     // Returns the initial in-stream advance.
-    float getGlyphsAndAdvancesForComplexText(const TextRun&, unsigned from, unsigned to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
+    FloatSize getGlyphsAndAdvancesForComplexText(const TextRun&, unsigned from, unsigned to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
     void drawEmphasisMarksForComplexText(GraphicsContext&, const TextRun&, const AtomString& mark, const FloatPoint&, unsigned from, unsigned to) const;
     float floatWidthForComplexText(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
     int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const;

Modified: trunk/Source/WebCore/platform/graphics/GlyphBuffer.h (254897 => 254898)


--- trunk/Source/WebCore/platform/graphics/GlyphBuffer.h	2020-01-22 01:54:38 UTC (rev 254897)
+++ trunk/Source/WebCore/platform/graphics/GlyphBuffer.h	2020-01-22 01:59:34 UTC (rev 254898)
@@ -98,6 +98,11 @@
 typedef FloatSize GlyphBufferAdvance;
 #endif
 
+inline FloatSize toFloatSize(const GlyphBufferAdvance& a)
+{
+    return FloatSize(a.width(), a.height());
+}
+
 class GlyphBuffer {
 public:
     bool isEmpty() const { return m_fonts.isEmpty(); }

Modified: trunk/Tools/ChangeLog (254897 => 254898)


--- trunk/Tools/ChangeLog	2020-01-22 01:54:38 UTC (rev 254897)
+++ trunk/Tools/ChangeLog	2020-01-22 01:59:34 UTC (rev 254898)
@@ -1,3 +1,13 @@
+2020-01-21  Fujii Hironori  <[email protected]>
+
+        A partially selected RTL text is placed at a wrong vertical position if it has a vertical initial advance
+        https://bugs.webkit.org/show_bug.cgi?id=205990
+
+        Reviewed by Darin Adler.
+
+        * TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
+        Replaced all "controller.totalWidth()" with "controller.totalAdvance().width()".
+
 2020-01-21  Sihui Liu  <[email protected]>
 
         REGRESSION (r254856?): [Win] http/tests/security/same-origin-websql-blocked.html and 2 fast/dom/Window/window-function-* tests failing

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp (254897 => 254898)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp	2020-01-22 01:54:38 UTC (rev 254897)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp	2020-01-22 01:59:34 UTC (rev 254898)
@@ -71,7 +71,7 @@
     float totalWidth = 0;
     for (size_t i = 1; i < advances.size(); ++i)
         totalWidth += advances[i].width();
-    EXPECT_NEAR(controller.totalWidth(), spaceWidth + totalWidth, 0.0001);
+    EXPECT_NEAR(controller.totalAdvance().width(), spaceWidth + totalWidth, 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     controller.advance(0, &glyphBuffer);
@@ -115,7 +115,7 @@
     float totalWidth = 0;
     for (size_t i = 1; i < advances.size(); ++i)
         totalWidth += advances[i].width();
-    EXPECT_NEAR(controller.totalWidth(), totalWidth, 0.0001);
+    EXPECT_NEAR(controller.totalAdvance().width(), totalWidth, 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     controller.advance(0, &glyphBuffer);
@@ -159,7 +159,7 @@
     runs.append(WTFMove(run2));
     ComplexTextController controller(font, textRun, runs);
 
-    EXPECT_NEAR(controller.totalWidth(), spaceWidth + 76.347656 + initialAdvance.width(), 0.0001);
+    EXPECT_NEAR(controller.totalAdvance().width(), spaceWidth + 76.347656 + initialAdvance.width(), 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     controller.advance(0, &glyphBuffer);
@@ -199,7 +199,7 @@
     runs.append(WTFMove(run));
     ComplexTextController controller(font, textRun, runs);
 
-    EXPECT_NEAR(controller.totalWidth(), 76.347656 + initialAdvance.width(), 0.0001);
+    EXPECT_NEAR(controller.totalAdvance().width(), 76.347656 + initialAdvance.width(), 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     controller.advance(0, &glyphBuffer);
@@ -238,7 +238,7 @@
     ComplexTextController controller(font, textRun, runs);
 
     float totalWidth = 14.0397830018083 + 12.0 + 43.8119349005425;
-    EXPECT_NEAR(controller.totalWidth(), totalWidth, 0.0001);
+    EXPECT_NEAR(controller.totalAdvance().width(), totalWidth, 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     controller.advance(0, &glyphBuffer);
@@ -278,7 +278,7 @@
     ComplexTextController controller(font, textRun, runs);
 
     float totalWidth = 100 + 24;
-    EXPECT_NEAR(controller.totalWidth(), totalWidth, 0.0001);
+    EXPECT_NEAR(controller.totalAdvance().width(), totalWidth, 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     controller.advance(0, &glyphBuffer);
@@ -309,7 +309,7 @@
     runs.append(WTFMove(run2));
     ComplexTextController controller(font, textRun, runs);
 
-    EXPECT_NEAR(controller.totalWidth(), 0, 0.0001);
+    EXPECT_NEAR(controller.totalAdvance().width(), 0, 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     controller.advance(0, &glyphBuffer);
@@ -356,12 +356,12 @@
     runs.append(WTFMove(run));
     ComplexTextController controller(font, textRun, runs);
 
-    EXPECT_NEAR(controller.totalWidth(), 1 + 20 + 7 + 4 + 20 + 7 + 16, 0.0001);
+    EXPECT_NEAR(controller.totalAdvance().width(), 1 + 20 + 7 + 4 + 20 + 7 + 16, 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     controller.advance(5, &glyphBuffer);
     EXPECT_EQ(glyphBuffer.size(), 5U);
-    EXPECT_NEAR(glyphBuffer.advanceAt(0).width() + glyphBuffer.advanceAt(1).width() + glyphBuffer.advanceAt(2).width() + glyphBuffer.advanceAt(3).width() + glyphBuffer.advanceAt(4).width(), controller.totalWidth(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(0).width() + glyphBuffer.advanceAt(1).width() + glyphBuffer.advanceAt(2).width() + glyphBuffer.advanceAt(3).width() + glyphBuffer.advanceAt(4).width(), controller.totalAdvance().width(), 0.0001);
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to