Chromium Code Reviews| 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() const | |
| 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); | |
|
Justin Novosad
2016/04/14 20:45:14
Is this call at all expensive? I am concerned that
davve
2016/04/15 07:24:31
I don't think it's particularly expensive. But at
davve
2016/04/15 09:31:18
Now being able to read the spec text, it says "...
xidachen
2016/04/15 12:24:04
Thanks David. I am going with
return !concreteObj
| |
| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 537 | 555 |
| 538 return m_page; | 556 return m_page; |
| 539 } | 557 } |
| 540 | 558 |
| 541 String SVGImage::filenameExtension() const | 559 String SVGImage::filenameExtension() const |
| 542 { | 560 { |
| 543 return "svg"; | 561 return "svg"; |
| 544 } | 562 } |
| 545 | 563 |
| 546 } // namespace blink | 564 } // namespace blink |
| OLD | NEW |