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

Unified Diff: Source/core/platform/graphics/GraphicsContext.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/platform/graphics/GraphicsContext.cpp
diff --git a/Source/core/platform/graphics/GraphicsContext.cpp b/Source/core/platform/graphics/GraphicsContext.cpp
index d3b6aa1ea6c78abdb4096223185fa3bd575eb9c4..3bcda353c03a35011233533f1ee3711b61948bcb 100644
--- a/Source/core/platform/graphics/GraphicsContext.cpp
+++ b/Source/core/platform/graphics/GraphicsContext.cpp
@@ -871,27 +871,30 @@ void GraphicsContext::drawRect(const IntRect& rect)
platformContext()->drawRect(rect);
}
-void GraphicsContext::drawText(const Font& font, const TextRun& run, const FloatPoint& point, int from, int to)
+void GraphicsContext::drawText(const Font& font, const TextRunPaintInfo& runInfo, const FloatPoint& point)
{
if (paintingDisabled())
return;
- font.drawText(this, run, point, from, to);
+ font.drawText(this, runInfo, point);
}
-void GraphicsContext::drawEmphasisMarks(const Font& font, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to)
+void GraphicsContext::drawEmphasisMarks(const Font& font, const TextRunPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point)
{
if (paintingDisabled())
return;
- font.drawEmphasisMarks(this, run, mark, point, from, to);
+ font.drawEmphasisMarks(this, runInfo, mark, point);
}
-void GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const FloatPoint& point, Font::CustomFontNotReadyAction customFontNotReadyAction)
+void GraphicsContext::drawBidiText(const Font& font, const TextRunPaintInfo& runInfo, const FloatPoint& point, Font::CustomFontNotReadyAction customFontNotReadyAction)
{
if (paintingDisabled())
return;
+ // sub-run painting is not supported for Bidi text.
+ const TextRun& run = runInfo.run;
+ ASSERT((runInfo.from == 0) && (runInfo.to == run.length()));
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()));
bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0));
@@ -911,7 +914,9 @@ void GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const F
subrun.setDirection(isRTL ? RTL : LTR);
subrun.setDirectionalOverride(bidiRun->dirOverride(false));
- font.drawText(this, subrun, currPoint, 0, -1, customFontNotReadyAction);
+ TextRunPaintInfo subrunInfo(subrun);
+ subrunInfo.bounds = runInfo.bounds;
+ font.drawText(this, subrunInfo, currPoint, customFontNotReadyAction);
bidiRun = bidiRun->next();
// FIXME: Have Font::drawText return the width of what it drew so that we don't have to re-measure here.

Powered by Google App Engine
This is Rietveld 408576698