Title: [222732] trunk/Source/WebCore
Revision
222732
Author
[email protected]
Date
2017-10-02 12:23:38 -0700 (Mon, 02 Oct 2017)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (222731 => 222732)


--- trunk/Source/WebCore/ChangeLog	2017-10-02 19:20:00 UTC (rev 222731)
+++ trunk/Source/WebCore/ChangeLog	2017-10-02 19:23:38 UTC (rev 222732)
@@ -1,3 +1,28 @@
+2017-10-02  Daniel Bates  <[email protected]>
+
+        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  <[email protected]>
 
         [curl] Crashes in CurlRequest::setupPUT()

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (222731 => 222732)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2017-10-02 19:20:00 UTC (rev 222731)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2017-10-02 19:23:38 UTC (rev 222732)
@@ -569,7 +569,7 @@
         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();

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (222731 => 222732)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2017-10-02 19:20:00 UTC (rev 222731)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2017-10-02 19:23:38 UTC (rev 222732)
@@ -120,7 +120,7 @@
         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);

Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (222731 => 222732)


--- trunk/Source/WebCore/rendering/TextPainter.cpp	2017-10-02 19:20:00 UTC (rev 222731)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp	2017-10-02 19:23:38 UTC (rev 222732)
@@ -190,10 +190,11 @@
     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.

Modified: trunk/Source/WebCore/rendering/TextPainter.h (222731 => 222732)


--- trunk/Source/WebCore/rendering/TextPainter.h	2017-10-02 19:20:00 UTC (rev 222731)
+++ trunk/Source/WebCore/rendering/TextPainter.h	2017-10-02 19:23:38 UTC (rev 222732)
@@ -62,8 +62,7 @@
     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,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to