diff options
Diffstat (limited to 'Source/WebCore/dom/Element.cpp')
-rw-r--r-- | Source/WebCore/dom/Element.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 743e12278..04bc20b0b 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -696,6 +696,8 @@ inline void Element::setAttributeInternal(size_t index, const QualifiedName& nam void Element::attributeChanged(const Attribute& attribute) { + parseAttribute(attribute); + document()->incDOMTreeVersion(); if (isIdAttributeName(attribute.name())) { @@ -747,6 +749,34 @@ void Element::attributeChanged(const Attribute& attribute) document()->axObjectCache()->postNotification(this, AXObjectCache::AXInvalidStatusChanged, true); } +void Element::parseAttribute(const Attribute& attribute) +{ + if (attribute.name() == classAttr) + classAttributeChanged(attribute.value()); +} + +void Element::classAttributeChanged(const AtomicString& newClassString) +{ + const UChar* characters = newClassString.characters(); + unsigned length = newClassString.length(); + unsigned i; + for (i = 0; i < length; ++i) { + if (isNotHTMLSpace(characters[i])) + break; + } + bool hasClass = i < length; + if (hasClass) { + const bool shouldFoldCase = document()->inQuirksMode(); + ensureAttributeData()->setClass(newClassString, shouldFoldCase); + } else if (attributeData()) + mutableAttributeData()->clearClass(); + + if (DOMTokenList* classList = optionalClassList()) + static_cast<ClassList*>(classList)->reset(newClassString); + + setNeedsStyleRecalc(); +} + // Returns true is the given attribute is an event handler. // We consider an event handler any attribute that begins with "on". // It is a simple solution that has the advantage of not requiring any |