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

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: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 updateBoundingBox(); 82 updateBoundingBox();
83 83
84 bool transformOrBoundariesUpdate = m_needsTransformUpdate || m_needsBoundari esUpdate; 84 bool updateParentBoundaries = false;
85 if (m_needsTransformUpdate) { 85 if (m_needsTransformUpdate) {
86 m_localTransform = toSVGImageElement(element())->calculateAnimatedLocalT ransform(); 86 m_localTransform = toSVGImageElement(element())->calculateAnimatedLocalT ransform();
87 m_needsTransformUpdate = false; 87 m_needsTransformUpdate = false;
88 } 88 updateParentBoundaries = true;
89
90 if (m_needsBoundariesUpdate) {
91 m_paintInvalidationBoundingBox = m_objectBoundingBox;
92 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_pa intInvalidationBoundingBox);
93
94 m_needsBoundariesUpdate = false;
95 } 89 }
96 90
97 // Invalidate all resources of this client if our layout changed. 91 // Invalidate all resources of this client if our layout changed.
pdr. 2016/04/22 22:33:33 It's a little confusing to have this in different
fs 2016/04/22 22:53:07 I hope we can... (This is pretty side-effecty - as
98 if (everHadLayout() && selfNeedsLayout()) 92 if (everHadLayout() && selfNeedsLayout())
99 SVGResourcesCache::clientLayoutChanged(this); 93 SVGResourcesCache::clientLayoutChanged(this);
100 94
95 if (m_needsBoundariesUpdate) {
96 m_paintInvalidationBoundingBox = m_objectBoundingBox;
97 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_pa intInvalidationBoundingBox);
98 m_needsBoundariesUpdate = false;
99 updateParentBoundaries = true;
100 }
101
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
105 clearNeedsLayout(); 106 clearNeedsLayout();
pdr. 2016/04/22 22:33:33 Possibly assert here (and in the other functions)
fs 2016/04/22 22:53:07 Yeah, that's probably a good idea.
106 } 107 }
107 108
108 void LayoutSVGImage::paint(const PaintInfo& paintInfo, const LayoutPoint&) const 109 void LayoutSVGImage::paint(const PaintInfo& paintInfo, const LayoutPoint&) const
109 { 110 {
110 SVGImagePainter(*this).paint(paintInfo); 111 SVGImagePainter(*this).paint(paintInfo);
111 } 112 }
112 113
113 bool LayoutSVGImage::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& p ointInParent, HitTestAction hitTestAction) 114 bool LayoutSVGImage::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& p ointInParent, HitTestAction hitTestAction)
114 { 115 {
115 // We only draw in the forground phase, so we only hit-test then. 116 // We only draw in the forground phase, so we only hit-test then.
(...skipping 30 matching lines...) Expand all
146 setShouldDoFullPaintInvalidation(); 147 setShouldDoFullPaintInvalidation();
147 } 148 }
148 149
149 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const 150 void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoin t&, IncludeBlockVisualOverflowOrNot) const
150 { 151 {
151 // this is called from paint() after the localTransform has already been app lied 152 // this is called from paint() after the localTransform has already been app lied
152 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates())); 153 rects.append(LayoutRect(paintInvalidationRectInLocalSVGCoordinates()));
153 } 154 }
154 155
155 } // namespace blink 156 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698