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

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

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
(...skipping 25 matching lines...) Expand all
36 }; 36 };
37 37
38 class Layer; 38 class Layer;
39 39
40 class RenderSVGResourceContainer : public RenderSVGHiddenContainer { 40 class RenderSVGResourceContainer : public RenderSVGHiddenContainer {
41 public: 41 public:
42 explicit RenderSVGResourceContainer(SVGElement*); 42 explicit RenderSVGResourceContainer(SVGElement*);
43 virtual ~RenderSVGResourceContainer(); 43 virtual ~RenderSVGResourceContainer();
44 44
45 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0; 45 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0;
46 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) = 0; 46 virtual void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) = 0;
47 47
48 virtual void layout() override; 48 virtual void layout() override;
49 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov erride final; 49 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov erride final;
50 virtual bool isOfType(RenderObjectType type) const override { return type == RenderObjectSVGResourceContainer || RenderSVGHiddenContainer::isOfType(type); } 50 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectSVGResourceContainer || RenderSVGHiddenContainer::isOfType(type); }
51 51
52 virtual RenderSVGResourceType resourceType() const = 0; 52 virtual RenderSVGResourceType resourceType() const = 0;
53 53
54 bool isSVGPaintServer() const 54 bool isSVGPaintServer() const
55 { 55 {
56 RenderSVGResourceType resourceType = this->resourceType(); 56 RenderSVGResourceType resourceType = this->resourceType();
57 return resourceType == PatternResourceType 57 return resourceType == PatternResourceType
58 || resourceType == LinearGradientResourceType 58 || resourceType == LinearGradientResourceType
59 || resourceType == RadialGradientResourceType; 59 || resourceType == RadialGradientResourceType;
60 } 60 }
61 61
62 void idChanged(); 62 void idChanged();
63 void addClientLayer(Node*); 63 void addClientLayer(Node*);
64 void addClientLayer(Layer*); 64 void addClientLayer(Layer*);
65 void removeClientLayer(Layer*); 65 void removeClientLayer(Layer*);
66 66
67 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = 0); 67 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = 0);
68 68
69 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n eedsLayout = true); 69 static void markForLayoutAndParentResourceInvalidation(LayoutObject*, bool n eedsLayout = true);
70 70
71 protected: 71 protected:
72 // When adding modes, make sure we don't overflow m_invalidationMask below. 72 // When adding modes, make sure we don't overflow m_invalidationMask below.
73 enum InvalidationMode { 73 enum InvalidationMode {
74 LayoutAndBoundariesInvalidation = 1 << 0, 74 LayoutAndBoundariesInvalidation = 1 << 0,
75 BoundariesInvalidation = 1 << 1, 75 BoundariesInvalidation = 1 << 1,
76 PaintInvalidation = 1 << 2, 76 PaintInvalidation = 1 << 2,
77 ParentOnlyInvalidation = 1 << 3 77 ParentOnlyInvalidation = 1 << 3
78 }; 78 };
79 79
80 // Used from the invalidateClient/invalidateClients methods from classes, in heriting from us. 80 // Used from the invalidateClient/invalidateClients methods from classes, in heriting from us.
81 void markAllClientsForInvalidation(InvalidationMode); 81 void markAllClientsForInvalidation(InvalidationMode);
82 void markAllClientLayersForInvalidation(); 82 void markAllClientLayersForInvalidation();
83 void markClientForInvalidation(RenderObject*, InvalidationMode); 83 void markClientForInvalidation(LayoutObject*, InvalidationMode);
84 84
85 void clearInvalidationMask() { m_invalidationMask = 0; } 85 void clearInvalidationMask() { m_invalidationMask = 0; }
86 86
87 bool m_isInLayout; 87 bool m_isInLayout;
88 88
89 private: 89 private:
90 friend class SVGResourcesCache; 90 friend class SVGResourcesCache;
91 void addClient(RenderObject*); 91 void addClient(LayoutObject*);
92 void removeClient(RenderObject*); 92 void removeClient(LayoutObject*);
93 93
94 virtual void willBeDestroyed() override final; 94 virtual void willBeDestroyed() override final;
95 void registerResource(); 95 void registerResource();
96 96
97 AtomicString m_id; 97 AtomicString m_id;
98 // Track global (markAllClientsForInvalidation) invals to avoid redundant cr awls. 98 // Track global (markAllClientsForInvalidation) invals to avoid redundant cr awls.
99 unsigned m_invalidationMask : 8; 99 unsigned m_invalidationMask : 8;
100 100
101 unsigned m_registered : 1; 101 unsigned m_registered : 1;
102 unsigned m_isInvalidating : 1; 102 unsigned m_isInvalidating : 1;
103 // 22 padding bits available 103 // 22 padding bits available
104 104
105 HashSet<RenderObject*> m_clients; 105 HashSet<LayoutObject*> m_clients;
106 HashSet<Layer*> m_clientLayers; 106 HashSet<Layer*> m_clientLayers;
107 }; 107 };
108 108
109 inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(TreeScope& treeScope, const AtomicString& id) 109 inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(TreeScope& treeScope, const AtomicString& id)
110 { 110 {
111 if (id.isEmpty()) 111 if (id.isEmpty())
112 return 0; 112 return 0;
113 113
114 if (RenderSVGResourceContainer* renderResource = treeScope.document().access SVGExtensions().resourceById(id)) 114 if (RenderSVGResourceContainer* renderResource = treeScope.document().access SVGExtensions().resourceById(id))
115 return renderResource; 115 return renderResource;
116 116
117 return 0; 117 return 0;
118 } 118 }
119 119
120 template<typename Renderer> 120 template<typename Renderer>
121 Renderer* getRenderSVGResourceById(TreeScope& treeScope, const AtomicString& id) 121 Renderer* getRenderSVGResourceById(TreeScope& treeScope, const AtomicString& id)
122 { 122 {
123 if (RenderSVGResourceContainer* container = getRenderSVGResourceContainerByI d(treeScope, id)) { 123 if (RenderSVGResourceContainer* container = getRenderSVGResourceContainerByI d(treeScope, id)) {
124 if (container->resourceType() == Renderer::s_resourceType) 124 if (container->resourceType() == Renderer::s_resourceType)
125 return static_cast<Renderer*>(container); 125 return static_cast<Renderer*>(container);
126 } 126 }
127 return 0; 127 return 0;
128 } 128 }
129 129
130 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContain er()); 130 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContain er());
131 131
132 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ 132 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \
133 DEFINE_TYPE_CASTS(thisType, RenderSVGResourceContainer, resource, resource-> resourceType() == typeName, resource.resourceType() == typeName) 133 DEFINE_TYPE_CASTS(thisType, RenderSVGResourceContainer, resource, resource-> resourceType() == typeName, resource.resourceType() == typeName)
134 134
135 } 135 }
136 136
137 #endif 137 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceClipper.cpp ('k') | Source/core/rendering/svg/RenderSVGResourceContainer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698