TextPainter: Rename start and end position to selectionStart and selectionEnd.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Dec 2015 21:22:03 +0000 (21:22 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Dec 2015 21:22:03 +0000 (21:22 +0000)
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:

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

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

index 9115bdc7878a4f8abea4a104b5bcdd50d89be2fb..55333c76744f4ada3a3442967dcc37380a2d03af 100644 (file)
@@ -1,3 +1,21 @@
+2015-12-09  Zalan Bujtas  <zalan@apple.com>
+
+        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  <jdiggs@igalia.com>
 
         AX: [GTK] Anonymous render block flow elements should be exposed as ATK_ROLE_SECTION; not ATK_ROLE_PANEL
index 9776720cc08193cc09f4e51b69e15b380557b5fb..dabad1be837bd99ea99279cd285c3d1b3efe37fe 100644 (file)
@@ -581,14 +581,14 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
     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 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
     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
index 6829f7648b56863610c335d35bc4ef0100911ac4..784567ca28b7ef2cacf244fc302c947dd67090c3 100644 (file)
@@ -79,8 +79,8 @@ ShadowApplier::~ShadowApplier()
         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 @@ TextPainter::TextPainter(GraphicsContext& context, bool paintSelectedTextOnly, b
     , 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 @@ void TextPainter::paintText()
     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)
index db4e9fc46f1ebb0e81f070663687e3d796c8e21c..b7286143ab6fb389a48472942b28b61166a43dae 100644 (file)
@@ -45,9 +45,9 @@ static inline AffineTransform rotation(const FloatRect& boxRect, RotationDirecti
 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 @@ private:
     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;