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

Side by Side Diff: Source/core/svg/SVGForeignObjectElement.cpp

Issue 23956012: Stop passing NodeRenderingContext except in textRendererIsNeeded (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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
« no previous file with comments | « Source/core/svg/SVGForeignObjectElement.h ('k') | Source/core/svg/SVGGElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 #include "core/svg/SVGForeignObjectElement.h" 22 #include "core/svg/SVGForeignObjectElement.h"
23 23
24 #include "SVGNames.h" 24 #include "SVGNames.h"
25 #include "XLinkNames.h" 25 #include "XLinkNames.h"
26 #include "core/dom/NodeRenderingContext.h"
27 #include "core/rendering/svg/RenderSVGForeignObject.h" 26 #include "core/rendering/svg/RenderSVGForeignObject.h"
28 #include "core/rendering/svg/RenderSVGResource.h" 27 #include "core/rendering/svg/RenderSVGResource.h"
29 #include "core/svg/SVGElementInstance.h" 28 #include "core/svg/SVGElementInstance.h"
30 #include "core/svg/SVGLength.h" 29 #include "core/svg/SVGLength.h"
31 #include "wtf/Assertions.h" 30 #include "wtf/Assertions.h"
32 31
33 namespace WebCore { 32 namespace WebCore {
34 33
35 // Animated property definitions 34 // Animated property definitions
36 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x) 35 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 119
121 if (RenderObject* renderer = this->renderer()) 120 if (RenderObject* renderer = this->renderer())
122 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 121 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
123 } 122 }
124 123
125 RenderObject* SVGForeignObjectElement::createRenderer(RenderStyle*) 124 RenderObject* SVGForeignObjectElement::createRenderer(RenderStyle*)
126 { 125 {
127 return new RenderSVGForeignObject(this); 126 return new RenderSVGForeignObject(this);
128 } 127 }
129 128
130 bool SVGForeignObjectElement::childShouldCreateRenderer(const NodeRenderingConte xt& childContext) const 129 bool SVGForeignObjectElement::childShouldCreateRenderer(const Node& child) const
131 { 130 {
132 // Disallow arbitary SVG content. Only allow proper <svg xmlns="svgNS"> subd ocuments. 131 // Disallow arbitary SVG content. Only allow proper <svg xmlns="svgNS"> subd ocuments.
133 if (childContext.node()->isSVGElement()) 132 if (child.isSVGElement())
134 return childContext.node()->hasTagName(SVGNames::svgTag); 133 return child.hasTagName(SVGNames::svgTag);
135 134
136 // Skip over SVG rules which disallow non-SVG kids 135 // Skip over SVG rules which disallow non-SVG kids
137 return Element::childShouldCreateRenderer(childContext); 136 return Element::childShouldCreateRenderer(child);
138 } 137 }
139 138
140 bool SVGForeignObjectElement::rendererIsNeeded(const NodeRenderingContext& conte xt) 139 bool SVGForeignObjectElement::rendererIsNeeded(const RenderStyle& style)
141 { 140 {
142 // Suppress foreignObject renderers in SVG hidden containers. 141 // Suppress foreignObject renderers in SVG hidden containers.
143 // (https://bugs.webkit.org/show_bug.cgi?id=87297) 142 // (https://bugs.webkit.org/show_bug.cgi?id=87297)
144 // Note that we currently do not support foreignObject instantiation via <us e>, hence it is safe 143 // Note that we currently do not support foreignObject instantiation via <us e>, hence it is safe
145 // to use parentElement() here. If that changes, this method should be updat ed to use 144 // to use parentElement() here. If that changes, this method should be updat ed to use
146 // parentOrShadowHostElement() instead. 145 // parentOrShadowHostElement() instead.
147 Element* ancestor = parentElement(); 146 Element* ancestor = parentElement();
148 while (ancestor && ancestor->isSVGElement()) { 147 while (ancestor && ancestor->isSVGElement()) {
149 if (ancestor->renderer() && ancestor->renderer()->isSVGHiddenContainer() ) 148 if (ancestor->renderer() && ancestor->renderer()->isSVGHiddenContainer() )
150 return false; 149 return false;
151 150
152 ancestor = ancestor->parentElement(); 151 ancestor = ancestor->parentElement();
153 } 152 }
154 153
155 return SVGGraphicsElement::rendererIsNeeded(context); 154 return SVGGraphicsElement::rendererIsNeeded(style);
156 } 155 }
157 156
158 bool SVGForeignObjectElement::selfHasRelativeLengths() const 157 bool SVGForeignObjectElement::selfHasRelativeLengths() const
159 { 158 {
160 return xCurrentValue().isRelative() 159 return xCurrentValue().isRelative()
161 || yCurrentValue().isRelative() 160 || yCurrentValue().isRelative()
162 || widthCurrentValue().isRelative() 161 || widthCurrentValue().isRelative()
163 || heightCurrentValue().isRelative(); 162 || heightCurrentValue().isRelative();
164 } 163 }
165 164
166 } 165 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGForeignObjectElement.h ('k') | Source/core/svg/SVGGElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698