Title: [204654] trunk/Source/WebCore
Revision
204654
Author
mmaxfi...@apple.com
Date
2016-08-19 14:47:43 -0700 (Fri, 19 Aug 2016)

Log Message

Migrate from ints to unsigneds in a few more places in rendering code
https://bugs.webkit.org/show_bug.cgi?id=161006

Reviewed by Alex Christensen.

No new tests because there is no behavior change.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawBidiText):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::drawText):
* platform/text/BidiResolver.h:
(WebCore::BidiCharacterRun::BidiCharacterRun):
(WebCore::BidiCharacterRun::start):
(WebCore::BidiCharacterRun::stop):
* rendering/BidiRun.cpp:
(WebCore::BidiRun::BidiRun):
* rendering/BidiRun.h:
* rendering/RenderBlockLineLayout.cpp:
(WebCore::setLogicalWidthForTextRun):
(WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
(WebCore::findFirstTrailingSpace):
(WebCore::RenderBlockFlow::handleTrailingSpaces):
* rendering/line/BreakingContext.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (204653 => 204654)


--- trunk/Source/WebCore/ChangeLog	2016-08-19 21:40:13 UTC (rev 204653)
+++ trunk/Source/WebCore/ChangeLog	2016-08-19 21:47:43 UTC (rev 204654)
@@ -1,5 +1,32 @@
 2016-08-19  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        Migrate from ints to unsigneds in a few more places in rendering code
+        https://bugs.webkit.org/show_bug.cgi?id=161006
+
+        Reviewed by Alex Christensen.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawBidiText):
+        * platform/mock/MockRealtimeVideoSource.cpp:
+        (WebCore::MockRealtimeVideoSource::drawText):
+        * platform/text/BidiResolver.h:
+        (WebCore::BidiCharacterRun::BidiCharacterRun):
+        (WebCore::BidiCharacterRun::start):
+        (WebCore::BidiCharacterRun::stop):
+        * rendering/BidiRun.cpp:
+        (WebCore::BidiRun::BidiRun):
+        * rendering/BidiRun.h:
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::setLogicalWidthForTextRun):
+        (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
+        (WebCore::findFirstTrailingSpace):
+        (WebCore::RenderBlockFlow::handleTrailingSpaces):
+        * rendering/line/BreakingContext.h:
+
+2016-08-19  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         Migrate RenderText::stringView() to unsigneds
         https://bugs.webkit.org/show_bug.cgi?id=161005
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (204653 => 204654)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2016-08-19 21:40:13 UTC (rev 204653)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2016-08-19 21:47:43 UTC (rev 204654)
@@ -691,7 +691,7 @@
         subrun.setDirection(isRTL ? RTL : LTR);
         subrun.setDirectionalOverride(bidiRun->dirOverride(false));
 
-        float width = font.drawText(*this, subrun, currPoint, 0, -1, customFontNotReadyAction);
+        float width = font.drawText(*this, subrun, currPoint, 0, Nullopt, customFontNotReadyAction);
         currPoint.move(width, 0);
 
         bidiRun = bidiRun->next();

Modified: trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp (204653 => 204654)


--- trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp	2016-08-19 21:40:13 UTC (rev 204653)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp	2016-08-19 21:47:43 UTC (rev 204654)
@@ -268,19 +268,19 @@
     context.setFillColor(Color::white);
     context.setTextDrawingMode(TextModeFill);
     String string = String::format("%02u:%02u:%02u.%03u", hours, minutes, seconds, milliseconds % 1000);
-    context.drawText(m_timeFont, TextRun((StringView(string))), timeLocation, 0, -1);
+    context.drawText(m_timeFont, TextRun((StringView(string))), timeLocation);
 
     string = String::format("%06u", m_frameNumber++);
     timeLocation.move(0, m_baseFontSize);
-    context.drawText(m_timeFont, TextRun((StringView(string))), timeLocation, 0, -1);
+    context.drawText(m_timeFont, TextRun((StringView(string))), timeLocation);
 
     FloatPoint statsLocation(m_size.width() * .65, m_size.height() * .75);
     string = String::format("Frame rate: %ufps", m_frameRate);
-    context.drawText(m_statsFont, TextRun((StringView(string))), statsLocation, 0, -1);
+    context.drawText(m_statsFont, TextRun((StringView(string))), statsLocation);
 
     string = String::format("Size: %u x %u", m_size.width(), m_size.height());
     statsLocation.move(0, m_statsFontSize);
-    context.drawText(m_statsFont, TextRun((StringView(string))), statsLocation, 0, -1);
+    context.drawText(m_statsFont, TextRun((StringView(string))), statsLocation);
 
     const char* camera;
     switch (settings().facingMode()) {
@@ -302,7 +302,7 @@
     }
     string = String::format("Camera: %s", camera);
     statsLocation.move(0, m_statsFontSize);
-    context.drawText(m_statsFont, TextRun((StringView(string))), statsLocation, 0, -1);
+    context.drawText(m_statsFont, TextRun((StringView(string))), statsLocation);
 
     FloatPoint bipBopLocation(m_size.width() * .6, m_size.height() * .6);
     unsigned frameMod = m_frameNumber % 60;
@@ -309,11 +309,11 @@
     if (frameMod <= 15) {
         context.setFillColor(Color::gray);
         String bip(ASCIILiteral("Bip"));
-        context.drawText(m_bipBopFont, TextRun(StringView(bip)), bipBopLocation, 0, -1);
+        context.drawText(m_bipBopFont, TextRun(StringView(bip)), bipBopLocation);
     } else if (frameMod > 30 && frameMod <= 45) {
         context.setFillColor(Color::white);
         String bop(ASCIILiteral("Bop"));
-        context.drawText(m_bipBopFont, TextRun(StringView(bop)), bipBopLocation, 0, -1);
+        context.drawText(m_bipBopFont, TextRun(StringView(bop)), bipBopLocation);
     }
 }
 

