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

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

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase Created 4 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
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 float SVGLengthContext::valueForLength(const Length& length, const ComputedStyle & style, SVGLengthMode mode) const 206 float SVGLengthContext::valueForLength(const Length& length, const ComputedStyle & style, SVGLengthMode mode) const
207 { 207 {
208 return valueForLength(length, style.effectiveZoom(), mode); 208 return valueForLength(length, style.effectiveZoom(), mode);
209 } 209 }
210 210
211 float SVGLengthContext::valueForLength(const Length& length, float zoom, SVGLeng thMode mode) const 211 float SVGLengthContext::valueForLength(const Length& length, float zoom, SVGLeng thMode mode) const
212 { 212 {
213 float dimension = 0; 213 float dimension = 0;
214 if (length.hasPercent()) { 214 if (length.isPercentOrCalc()) {
215 FloatSize viewportSize; 215 FloatSize viewportSize;
216 determineViewport(viewportSize); 216 determineViewport(viewportSize);
217 // The viewport will be unaffected by zoom. 217 // The viewport will be unaffected by zoom.
218 dimension = dimensionForLengthMode(mode, viewportSize); 218 dimension = dimensionForLengthMode(mode, viewportSize);
219 } 219 }
220 return valueForLength(length, zoom, dimension); 220 return valueForLength(length, zoom, dimension);
221 } 221 }
222 222
223 float SVGLengthContext::valueForLength(const Length& length, const ComputedStyle & style, float dimension) 223 float SVGLengthContext::valueForLength(const Length& length, const ComputedStyle & style, float dimension)
224 { 224 {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 const ComputedStyle* rootStyle = rootElementStyle(m_context); 427 const ComputedStyle* rootStyle = rootElementStyle(m_context);
428 if (!rootStyle) 428 if (!rootStyle)
429 return 0; 429 return 0;
430 430
431 CSSToLengthConversionData conversionData = CSSToLengthConversionData(style, rootStyle, m_context->document().layoutViewItem(), 1.0f); 431 CSSToLengthConversionData conversionData = CSSToLengthConversionData(style, rootStyle, m_context->document().layoutViewItem(), 1.0f);
432 Length length = primitiveValue.convertToLength(conversionData); 432 Length length = primitiveValue.convertToLength(conversionData);
433 return valueForLength(length, 1.0f, mode); 433 return valueForLength(length, 1.0f, mode);
434 } 434 }
435 } // namespace blink 435 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/GridLength.h ('k') | third_party/WebKit/Source/platform/Length.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698