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

Unified Diff: Source/core/rendering/RenderListMarker.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/RenderListMarker.cpp
diff --git a/Source/core/rendering/RenderListMarker.cpp b/Source/core/rendering/RenderListMarker.cpp
index 315c31261a46fa3e6df10e54e330a473e13b879e..984d6916377c4ca13448aabd22be88902095a7d7 100644
--- a/Source/core/rendering/RenderListMarker.cpp
+++ b/Source/core/rendering/RenderListMarker.cpp
@@ -1277,10 +1277,13 @@ void RenderListMarker::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
context->translate(-marker.x(), -marker.maxY());
}
+ TextRunPaintInfo textRunPaintInfo(textRun);
+ textRunPaintInfo.bounds = marker;
IntPoint textOrigin = IntPoint(marker.x(), marker.y() + style()->fontMetrics().ascent());
- if (type == Asterisks || type == Footnotes)
- context->drawText(font, textRun, textOrigin);
+ if (type == Asterisks || type == Footnotes) {
+ context->drawText(font, textRunPaintInfo, textOrigin);
+ }
else {
// Text is not arbitrary. We can judge whether it's RTL from the first character,
// and we only need to handle the direction RightToLeft for now.
@@ -1296,16 +1299,21 @@ void RenderListMarker::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
const UChar suffix = listMarkerSuffix(type, m_listItem->value());
if (style()->isLeftToRightDirection()) {
- int width = font.width(textRun);
- context->drawText(font, textRun, textOrigin);
+ context->drawText(font, textRunPaintInfo, textOrigin);
+
UChar suffixSpace[2] = { suffix, ' ' };
- context->drawText(font, RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()), textOrigin + IntSize(width, 0));
+ TextRun suffixRun = RenderBlock::constructTextRun(this, font, suffixSpace, 2, style());
+ TextRunPaintInfo suffixRunInfo(suffixRun);
+ suffixRunInfo.bounds = marker;
+ context->drawText(font, suffixRunInfo, textOrigin + IntSize(font.width(textRun), 0));
} else {
UChar spaceSuffix[2] = { ' ', suffix };
- TextRun spaceSuffixRun = RenderBlock::constructTextRun(this, font, spaceSuffix, 2, style());
- int width = font.width(spaceSuffixRun);
- context->drawText(font, spaceSuffixRun, textOrigin);
- context->drawText(font, textRun, textOrigin + IntSize(width, 0));
+ TextRun suffixRun = RenderBlock::constructTextRun(this, font, spaceSuffix, 2, style());
+ TextRunPaintInfo suffixRunInfo(suffixRun);
+ suffixRunInfo.bounds = marker;
+ context->drawText(font, suffixRunInfo, textOrigin);
+
+ context->drawText(font, textRunPaintInfo, textOrigin + IntSize(font.width(suffixRun), 0));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698