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

Side by Side Diff: Source/core/svg/SVGSVGElement.cpp

Issue 33353003: Have Frame::tree() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/TextAutosizer.cpp ('k') | Source/core/testing/Internals.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, 2008, 2010 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 float SVGSVGElement::currentScale() const 177 float SVGSVGElement::currentScale() const
178 { 178 {
179 if (!inDocument() || !isOutermostSVGSVGElement()) 179 if (!inDocument() || !isOutermostSVGSVGElement())
180 return 1; 180 return 1;
181 181
182 Frame* frame = document().frame(); 182 Frame* frame = document().frame();
183 if (!frame) 183 if (!frame)
184 return 1; 184 return 1;
185 185
186 FrameTree* frameTree = frame->tree(); 186 const FrameTree& frameTree = frame->tree();
187 ASSERT(frameTree);
188 187
189 // The behaviour of currentScale() is undefined, when we're dealing with non -standalone SVG documents. 188 // The behaviour of currentScale() is undefined, when we're dealing with non -standalone SVG documents.
190 // If the svg is embedded, the scaling is handled by the host renderer, so w hen asking from inside 189 // If the svg is embedded, the scaling is handled by the host renderer, so w hen asking from inside
191 // the SVG document, a scale value of 1 seems reasonable, as it doesn't know anything about the parent scale. 190 // the SVG document, a scale value of 1 seems reasonable, as it doesn't know anything about the parent scale.
192 return frameTree->parent() ? 1 : frame->pageZoomFactor(); 191 return frameTree.parent() ? 1 : frame->pageZoomFactor();
193 } 192 }
194 193
195 void SVGSVGElement::setCurrentScale(float scale) 194 void SVGSVGElement::setCurrentScale(float scale)
196 { 195 {
197 if (!inDocument() || !isOutermostSVGSVGElement()) 196 if (!inDocument() || !isOutermostSVGSVGElement())
198 return; 197 return;
199 198
200 Frame* frame = document().frame(); 199 Frame* frame = document().frame();
201 if (!frame) 200 if (!frame)
202 return; 201 return;
203 202
204 FrameTree* frameTree = frame->tree(); 203 const FrameTree& frameTree = frame->tree();
205 ASSERT(frameTree);
206 204
207 // The behaviour of setCurrentScale() is undefined, when we're dealing with non-standalone SVG documents. 205 // The behaviour of setCurrentScale() is undefined, when we're dealing with non-standalone SVG documents.
208 // We choose the ignore this call, it's pretty useless to support calling se tCurrentScale() from within 206 // We choose the ignore this call, it's pretty useless to support calling se tCurrentScale() from within
209 // an embedded SVG document, for the same reasons as in currentScale() - nee ds resolution by SVG WG. 207 // an embedded SVG document, for the same reasons as in currentScale() - nee ds resolution by SVG WG.
210 if (frameTree->parent()) 208 if (frameTree.parent())
211 return; 209 return;
212 210
213 frame->setPageZoomFactor(scale); 211 frame->setPageZoomFactor(scale);
214 } 212 }
215 213
216 void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation) 214 void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation)
217 { 215 {
218 m_translation = translation; 216 m_translation = translation;
219 updateCurrentTranslate(); 217 updateCurrentTranslate();
220 } 218 }
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 continue; 779 continue;
782 780
783 Element* element = toElement(node); 781 Element* element = toElement(node);
784 if (element->getIdAttribute() == id) 782 if (element->getIdAttribute() == id)
785 return element; 783 return element;
786 } 784 }
787 return 0; 785 return 0;
788 } 786 }
789 787
790 } 788 }
OLDNEW
« no previous file with comments | « Source/core/rendering/TextAutosizer.cpp ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698