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

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

Issue 1127773003: This CL clean up patch in SVGElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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/core/svg/SVGGraphicsElement.cpp ('k') | Source/core/svg/SVGPathElement.h » ('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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 static float convertValueFromPercentageToUserUnits(const SVGLength& value, const FloatSize& viewportSize) 51 static float convertValueFromPercentageToUserUnits(const SVGLength& value, const FloatSize& viewportSize)
52 { 52 {
53 return CSSPrimitiveValue::clampToCSSLengthRange(value.scaleByPercentage(dime nsionForLengthMode(value.unitMode(), viewportSize))); 53 return CSSPrimitiveValue::clampToCSSLengthRange(value.scaleByPercentage(dime nsionForLengthMode(value.unitMode(), viewportSize)));
54 } 54 }
55 55
56 static const ComputedStyle* computedStyleForLengthResolving(const SVGElement* co ntext) 56 static const ComputedStyle* computedStyleForLengthResolving(const SVGElement* co ntext)
57 { 57 {
58 if (!context) 58 if (!context)
59 return 0; 59 return nullptr;
60 60
61 const ContainerNode* currentContext = context; 61 const ContainerNode* currentContext = context;
62 do { 62 do {
63 if (currentContext->layoutObject()) 63 if (currentContext->layoutObject())
64 return currentContext->layoutObject()->style(); 64 return currentContext->layoutObject()->style();
65 currentContext = currentContext->parentNode(); 65 currentContext = currentContext->parentNode();
66 } while (currentContext); 66 } while (currentContext);
67 67
68 // There must be at least a LayoutSVGRoot layoutObject, carrying a style. 68 // There must be at least a LayoutSVGRoot layoutObject, carrying a style.
69 ASSERT_NOT_REACHED(); 69 ASSERT_NOT_REACHED();
70 return 0; 70 return nullptr;
71 } 71 }
72 72
73 static const ComputedStyle* rootElementStyle(const Node* context) 73 static const ComputedStyle* rootElementStyle(const Node* context)
74 { 74 {
75 if (!context) 75 if (!context)
76 return 0; 76 return nullptr;
77 77
78 const Document& document = context->document(); 78 const Document& document = context->document();
79 Node* documentElement = document.documentElement(); 79 Node* documentElement = document.documentElement();
80 const ComputedStyle* documentStyle = document.computedStyle(); 80 const ComputedStyle* documentStyle = document.computedStyle();
81 const ComputedStyle* style = documentElement && context != documentElement ? documentElement->computedStyle() : documentStyle; 81 const ComputedStyle* style = documentElement && context != documentElement ? documentElement->computedStyle() : documentStyle;
82 if (!style) 82 if (!style)
83 style = documentStyle; 83 style = documentStyle;
84 return style; 84 return style;
85 } 85 }
86 86
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); 346 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement);
347 viewportSize = svg.currentViewBoxRect().size(); 347 viewportSize = svg.currentViewBoxRect().size();
348 if (viewportSize.isEmpty()) 348 if (viewportSize.isEmpty())
349 viewportSize = svg.currentViewportSize(); 349 viewportSize = svg.currentViewportSize();
350 350
351 return true; 351 return true;
352 } 352 }
353 353
354 } 354 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGGraphicsElement.cpp ('k') | Source/core/svg/SVGPathElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698