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, |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "core/layout/svg/LayoutSVGForeignObject.h" | 25 #include "core/layout/svg/LayoutSVGForeignObject.h" |
26 #include "core/svg/SVGLength.h" | 26 #include "core/svg/SVGLength.h" |
27 #include "wtf/Assertions.h" | 27 #include "wtf/Assertions.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
31 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) | 31 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) |
32 : SVGGraphicsElement(SVGNames::foreignObjectTag, document), | 32 : SVGGraphicsElement(SVGNames::foreignObjectTag, document), |
33 m_x(SVGAnimatedLength::create(this, | 33 m_x(SVGAnimatedLength::create(this, |
34 SVGNames::xAttr, | 34 SVGNames::xAttr, |
35 SVGLength::create(SVGLengthMode::Width))), | 35 SVGLength::create(SVGLengthMode::Width), |
| 36 CSSPropertyX)), |
36 m_y(SVGAnimatedLength::create(this, | 37 m_y(SVGAnimatedLength::create(this, |
37 SVGNames::yAttr, | 38 SVGNames::yAttr, |
38 SVGLength::create(SVGLengthMode::Height))), | 39 SVGLength::create(SVGLengthMode::Height), |
39 m_width( | 40 CSSPropertyY)), |
40 SVGAnimatedLength::create(this, | 41 m_width(SVGAnimatedLength::create(this, |
41 SVGNames::widthAttr, | 42 SVGNames::widthAttr, |
42 SVGLength::create(SVGLengthMode::Width))), | 43 SVGLength::create(SVGLengthMode::Width), |
| 44 CSSPropertyWidth)), |
43 m_height( | 45 m_height( |
44 SVGAnimatedLength::create(this, | 46 SVGAnimatedLength::create(this, |
45 SVGNames::heightAttr, | 47 SVGNames::heightAttr, |
46 SVGLength::create(SVGLengthMode::Height))) { | 48 SVGLength::create(SVGLengthMode::Height), |
| 49 CSSPropertyHeight)) { |
47 addToPropertyMap(m_x); | 50 addToPropertyMap(m_x); |
48 addToPropertyMap(m_y); | 51 addToPropertyMap(m_y); |
49 addToPropertyMap(m_width); | 52 addToPropertyMap(m_width); |
50 addToPropertyMap(m_height); | 53 addToPropertyMap(m_height); |
51 | 54 |
52 UseCounter::count(document, UseCounter::SVGForeignObjectElement); | 55 UseCounter::count(document, UseCounter::SVGForeignObjectElement); |
53 } | 56 } |
54 | 57 |
55 DEFINE_TRACE(SVGForeignObjectElement) { | 58 DEFINE_TRACE(SVGForeignObjectElement) { |
56 visitor->trace(m_x); | 59 visitor->trace(m_x); |
57 visitor->trace(m_y); | 60 visitor->trace(m_y); |
58 visitor->trace(m_width); | 61 visitor->trace(m_width); |
59 visitor->trace(m_height); | 62 visitor->trace(m_height); |
60 SVGGraphicsElement::trace(visitor); | 63 SVGGraphicsElement::trace(visitor); |
61 } | 64 } |
62 | 65 |
63 DEFINE_NODE_FACTORY(SVGForeignObjectElement) | 66 DEFINE_NODE_FACTORY(SVGForeignObjectElement) |
64 | 67 |
65 bool SVGForeignObjectElement::isPresentationAttribute( | |
66 const QualifiedName& name) const { | |
67 if (name == SVGNames::xAttr || name == SVGNames::yAttr || | |
68 name == SVGNames::widthAttr || name == SVGNames::heightAttr) | |
69 return true; | |
70 return SVGGraphicsElement::isPresentationAttribute(name); | |
71 } | |
72 | |
73 bool SVGForeignObjectElement::isPresentationAttributeWithSVGDOM( | |
74 const QualifiedName& attrName) const { | |
75 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || | |
76 attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) | |
77 return true; | |
78 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName); | |
79 } | |
80 | |
81 void SVGForeignObjectElement::collectStyleForPresentationAttribute( | 68 void SVGForeignObjectElement::collectStyleForPresentationAttribute( |
82 const QualifiedName& name, | 69 const QualifiedName& name, |
83 const AtomicString& value, | 70 const AtomicString& value, |
84 MutableStylePropertySet* style) { | 71 MutableStylePropertySet* style) { |
85 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); | 72 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); |
86 if (property == m_width) | 73 if (property == m_width) |
87 addPropertyToPresentationAttributeStyle( | 74 addPropertyToPresentationAttributeStyle( |
88 style, CSSPropertyWidth, | 75 style, CSSPropertyWidth, |
89 m_width->currentValue()->asCSSPrimitiveValue()); | 76 m_width->currentValue()->asCSSPrimitiveValue()); |
90 else if (property == m_height) | 77 else if (property == m_height) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 141 } |
155 | 142 |
156 bool SVGForeignObjectElement::selfHasRelativeLengths() const { | 143 bool SVGForeignObjectElement::selfHasRelativeLengths() const { |
157 return m_x->currentValue()->isRelative() || | 144 return m_x->currentValue()->isRelative() || |
158 m_y->currentValue()->isRelative() || | 145 m_y->currentValue()->isRelative() || |
159 m_width->currentValue()->isRelative() || | 146 m_width->currentValue()->isRelative() || |
160 m_height->currentValue()->isRelative(); | 147 m_height->currentValue()->isRelative(); |
161 } | 148 } |
162 | 149 |
163 } // namespace blink | 150 } // namespace blink |
OLD | NEW |