Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp |
index 91867b267e3846e7871142f9b3e0af1f11131e9a..de08ab94133cf88d7ffcbb148b03d4ae8062c43f 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp |
@@ -61,17 +61,25 @@ void LayoutSVGImage::willBeDestroyed() |
LayoutSVGModelObject::willBeDestroyed(); |
} |
-void LayoutSVGImage::updateBoundingBox() |
+bool LayoutSVGImage::updateBoundingBox() |
{ |
FloatRect oldBoundaries = m_objectBoundingBox; |
SVGLengthContext lengthContext(element()); |
+ ImageResource* cachedImage = m_imageResource->cachedImage(); |
+ FloatSize intrinsicSize; |
+ if (cachedImage && !cachedImage->errorOccurred()) |
+ intrinsicSize = FloatSize(cachedImage->getImage()->size()); |
+ |
m_objectBoundingBox = FloatRect( |
lengthContext.valueForLength(styleRef().svgStyle().x(), styleRef(), SVGLengthMode::Width), |
lengthContext.valueForLength(styleRef().svgStyle().y(), styleRef(), SVGLengthMode::Height), |
- lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLengthMode::Width), |
- lengthContext.valueForLength(styleRef().height(), styleRef(), SVGLengthMode::Height)); |
+ styleRef().width().isAuto() ? intrinsicSize.width() : lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLengthMode::Width), |
+ styleRef().height().isAuto() ? intrinsicSize.height() : lengthContext.valueForLength(styleRef().height(), styleRef(), SVGLengthMode::Height)); |
fs
2016/08/19 08:59:45
This is still not using what's specced by https://
Shanmuga Pandi
2016/08/19 11:56:42
Agree.
I will study more about intrinsic dimension
Shanmuga Pandi
2016/09/14 09:20:16
Please check this.
|
+ |
m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox; |
+ |
+ return oldBoundaries.size() != m_objectBoundingBox.size(); |
} |
void LayoutSVGImage::layout() |
@@ -146,6 +154,11 @@ void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*) |
// representation of this image/layout object. |
LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false); |
+ if (styleRef().width().isAuto() || styleRef().height().isAuto()) { |
+ if (updateBoundingBox()) |
+ setNeedsLayout(LayoutInvalidationReason::SizeChanged); |
+ } |
+ |
setShouldDoFullPaintInvalidation(); |
} |