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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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) 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void RenderSVGInlineText::updateScaledFont() 212 void RenderSVGInlineText::updateScaledFont()
213 { 213 {
214 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont); 214 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont);
215 } 215 }
216 216
217 void RenderSVGInlineText::computeNewScaledFontForStyle(RenderObject* renderer, c onst RenderStyle* style, float& scalingFactor, Font& scaledFont) 217 void RenderSVGInlineText::computeNewScaledFontForStyle(RenderObject* renderer, c onst RenderStyle* style, float& scalingFactor, Font& scaledFont)
218 { 218 {
219 ASSERT(style); 219 ASSERT(style);
220 ASSERT(renderer); 220 ASSERT(renderer);
221 221
222 Document* document = renderer->document(); 222 Document& document = renderer->document();
223 ASSERT(document);
224 223
225 StyleResolver* styleResolver = document->styleResolver(); 224 StyleResolver* styleResolver = document.styleResolver();
226 ASSERT(styleResolver); 225 ASSERT(styleResolver);
227 226
228 // Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified. 227 // Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified.
229 scalingFactor = SVGRenderingContext::calculateScreenFontSizeScalingFactor(re nderer); 228 scalingFactor = SVGRenderingContext::calculateScreenFontSizeScalingFactor(re nderer);
230 if (scalingFactor == 1 || !scalingFactor) { 229 if (scalingFactor == 1 || !scalingFactor) {
231 scalingFactor = 1; 230 scalingFactor = 1;
232 scaledFont = style->font(); 231 scaledFont = style->font();
233 return; 232 return;
234 } 233 }
235 234
236 if (style->fontDescription().textRenderingMode() == GeometricPrecision) 235 if (style->fontDescription().textRenderingMode() == GeometricPrecision)
237 scalingFactor = 1; 236 scalingFactor = 1;
238 237
239 FontDescription fontDescription(style->fontDescription()); 238 FontDescription fontDescription(style->fontDescription());
240 239
241 // FIXME: We need to better handle the case when we compute very small fonts below (below 1pt). 240 // FIXME: We need to better handle the case when we compute very small fonts below (below 1pt).
242 fontDescription.setComputedSize(FontSize::getComputedSizeFromSpecifiedSize(d ocument, scalingFactor, fontDescription.isAbsoluteSize(), fontDescription.specif iedSize(), DoNotUseSmartMinimumForFontSize)); 241 fontDescription.setComputedSize(FontSize::getComputedSizeFromSpecifiedSize(& document, scalingFactor, fontDescription.isAbsoluteSize(), fontDescription.speci fiedSize(), DoNotUseSmartMinimumForFontSize));
243 242
244 scaledFont = Font(fontDescription, 0, 0); 243 scaledFont = Font(fontDescription, 0, 0);
245 scaledFont.update(styleResolver->fontSelector()); 244 scaledFont.update(styleResolver->fontSelector());
246 } 245 }
247 246
248 } 247 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/ReferenceFilterBuilder.cpp ('k') | Source/core/rendering/svg/RenderSVGModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698