Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1531)

Unified Diff: Source/core/rendering/InlineTextBox.cpp

Issue 14160005: Track the region where text is painted. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: implemented TextRun wrapper Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/InlineTextBox.cpp
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp
index f90aa8ecf3cf49aa615934dc25de426386e8f604..b2b2436adcdbc4174a28c9e543a01853775c34cf 100644
--- a/Source/core/rendering/InlineTextBox.cpp
+++ b/Source/core/rendering/InlineTextBox.cpp
@@ -411,8 +411,11 @@ FloatSize InlineTextBox::applyShadowToGraphicsContext(GraphicsContext* context,
return extraOffset;
}
-static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun, const AtomicString& emphasisMark, int emphasisMarkOffset, int startOffset, int endOffset, int truncationPoint, const FloatPoint& textOrigin,
- const FloatRect& boxRect, const ShadowData* shadow, bool stroked, bool horizontal)
+static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun,
+ const AtomicString& emphasisMark, int emphasisMarkOffset,
+ int startOffset, int endOffset, int truncationPoint,
+ const FloatPoint& textOrigin, const FloatRect& boxRect,
+ const ShadowData* shadow, bool stroked, bool horizontal)
{
Color fillColor = context->fillColor();
ColorSpace fillColorSpace = context->fillColorSpace();
@@ -420,6 +423,8 @@ static void paintTextWithShadows(GraphicsContext* context, const Font& font, con
if (!opaque)
context->setFillColor(Color::black, fillColorSpace);
+ TextRunPaintInfo textRunPaintInfo(textRun);
+ textRunPaintInfo.bounds = boxRect;
do {
IntSize extraOffset;
if (shadow)
@@ -428,22 +433,28 @@ static void paintTextWithShadows(GraphicsContext* context, const Font& font, con
context->setFillColor(fillColor, fillColorSpace);
if (startOffset <= endOffset) {
+ textRunPaintInfo.from = startOffset;
+ textRunPaintInfo.to = endOffset;
if (emphasisMark.isEmpty())
- context->drawText(font, textRun, textOrigin + extraOffset, startOffset, endOffset);
+ context->drawText(font, textRunPaintInfo, textOrigin + extraOffset);
else
- context->drawEmphasisMarks(font, textRun, emphasisMark, textOrigin + extraOffset + IntSize(0, emphasisMarkOffset), startOffset, endOffset);
+ context->drawEmphasisMarks(font, textRunPaintInfo, emphasisMark, textOrigin + extraOffset + IntSize(0, emphasisMarkOffset));
} else {
if (endOffset > 0) {
+ textRunPaintInfo.from = 0;
+ textRunPaintInfo.to = endOffset;
if (emphasisMark.isEmpty())
- context->drawText(font, textRun, textOrigin + extraOffset, 0, endOffset);
+ context->drawText(font, textRunPaintInfo, textOrigin + extraOffset);
else
- context->drawEmphasisMarks(font, textRun, emphasisMark, textOrigin + extraOffset + IntSize(0, emphasisMarkOffset), 0, endOffset);
+ context->drawEmphasisMarks(font, textRunPaintInfo, emphasisMark, textOrigin + extraOffset + IntSize(0, emphasisMarkOffset));
}
if (startOffset < truncationPoint) {
+ textRunPaintInfo.from = startOffset;
+ textRunPaintInfo.to = truncationPoint;
if (emphasisMark.isEmpty())
- context->drawText(font, textRun, textOrigin + extraOffset, startOffset, truncationPoint);
+ context->drawText(font, textRunPaintInfo, textOrigin + extraOffset);
else
- context->drawEmphasisMarks(font, textRun, emphasisMark, textOrigin + extraOffset + IntSize(0, emphasisMarkOffset), startOffset, truncationPoint);
+ context->drawEmphasisMarks(font, textRunPaintInfo, emphasisMark, textOrigin + extraOffset + IntSize(0, emphasisMarkOffset));
}
}

Powered by Google App Engine
This is Rietveld 408576698