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

Log Message

Migrate RenderText::stringView() to unsigneds
https://bugs.webkit.org/show_bug.cgi?id=161005

Reviewed by Alex Christensen.

No new tests because there is no behavior change.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
* rendering/RenderText.cpp:
(WebCore::RenderText::stringView):
* rendering/RenderText.h:

Modified Paths

Diff

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


--- trunk/Source/WebCore/ChangeLog	2016-08-19 21:02:31 UTC (rev 204652)
+++ trunk/Source/WebCore/ChangeLog	2016-08-19 21:40:13 UTC (rev 204653)
@@ -1,3 +1,18 @@
+2016-08-19  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Migrate RenderText::stringView() to unsigneds
+        https://bugs.webkit.org/show_bug.cgi?id=161005
+
+        Reviewed by Alex Christensen.
+
+        No new tests because there is no behavior change.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::stringView):
+        * rendering/RenderText.h:
+
 2016-08-18  Ryosuke Niwa  <rn...@webkit.org>
 
         Rename LifecycleCallback to CustomElementReaction

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


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2016-08-19 21:02:31 UTC (rev 204652)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2016-08-19 21:40:13 UTC (rev 204653)
@@ -883,6 +883,7 @@
                 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;

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (204652 => 204653)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2016-08-19 21:02:31 UTC (rev 204652)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2016-08-19 21:40:13 UTC (rev 204653)
@@ -1676,18 +1676,15 @@
     secureTextTimer->restart(offsetAfterLastTypedCharacter);
 }
 
-StringView RenderText::stringView(int start, int stop) const
+StringView RenderText::stringView(unsigned start, Optional<unsigned> stop) const
 {
-    if (stop == -1)
-        stop = textLength();
-    ASSERT(static_cast<unsigned>(start) <= length());
-    ASSERT(static_cast<unsigned>(stop) <= length());
-    ASSERT(start <= stop);
-    ASSERT(start >= 0);
-    ASSERT(stop >= 0);
+    unsigned destination = stop.valueOr(textLength());
+    ASSERT(start <= length());
+    ASSERT(destination <= length());
+    ASSERT(start <= destination);
     if (is8Bit())
-        return StringView(characters8() + start, stop - start);
-    return StringView(characters16() + start, stop - start);
+        return StringView(characters8() + start, destination - start);
+    return StringView(characters16() + start, destination - start);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderText.h (204652 => 204653)


--- trunk/Source/WebCore/rendering/RenderText.h	2016-08-19 21:02:31 UTC (rev 204652)
+++ trunk/Source/WebCore/rendering/RenderText.h	2016-08-19 21:40:13 UTC (rev 204653)
@@ -167,7 +167,7 @@
     void deleteLineBoxesBeforeSimpleLineLayout();
     const SimpleLineLayout::Layout* simpleLineLayout() const;
 
-    StringView stringView(int start = 0, int stop = -1) const;
+    StringView stringView(unsigned start = 0, Optional<unsigned> stop = Nullopt) const;
 
     LayoutUnit topOfFirstText() const;
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to