| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
| 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
| 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 static float resolveWidthForRatio(float height, const FloatSize& intrinsicRatio) | 161 static float resolveWidthForRatio(float height, const FloatSize& intrinsicRatio) |
| 162 { | 162 { |
| 163 return height * intrinsicRatio.width() / intrinsicRatio.height(); | 163 return height * intrinsicRatio.width() / intrinsicRatio.height(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 static float resolveHeightForRatio(float width, const FloatSize& intrinsicRatio) | 166 static float resolveHeightForRatio(float width, const FloatSize& intrinsicRatio) |
| 167 { | 167 { |
| 168 return width * intrinsicRatio.height() / intrinsicRatio.width(); | 168 return width * intrinsicRatio.height() / intrinsicRatio.width(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 bool SVGImage::hasIntrinsicSize() |
| 172 { |
| 173 SVGSVGElement* svg = svgRootElement(m_page.get()); |
| 174 if (!svg) |
| 175 return false; |
| 176 |
| 177 LayoutSVGRoot* layoutObject = toLayoutSVGRoot(svg->layoutObject()); |
| 178 if (!layoutObject) |
| 179 return false; |
| 180 |
| 181 LayoutReplaced::IntrinsicSizingInfo intrinsicSizingInfo; |
| 182 layoutObject->computeIntrinsicSizingInfo(intrinsicSizingInfo); |
| 183 |
| 184 if (intrinsicSizingInfo.hasWidth && intrinsicSizingInfo.hasHeight) |
| 185 return true; |
| 186 return false; |
| 187 } |
| 188 |
| 171 FloatSize SVGImage::concreteObjectSize(const FloatSize& defaultObjectSize) const | 189 FloatSize SVGImage::concreteObjectSize(const FloatSize& defaultObjectSize) const |
| 172 { | 190 { |
| 173 SVGSVGElement* svg = svgRootElement(m_page.get()); | 191 SVGSVGElement* svg = svgRootElement(m_page.get()); |
| 174 if (!svg) | 192 if (!svg) |
| 175 return FloatSize(); | 193 return FloatSize(); |
| 176 | 194 |
| 177 LayoutSVGRoot* layoutObject = toLayoutSVGRoot(svg->layoutObject()); | 195 LayoutSVGRoot* layoutObject = toLayoutSVGRoot(svg->layoutObject()); |
| 178 if (!layoutObject) | 196 if (!layoutObject) |
| 179 return FloatSize(); | 197 return FloatSize(); |
| 180 | 198 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 | 554 |
| 537 return m_page; | 555 return m_page; |
| 538 } | 556 } |
| 539 | 557 |
| 540 String SVGImage::filenameExtension() const | 558 String SVGImage::filenameExtension() const |
| 541 { | 559 { |
| 542 return "svg"; | 560 return "svg"; |
| 543 } | 561 } |
| 544 | 562 |
| 545 } // namespace blink | 563 } // namespace blink |
| OLD | NEW |