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 LayoutSVGResourceContainer_h | 20 #ifndef LayoutSVGResourceContainer_h |
21 #define LayoutSVGResourceContainer_h | 21 #define LayoutSVGResourceContainer_h |
22 | 22 |
23 #include "core/layout/svg/LayoutSVGHiddenContainer.h" | 23 #include "core/layout/svg/LayoutSVGHiddenContainer.h" |
24 #include "core/svg/SVGDocumentExtensions.h" | 24 #include "core/svg/SVGTreeScopeResources.h" |
25 | 25 |
26 namespace blink { | 26 namespace blink { |
27 | 27 |
28 class SVGElementProxySet; | 28 class SVGElementProxySet; |
29 | 29 |
30 enum LayoutSVGResourceType { | 30 enum LayoutSVGResourceType { |
31 MaskerResourceType, | 31 MaskerResourceType, |
32 MarkerResourceType, | 32 MarkerResourceType, |
33 PatternResourceType, | 33 PatternResourceType, |
34 LinearGradientResourceType, | 34 LinearGradientResourceType, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 HashSet<LayoutObject*> m_clients; | 113 HashSet<LayoutObject*> m_clients; |
114 }; | 114 }; |
115 | 115 |
116 inline LayoutSVGResourceContainer* getLayoutSVGResourceContainerById( | 116 inline LayoutSVGResourceContainer* getLayoutSVGResourceContainerById( |
117 TreeScope& treeScope, | 117 TreeScope& treeScope, |
118 const AtomicString& id) { | 118 const AtomicString& id) { |
119 if (id.isEmpty()) | 119 if (id.isEmpty()) |
120 return nullptr; | 120 return nullptr; |
121 | 121 |
122 if (LayoutSVGResourceContainer* layoutResource = | 122 if (LayoutSVGResourceContainer* layoutResource = |
123 treeScope.document().accessSVGExtensions().resourceById(id)) | 123 treeScope.ensureSVGTreeScopedResources().resourceById(id)) |
124 return layoutResource; | 124 return layoutResource; |
125 | 125 |
126 return nullptr; | 126 return nullptr; |
127 } | 127 } |
128 | 128 |
129 template <typename Layout> | 129 template <typename Layout> |
130 Layout* getLayoutSVGResourceById(TreeScope& treeScope, const AtomicString& id) { | 130 Layout* getLayoutSVGResourceById(TreeScope& treeScope, const AtomicString& id) { |
131 if (LayoutSVGResourceContainer* container = | 131 if (LayoutSVGResourceContainer* container = |
132 getLayoutSVGResourceContainerById(treeScope, id)) { | 132 getLayoutSVGResourceContainerById(treeScope, id)) { |
133 if (container->resourceType() == Layout::s_resourceType) | 133 if (container->resourceType() == Layout::s_resourceType) |
134 return static_cast<Layout*>(container); | 134 return static_cast<Layout*>(container); |
135 } | 135 } |
136 return nullptr; | 136 return nullptr; |
137 } | 137 } |
138 | 138 |
139 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceContainer, | 139 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceContainer, |
140 isSVGResourceContainer()); | 140 isSVGResourceContainer()); |
141 | 141 |
142 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ | 142 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ |
143 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \ | 143 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \ |
144 resource->resourceType() == typeName, \ | 144 resource->resourceType() == typeName, \ |
145 resource.resourceType() == typeName) | 145 resource.resourceType() == typeName) |
146 | 146 |
147 } // namespace blink | 147 } // namespace blink |
148 | 148 |
149 #endif | 149 #endif |
OLD | NEW |