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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 { | 54 { |
55 } | 55 } |
56 | 56 |
57 void LayoutSVGImage::willBeDestroyed() | 57 void LayoutSVGImage::willBeDestroyed() |
58 { | 58 { |
59 ImageQualityController::remove(*this); | 59 ImageQualityController::remove(*this); |
60 m_imageResource->shutdown(); | 60 m_imageResource->shutdown(); |
61 LayoutSVGModelObject::willBeDestroyed(); | 61 LayoutSVGModelObject::willBeDestroyed(); |
62 } | 62 } |
63 | 63 |
64 void LayoutSVGImage::updateBoundingBox() | 64 bool LayoutSVGImage::updateBoundingBox() |
65 { | 65 { |
66 FloatRect oldBoundaries = m_objectBoundingBox; | 66 FloatRect oldBoundaries = m_objectBoundingBox; |
67 | 67 |
68 SVGLengthContext lengthContext(element()); | 68 SVGLengthContext lengthContext(element()); |
69 ImageResource* cachedImage = m_imageResource->cachedImage(); | |
70 FloatSize intrinsicSize; | |
71 if (cachedImage && !cachedImage->errorOccurred()) | |
72 intrinsicSize = FloatSize(cachedImage->getImage()->size()); | |
73 | |
69 m_objectBoundingBox = FloatRect( | 74 m_objectBoundingBox = FloatRect( |
70 lengthContext.valueForLength(styleRef().svgStyle().x(), styleRef(), SVGL engthMode::Width), | 75 lengthContext.valueForLength(styleRef().svgStyle().x(), styleRef(), SVGL engthMode::Width), |
71 lengthContext.valueForLength(styleRef().svgStyle().y(), styleRef(), SVGL engthMode::Height), | 76 lengthContext.valueForLength(styleRef().svgStyle().y(), styleRef(), SVGL engthMode::Height), |
72 lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLengthMo de::Width), | 77 styleRef().width().isAuto() ? intrinsicSize.width() : lengthContext.valu eForLength(styleRef().width(), styleRef(), SVGLengthMode::Width), |
73 lengthContext.valueForLength(styleRef().height(), styleRef(), SVGLengthM ode::Height)); | 78 styleRef().height().isAuto() ? intrinsicSize.height() : lengthContext.va lueForLength(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.
| |
79 | |
74 m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox; | 80 m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox; |
81 | |
82 return oldBoundaries.size() != m_objectBoundingBox.size(); | |
75 } | 83 } |
76 | 84 |
77 void LayoutSVGImage::layout() | 85 void LayoutSVGImage::layout() |
78 { | 86 { |
79 ASSERT(needsLayout()); | 87 ASSERT(needsLayout()); |
80 LayoutAnalyzer::Scope analyzer(*this); | 88 LayoutAnalyzer::Scope analyzer(*this); |
81 | 89 |
82 // Invalidate all resources of this client if our layout changed. | 90 // Invalidate all resources of this client if our layout changed. |
83 if (everHadLayout() && selfNeedsLayout()) | 91 if (everHadLayout() && selfNeedsLayout()) |
84 SVGResourcesCache::clientLayoutChanged(this); | 92 SVGResourcesCache::clientLayoutChanged(this); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 return false; | 147 return false; |
140 } | 148 } |
141 | 149 |
142 void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*) | 150 void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*) |
143 { | 151 { |
144 // Notify parent resources that we've changed. This also invalidates | 152 // Notify parent resources that we've changed. This also invalidates |
145 // references from resources (filters) that may have a cached | 153 // references from resources (filters) that may have a cached |
146 // representation of this image/layout object. | 154 // representation of this image/layout object. |
147 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false); | 155 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false); |
148 | 156 |
157 if (styleRef().width().isAuto() || styleRef().height().isAuto()) { | |
158 if (updateBoundingBox()) | |
159 setNeedsLayout(LayoutInvalidationReason::SizeChanged); | |
160 } | |
161 | |
149 setShouldDoFullPaintInvalidation(); | 162 setShouldDoFullPaintInvalidation(); |
150 } | 163 } |
151 | 164 |
152 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const | 165 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const |
153 { | 166 { |
154 // this is called from paint() after the localTransform has already been app lied | 167 // this is called from paint() after the localTransform has already been app lied |
155 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates())); | 168 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates())); |
156 } | 169 } |
157 | 170 |
158 } // namespace blink | 171 } // namespace blink |
OLD | NEW |