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

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

Issue 1907333002: Order bounds update correctly for LayoutSVGShape and LayoutSVGImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shuffle clientLayoutChanged instead. Created 4 years, 8 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLengthMo de::Width), 72 lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLengthMo de::Width),
73 lengthContext.valueForLength(styleRef().height(), styleRef(), SVGLengthM ode::Height)); 73 lengthContext.valueForLength(styleRef().height(), styleRef(), SVGLengthM ode::Height));
74 m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox; 74 m_needsBoundariesUpdate |= oldBoundaries != m_objectBoundingBox;
75 } 75 }
76 76
77 void LayoutSVGImage::layout() 77 void LayoutSVGImage::layout()
78 { 78 {
79 ASSERT(needsLayout()); 79 ASSERT(needsLayout());
80 LayoutAnalyzer::Scope analyzer(*this); 80 LayoutAnalyzer::Scope analyzer(*this);
81 81
82 // Invalidate all resources of this client if our layout changed.
83 if (everHadLayout() && selfNeedsLayout())
84 SVGResourcesCache::clientLayoutChanged(this);
85
82 updateBoundingBox(); 86 updateBoundingBox();
83 87
84 bool transformOrBoundariesUpdate = m_needsTransformUpdate || m_needsBoundari esUpdate; 88 bool updateParentBoundaries = false;
85 if (m_needsTransformUpdate) { 89 if (m_needsTransformUpdate) {
86 m_localTransform = toSVGImageElement(element())->calculateAnimatedLocalT ransform(); 90 m_localTransform = toSVGImageElement(element())->calculateAnimatedLocalT ransform();
87 m_needsTransformUpdate = false; 91 m_needsTransformUpdate = false;
92 updateParentBoundaries = true;
88 } 93 }
89 94
90 if (m_needsBoundariesUpdate) { 95 if (m_needsBoundariesUpdate) {
91 m_paintInvalidationBoundingBox = m_objectBoundingBox; 96 m_paintInvalidationBoundingBox = m_objectBoundingBox;
92 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_pa intInvalidationBoundingBox); 97 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_pa intInvalidationBoundingBox);
93
94 m_needsBoundariesUpdate = false; 98 m_needsBoundariesUpdate = false;
99 updateParentBoundaries = true;
95 } 100 }
96 101
97 // Invalidate all resources of this client if our layout changed.
98 if (everHadLayout() && selfNeedsLayout())
99 SVGResourcesCache::clientLayoutChanged(this);
100
101 // If our bounds changed, notify the parents. 102 // If our bounds changed, notify the parents.
102 if (transformOrBoundariesUpdate) 103 if (updateParentBoundaries)
103 LayoutSVGModelObject::setNeedsBoundariesUpdate(); 104 LayoutSVGModelObject::setNeedsBoundariesUpdate();
104 105
106 ASSERT(!m_needsBoundariesUpdate);
107 ASSERT(!m_needsTransformUpdate);
105 clearNeedsLayout(); 108 clearNeedsLayout();
106 } 109 }
107 110
108 void LayoutSVGImage::paint(const PaintInfo& paintInfo, const LayoutPoint&) const 111 void LayoutSVGImage::paint(const PaintInfo& paintInfo, const LayoutPoint&) const
109 { 112 {
110 SVGImagePainter(*this).paint(paintInfo); 113 SVGImagePainter(*this).paint(paintInfo);
111 } 114 }
112 115
113 bool LayoutSVGImage::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& p ointInParent, HitTestAction hitTestAction) 116 bool LayoutSVGImage::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& p ointInParent, HitTestAction hitTestAction)
114 { 117 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 setShouldDoFullPaintInvalidation(); 149 setShouldDoFullPaintInvalidation();
147 } 150 }
148 151
149 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const 152 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const
150 { 153 {
151 // this is called from paint() after the localTransform has already been app lied 154 // this is called from paint() after the localTransform has already been app lied
152 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates())); 155 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates()));
153 } 156 }
154 157
155 } // namespace blink 158 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698