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/rendering/svg/RenderSVGForeignObject.h" | 25 #include "core/rendering/svg/RenderSVGForeignObject.h" |
26 #include "core/rendering/svg/RenderSVGResource.h" | 26 #include "core/rendering/svg/RenderSVGResource.h" |
27 #include "core/svg/SVGElementInstance.h" | 27 #include "core/svg/SVGElementInstance.h" |
28 #include "core/svg/SVGLength.h" | 28 #include "core/svg/SVGLength.h" |
29 #include "wtf/Assertions.h" | 29 #include "wtf/Assertions.h" |
30 | 30 |
31 namespace WebCore { | 31 namespace WebCore { |
32 | 32 |
33 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) | 33 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) |
34 : SVGGraphicsElement(SVGNames::foreignObjectTag, document) | 34 : SVGGraphicsElement(SVGNames::foreignObjectTag, document) |
35 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) | 35 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth), AllowNegativeLengths)) |
36 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) | 36 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight), AllowNegativeLengths)) |
37 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) | 37 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth), ForbidNegativeLengths)) |
38 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) | 38 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight), ForbidNegativeLengths)) |
39 { | 39 { |
40 ScriptWrappable::init(this); | 40 ScriptWrappable::init(this); |
41 | 41 |
42 addToPropertyMap(m_x); | 42 addToPropertyMap(m_x); |
43 addToPropertyMap(m_y); | 43 addToPropertyMap(m_y); |
44 addToPropertyMap(m_width); | 44 addToPropertyMap(m_width); |
45 addToPropertyMap(m_height); | 45 addToPropertyMap(m_height); |
46 } | 46 } |
47 | 47 |
48 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(Document& do
cument) | 48 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(Document& do
cument) |
(...skipping 13 matching lines...) Expand all Loading... |
62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
63 } | 63 } |
64 | 64 |
65 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
omicString& value) | 65 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
omicString& value) |
66 { | 66 { |
67 SVGParsingError parseError = NoError; | 67 SVGParsingError parseError = NoError; |
68 | 68 |
69 if (!isSupportedAttribute(name)) | 69 if (!isSupportedAttribute(name)) |
70 SVGGraphicsElement::parseAttribute(name, value); | 70 SVGGraphicsElement::parseAttribute(name, value); |
71 else if (name == SVGNames::xAttr) | 71 else if (name == SVGNames::xAttr) |
72 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 72 m_x->setBaseValueAsString(value, parseError); |
73 else if (name == SVGNames::yAttr) | 73 else if (name == SVGNames::yAttr) |
74 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 74 m_y->setBaseValueAsString(value, parseError); |
75 else if (name == SVGNames::widthAttr) | 75 else if (name == SVGNames::widthAttr) |
76 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 76 m_width->setBaseValueAsString(value, parseError); |
77 else if (name == SVGNames::heightAttr) | 77 else if (name == SVGNames::heightAttr) |
78 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; | 78 m_height->setBaseValueAsString(value, parseError); |
79 else | 79 else |
80 ASSERT_NOT_REACHED(); | 80 ASSERT_NOT_REACHED(); |
81 | 81 |
82 reportAttributeParsingError(parseError, name, value); | 82 reportAttributeParsingError(parseError, name, value); |
83 } | 83 } |
84 | 84 |
85 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) | 85 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) |
86 { | 86 { |
87 if (!isSupportedAttribute(attrName)) { | 87 if (!isSupportedAttribute(attrName)) { |
88 SVGGraphicsElement::svgAttributeChanged(attrName); | 88 SVGGraphicsElement::svgAttributeChanged(attrName); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 bool SVGForeignObjectElement::selfHasRelativeLengths() const | 129 bool SVGForeignObjectElement::selfHasRelativeLengths() const |
130 { | 130 { |
131 return m_x->currentValue()->isRelative() | 131 return m_x->currentValue()->isRelative() |
132 || m_y->currentValue()->isRelative() | 132 || m_y->currentValue()->isRelative() |
133 || m_width->currentValue()->isRelative() | 133 || m_width->currentValue()->isRelative() |
134 || m_height->currentValue()->isRelative(); | 134 || m_height->currentValue()->isRelative(); |
135 } | 135 } |
136 | 136 |
137 } | 137 } |
OLD | NEW |