summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLImageElement.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-09 14:16:12 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-09 14:16:12 +0100
commit03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (patch)
tree52599cd0ab782b1768e23ad176f7618f98333cb6 /Source/WebCore/html/HTMLImageElement.cpp
parentcd44dc59cdfc39534aef4d417e9f3c412e3be139 (diff)
downloadqtwebkit-03e12282df9aa1e1fb05a8b90f1cfc2e08764cec.tar.gz
Imported WebKit commit e09a82039aa4273ab318b71122e92d8e5f233525 (http://svn.webkit.org/repository/webkit/trunk@107223)
Diffstat (limited to 'Source/WebCore/html/HTMLImageElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLImageElement.cpp54
1 files changed, 26 insertions, 28 deletions
diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp
index b5c513de7..6c22edc12 100644
--- a/Source/WebCore/html/HTMLImageElement.cpp
+++ b/Source/WebCore/html/HTMLImageElement.cpp
@@ -78,26 +78,7 @@ PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document*
return image.release();
}
-bool HTMLImageElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
-{
- if (attrName == widthAttr ||
- attrName == heightAttr ||
- attrName == vspaceAttr ||
- attrName == hspaceAttr ||
- attrName == valignAttr) {
- result = eUniversal;
- return false;
- }
-
- if (attrName == borderAttr || attrName == alignAttr) {
- result = eReplaced; // Shared with embed and iframe elements.
- return false;
- }
-
- return HTMLElement::mapToEntry(attrName, result);
-}
-
-void HTMLImageElement::parseMappedAttribute(Attribute* attr)
+void HTMLImageElement::parseAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
if (attrName == altAttr) {
@@ -106,22 +87,39 @@ void HTMLImageElement::parseMappedAttribute(Attribute* attr)
} else if (attrName == srcAttr)
m_imageLoader.updateFromElementIgnoringPreviousError();
else if (attrName == widthAttr)
- addCSSLength(attr, CSSPropertyWidth, attr->value());
+ if (attr->value().isNull())
+ removeCSSProperty(CSSPropertyWidth);
+ else
+ addCSSLength(CSSPropertyWidth, attr->value());
else if (attrName == heightAttr)
- addCSSLength(attr, CSSPropertyHeight, attr->value());
+ if (attr->value().isNull())
+ removeCSSProperty(CSSPropertyHeight);
+ else
+ addCSSLength(CSSPropertyHeight, attr->value());
else if (attrName == borderAttr) {
// border="noborder" -> border="0"
applyBorderAttribute(attr);
} else if (attrName == vspaceAttr) {
- addCSSLength(attr, CSSPropertyMarginTop, attr->value());
- addCSSLength(attr, CSSPropertyMarginBottom, attr->value());
+ if (attr->value().isNull())
+ removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom);
+ else {
+ addCSSLength(CSSPropertyMarginTop, attr->value());
+ addCSSLength(CSSPropertyMarginBottom, attr->value());
+ }
} else if (attrName == hspaceAttr) {
- addCSSLength(attr, CSSPropertyMarginLeft, attr->value());
- addCSSLength(attr, CSSPropertyMarginRight, attr->value());
+ if (attr->value().isNull())
+ removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight);
+ else {
+ addCSSLength(CSSPropertyMarginLeft, attr->value());
+ addCSSLength(CSSPropertyMarginRight, attr->value());
+ }
} else if (attrName == alignAttr)
addHTMLAlignment(attr);
else if (attrName == valignAttr)
- addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value());
+ if (attr->value().isNull())
+ removeCSSProperty(CSSPropertyVerticalAlign);
+ else
+ addCSSProperty(CSSPropertyVerticalAlign, attr->value());
else if (attrName == usemapAttr)
setIsLink(!attr->isNull());
else if (attrName == onabortAttr)
@@ -134,7 +132,7 @@ void HTMLImageElement::parseMappedAttribute(Attribute* attr)
if (!parseCompositeOperator(attr->value(), m_compositeOperator))
m_compositeOperator = CompositeSourceOver;
} else
- HTMLElement::parseMappedAttribute(attr);
+ HTMLElement::parseAttribute(attr);
}
String HTMLImageElement::altText() const