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

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: 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/RenderListBox.cpp ('k') | Source/core/rendering/svg/SVGInlineTextBox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderListMarker.cpp
diff --git a/Source/core/rendering/RenderListMarker.cpp b/Source/core/rendering/RenderListMarker.cpp
index f429f31053ccf8b03e06a0802b90e1e05099b70f..b1c8785c7ef4460bb4872f9e58eb81c92596bc6f 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));
}
}
}
« no previous file with comments | « Source/core/rendering/RenderListBox.cpp ('k') | Source/core/rendering/svg/SVGInlineTextBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698