OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Google, Inc. | 5 * Copyright (C) 2009 Google, Inc. |
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // https://www.w3.org/TR/SVG/coords.html#IntrinsicSizing | 77 // https://www.w3.org/TR/SVG/coords.html#IntrinsicSizing |
78 | 78 |
79 SVGSVGElement* svg = toSVGSVGElement(node()); | 79 SVGSVGElement* svg = toSVGSVGElement(node()); |
80 ASSERT(svg); | 80 ASSERT(svg); |
81 | 81 |
82 intrinsicSizingInfo.size = calculateIntrinsicSize(*svg); | 82 intrinsicSizingInfo.size = calculateIntrinsicSize(*svg); |
83 intrinsicSizingInfo.hasWidth = svg->hasIntrinsicWidth(); | 83 intrinsicSizingInfo.hasWidth = svg->hasIntrinsicWidth(); |
84 intrinsicSizingInfo.hasHeight = svg->hasIntrinsicHeight(); | 84 intrinsicSizingInfo.hasHeight = svg->hasIntrinsicHeight(); |
85 | 85 |
86 if (!intrinsicSizingInfo.size.isEmpty()) { | 86 if (!intrinsicSizingInfo.size.isEmpty()) { |
87 intrinsicSizingInfo.aspectRatio = intrinsicSizingInfo.size.width() / sta
tic_cast<double>(intrinsicSizingInfo.size.height()); | 87 intrinsicSizingInfo.aspectRatio = intrinsicSizingInfo.size; |
88 } else { | 88 } else { |
89 FloatSize viewBoxSize = svg->viewBox()->currentValue()->value().size(); | 89 FloatSize viewBoxSize = svg->viewBox()->currentValue()->value().size(); |
90 if (!viewBoxSize.isEmpty()) { | 90 if (!viewBoxSize.isEmpty()) { |
91 // The viewBox can only yield an intrinsic ratio, not an intrinsic s
ize. | 91 // The viewBox can only yield an intrinsic ratio, not an intrinsic s
ize. |
92 intrinsicSizingInfo.aspectRatio = viewBoxSize.width() / static_cast<
double>(viewBoxSize.height()); | 92 intrinsicSizingInfo.aspectRatio = viewBoxSize; |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 if (!isHorizontalWritingMode()) | 96 if (!isHorizontalWritingMode()) |
97 intrinsicSizingInfo.transpose(); | 97 intrinsicSizingInfo.transpose(); |
98 } | 98 } |
99 | 99 |
100 bool LayoutSVGRoot::isEmbeddedThroughSVGImage() const | 100 bool LayoutSVGRoot::isEmbeddedThroughSVGImage() const |
101 { | 101 { |
102 return SVGImage::isInSVGImage(toSVGSVGElement(node())); | 102 return SVGImage::isInSVGImage(toSVGSVGElement(node())); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 updateHitTestResult(result, pointInBorderBox); | 404 updateHitTestResult(result, pointInBorderBox); |
405 if (result.addNodeToListBasedTestResult(node(), locationInContainer,
boundsRect) == StopHitTesting) | 405 if (result.addNodeToListBasedTestResult(node(), locationInContainer,
boundsRect) == StopHitTesting) |
406 return true; | 406 return true; |
407 } | 407 } |
408 } | 408 } |
409 | 409 |
410 return false; | 410 return false; |
411 } | 411 } |
412 | 412 |
413 } // namespace blink | 413 } // namespace blink |
OLD | NEW |