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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 else if (name == SVGNames::widthAttr) | 75 else if (name == SVGNames::widthAttr) |
76 m_width->setBaseValueAsString(value, parseError); | 76 m_width->setBaseValueAsString(value, parseError); |
77 else if (name == SVGNames::heightAttr) | 77 else if (name == SVGNames::heightAttr) |
78 m_height->setBaseValueAsString(value, 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 bool SVGForeignObjectElement::isPresentationAttribute(const QualifiedName& name) const | |
86 { | |
87 if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) | |
88 return true; | |
89 return SVGGraphicsElement::isPresentationAttribute(name); | |
90 } | |
91 | |
92 void SVGForeignObjectElement::collectStyleForPresentationAttribute(const Qualifi edName& name, const AtomicString& value, MutableStylePropertySet* style) | |
93 { | |
94 if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) { | |
95 RefPtr<SVGLength> length = SVGLength::create(LengthModeOther); | |
96 length->setValueAsString(value, IGNORE_EXCEPTION); | |
97 if (length->unitType() == LengthTypeNumber) | |
fs
2014/04/02 14:38:31
Won't the mode == SVGAttributeMode on the MutableS
davve
2014/04/02 18:23:27
True, it would still work without it. But we would
fs
2014/04/03 07:50:41
Ok. Maybe just add a comment to that effect then?
davve
2014/04/03 08:43:57
Leaning towards removing now. Enabling the present
| |
98 length->setUnitType(LengthTypePX); | |
99 if (length->unitType() != LengthTypeUnknown) { | |
100 if (name == SVGNames::widthAttr) | |
101 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, length->valueAsString()); | |
102 else if (name == SVGNames::heightAttr) | |
103 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight , length->valueAsString()); | |
104 } | |
105 } else { | |
106 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle); | |
107 } | |
108 } | |
109 | |
85 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) | 110 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) |
86 { | 111 { |
87 if (!isSupportedAttribute(attrName)) { | 112 if (!isSupportedAttribute(attrName)) { |
88 SVGGraphicsElement::svgAttributeChanged(attrName); | 113 SVGGraphicsElement::svgAttributeChanged(attrName); |
89 return; | 114 return; |
90 } | 115 } |
91 | 116 |
117 if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { | |
118 invalidateSVGPresentationAttributeStyle(); | |
119 setNeedsStyleRecalc(LocalStyleChange); | |
120 } | |
121 | |
92 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 122 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
93 | 123 |
94 bool isLengthAttribute = attrName == SVGNames::xAttr | 124 bool isLengthAttribute = attrName == SVGNames::xAttr |
95 || attrName == SVGNames::yAttr | 125 || attrName == SVGNames::yAttr |
96 || attrName == SVGNames::widthAttr | 126 || attrName == SVGNames::widthAttr |
97 || attrName == SVGNames::heightAttr; | 127 || attrName == SVGNames::heightAttr; |
98 | 128 |
99 if (isLengthAttribute) | 129 if (isLengthAttribute) |
100 updateRelativeLengthsInformation(); | 130 updateRelativeLengthsInformation(); |
101 | 131 |
(...skipping 26 matching lines...) Expand all Loading... | |
128 | 158 |
129 bool SVGForeignObjectElement::selfHasRelativeLengths() const | 159 bool SVGForeignObjectElement::selfHasRelativeLengths() const |
130 { | 160 { |
131 return m_x->currentValue()->isRelative() | 161 return m_x->currentValue()->isRelative() |
132 || m_y->currentValue()->isRelative() | 162 || m_y->currentValue()->isRelative() |
133 || m_width->currentValue()->isRelative() | 163 || m_width->currentValue()->isRelative() |
134 || m_height->currentValue()->isRelative(); | 164 || m_height->currentValue()->isRelative(); |
135 } | 165 } |
136 | 166 |
137 } | 167 } |
OLD | NEW |