Skip to content
Permalink
Browse files
TextPainter: Rename start and end position to selectionStart and sele…
…ctionEnd.

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:

Canonical link: https://commits.webkit.org/170224@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193857 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Dec 9, 2015
1 parent 0686f5b commit cee2c15679c224b7e371775009157145d4295d78
Showing 4 changed files with 38 additions and 21 deletions.
@@ -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
@@ -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
@@ -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)
@@ -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 @@ class TextPainter {
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;

0 comments on commit cee2c15

Please sign in to comment.