Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp

Issue 2230963002: SVG Image intrinsic size should be used if css style size is 'auto' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 LayoutSize intrinsicSize = m_imageResource->imageSize(style()->effectiveZoom ());
fs 2016/08/11 15:52:57 Probably needs to refine this a bit. (The end of)
Shanmuga Pandi 2016/08/16 10:24:57 Done.
69 m_objectBoundingBox = FloatRect( 70 m_objectBoundingBox = FloatRect(
70 lengthContext.valueForLength(styleRef().svgStyle().x(), styleRef(), SVGL engthMode::Width), 71 lengthContext.valueForLength(styleRef().svgStyle().x(), styleRef(), SVGL engthMode::Width),
71 lengthContext.valueForLength(styleRef().svgStyle().y(), styleRef(), SVGL engthMode::Height), 72 lengthContext.valueForLength(styleRef().svgStyle().y(), styleRef(), SVGL engthMode::Height),
72 lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLengthMo de::Width), 73 styleRef().width().isAuto() ? intrinsicSize.width().toFloat() : lengthCo ntext.valueForLength(styleRef().width(), styleRef(), SVGLengthMode::Width),
73 lengthContext.valueForLength(styleRef().height(), styleRef(), SVGLengthM ode::Height)); 74 styleRef().height().isAuto() ? intrinsicSize.height().toFloat() : length Context.valueForLength(styleRef().height(), styleRef(), SVGLengthMode::Height));
74 m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox; 75 m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox;
75 } 76 }
76 77
77 void LayoutSVGImage::layout() 78 void LayoutSVGImage::layout()
78 { 79 {
79 ASSERT(needsLayout()); 80 ASSERT(needsLayout());
80 LayoutAnalyzer::Scope analyzer(*this); 81 LayoutAnalyzer::Scope analyzer(*this);
81 82
82 // Invalidate all resources of this client if our layout changed. 83 // Invalidate all resources of this client if our layout changed.
83 if (everHadLayout() && selfNeedsLayout()) 84 if (everHadLayout() && selfNeedsLayout())
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 updateHitTestResult(result, localLayoutPoint); 133 updateHitTestResult(result, localLayoutPoint);
133 if (result.addNodeToListBasedTestResult(element(), localLayoutPo int) == StopHitTesting) 134 if (result.addNodeToListBasedTestResult(element(), localLayoutPo int) == StopHitTesting)
134 return true; 135 return true;
135 } 136 }
136 } 137 }
137 } 138 }
138 139
139 return false; 140 return false;
140 } 141 }
141 142
142 void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*) 143 void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*)
fs 2016/08/11 16:39:36 Probably need to make sure to trigger layout when
Shanmuga Pandi 2016/08/16 10:24:57 Done.
143 { 144 {
144 // Notify parent resources that we've changed. This also invalidates 145 // Notify parent resources that we've changed. This also invalidates
145 // references from resources (filters) that may have a cached 146 // references from resources (filters) that may have a cached
146 // representation of this image/layout object. 147 // representation of this image/layout object.
147 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false); 148 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false);
148 149
149 setShouldDoFullPaintInvalidation(); 150 setShouldDoFullPaintInvalidation();
150 } 151 }
151 152
152 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const 153 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const
153 { 154 {
154 // this is called from paint() after the localTransform has already been app lied 155 // this is called from paint() after the localTransform has already been app lied
155 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates())); 156 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates()));
156 } 157 }
157 158
158 } // namespace blink 159 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698