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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.h

Issue 2772773005: Make resource lookup more uniform in SVGResources::buildResources (Closed)
Patch Set: Created 3 years, 9 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
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 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/SVGTreeScopeResources.h"
25 24
26 namespace blink { 25 namespace blink {
27 26
28 class SVGElementProxySet; 27 class SVGElementProxySet;
29 28
30 enum LayoutSVGResourceType { 29 enum LayoutSVGResourceType {
31 MaskerResourceType, 30 MaskerResourceType,
32 MarkerResourceType, 31 MarkerResourceType,
33 PatternResourceType, 32 PatternResourceType,
34 LinearGradientResourceType, 33 LinearGradientResourceType,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // crawls. 108 // crawls.
110 unsigned m_invalidationMask : 8; 109 unsigned m_invalidationMask : 8;
111 110
112 unsigned m_registered : 1; 111 unsigned m_registered : 1;
113 unsigned m_isInvalidating : 1; 112 unsigned m_isInvalidating : 1;
114 // 22 padding bits available 113 // 22 padding bits available
115 114
116 HashSet<LayoutObject*> m_clients; 115 HashSet<LayoutObject*> m_clients;
117 }; 116 };
118 117
119 template <typename Layout>
120 Layout* getLayoutSVGResourceById(SVGTreeScopeResources& treeScopeResources,
121 const AtomicString& id) {
122 if (LayoutSVGResourceContainer* container =
123 treeScopeResources.resourceById(id)) {
124 if (container->resourceType() == Layout::s_resourceType)
125 return static_cast<Layout*>(container);
126 }
127 return nullptr;
128 }
129
130 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceContainer, 118 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceContainer,
131 isSVGResourceContainer()); 119 isSVGResourceContainer());
132 120
133 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ 121 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \
134 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \ 122 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \
135 resource->resourceType() == typeName, \ 123 resource->resourceType() == typeName, \
136 resource.resourceType() == typeName) 124 resource.resourceType() == typeName)
137 125
138 } // namespace blink 126 } // namespace blink
139 127
140 #endif 128 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698