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

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

Issue 2458233002: Fix under-invalidation on SVG shape/image resize in subpixels (Closed)
Patch Set: - Created 4 years, 1 month 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 m_objectBoundingBox.width(), 81 m_objectBoundingBox.width(),
82 resolveHeightForRatio(m_objectBoundingBox.width(), intrinsicSize)); 82 resolveHeightForRatio(m_objectBoundingBox.width(), intrinsicSize));
83 83
84 DCHECK(styleRef().width().isAuto()); 84 DCHECK(styleRef().width().isAuto());
85 return FloatSize( 85 return FloatSize(
86 resolveWidthForRatio(m_objectBoundingBox.height(), intrinsicSize), 86 resolveWidthForRatio(m_objectBoundingBox.height(), intrinsicSize),
87 m_objectBoundingBox.height()); 87 m_objectBoundingBox.height());
88 } 88 }
89 89
90 bool LayoutSVGImage::updateBoundingBox() { 90 bool LayoutSVGImage::updateBoundingBox() {
91 FloatRect oldBoundaries = m_objectBoundingBox; 91 FloatRect oldObjectBoundingBox = m_objectBoundingBox;
92 92
93 SVGLengthContext lengthContext(element()); 93 SVGLengthContext lengthContext(element());
94 m_objectBoundingBox = 94 m_objectBoundingBox =
95 FloatRect(lengthContext.valueForLength(styleRef().svgStyle().x(), 95 FloatRect(lengthContext.valueForLength(styleRef().svgStyle().x(),
96 styleRef(), SVGLengthMode::Width), 96 styleRef(), SVGLengthMode::Width),
97 lengthContext.valueForLength(styleRef().svgStyle().y(), 97 lengthContext.valueForLength(styleRef().svgStyle().y(),
98 styleRef(), SVGLengthMode::Height), 98 styleRef(), SVGLengthMode::Height),
99 lengthContext.valueForLength(styleRef().width(), styleRef(), 99 lengthContext.valueForLength(styleRef().width(), styleRef(),
100 SVGLengthMode::Width), 100 SVGLengthMode::Width),
101 lengthContext.valueForLength(styleRef().height(), styleRef(), 101 lengthContext.valueForLength(styleRef().height(), styleRef(),
102 SVGLengthMode::Height)); 102 SVGLengthMode::Height));
103 103
104 if (styleRef().width().isAuto() || styleRef().height().isAuto()) 104 if (styleRef().width().isAuto() || styleRef().height().isAuto())
105 m_objectBoundingBox.setSize(calculateObjectSize()); 105 m_objectBoundingBox.setSize(calculateObjectSize());
106 106
107 m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox; 107 if (oldObjectBoundingBox != m_objectBoundingBox) {
108 setShouldDoFullPaintInvalidation();
109 m_needsBoundariesUpdate = true;
110 }
111
108 if (element()) 112 if (element())
109 element()->setNeedsResizeObserverUpdate(); 113 element()->setNeedsResizeObserverUpdate();
110 114
111 return oldBoundaries.size() != m_objectBoundingBox.size(); 115 return oldObjectBoundingBox.size() != m_objectBoundingBox.size();
112 } 116 }
113 117
114 void LayoutSVGImage::layout() { 118 void LayoutSVGImage::layout() {
115 ASSERT(needsLayout()); 119 ASSERT(needsLayout());
116 LayoutAnalyzer::Scope analyzer(*this); 120 LayoutAnalyzer::Scope analyzer(*this);
117 121
118 // Invalidate all resources of this client if our layout changed. 122 // Invalidate all resources of this client if our layout changed.
119 if (everHadLayout() && selfNeedsLayout()) 123 if (everHadLayout() && selfNeedsLayout())
120 SVGResourcesCache::clientLayoutChanged(this); 124 SVGResourcesCache::clientLayoutChanged(this);
121 125
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 203
200 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, 204 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects,
201 const LayoutPoint&, 205 const LayoutPoint&,
202 IncludeBlockVisualOverflowOrNot) const { 206 IncludeBlockVisualOverflowOrNot) const {
203 // this is called from paint() after the localTransform has already been 207 // this is called from paint() after the localTransform has already been
204 // applied 208 // applied
205 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates())); 209 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates()));
206 } 210 }
207 211
208 } // namespace blink 212 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698