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

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: fixed build on win and mac Created 7 years, 7 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
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/RenderEmbeddedObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/InlineTextBox.cpp
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp
index 23de0a7eb91a0bc89fb4c73e4bf584520663656f..624d9c12afb81dc5db272f065323efd188223892 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));
}
}
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/RenderEmbeddedObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698