OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 #include "core/layout/style/LayoutStyle.h" | 28 #include "core/layout/style/LayoutStyle.h" |
29 #include "core/svg/SVGSVGElement.h" | 29 #include "core/svg/SVGSVGElement.h" |
30 #include "platform/LengthFunctions.h" | 30 #include "platform/LengthFunctions.h" |
31 #include "platform/fonts/FontMetrics.h" | 31 #include "platform/fonts/FontMetrics.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 static inline float dimensionForLengthMode(SVGLengthMode mode, const FloatSize&
viewportSize) | 35 static inline float dimensionForLengthMode(SVGLengthMode mode, const FloatSize&
viewportSize) |
36 { | 36 { |
37 switch (mode) { | 37 switch (mode) { |
38 case LengthModeWidth: | 38 case SVGLengthMode::Width: |
39 return viewportSize.width(); | 39 return viewportSize.width(); |
40 case LengthModeHeight: | 40 case SVGLengthMode::Height: |
41 return viewportSize.height(); | 41 return viewportSize.height(); |
42 case LengthModeOther: | 42 case SVGLengthMode::Other: |
43 return sqrtf(viewportSize.diagonalLengthSquared() / 2); | 43 return sqrtf(viewportSize.diagonalLengthSquared() / 2); |
44 } | 44 } |
45 ASSERT_NOT_REACHED(); | 45 ASSERT_NOT_REACHED(); |
46 return 0; | 46 return 0; |
47 } | 47 } |
48 | 48 |
49 static float convertValueFromPercentageToUserUnits(const SVGLength& value, const
FloatSize& viewportSize) | 49 static float convertValueFromPercentageToUserUnits(const SVGLength& value, const
FloatSize& viewportSize) |
50 { | 50 { |
51 return value.scaleByPercentage(dimensionForLengthMode(value.unitMode(), view
portSize)); | 51 return value.scaleByPercentage(dimensionForLengthMode(value.unitMode(), view
portSize)); |
52 } | 52 } |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); | 269 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); |
270 viewportSize = svg.currentViewBoxRect().size(); | 270 viewportSize = svg.currentViewBoxRect().size(); |
271 if (viewportSize.isEmpty()) | 271 if (viewportSize.isEmpty()) |
272 viewportSize = svg.currentViewportSize(); | 272 viewportSize = svg.currentViewportSize(); |
273 | 273 |
274 return true; | 274 return true; |
275 } | 275 } |
276 | 276 |
277 } | 277 } |
OLD | NEW |