summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLBodyElement.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/HTMLBodyElement.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/HTMLBodyElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLBodyElement.cpp64
1 files changed, 31 insertions, 33 deletions
diff --git a/Source/WebCore/html/HTMLBodyElement.cpp b/Source/WebCore/html/HTMLBodyElement.cpp
index 6558d46d6..a769a2c21 100644
--- a/Source/WebCore/html/HTMLBodyElement.cpp
+++ b/Source/WebCore/html/HTMLBodyElement.cpp
@@ -60,46 +60,43 @@ HTMLBodyElement::~HTMLBodyElement()
{
}
-bool HTMLBodyElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
-{
- if (attrName == backgroundAttr) {
- result = (MappedAttributeEntry)(eLastEntry + document()->docID());
- return false;
- }
-
- if (attrName == bgcolorAttr ||
- attrName == textAttr ||
- attrName == marginwidthAttr ||
- attrName == leftmarginAttr ||
- attrName == marginheightAttr ||
- attrName == topmarginAttr ||
- attrName == bgpropertiesAttr) {
- result = eUniversal;
- return false;
- }
-
- return HTMLElement::mapToEntry(attrName, result);
-}
-
-void HTMLBodyElement::parseMappedAttribute(Attribute* attr)
+void HTMLBodyElement::parseAttribute(Attribute* attr)
{
if (attr->name() == backgroundAttr) {
String url = stripLeadingAndTrailingHTMLSpaces(attr->value());
if (!url.isEmpty())
- addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string());
+ addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string());
+ else
+ removeCSSProperty(CSSPropertyBackgroundImage);
} else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) {
- addCSSLength(attr, CSSPropertyMarginRight, attr->value());
- addCSSLength(attr, CSSPropertyMarginLeft, attr->value());
+ if (attr->value().isNull())
+ removeCSSProperties(CSSPropertyMarginRight, CSSPropertyMarginLeft);
+ else {
+ addCSSLength(CSSPropertyMarginRight, attr->value());
+ addCSSLength(CSSPropertyMarginLeft, attr->value());
+ }
} else if (attr->name() == marginheightAttr || attr->name() == topmarginAttr) {
- addCSSLength(attr, CSSPropertyMarginBottom, attr->value());
- addCSSLength(attr, CSSPropertyMarginTop, attr->value());
+ if (attr->value().isNull())
+ removeCSSProperties(CSSPropertyMarginBottom, CSSPropertyMarginTop);
+ else {
+ addCSSLength(CSSPropertyMarginBottom, attr->value());
+ addCSSLength(CSSPropertyMarginTop, attr->value());
+ }
} else if (attr->name() == bgcolorAttr) {
- addCSSColor(attr, CSSPropertyBackgroundColor, attr->value());
+ if (attr->value().isNull())
+ removeCSSProperty(CSSPropertyBackgroundColor);
+ else
+ addCSSColor(CSSPropertyBackgroundColor, attr->value());
} else if (attr->name() == textAttr) {
- addCSSColor(attr, CSSPropertyColor, attr->value());
+ if (attr->value().isNull())
+ removeCSSProperty(CSSPropertyColor);
+ else
+ addCSSColor(CSSPropertyColor, attr->value());
} else if (attr->name() == bgpropertiesAttr) {
if (equalIgnoringCase(attr->value(), "fixed"))
- addCSSProperty(attr, CSSPropertyBackgroundAttachment, CSSValueFixed);
+ addCSSProperty(CSSPropertyBackgroundAttachment, CSSValueFixed);
+ else
+ removeCSSProperty(CSSPropertyBackgroundAttachment);
} else if (attr->name() == vlinkAttr ||
attr->name() == alinkAttr ||
attr->name() == linkAttr) {
@@ -159,13 +156,15 @@ void HTMLBodyElement::parseMappedAttribute(Attribute* attr)
else if (attr->name() == onofflineAttr)
document()->setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document()->frame(), attr));
else
- HTMLElement::parseMappedAttribute(attr);
+ HTMLElement::parseAttribute(attr);
}
void HTMLBodyElement::insertedIntoDocument()
{
HTMLElement::insertedIntoDocument();
+ ASSERT(document());
+
// FIXME: Perhaps this code should be in attach() instead of here.
Element* ownerElement = document()->ownerElement();
if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) {
@@ -183,8 +182,7 @@ void HTMLBodyElement::insertedIntoDocument()
if (FrameView* view = document()->view())
view->scheduleRelayout();
- if (document() && document()->page())
- document()->page()->updateViewportArguments();
+ document()->updateViewportArguments();
}
bool HTMLBodyElement::isURLAttribute(Attribute *attr) const