Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
| 3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
| 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> | 5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> |
| 6 * Copyright (C) 2009 Google, Inc. | 6 * Copyright (C) 2009 Google, Inc. |
| 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> | 8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 return height * intrinsicRatio.width() / intrinsicRatio.height(); | 62 return height * intrinsicRatio.width() / intrinsicRatio.height(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 static float resolveHeightForRatio(float width, | 65 static float resolveHeightForRatio(float width, |
| 66 const FloatSize& intrinsicRatio) { | 66 const FloatSize& intrinsicRatio) { |
| 67 return width * intrinsicRatio.height() / intrinsicRatio.width(); | 67 return width * intrinsicRatio.height() / intrinsicRatio.width(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 FloatSize LayoutSVGImage::calculateObjectSize() const { | 70 FloatSize LayoutSVGImage::calculateObjectSize() const { |
| 71 ImageResourceContent* cachedImage = m_imageResource->cachedImage(); | 71 ImageResourceContent* cachedImage = m_imageResource->cachedImage(); |
| 72 if (!cachedImage || cachedImage->errorOccurred()) | 72 if (!cachedImage || cachedImage->errorOccurred() || |
| 73 !cachedImage->isSizeAvailable()) | |
|
fs
2016/12/20 10:08:12
Would this not affect other similar code-paths sim
yhirano
2016/12/20 12:06:30
I'm not sure (I'm not familiar with the layout / i
fs
2016/12/20 12:15:45
My observation was mostly that other code seems to
hiroshige
2016/12/21 17:51:06
If we can replace isSizeAvailable() here and in Im
| |
| 73 return m_objectBoundingBox.size(); | 74 return m_objectBoundingBox.size(); |
| 74 | 75 |
| 75 FloatSize intrinsicSize = FloatSize(cachedImage->getImage()->size()); | 76 FloatSize intrinsicSize = FloatSize(cachedImage->getImage()->size()); |
| 76 if (styleRef().width().isAuto() && styleRef().height().isAuto()) | 77 if (styleRef().width().isAuto() && styleRef().height().isAuto()) |
| 77 return intrinsicSize; | 78 return intrinsicSize; |
| 78 | 79 |
| 79 if (styleRef().height().isAuto()) | 80 if (styleRef().height().isAuto()) |
| 80 return FloatSize( | 81 return FloatSize( |
| 81 m_objectBoundingBox.width(), | 82 m_objectBoundingBox.width(), |
| 82 resolveHeightForRatio(m_objectBoundingBox.width(), intrinsicSize)); | 83 resolveHeightForRatio(m_objectBoundingBox.width(), intrinsicSize)); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 | 203 |
| 203 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, | 204 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, |
| 204 const LayoutPoint&, | 205 const LayoutPoint&, |
| 205 IncludeBlockVisualOverflowOrNot) const { | 206 IncludeBlockVisualOverflowOrNot) const { |
| 206 // this is called from paint() after the localTransform has already been | 207 // this is called from paint() after the localTransform has already been |
| 207 // applied | 208 // applied |
| 208 rects.append(LayoutRect(visualRectInLocalSVGCoordinates())); | 209 rects.append(LayoutRect(visualRectInLocalSVGCoordinates())); |
| 209 } | 210 } |
| 210 | 211 |
| 211 } // namespace blink | 212 } // namespace blink |
| OLD | NEW |