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

Side by Side Diff: Source/WebCore/rendering/svg/RenderSVGInlineText.cpp

Issue 8041050: Merge 95301 - cachedFont not getting updated for inline SVG text. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « Source/WebCore/rendering/svg/RenderSVGInlineText.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
3 * Copyright (C) 2006 Apple Computer Inc. 3 * Copyright (C) 2006 Apple Computer Inc.
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
5 * Copyright (C) 2008 Rob Buis <buis@kde.org> 5 * Copyright (C) 2008 Rob Buis <buis@kde.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 void RenderSVGInlineText::styleDidChange(StyleDifference diff, const RenderStyle * oldStyle) 82 void RenderSVGInlineText::styleDidChange(StyleDifference diff, const RenderStyle * oldStyle)
83 { 83 {
84 RenderText::styleDidChange(diff, oldStyle); 84 RenderText::styleDidChange(diff, oldStyle);
85 85
86 if (diff == StyleDifferenceLayout) { 86 if (diff == StyleDifferenceLayout) {
87 // The text metrics may be influenced by style changes. 87 // The text metrics may be influenced by style changes.
88 if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAnce stor(this)) 88 if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAnce stor(this))
89 textRenderer->setNeedsPositioningValuesUpdate(); 89 textRenderer->setNeedsPositioningValuesUpdate();
90
91 updateScaledFont();
92 } 90 }
93 91
94 const RenderStyle* newStyle = style(); 92 const RenderStyle* newStyle = style();
95 if (!newStyle || newStyle->whiteSpace() != PRE) 93 if (!newStyle || newStyle->whiteSpace() != PRE)
96 return; 94 return;
97 95
98 if (!oldStyle || oldStyle->whiteSpace() != PRE) 96 if (!oldStyle || oldStyle->whiteSpace() != PRE)
99 setText(applySVGWhitespaceRules(originalText(), true), true); 97 setText(applySVGWhitespaceRules(originalText(), true), true);
100 } 98 }
101 99
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 214 }
217 } 215 }
218 216
219 if (!closestDistanceFragment) 217 if (!closestDistanceFragment)
220 return createVisiblePosition(0, DOWNSTREAM); 218 return createVisiblePosition(0, DOWNSTREAM);
221 219
222 int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanc eFragment, absolutePoint.x() - closestDistancePosition, true); 220 int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanc eFragment, absolutePoint.x() - closestDistancePosition, true);
223 return createVisiblePosition(offset + closestDistanceBox->start(), offset > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM); 221 return createVisiblePosition(offset + closestDistanceBox->start(), offset > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM);
224 } 222 }
225 223
224 void RenderSVGInlineText::setStyle(PassRefPtr<RenderStyle> style)
225 {
226 RenderText::setStyle(style);
227
228 // The cached scaledFont needs to be updated on every style set call. It
229 // is not similar to m_style which can get derived from parent's style and
230 // hence will get automatically updated on ancestor's style change. This is
231 // required, otherwise we will maintain stale font list in cached scaledFont
232 // when custom fonts are retired on Document::recalcStyle. See webkit bug
233 // https://bugs.webkit.org/show_bug.cgi?id=68060.
234 updateScaledFont();
235 }
236
226 void RenderSVGInlineText::updateScaledFont() 237 void RenderSVGInlineText::updateScaledFont()
227 { 238 {
228 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont); 239 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont);
229 } 240 }
230 241
231 void RenderSVGInlineText::computeNewScaledFontForStyle(RenderObject* renderer, c onst RenderStyle* style, float& scalingFactor, Font& scaledFont) 242 void RenderSVGInlineText::computeNewScaledFontForStyle(RenderObject* renderer, c onst RenderStyle* style, float& scalingFactor, Font& scaledFont)
232 { 243 {
233 ASSERT(style); 244 ASSERT(style);
234 ASSERT(renderer); 245 ASSERT(renderer);
235 246
(...skipping 16 matching lines...) Expand all
252 FontDescription fontDescription(style->fontDescription()); 263 FontDescription fontDescription(style->fontDescription());
253 fontDescription.setComputedSize(CSSStyleSelector::getComputedSizeFromSpecifi edSize(document, scalingFactor, fontDescription.isAbsoluteSize(), fontDescriptio n.computedSize(), DoNotUseSmartMinimumForFontSize)); 264 fontDescription.setComputedSize(CSSStyleSelector::getComputedSizeFromSpecifi edSize(document, scalingFactor, fontDescription.isAbsoluteSize(), fontDescriptio n.computedSize(), DoNotUseSmartMinimumForFontSize));
254 265
255 scaledFont = Font(fontDescription, 0, 0); 266 scaledFont = Font(fontDescription, 0, 0);
256 scaledFont.update(styleSelector->fontSelector()); 267 scaledFont.update(styleSelector->fontSelector());
257 } 268 }
258 269
259 } 270 }
260 271
261 #endif // ENABLE(SVG) 272 #endif // ENABLE(SVG)
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/svg/RenderSVGInlineText.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698