Title: [265412] trunk/Source/WebCore
Revision
265412
Author
[email protected]
Date
2020-08-08 21:27:09 -0700 (Sat, 08 Aug 2020)

Log Message

WidthIterator::m_finalRoundingWidth is always 0
https://bugs.webkit.org/show_bug.cgi?id=215307

Reviewed by Darin Adler.

There's no reason for it to exist.

No new tests because there is no behavior change.

* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::layoutSimpleText const):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):
* platform/graphics/WidthIterator.h:
(WebCore::WidthIterator::runWidthSoFar const):
(WebCore::WidthIterator::finalRoundingWidth const): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265411 => 265412)


--- trunk/Source/WebCore/ChangeLog	2020-08-09 03:57:08 UTC (rev 265411)
+++ trunk/Source/WebCore/ChangeLog	2020-08-09 04:27:09 UTC (rev 265412)
@@ -1,5 +1,24 @@
 2020-08-08  Myles C. Maxfield  <[email protected]>
 
+        WidthIterator::m_finalRoundingWidth is always 0
+        https://bugs.webkit.org/show_bug.cgi?id=215307
+
+        Reviewed by Darin Adler.
+
+        There's no reason for it to exist.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::layoutSimpleText const):
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::advanceInternal):
+        * platform/graphics/WidthIterator.h:
+        (WebCore::WidthIterator::runWidthSoFar const):
+        (WebCore::WidthIterator::finalRoundingWidth const): Deleted.
+
+2020-08-08  Myles C. Maxfield  <[email protected]>
+
         Use references instead of pointers for GlyphBuffer::add()'s Font argument
         https://bugs.webkit.org/show_bug.cgi?id=215309
 

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (265411 => 265412)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-08-09 03:57:08 UTC (rev 265411)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-08-09 04:27:09 UTC (rev 265412)
@@ -1387,9 +1387,8 @@
 
     float initialAdvance = 0;
     if (run.rtl()) {
-        float finalRoundingWidth = it.finalRoundingWidth();
         it.advance(run.length(), &localGlyphBuffer);
-        initialAdvance = finalRoundingWidth + it.runWidthSoFar() - afterWidth;
+        initialAdvance = it.runWidthSoFar() - afterWidth;
     } else
         initialAdvance = beforeWidth;
     // FIXME: Deal with the GlyphBuffer's current initialAdvance.

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (265411 => 265412)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2020-08-09 03:57:08 UTC (rev 265411)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2020-08-09 04:27:09 UTC (rev 265412)
@@ -179,12 +179,8 @@
     bool runForcesRightExpansion = (m_run.expansionBehavior() & RightExpansionMask) == ForceRightExpansion;
     bool runForbidsLeftExpansion = (m_run.expansionBehavior() & LeftExpansionMask) == ForbidLeftExpansion;
     bool runForbidsRightExpansion = (m_run.expansionBehavior() & RightExpansionMask) == ForbidRightExpansion;
-    float widthSinceLastRounding = m_runWidthSoFar;
     float leftoverJustificationWidth = 0;
-    m_runWidthSoFar = floorf(m_runWidthSoFar);
-    widthSinceLastRounding -= m_runWidthSoFar;
 
-    float lastRoundingWidth = m_finalRoundingWidth;
     FloatRect bounds;
 
     const Font& primaryFont = m_font.primaryFont();
@@ -221,7 +217,7 @@
         // Now that we have a glyph and font data, get its width.
         float width;
         if (character == '\t' && m_run.allowTabs())
-            width = m_font.tabWidth(*font, m_run.tabSize(), m_run.xPos() + m_runWidthSoFar + widthSinceLastRounding);
+            width = m_font.tabWidth(*font, m_run.tabSize(), m_run.xPos() + m_runWidthSoFar);
         else {
             width = font->widthForGlyph(glyph);
 
@@ -334,15 +330,11 @@
         // Advance past the character we just dealt with.
         textIterator.advance(advanceLength);
 
-        float oldWidth = width;
+        m_runWidthSoFar += width;
 
-        widthSinceLastRounding += width;
-
         if (glyphBuffer)
-            glyphBuffer->add(glyph, *font, (rtl ? oldWidth + lastRoundingWidth : width), currentCharacterIndex);
+            glyphBuffer->add(glyph, *font, width, currentCharacterIndex);
 
-        lastRoundingWidth = width - oldWidth;
-
         if (m_accountForGlyphBounds) {
             m_maxGlyphBoundingBoxY = std::max(m_maxGlyphBoundingBoxY, bounds.maxY());
             m_minGlyphBoundingBoxY = std::min(m_minGlyphBoundingBoxY, bounds.y());
@@ -366,8 +358,6 @@
     }
 
     m_currentCharacterIndex = textIterator.currentIndex();
-    m_runWidthSoFar += widthSinceLastRounding;
-    m_finalRoundingWidth = lastRoundingWidth;
 }
 
 void WidthIterator::advance(unsigned offset, GlyphBuffer* glyphBuffer)

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.h (265411 => 265412)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.h	2020-08-09 03:57:08 UTC (rev 265411)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.h	2020-08-09 04:27:09 UTC (rev 265412)
@@ -52,7 +52,6 @@
 
     const TextRun& run() const { return m_run; }
     float runWidthSoFar() const { return m_runWidthSoFar; }
-    float finalRoundingWidth() const { return m_finalRoundingWidth; }
     unsigned currentCharacterIndex() const { return m_currentCharacterIndex; }
 
 private:
@@ -72,7 +71,6 @@
     float m_runWidthSoFar { 0 };
     float m_expansion { 0 };
     float m_expansionPerOpportunity { 0 };
-    float m_finalRoundingWidth { 0 };
     float m_maxGlyphBoundingBoxY { std::numeric_limits<float>::min() };
     float m_minGlyphBoundingBoxY { std::numeric_limits<float>::max() };
     float m_firstGlyphOverflow { 0 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to