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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourceContainer.cpp

Issue 23785014: [SVG] Resources should be laid out in dependecy order. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Set #3 rebased. Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #include "config.h" 20 #include "config.h"
21 21
22 #include "core/rendering/svg/RenderSVGResourceContainer.h" 22 #include "core/rendering/svg/RenderSVGResourceContainer.h"
23 23
24 #include "core/rendering/RenderLayer.h" 24 #include "core/rendering/RenderLayer.h"
25 #include "core/rendering/RenderView.h" 25 #include "core/rendering/RenderView.h"
26 #include "core/rendering/svg/RenderSVGRoot.h"
27 #include "core/rendering/svg/SVGRenderingContext.h" 26 #include "core/rendering/svg/SVGRenderingContext.h"
28 #include "core/rendering/svg/SVGResourcesCache.h" 27 #include "core/rendering/svg/SVGResourcesCache.h"
29 #include "core/svg/SVGGraphicsElement.h" 28 #include "core/svg/SVGGraphicsElement.h"
30 29
30 #include "wtf/TemporaryChange.h"
31
31 namespace WebCore { 32 namespace WebCore {
32 33
33 static inline SVGDocumentExtensions* svgExtensionsFromElement(SVGElement* elemen t) 34 static inline SVGDocumentExtensions* svgExtensionsFromElement(SVGElement* elemen t)
34 { 35 {
35 ASSERT(element); 36 ASSERT(element);
36 return element->document().accessSVGExtensions(); 37 return element->document().accessSVGExtensions();
37 } 38 }
38 39
39 RenderSVGResourceContainer::RenderSVGResourceContainer(SVGElement* node) 40 RenderSVGResourceContainer::RenderSVGResourceContainer(SVGElement* node)
40 : RenderSVGHiddenContainer(node) 41 : RenderSVGHiddenContainer(node)
41 , m_id(node->getIdAttribute()) 42 , m_id(node->getIdAttribute())
42 , m_registered(false) 43 , m_registered(false)
43 , m_isInvalidating(false) 44 , m_isInvalidating(false)
45 , m_isInLayout(false)
44 { 46 {
45 } 47 }
46 48
47 RenderSVGResourceContainer::~RenderSVGResourceContainer() 49 RenderSVGResourceContainer::~RenderSVGResourceContainer()
48 { 50 {
49 if (m_registered) 51 if (m_registered)
50 svgExtensionsFromElement(element())->removeResource(m_id); 52 svgExtensionsFromElement(element())->removeResource(m_id);
51 } 53 }
52 54
53 void RenderSVGResourceContainer::layout() 55 void RenderSVGResourceContainer::layout()
54 { 56 {
57 if (!needsLayout() || m_isInLayout)
pdr. 2013/09/23 22:26:02 Should these be asserts?
f(malita) 2013/09/23 23:20:33 m_isInLayout is used for runtime layout cycle dete
58 return;
59
60 TemporaryChange<bool> inLayoutChange(m_isInLayout, true);
61
55 // Invalidate all resources if our layout changed. 62 // Invalidate all resources if our layout changed.
56 if (everHadLayout() && selfNeedsLayout()) 63 if (everHadLayout() && selfNeedsLayout())
57 RenderSVGRoot::addResourceForClientInvalidation(this); 64 removeAllClientsFromCache();
58 65
59 RenderSVGHiddenContainer::layout(); 66 RenderSVGHiddenContainer::layout();
60 } 67 }
61 68
62 void RenderSVGResourceContainer::willBeDestroyed() 69 void RenderSVGResourceContainer::willBeDestroyed()
63 { 70 {
64 SVGResourcesCache::resourceDestroyed(this); 71 SVGResourcesCache::resourceDestroyed(this);
65 RenderSVGHiddenContainer::willBeDestroyed(); 72 RenderSVGHiddenContainer::willBeDestroyed();
66 } 73 }
67 74
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (!object->isSVGShape()) 231 if (!object->isSVGShape())
225 return resourceTransform; 232 return resourceTransform;
226 233
227 SVGGraphicsElement* element = toSVGGraphicsElement(object->node()); 234 SVGGraphicsElement* element = toSVGGraphicsElement(object->node());
228 AffineTransform transform = element->getScreenCTM(SVGLocatable::DisallowStyl eUpdate); 235 AffineTransform transform = element->getScreenCTM(SVGLocatable::DisallowStyl eUpdate);
229 transform *= resourceTransform; 236 transform *= resourceTransform;
230 return transform; 237 return transform;
231 } 238 }
232 239
233 } 240 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698