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

Side by Side Diff: Source/core/svg/SVGLengthContext.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
« no previous file with comments | « Source/core/svg/SVGImageLoader.cpp ('k') | Source/core/svg/SVGLinearGradientElement.cpp » ('j') | 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) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 // If an overriden viewport is given, it has precedence. 288 // If an overriden viewport is given, it has precedence.
289 if (!m_overridenViewport.isEmpty()) { 289 if (!m_overridenViewport.isEmpty()) {
290 width = m_overridenViewport.width(); 290 width = m_overridenViewport.width();
291 height = m_overridenViewport.height(); 291 height = m_overridenViewport.height();
292 return true; 292 return true;
293 } 293 }
294 294
295 // SVGLengthContext should NEVER be used to resolve width/height values for <svg> elements, 295 // SVGLengthContext should NEVER be used to resolve width/height values for <svg> elements,
296 // as they require special treatment, due the relationship with the CSS widt h/height properties. 296 // as they require special treatment, due the relationship with the CSS widt h/height properties.
297 ASSERT(m_context->document()->documentElement() != m_context); 297 ASSERT(m_context->document().documentElement() != m_context);
298 298
299 // Take size from nearest viewport element. 299 // Take size from nearest viewport element.
300 SVGElement* viewportElement = m_context->viewportElement(); 300 SVGElement* viewportElement = m_context->viewportElement();
301 if (!viewportElement || !viewportElement->isSVGSVGElement()) 301 if (!viewportElement || !viewportElement->isSVGSVGElement())
302 return false; 302 return false;
303 303
304 const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(viewportElement ); 304 const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(viewportElement );
305 FloatSize viewportSize = svg->currentViewBoxRect().size(); 305 FloatSize viewportSize = svg->currentViewBoxRect().size();
306 if (viewportSize.isEmpty()) 306 if (viewportSize.isEmpty())
307 viewportSize = svg->currentViewportSize(); 307 viewportSize = svg->currentViewportSize();
308 308
309 width = viewportSize.width(); 309 width = viewportSize.width();
310 height = viewportSize.height(); 310 height = viewportSize.height();
311 return true; 311 return true;
312 } 312 }
313 313
314 } 314 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGImageLoader.cpp ('k') | Source/core/svg/SVGLinearGradientElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698