| OLD | NEW |
| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 Path path; | 141 Path path; |
| 142 FloatRect replacementTextRect; | 142 FloatRect replacementTextRect; |
| 143 Font font; | 143 Font font; |
| 144 TextRun run(""); | 144 TextRun run(""); |
| 145 float textWidth; | 145 float textWidth; |
| 146 if (!getReplacementTextGeometry(paintOffset, contentRect, path, replacementT
extRect, font, run, textWidth)) | 146 if (!getReplacementTextGeometry(paintOffset, contentRect, path, replacementT
extRect, font, run, textWidth)) |
| 147 return; | 147 return; |
| 148 | 148 |
| 149 GraphicsContextStateSaver stateSaver(*context); | 149 GraphicsContextStateSaver stateSaver(*context); |
| 150 context->clip(contentRect); | 150 context->clip(contentRect); |
| 151 context->setAlpha(replacementTextRoundedRectOpacity); | 151 context->setAlphaAsFloat(replacementTextRoundedRectOpacity); |
| 152 context->setFillColor(Color::white); | 152 context->setFillColor(Color::white); |
| 153 context->fillPath(path); | 153 context->fillPath(path); |
| 154 | 154 |
| 155 const FontMetrics& fontMetrics = font.fontMetrics(); | 155 const FontMetrics& fontMetrics = font.fontMetrics(); |
| 156 float labelX = roundf(replacementTextRect.location().x() + (replacementTextR
ect.size().width() - textWidth) / 2); | 156 float labelX = roundf(replacementTextRect.location().x() + (replacementTextR
ect.size().width() - textWidth) / 2); |
| 157 float labelY = roundf(replacementTextRect.location().y() + (replacementTextR
ect.size().height() - fontMetrics.height()) / 2 + fontMetrics.ascent()); | 157 float labelY = roundf(replacementTextRect.location().y() + (replacementTextR
ect.size().height() - fontMetrics.height()) / 2 + fontMetrics.ascent()); |
| 158 TextRunPaintInfo runInfo(run); | 158 TextRunPaintInfo runInfo(run); |
| 159 runInfo.bounds = replacementTextRect; | 159 runInfo.bounds = replacementTextRect; |
| 160 context->setAlpha(replacementTextTextOpacity); | 160 context->setAlphaAsFloat(replacementTextTextOpacity); |
| 161 context->setFillColor(Color::black); | 161 context->setFillColor(Color::black); |
| 162 context->drawBidiText(font, runInfo, FloatPoint(labelX, labelY)); | 162 context->drawBidiText(font, runInfo, FloatPoint(labelX, labelY)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumul
atedOffset, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect,
Font& font, TextRun& run, float& textWidth) const | 165 bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumul
atedOffset, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect,
Font& font, TextRun& run, float& textWidth) const |
| 166 { | 166 { |
| 167 contentRect = contentBoxRect(); | 167 contentRect = contentBoxRect(); |
| 168 contentRect.moveBy(roundedIntPoint(accumulatedOffset)); | 168 contentRect.moveBy(roundedIntPoint(accumulatedOffset)); |
| 169 | 169 |
| 170 FontDescription fontDescription; | 170 FontDescription fontDescription; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 { | 246 { |
| 247 return false; | 247 return false; |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool RenderEmbeddedObject::canHaveChildren() const | 250 bool RenderEmbeddedObject::canHaveChildren() const |
| 251 { | 251 { |
| 252 return false; | 252 return false; |
| 253 } | 253 } |
| 254 | 254 |
| 255 } | 255 } |
| OLD | NEW |