OLD | NEW |
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 "core/XLinkNames.h" | 24 #include "core/XLinkNames.h" |
25 #include "core/frame/UseCounter.h" | 25 #include "core/frame/UseCounter.h" |
26 #include "core/rendering/svg/RenderSVGForeignObject.h" | 26 #include "core/layout/svg/LayoutSVGForeignObject.h" |
27 #include "core/svg/SVGLength.h" | 27 #include "core/svg/SVGLength.h" |
28 #include "wtf/Assertions.h" | 28 #include "wtf/Assertions.h" |
29 | 29 |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) | 32 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) |
33 : SVGGraphicsElement(SVGNames::foreignObjectTag, document) | 33 : SVGGraphicsElement(SVGNames::foreignObjectTag, document) |
34 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth), AllowNegativeLengths)) | 34 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth), AllowNegativeLengths)) |
35 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight), AllowNegativeLengths)) | 35 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight), AllowNegativeLengths)) |
36 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth), ForbidNegativeLengths)) | 36 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth), ForbidNegativeLengths)) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 if (isLengthAttribute) { | 118 if (isLengthAttribute) { |
119 updateRelativeLengthsInformation(); | 119 updateRelativeLengthsInformation(); |
120 if (LayoutObject* renderer = this->renderer()) | 120 if (LayoutObject* renderer = this->renderer()) |
121 markForLayoutAndParentResourceInvalidation(renderer); | 121 markForLayoutAndParentResourceInvalidation(renderer); |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 LayoutObject* SVGForeignObjectElement::createRenderer(const LayoutStyle&) | 125 LayoutObject* SVGForeignObjectElement::createRenderer(const LayoutStyle&) |
126 { | 126 { |
127 return new RenderSVGForeignObject(this); | 127 return new LayoutSVGForeignObject(this); |
128 } | 128 } |
129 | 129 |
130 bool SVGForeignObjectElement::rendererIsNeeded(const LayoutStyle& style) | 130 bool SVGForeignObjectElement::rendererIsNeeded(const LayoutStyle& style) |
131 { | 131 { |
132 // Suppress foreignObject renderers in SVG hidden containers. | 132 // Suppress foreignObject renderers in SVG hidden containers. |
133 // (https://bugs.webkit.org/show_bug.cgi?id=87297) | 133 // (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 | 134 // 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 | 135 // to use parentElement() here. If that changes, this method should be updat
ed to use |
136 // parentOrShadowHostElement() instead. | 136 // parentOrShadowHostElement() instead. |
137 Element* ancestor = parentElement(); | 137 Element* ancestor = parentElement(); |
138 while (ancestor && ancestor->isSVGElement()) { | 138 while (ancestor && ancestor->isSVGElement()) { |
139 if (ancestor->renderer() && ancestor->renderer()->isSVGHiddenContainer()
) | 139 if (ancestor->renderer() && ancestor->renderer()->isSVGHiddenContainer()
) |
140 return false; | 140 return false; |
141 | 141 |
142 ancestor = ancestor->parentElement(); | 142 ancestor = ancestor->parentElement(); |
143 } | 143 } |
144 | 144 |
145 return SVGGraphicsElement::rendererIsNeeded(style); | 145 return SVGGraphicsElement::rendererIsNeeded(style); |
146 } | 146 } |
147 | 147 |
148 bool SVGForeignObjectElement::selfHasRelativeLengths() const | 148 bool SVGForeignObjectElement::selfHasRelativeLengths() const |
149 { | 149 { |
150 return m_x->currentValue()->isRelative() | 150 return m_x->currentValue()->isRelative() |
151 || m_y->currentValue()->isRelative() | 151 || m_y->currentValue()->isRelative() |
152 || m_width->currentValue()->isRelative() | 152 || m_width->currentValue()->isRelative() |
153 || m_height->currentValue()->isRelative(); | 153 || m_height->currentValue()->isRelative(); |
154 } | 154 } |
155 | 155 |
156 } // namespace blink | 156 } // namespace blink |
OLD | NEW |