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

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

Issue 673753004: Move RenderSVGResource into the inheritance hierarchy (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Non-move changes. Created 6 years, 2 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 #ifndef RenderSVGResourceContainer_h 20 #ifndef RenderSVGResourceContainer_h
21 #define RenderSVGResourceContainer_h 21 #define RenderSVGResourceContainer_h
22 22
23 #include "core/rendering/svg/RenderSVGHiddenContainer.h" 23 #include "core/rendering/svg/RenderSVGHiddenContainer.h"
24 #include "core/rendering/svg/RenderSVGResource.h"
25 #include "core/svg/SVGDocumentExtensions.h" 24 #include "core/svg/SVGDocumentExtensions.h"
26 25
27 namespace blink { 26 namespace blink {
28 27
29 enum RenderSVGResourceType { 28 enum RenderSVGResourceType {
30 MaskerResourceType, 29 MaskerResourceType,
31 MarkerResourceType, 30 MarkerResourceType,
32 PatternResourceType, 31 PatternResourceType,
33 LinearGradientResourceType, 32 LinearGradientResourceType,
34 RadialGradientResourceType, 33 RadialGradientResourceType,
35 FilterResourceType, 34 FilterResourceType,
36 ClipperResourceType 35 ClipperResourceType
37 }; 36 };
38 37
39 class RenderLayer; 38 class RenderLayer;
40 39
41 class RenderSVGResourceContainer : public RenderSVGHiddenContainer, 40 class RenderSVGResourceContainer : public RenderSVGHiddenContainer {
42 public RenderSVGResource {
43 public: 41 public:
44 explicit RenderSVGResourceContainer(SVGElement*); 42 explicit RenderSVGResourceContainer(SVGElement*);
45 virtual ~RenderSVGResourceContainer(); 43 virtual ~RenderSVGResourceContainer();
46 44
47 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0; 45 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0;
48 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) = 0; 46 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) = 0;
49 47
50 virtual void layout() override; 48 virtual void layout() override;
51 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov erride final; 49 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov erride final;
52 virtual bool isOfType(RenderObjectType type) const override { return type == RenderObjectSVGResourceContainer || RenderSVGHiddenContainer::isOfType(type); } 50 virtual bool isOfType(RenderObjectType type) const override { return type == RenderObjectSVGResourceContainer || RenderSVGHiddenContainer::isOfType(type); }
53 51
54 virtual RenderSVGResourceType resourceType() const = 0; 52 virtual RenderSVGResourceType resourceType() const = 0;
55 53
54 bool isSVGPaintServer() const
55 {
56 RenderSVGResourceType resourceType = this->resourceType();
57 return resourceType == PatternResourceType
58 || resourceType == LinearGradientResourceType
59 || resourceType == RadialGradientResourceType;
60 }
61
56 void idChanged(); 62 void idChanged();
57 void addClientRenderLayer(Node*); 63 void addClientRenderLayer(Node*);
58 void addClientRenderLayer(RenderLayer*); 64 void addClientRenderLayer(RenderLayer*);
59 void removeClientRenderLayer(RenderLayer*); 65 void removeClientRenderLayer(RenderLayer*);
60 66
61 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = 0); 67 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = 0);
62 68
63 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n eedsLayout = true); 69 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n eedsLayout = true);
64 70
65 protected: 71 protected:
(...skipping 19 matching lines...) Expand all
85 void addClient(RenderObject*); 91 void addClient(RenderObject*);
86 void removeClient(RenderObject*); 92 void removeClient(RenderObject*);
87 93
88 virtual void willBeDestroyed() override final; 94 virtual void willBeDestroyed() override final;
89 void registerResource(); 95 void registerResource();
90 96
91 AtomicString m_id; 97 AtomicString m_id;
92 // Track global (markAllClientsForInvalidation) invals to avoid redundant cr awls. 98 // Track global (markAllClientsForInvalidation) invals to avoid redundant cr awls.
93 unsigned m_invalidationMask : 8; 99 unsigned m_invalidationMask : 8;
94 100
95 bool m_registered : 1; 101 unsigned m_registered : 1;
96 bool m_isInvalidating : 1; 102 unsigned m_isInvalidating : 1;
97 // 22 padding bits available 103 // 22 padding bits available
98 104
99 HashSet<RenderObject*> m_clients; 105 HashSet<RenderObject*> m_clients;
100 HashSet<RenderLayer*> m_clientLayers; 106 HashSet<RenderLayer*> m_clientLayers;
101 }; 107 };
102 108
103 inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(TreeScope& treeScope, const AtomicString& id) 109 inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(TreeScope& treeScope, const AtomicString& id)
104 { 110 {
105 if (id.isEmpty()) 111 if (id.isEmpty())
106 return 0; 112 return 0;
(...skipping 15 matching lines...) Expand all
122 } 128 }
123 129
124 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContain er()); 130 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContain er());
125 131
126 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ 132 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \
127 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)
128 134
129 } 135 }
130 136
131 #endif 137 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResource.cpp ('k') | Source/core/rendering/svg/RenderSVGResourceGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698