Modified: trunk/Source/WebCore/platform/text/BidiResolver.h (204653 => 204654)


--- trunk/Source/WebCore/platform/text/BidiResolver.h	2016-08-19 21:40:13 UTC (rev 204653)
+++ trunk/Source/WebCore/platform/text/BidiResolver.h	2016-08-19 21:47:43 UTC (rev 204654)
@@ -141,7 +141,7 @@
 struct BidiCharacterRun {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    BidiCharacterRun(int start, int stop, BidiContext* context, UCharDirection direction)
+    BidiCharacterRun(unsigned start, unsigned stop, BidiContext* context, UCharDirection direction)
         : m_start(start)
         , m_stop(stop)
         , m_override(context->override())
@@ -171,8 +171,8 @@
             next = WTFMove(next->m_next);
     }
 
-    int start() const { return m_start; }
-    int stop() const { return m_stop; }
+    unsigned start() const { return m_start; }
+    unsigned stop() const { return m_stop; }
     unsigned char level() const { return m_level; }
     bool reversed(bool visuallyOrdered) { return m_level % 2 && !visuallyOrdered; }
     bool dirOverride(bool visuallyOrdered) { return m_override || visuallyOrdered; }
@@ -185,8 +185,8 @@
     std::unique_ptr<BidiCharacterRun> m_next;
 
 public:
-    int m_start;
-    int m_stop;
+    unsigned m_start;
+    unsigned m_stop;
     unsigned char m_level;
     bool m_override : 1;
     bool m_hasHyphen : 1; // Used by BidiRun subclass which is a layering violation but enables us to save 8 bytes per object on 64-bit.

Modified: trunk/Source/WebCore/rendering/BidiRun.cpp (204653 => 204654)


--- trunk/Source/WebCore/rendering/BidiRun.cpp	2016-08-19 21:40:13 UTC (rev 204653)
+++ trunk/Source/WebCore/rendering/BidiRun.cpp	2016-08-19 21:47:43 UTC (rev 204654)
@@ -33,7 +33,7 @@
 
 DEFINE_DEBUG_ONLY_GLOBAL(RefCountedLeakCounter, bidiRunCounter, ("BidiRun"));
 
-BidiRun::BidiRun(int start, int stop, RenderObject& renderer, BidiContext* context, UCharDirection dir)
+BidiRun::BidiRun(unsigned start, unsigned stop, RenderObject& renderer, BidiContext* context, UCharDirection dir)
     : BidiCharacterRun(start, stop, context, dir)
     , m_renderer(renderer)
     , m_box(nullptr)

