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

Side by Side Diff: Source/core/rendering/RenderEmbeddedObject.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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 3 * (C) 2000 Simon Hausmann <hausmann@kde.org>
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 GraphicsContextStateSaver stateSaver(*context); 197 GraphicsContextStateSaver stateSaver(*context);
198 context->clip(contentRect); 198 context->clip(contentRect);
199 context->setAlpha(m_unavailablePluginIndicatorIsPressed ? replacementTextPre ssedRoundedRectOpacity : replacementTextRoundedRectOpacity); 199 context->setAlpha(m_unavailablePluginIndicatorIsPressed ? replacementTextPre ssedRoundedRectOpacity : replacementTextRoundedRectOpacity);
200 context->setFillColor(m_unavailablePluginIndicatorIsPressed ? replacementTex tRoundedRectPressedColor() : Color::white, style()->colorSpace()); 200 context->setFillColor(m_unavailablePluginIndicatorIsPressed ? replacementTex tRoundedRectPressedColor() : Color::white, style()->colorSpace());
201 context->fillPath(path); 201 context->fillPath(path);
202 202
203 const FontMetrics& fontMetrics = font.fontMetrics(); 203 const FontMetrics& fontMetrics = font.fontMetrics();
204 float labelX = roundf(replacementTextRect.location().x() + (replacementTextR ect.size().width() - textWidth) / 2); 204 float labelX = roundf(replacementTextRect.location().x() + (replacementTextR ect.size().width() - textWidth) / 2);
205 float labelY = roundf(replacementTextRect.location().y() + (replacementTextR ect.size().height() - fontMetrics.height()) / 2 + fontMetrics.ascent()); 205 float labelY = roundf(replacementTextRect.location().y() + (replacementTextR ect.size().height() - fontMetrics.height()) / 2 + fontMetrics.ascent());
206 TextRunPaintInfo runInfo(run);
207 runInfo.bounds = replacementTextRect;
206 context->setAlpha(m_unavailablePluginIndicatorIsPressed ? replacementTextPre ssedTextOpacity : replacementTextTextOpacity); 208 context->setAlpha(m_unavailablePluginIndicatorIsPressed ? replacementTextPre ssedTextOpacity : replacementTextTextOpacity);
207 context->setFillColor(Color::black, style()->colorSpace()); 209 context->setFillColor(Color::black, style()->colorSpace());
208 context->drawBidiText(font, run, FloatPoint(labelX, labelY)); 210 context->drawBidiText(font, runInfo, FloatPoint(labelX, labelY));
209 } 211 }
210 212
211 bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumul atedOffset, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect, Font& font, TextRun& run, float& textWidth) const 213 bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumul atedOffset, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect, Font& font, TextRun& run, float& textWidth) const
212 { 214 {
213 contentRect = contentBoxRect(); 215 contentRect = contentBoxRect();
214 contentRect.moveBy(roundedIntPoint(accumulatedOffset)); 216 contentRect.moveBy(roundedIntPoint(accumulatedOffset));
215 217
216 FontDescription fontDescription; 218 FontDescription fontDescription;
217 RenderTheme::defaultTheme()->systemFont(CSSValueWebkitSmallControl, fontDesc ription); 219 RenderTheme::defaultTheme()->systemFont(CSSValueWebkitSmallControl, fontDesc ription);
218 fontDescription.setWeight(FontWeightBold); 220 fontDescription.setWeight(FontWeightBold);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 397 }
396 return RenderPart::getCursor(point, cursor); 398 return RenderPart::getCursor(point, cursor);
397 } 399 }
398 400
399 bool RenderEmbeddedObject::canHaveChildren() const 401 bool RenderEmbeddedObject::canHaveChildren() const
400 { 402 {
401 return false; 403 return false;
402 } 404 }
403 405
404 } 406 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698