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

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

Issue 133873003: Convert SVG <foreignObject> to use RenderObject::isChildAllowed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reupload. Created 6 years, 11 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
« no previous file with comments | « Source/core/svg/SVGForeignObjectElement.h ('k') | no next file » | 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,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 if (RenderObject* renderer = this->renderer()) 112 if (RenderObject* renderer = this->renderer())
113 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 113 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
114 } 114 }
115 115
116 RenderObject* SVGForeignObjectElement::createRenderer(RenderStyle*) 116 RenderObject* SVGForeignObjectElement::createRenderer(RenderStyle*)
117 { 117 {
118 return new RenderSVGForeignObject(this); 118 return new RenderSVGForeignObject(this);
119 } 119 }
120 120
121 bool SVGForeignObjectElement::childShouldCreateRenderer(const Node& child) const
122 {
123 // Disallow arbitary SVG content. Only allow proper <svg xmlns="svgNS"> subd ocuments.
124 if (child.isSVGElement())
125 return child.hasTagName(SVGNames::svgTag);
126 // Skip over SVG rules which disallow non-SVG kids
127 return true;
128 }
129
130 bool SVGForeignObjectElement::rendererIsNeeded(const RenderStyle& style) 121 bool SVGForeignObjectElement::rendererIsNeeded(const RenderStyle& style)
131 { 122 {
132 // Suppress foreignObject renderers in SVG hidden containers. 123 // Suppress foreignObject renderers in SVG hidden containers.
133 // (https://bugs.webkit.org/show_bug.cgi?id=87297) 124 // (https://bugs.webkit.org/show_bug.cgi?id=87297)
134 // Note that we currently do not support foreignObject instantiation via <us e>, hence it is safe 125 // Note that we currently do not support foreignObject instantiation via <us e>, hence it is safe
135 // to use parentElement() here. If that changes, this method should be updat ed to use 126 // to use parentElement() here. If that changes, this method should be updat ed to use
136 // parentOrShadowHostElement() instead. 127 // parentOrShadowHostElement() instead.
137 Element* ancestor = parentElement(); 128 Element* ancestor = parentElement();
138 while (ancestor && ancestor->isSVGElement()) { 129 while (ancestor && ancestor->isSVGElement()) {
139 if (ancestor->renderer() && ancestor->renderer()->isSVGHiddenContainer() ) 130 if (ancestor->renderer() && ancestor->renderer()->isSVGHiddenContainer() )
140 return false; 131 return false;
141 132
142 ancestor = ancestor->parentElement(); 133 ancestor = ancestor->parentElement();
143 } 134 }
144 135
145 return SVGGraphicsElement::rendererIsNeeded(style); 136 return SVGGraphicsElement::rendererIsNeeded(style);
146 } 137 }
147 138
148 bool SVGForeignObjectElement::selfHasRelativeLengths() const 139 bool SVGForeignObjectElement::selfHasRelativeLengths() const
149 { 140 {
150 return m_x->currentValue()->isRelative() 141 return m_x->currentValue()->isRelative()
151 || m_y->currentValue()->isRelative() 142 || m_y->currentValue()->isRelative()
152 || m_width->currentValue()->isRelative() 143 || m_width->currentValue()->isRelative()
153 || m_height->currentValue()->isRelative(); 144 || m_height->currentValue()->isRelative();
154 } 145 }
155 146
156 } 147 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGForeignObjectElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698