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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 void 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()); | |
|
fs
2016/08/16 12:43:08
I checked the spec, and these seem to be the relev
Shanmuga Pandi
2016/08/19 07:20:28
I filed a spec bug:
https://github.com/w3c/svgwg/i
| |
| 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)); |
| 79 | |
| 74 m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox; | 80 m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox; |
| 75 } | 81 } |
| 76 | 82 |
| 77 void LayoutSVGImage::layout() | 83 void LayoutSVGImage::layout() |
| 78 { | 84 { |
| 79 ASSERT(needsLayout()); | 85 ASSERT(needsLayout()); |
| 80 LayoutAnalyzer::Scope analyzer(*this); | 86 LayoutAnalyzer::Scope analyzer(*this); |
| 81 | 87 |
| 82 // Invalidate all resources of this client if our layout changed. | 88 // Invalidate all resources of this client if our layout changed. |
| 83 if (everHadLayout() && selfNeedsLayout()) | 89 if (everHadLayout() && selfNeedsLayout()) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 return false; | 145 return false; |
| 140 } | 146 } |
| 141 | 147 |
| 142 void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*) | 148 void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*) |
| 143 { | 149 { |
| 144 // Notify parent resources that we've changed. This also invalidates | 150 // Notify parent resources that we've changed. This also invalidates |
| 145 // references from resources (filters) that may have a cached | 151 // references from resources (filters) that may have a cached |
| 146 // representation of this image/layout object. | 152 // representation of this image/layout object. |
| 147 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false); | 153 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false); |
| 148 | 154 |
| 155 if (styleRef().width().isAuto() || styleRef().height().isAuto()) { | |
| 156 FloatRect oldBoundaries = m_objectBoundingBox; | |
| 157 updateBoundingBox(); | |
| 158 FloatRect newBoundaries = m_objectBoundingBox; | |
| 159 if (oldBoundaries.size() != newBoundaries.size()) { | |
|
fs
2016/08/16 12:43:08
Just make updateBoundingBox() return a bool instea
Shanmuga Pandi
2016/08/19 07:20:28
Done.
| |
| 160 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Siz eChanged); | |
|
fs
2016/08/16 12:43:08
Maybe just make this setNeedsLayout and then a fal
Shanmuga Pandi
2016/08/19 07:20:28
Done.
| |
| 161 return; | |
| 162 } | |
| 163 } | |
| 164 | |
| 149 setShouldDoFullPaintInvalidation(); | 165 setShouldDoFullPaintInvalidation(); |
| 150 } | 166 } |
| 151 | 167 |
| 152 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const | 168 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const |
| 153 { | 169 { |
| 154 // this is called from paint() after the localTransform has already been app lied | 170 // this is called from paint() after the localTransform has already been app lied |
| 155 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates())); | 171 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates())); |
| 156 } | 172 } |
| 157 | 173 |
| 158 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |