Remove length argument from TextPainter::paint()
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Oct 2017 19:23:38 +0000 (19:23 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Oct 2017 19:23:38 +0000 (19:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177758

Reviewed by Alex Christensen.

Have TextPainter.paint() use the length of the specified TextRun as opposed to
taking an explicit argument for the length of the TextRun.

Following r222670 InlineTextBox creates a TextRun with respect to the truncated
line. Prior to r222670 InlineTextBox did not do this and hence it had to pass both
the TextRun and truncated length to TextPainter.paint() to have the line painted.
Code that needs to paint a substring of a TextRun can still do so by using TextPainter.paintRange().

No functionality changed. So, no new tests.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow):
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paint):
* rendering/TextPainter.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@222732 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
Source/WebCore/rendering/TextPainter.cpp
Source/WebCore/rendering/TextPainter.h

index b9ee264..0a0b316 100644 (file)
@@ -1,3 +1,28 @@
+2017-10-02  Daniel Bates  <dabates@apple.com>
+
+        Remove length argument from TextPainter::paint()
+        https://bugs.webkit.org/show_bug.cgi?id=177758
+
+        Reviewed by Alex Christensen.
+
+        Have TextPainter.paint() use the length of the specified TextRun as opposed to
+        taking an explicit argument for the length of the TextRun.
+
+        Following r222670 InlineTextBox creates a TextRun with respect to the truncated
+        line. Prior to r222670 InlineTextBox did not do this and hence it had to pass both
+        the TextRun and truncated length to TextPainter.paint() to have the line painted.
+        Code that needs to paint a substring of a TextRun can still do so by using TextPainter.paintRange().
+
+        No functionality changed. So, no new tests.
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paint):
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::paintFlow):
+        * rendering/TextPainter.cpp:
+        (WebCore::TextPainter::paint):
+        * rendering/TextPainter.h:
+
 2017-10-02  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [curl] Crashes in CurlRequest::setupPUT()
index 9ddd187..16905fd 100644 (file)
@@ -569,7 +569,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
         if (currentEnd < length)
             textPainter.paintRange(textRun, boxRect, textOrigin, currentEnd, length);
     } else
-        textPainter.paint(textRun, length, boxRect, textOrigin, selectionStart, selectionEnd, paintSelectedTextOnly, paintSelectedTextSeparately, paintNonSelectedTextOnly);
+        textPainter.paint(textRun, boxRect, textOrigin, selectionStart, selectionEnd, paintSelectedTextOnly, paintSelectedTextSeparately, paintNonSelectedTextOnly);
 
     // Paint decorations
     TextDecoration textDecorations = lineStyle.textDecorationsInEffect();
index 06b61cc..a8943b1 100644 (file)
@@ -120,7 +120,7 @@ void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& pai
         TextRun textRun(run.hasHyphen() ? textWithHyphen : run.text(), 0, run.expansion(), run.expansionBehavior());
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
         FloatPoint textOrigin = FloatPoint(rect.x() + paintOffset.x(), roundToDevicePixel(run.baselinePosition() + paintOffset.y(), deviceScaleFactor));
-        textPainter.paint(textRun, textRun.length(), rect, textOrigin);
+        textPainter.paint(textRun, rect, textOrigin);
         if (textDecorationPainter) {
             textDecorationPainter->setWidth(rect.width());
             textDecorationPainter->paintTextDecoration(textRun, textOrigin, rect.location() + paintOffset);
index 60e920e..8dc378f 100644 (file)
@@ -190,10 +190,11 @@ void TextPainter::paintRange(const TextRun& textRun, const FloatRect& boxRect, c
     paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, start, end, m_style, m_shadow);
 }
     
-void TextPainter::paint(const TextRun& textRun, unsigned length, const FloatRect& boxRect, const FloatPoint& textOrigin, unsigned selectionStart, unsigned selectionEnd,
+void TextPainter::paint(const TextRun& textRun, const FloatRect& boxRect, const FloatPoint& textOrigin, unsigned selectionStart, unsigned selectionEnd,
     bool paintSelectedTextOnly, bool paintSelectedTextSeparately, bool paintNonSelectedTextOnly)
 {
     ASSERT(m_font);
+    unsigned length = textRun.length();
     if (!paintSelectedTextOnly) {
         // For stroked painting, we have to change the text drawing mode. It's probably dangerous to leave that mutated as a side
         // effect, so only when we know we're stroking, do a save/restore.
index c8a7b39..c74d9ea 100644 (file)
@@ -62,8 +62,7 @@ public:
     void setEmphasisMark(const AtomicString& mark, float offset, const RenderCombineText*);
 
     void paintRange(const TextRun&, const FloatRect& boxRect, const FloatPoint& textOrigin, unsigned start, unsigned end);
-    void paint(const TextRun&, unsigned length, const FloatRect& boxRect, const FloatPoint& textOrigin,
-        unsigned selectionStart = 0, unsigned selectionEnd = 0, bool paintSelectedTextOnly = false, bool paintSelectedTextSeparately = false, bool paintNonSelectedTextOnly = false);
+    void paint(const TextRun&, const FloatRect& boxRect, const FloatPoint& textOrigin, unsigned selectionStart = 0, unsigned selectionEnd = 0, bool paintSelectedTextOnly = false, bool paintSelectedTextSeparately = false, bool paintNonSelectedTextOnly = false);
 
 private:
     void paintTextOrEmphasisMarks(const FontCascade&, const TextRun&, const AtomicString& emphasisMark, float emphasisMarkOffset,