Title: [193857] trunk/Source/WebCore
Revision
193857
Author
[email protected]
Date
2015-12-09 13:22:03 -0800 (Wed, 09 Dec 2015)

Log Message

TextPainter: Rename start and end position to selectionStart and selectionEnd.
https://bugs.webkit.org/show_bug.cgi?id=152088

Reviewed by Myles C. Maxfield.

They actually mean selection start/end.

No change in functionality.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
* rendering/TextPainter.cpp:
(WebCore::TextPainter::TextPainter):
(WebCore::TextPainter::paintText):
* rendering/TextPainter.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (193856 => 193857)


--- trunk/Source/WebCore/ChangeLog	2015-12-09 21:14:03 UTC (rev 193856)
+++ trunk/Source/WebCore/ChangeLog	2015-12-09 21:22:03 UTC (rev 193857)
@@ -1,3 +1,21 @@
+2015-12-09  Zalan Bujtas  <[email protected]>
+
+        TextPainter: Rename start and end position to selectionStart and selectionEnd.
+        https://bugs.webkit.org/show_bug.cgi?id=152088
+
+        Reviewed by Myles C. Maxfield.
+
+        They actually mean selection start/end.
+
+        No change in functionality.
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paint):
+        * rendering/TextPainter.cpp:
+        (WebCore::TextPainter::TextPainter):
+        (WebCore::TextPainter::paintText):
+        * rendering/TextPainter.h:
+
 2015-12-09  Joanmarie Diggs  <[email protected]>
 
         AX: [GTK] Anonymous render block flow elements should be exposed as ATK_ROLE_SECTION; not ATK_ROLE_PANEL

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (193856 => 193857)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2015-12-09 21:14:03 UTC (rev 193856)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2015-12-09 21:22:03 UTC (rev 193857)
@@ -581,14 +581,14 @@
     if (hasHyphen())
         length = textRun.length();
 
-    int sPos = 0;
-    int ePos = 0;
+    int selectionStart = 0;
+    int selectionEnd = 0;
     if (haveSelection && (paintSelectedTextOnly || paintSelectedTextSeparately))
-        selectionStartEnd(sPos, ePos);
+        selectionStartEnd(selectionStart, selectionEnd);
 
     if (m_truncation != cNoTruncation) {
-        sPos = std::min<int>(sPos, m_truncation);
-        ePos = std::min<int>(ePos, m_truncation);
+        selectionStart = std::min<int>(selectionStart, m_truncation);
+        selectionEnd = std::min<int>(selectionEnd, m_truncation);
         length = m_truncation;
     }
 
@@ -612,7 +612,7 @@
     else
         textOrigin.setX(roundToDevicePixel(LayoutUnit(textOrigin.x()), renderer().document().deviceScaleFactor()));
 
-    TextPainter textPainter(context, paintSelectedTextOnly, paintSelectedTextSeparately, font, sPos, ePos, length, emphasisMark, combinedText, textRun, boxRect, textOrigin, emphasisMarkOffset, textShadow, selectionShadow, isHorizontal(), textPaintStyle, selectionPaintStyle);
+    TextPainter textPainter(context, paintSelectedTextOnly, paintSelectedTextSeparately, font, selectionStart, selectionEnd, length, emphasisMark, combinedText, textRun, boxRect, textOrigin, emphasisMarkOffset, textShadow, selectionShadow, isHorizontal(), textPaintStyle, selectionPaintStyle);
     textPainter.paintText();
 
     // Paint decorations

Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (193856 => 193857)


--- trunk/Source/WebCore/rendering/TextPainter.cpp	2015-12-09 21:14:03 UTC (rev 193856)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp	2015-12-09 21:22:03 UTC (rev 193857)
@@ -79,8 +79,8 @@
         m_context.clearShadow();
 }
 
