OLD | NEW |
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" | 24 #include "core/rendering/svg/RenderSVGResource.h" |
25 #include "core/svg/SVGDocumentExtensions.h" | 25 #include "core/svg/SVGDocumentExtensions.h" |
26 | 26 |
27 namespace blink { | 27 namespace blink { |
28 | 28 |
| 29 enum RenderSVGResourceType { |
| 30 MaskerResourceType, |
| 31 MarkerResourceType, |
| 32 PatternResourceType, |
| 33 LinearGradientResourceType, |
| 34 RadialGradientResourceType, |
| 35 FilterResourceType, |
| 36 ClipperResourceType |
| 37 }; |
| 38 |
29 class RenderLayer; | 39 class RenderLayer; |
30 | 40 |
31 class RenderSVGResourceContainer : public RenderSVGHiddenContainer, | 41 class RenderSVGResourceContainer : public RenderSVGHiddenContainer, |
32 public RenderSVGResource { | 42 public RenderSVGResource { |
33 public: | 43 public: |
34 explicit RenderSVGResourceContainer(SVGElement*); | 44 explicit RenderSVGResourceContainer(SVGElement*); |
35 virtual ~RenderSVGResourceContainer(); | 45 virtual ~RenderSVGResourceContainer(); |
36 | 46 |
37 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0; | 47 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0; |
38 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation =
true) = 0; | 48 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation =
true) = 0; |
39 | 49 |
40 virtual void layout() override; | 50 virtual void layout() override; |
41 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride final; | 51 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride final; |
42 virtual bool isOfType(RenderObjectType type) const override { return type ==
RenderObjectSVGResourceContainer || RenderSVGHiddenContainer::isOfType(type); } | 52 virtual bool isOfType(RenderObjectType type) const override { return type ==
RenderObjectSVGResourceContainer || RenderSVGHiddenContainer::isOfType(type); } |
43 | 53 |
| 54 virtual RenderSVGResourceType resourceType() const = 0; |
| 55 |
44 void idChanged(); | 56 void idChanged(); |
45 void addClientRenderLayer(Node*); | 57 void addClientRenderLayer(Node*); |
46 void addClientRenderLayer(RenderLayer*); | 58 void addClientRenderLayer(RenderLayer*); |
47 void removeClientRenderLayer(RenderLayer*); | 59 void removeClientRenderLayer(RenderLayer*); |
48 | 60 |
49 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = 0); | 61 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = 0); |
50 | 62 |
51 protected: | 63 protected: |
52 // When adding modes, make sure we don't overflow m_invalidationMask below. | 64 // When adding modes, make sure we don't overflow m_invalidationMask below. |
53 enum InvalidationMode { | 65 enum InvalidationMode { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 { | 114 { |
103 if (RenderSVGResourceContainer* container = getRenderSVGResourceContainerByI
d(treeScope, id)) { | 115 if (RenderSVGResourceContainer* container = getRenderSVGResourceContainerByI
d(treeScope, id)) { |
104 if (container->resourceType() == Renderer::s_resourceType) | 116 if (container->resourceType() == Renderer::s_resourceType) |
105 return static_cast<Renderer*>(container); | 117 return static_cast<Renderer*>(container); |
106 } | 118 } |
107 return 0; | 119 return 0; |
108 } | 120 } |
109 | 121 |
110 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContain
er()); | 122 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContain
er()); |
111 | 123 |
| 124 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ |
| 125 DEFINE_TYPE_CASTS(thisType, RenderSVGResourceContainer, resource, resource->
resourceType() == typeName, resource.resourceType() == typeName) |
| 126 |
112 } | 127 } |
113 | 128 |
114 #endif | 129 #endif |
OLD | NEW |