Modified: trunk/Source/WebCore/rendering/BidiRun.h (204653 => 204654)


--- trunk/Source/WebCore/rendering/BidiRun.h	2016-08-19 21:40:13 UTC (rev 204653)
+++ trunk/Source/WebCore/rendering/BidiRun.h	2016-08-19 21:47:43 UTC (rev 204654)
@@ -34,7 +34,7 @@
 class RenderObject;
 
 struct BidiRun : BidiCharacterRun {
-    BidiRun(int start, int stop, RenderObject&, BidiContext*, UCharDirection);
+    BidiRun(unsigned start, unsigned stop, RenderObject&, BidiContext*, UCharDirection);
     ~BidiRun();
 
     BidiRun* next() { return static_cast<BidiRun*>(BidiCharacterRun::next()); }

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (204653 => 204654)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2016-08-19 21:40:13 UTC (rev 204653)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2016-08-19 21:47:43 UTC (rev 204654)
@@ -488,7 +488,7 @@
     // the style is linebox-contain: glyph.
     
     if (!lineBox->fitsToGlyphs() && canUseSimpleFontCodePath) {
-        int lastEndOffset = run->m_start;
+        unsigned lastEndOffset = run->m_start;
         for (size_t i = 0, size = wordMeasurements.size(); i < size && lastEndOffset < run->m_stop; ++i) {
             WordMeasurement& wordMeasurement = wordMeasurements[i];
             if (wordMeasurement.width <= 0 || wordMeasurement.startOffset == wordMeasurement.endOffset)
@@ -883,15 +883,15 @@
                 ExpansionBehavior expansionBehavior = expansionBehaviorForInlineTextBox(*this, textBox, previousRun, run->next(), textAlign, isAfterExpansion);
                 applyExpansionBehavior(textBox, expansionBehavior);
                 unsigned opportunitiesInRun;
-                ASSERT(run->m_stop != -1);
                 std::tie(opportunitiesInRun, isAfterExpansion) = FontCascade::expansionOpportunityCount(renderText.stringView(run->m_start, run->m_stop), run->box()->direction(), expansionBehavior);
                 expansionOpportunities.append(opportunitiesInRun);
                 expansionOpportunityCount += opportunitiesInRun;
             }
 
-            if (int length = renderText.textLength()) {
+            if (unsigned length = renderText.textLength()) {
                 if (!run->m_start && needsWordSpacing && isSpaceOrNewline(renderText.characterAt(run->m_start)))
                     totalLogicalWidth += lineStyle(*renderText.parent(), lineInfo).fontCascade().wordSpacing();
+                ASSERT(run->m_stop > 0);
                 needsWordSpacing = !isSpaceOrNewline(renderText.characterAt(run->m_stop - 1)) && run->m_stop == length;
             }
 
@@ -1026,9 +1026,9 @@
 }
 
 template <typename CharacterType>
-static inline int findFirstTrailingSpace(const RenderText& lastText, const CharacterType* characters, int start, int stop)
+static inline unsigned findFirstTrailingSpace(const RenderText& lastText, const CharacterType* characters, unsigned start, unsigned stop)
 {
-    int firstSpace = stop;
+    unsigned firstSpace = stop;
     while (firstSpace > start) {
         UChar current = characters[firstSpace - 1];
         if (!isCollapsibleSpace(current, lastText))
@@ -1052,7 +1052,7 @@
         return nullptr;
 
     const RenderText& lastText = downcast<RenderText>(lastObject);
-    int firstSpace;
+    unsigned firstSpace;
     if (lastText.is8Bit())
         firstSpace = findFirstTrailingSpace(lastText, lastText.characters8(), trailingSpaceRun->start(), trailingSpaceRun->stop());
     else

Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (204653 => 204654)


--- trunk/Source/WebCore/rendering/line/BreakingContext.h	2016-08-19 21:40:13 UTC (rev 204653)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h	2016-08-19 21:47:43 UTC (rev 204654)
@@ -58,8 +58,8 @@
 
     RenderText* renderer;
     float width;
-    int startOffset;
-    int endOffset;
+    unsigned startOffset;
+    unsigned endOffset;
     HashSet<const Font*> fallbackFonts;
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to