-TextPainter::TextPainter(GraphicsContext& context, bool paintSelectedTextOnly, bool paintSelectedTextSeparately, const FontCascade& font, int startPositionInTextRun,
-    int endPositionInTextBoxString, int length, const AtomicString& emphasisMark, RenderCombineText* combinedText, TextRun& textRun, FloatRect& boxRect,
+TextPainter::TextPainter(GraphicsContext& context, bool paintSelectedTextOnly, bool paintSelectedTextSeparately, const FontCascade& font, int selectionStart,
+    int selectionEnd, int length, const AtomicString& emphasisMark, RenderCombineText* combinedText, TextRun& textRun, FloatRect& boxRect,
     FloatPoint& textOrigin, int emphasisMarkOffset, const ShadowData* textShadow, const ShadowData* selectionShadow, bool textBoxIsHorizontal,
     TextPaintStyle& textPaintStyle, TextPaintStyle& selectionPaintStyle)
     : m_context(context)
@@ -91,8 +91,8 @@
     , m_paintSelectedTextOnly(paintSelectedTextOnly)
     , m_paintSelectedTextSeparately(paintSelectedTextSeparately)
     , m_font(font)
-    , m_startPositionInTextRun(startPositionInTextRun)
-    , m_endPositionInTextRun(endPositionInTextBoxString)
+    , m_selectionStart(selectionStart)
+    , m_selectionEnd(selectionEnd)
     , m_length(length)
     , m_emphasisMark(emphasisMark)
     , m_combinedText(combinedText)
@@ -187,15 +187,14 @@
     if (!m_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.
-        bool fullLengthPaint = !m_paintSelectedTextSeparately || m_endPositionInTextRun <= m_startPositionInTextRun;
-        int startOffset = fullLengthPaint ? 0 : m_endPositionInTextRun;
-        int endOffset = fullLengthPaint ? m_length : m_startPositionInTextRun;
-        paintTextWithStyle(m_textPaintStyle, startOffset, endOffset, m_textShadow);
+        int startPosition = m_paintSelectedTextSeparately ? m_selectionEnd : 0;
+        int endPosition = m_paintSelectedTextSeparately ? m_selectionStart : m_length;
+        paintTextWithStyle(m_textPaintStyle, startPosition, endPosition, m_textShadow);
     }
 
     // paint only the text that is selected
-    if ((m_paintSelectedTextOnly || m_paintSelectedTextSeparately) && m_startPositionInTextRun < m_endPositionInTextRun)
-        paintTextWithStyle(m_selectionPaintStyle, m_startPositionInTextRun, m_endPositionInTextRun, m_selectionShadow);
+    if ((m_paintSelectedTextOnly || m_paintSelectedTextSeparately) && m_selectionStart < m_selectionEnd)
+        paintTextWithStyle(m_selectionPaintStyle, m_selectionStart, m_selectionEnd, m_selectionShadow);
 }
 
 #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)

Modified: trunk/Source/WebCore/rendering/TextPainter.h (193856 => 193857)


--- trunk/Source/WebCore/rendering/TextPainter.h	2015-12-09 21:14:03 UTC (rev 193856)
+++ trunk/Source/WebCore/rendering/TextPainter.h	2015-12-09 21:22:03 UTC (rev 193857)
@@ -45,9 +45,9 @@
 class TextPainter {
 public:
     TextPainter(GraphicsContext&, bool paintSelectedTextOnly, bool paintSelectedTextSeparately, const FontCascade&,
-    int startPositionInTextRun, int endPositionInTextBoxString, int length, const AtomicString& emphasisMark, RenderCombineText*,
-    TextRun&, FloatRect& boxRect, FloatPoint& textOrigin, int emphasisMarkOffset, const ShadowData* textShadow, const ShadowData* selectionShadow,
-    bool textBoxIsHorizontal, TextPaintStyle& nonSelectionPaintStyle, TextPaintStyle& selectionPaintStyle);
+        int selectionStart, int selectionEnd, int length, const AtomicString& emphasisMark, RenderCombineText*,
+        TextRun&, FloatRect& boxRect, FloatPoint& textOrigin, int emphasisMarkOffset, const ShadowData* textShadow, const ShadowData* selectionShadow,
+        bool textBoxIsHorizontal, TextPaintStyle& nonSelectionPaintStyle, TextPaintStyle& selectionPaintStyle);
     
     void paintText();
 #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
@@ -70,8 +70,8 @@
     bool m_paintSelectedTextOnly;
     bool m_paintSelectedTextSeparately;
     const FontCascade& m_font;
-    int m_startPositionInTextRun;
-    int m_endPositionInTextRun;
+    int m_selectionStart;
+    int m_selectionEnd;
     int m_length;
     const AtomicString& m_emphasisMark;
     RenderCombineText* m_combinedText;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to