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

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

Issue 135913002: Do refactor in collectGradientAttributes() and renderStyleForLengthResolve() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 | « no previous file | 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 ASSERT_NOT_REACHED(); 210 ASSERT_NOT_REACHED();
211 return 0; 211 return 0;
212 } 212 }
213 213
214 static inline RenderStyle* renderStyleForLengthResolving(const SVGElement* conte xt) 214 static inline RenderStyle* renderStyleForLengthResolving(const SVGElement* conte xt)
215 { 215 {
216 if (!context) 216 if (!context)
217 return 0; 217 return 0;
218 218
219 const ContainerNode* currentContext = context; 219 const ContainerNode* currentContext = context;
220 while (currentContext) { 220 do {
221 if (currentContext->renderer()) 221 if (currentContext->renderer())
222 return currentContext->renderer()->style(); 222 return currentContext->renderer()->style();
223 currentContext = currentContext->parentNode(); 223 currentContext = currentContext->parentNode();
224 } 224 } while (currentContext);
225 225
226 // There must be at least a RenderSVGRoot renderer, carrying a style. 226 // There must be at least a RenderSVGRoot renderer, carrying a style.
227 ASSERT_NOT_REACHED(); 227 ASSERT_NOT_REACHED();
228 return 0; 228 return 0;
229 } 229 }
230 230
231 float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionSta te& exceptionState) const 231 float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionSta te& exceptionState) const
232 { 232 {
233 RenderStyle* style = renderStyleForLengthResolving(m_context); 233 RenderStyle* style = renderStyleForLengthResolving(m_context);
234 if (!style) { 234 if (!style) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 const SVGSVGElement* svg = toSVGSVGElement(viewportElement); 313 const SVGSVGElement* svg = toSVGSVGElement(viewportElement);
314 viewportSize = svg->currentViewBoxRect().size(); 314 viewportSize = svg->currentViewBoxRect().size();
315 if (viewportSize.isEmpty()) 315 if (viewportSize.isEmpty())
316 viewportSize = svg->currentViewportSize(); 316 viewportSize = svg->currentViewportSize();
317 317
318 return true; 318 return true;
319 } 319 }
320 320
321 } 321 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/svg/SVGLinearGradientElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698