diff options
Diffstat (limited to 'WebCore/dom/StyledElement.cpp')
-rw-r--r-- | WebCore/dom/StyledElement.cpp | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/WebCore/dom/StyledElement.cpp b/WebCore/dom/StyledElement.cpp index cd5f863..34a593c 100644 --- a/WebCore/dom/StyledElement.cpp +++ b/WebCore/dom/StyledElement.cpp @@ -24,12 +24,12 @@ #include "config.h" #include "StyledElement.h" +#include "Attribute.h" #include "CSSStyleSelector.h" #include "CSSStyleSheet.h" #include "CSSValueKeywords.h" #include "Document.h" #include "HTMLNames.h" -#include "MappedAttribute.h" #include <wtf/HashFunctions.h> using namespace std; @@ -118,7 +118,7 @@ StyledElement::~StyledElement() PassRefPtr<Attribute> StyledElement::createAttribute(const QualifiedName& name, const AtomicString& value) { - return MappedAttribute::create(name, value); + return Attribute::createMapped(name, value); } void StyledElement::createInlineStyleDecl() @@ -145,9 +145,8 @@ void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls) return; } - MappedAttribute* mappedAttr = static_cast<MappedAttribute*>(attr); - if (mappedAttr->decl() && !preserveDecls) { - mappedAttr->setDecl(0); + if (attr->decl() && !preserveDecls) { + attr->setDecl(0); setNeedsStyleRecalc(); if (namedAttrMap) mappedAttributes()->declRemoved(); @@ -157,17 +156,16 @@ void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls) MappedAttributeEntry entry; bool needToParse = mapToEntry(attr->name(), entry); if (preserveDecls) { - if (mappedAttr->decl()) { + if (attr->decl()) { setNeedsStyleRecalc(); if (namedAttrMap) mappedAttributes()->declAdded(); checkDecl = false; } - } - else if (!attr->isNull() && entry != eNone) { + } else if (!attr->isNull() && entry != eNone) { CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(entry, attr); if (decl) { - mappedAttr->setDecl(decl); + attr->setDecl(decl); setNeedsStyleRecalc(); if (namedAttrMap) mappedAttributes()->declAdded(); @@ -182,17 +180,17 @@ void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls) // If that changes for some reason moving between documents will be buggy. // webarchive/adopt-attribute-styled-node-webarchive.html should catch any resulting crashes. if (needToParse) - parseMappedAttribute(mappedAttr); + parseMappedAttribute(attr); if (entry == eNone) recalcStyleIfNeededAfterAttributeChanged(attr); - if (checkDecl && mappedAttr->decl()) { + if (checkDecl && attr->decl()) { // Add the decl to the table in the appropriate spot. - setMappedAttributeDecl(entry, attr, mappedAttr->decl()); - mappedAttr->decl()->setMappedState(entry, attr->name(), attr->value()); - mappedAttr->decl()->setParent(0); - mappedAttr->decl()->setNode(0); + setMappedAttributeDecl(entry, attr, attr->decl()); + attr->decl()->setMappedState(entry, attr->name(), attr->value()); + attr->decl()->setParent(0); + attr->decl()->setNode(0); if (namedAttrMap) mappedAttributes()->declAdded(); } @@ -227,7 +225,7 @@ void StyledElement::classAttributeChanged(const AtomicString& newClassString) dispatchSubtreeModifiedEvent(); } -void StyledElement::parseMappedAttribute(MappedAttribute *attr) +void StyledElement::parseMappedAttribute(Attribute* attr) { if (attr->name() == idAttributeName()) { // unique id @@ -253,11 +251,6 @@ void StyledElement::parseMappedAttribute(MappedAttribute *attr) } } -void StyledElement::createAttributeMap() const -{ - namedAttrMap = NamedMappedAttrMap::create(const_cast<StyledElement*>(this)); -} - CSSMutableStyleDeclaration* StyledElement::getInlineStyleDecl() { if (!m_inlineStyleDecl) @@ -270,25 +263,25 @@ CSSStyleDeclaration* StyledElement::style() return getInlineStyleDecl(); } -void StyledElement::addCSSProperty(MappedAttribute* attr, int id, const String &value) +void StyledElement::addCSSProperty(Attribute* attr, int id, const String &value) { if (!attr->decl()) createMappedDecl(attr); attr->decl()->setProperty(id, value, false); } -void StyledElement::addCSSProperty(MappedAttribute* attr, int id, int value) +void StyledElement::addCSSProperty(Attribute* attr, int id, int value) { if (!attr->decl()) createMappedDecl(attr); attr->decl()->setProperty(id, value, false); } -void StyledElement::addCSSImageProperty(MappedAttribute* attr, int id, const String& url) +void StyledElement::addCSSImageProperty(Attribute* attr, int id, const String& url) { if (!attr->decl()) createMappedDecl(attr); attr->decl()->setImageProperty(id, url, false); } -void StyledElement::addCSSLength(MappedAttribute* attr, int id, const String &value) +void StyledElement::addCSSLength(Attribute* attr, int id, const String &value) { // FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct // length unit and make the appropriate parsed value. @@ -325,7 +318,7 @@ void StyledElement::addCSSLength(MappedAttribute* attr, int id, const String &va } /* color parsing that tries to match as close as possible IE 6. */ -void StyledElement::addCSSColor(MappedAttribute* attr, int id, const String& c) +void StyledElement::addCSSColor(Attribute* attr, int id, const String& c) { // this is the only case no color gets applied in IE. if (!c.length()) @@ -397,7 +390,7 @@ void StyledElement::addCSSColor(MappedAttribute* attr, int id, const String& c) attr->decl()->setProperty(id, CSSValueBlack, false); } -void StyledElement::createMappedDecl(MappedAttribute* attr) +void StyledElement::createMappedDecl(Attribute* attr) { RefPtr<CSSMappedAttributeDeclaration> decl = CSSMappedAttributeDeclaration::create(); attr->setDecl(decl); |