summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/Element.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-23 17:03:15 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-23 17:03:15 +0200
commita73d1c176f2f3e0458861de8590dc20321a501ae (patch)
treed897fc5974797c3cb300d7f5916f258df765401f /Source/WebCore/dom/Element.cpp
parentc311cf639cc1d6570d67b0a80a8ba04dc992a658 (diff)
downloadqtwebkit-a73d1c176f2f3e0458861de8590dc20321a501ae.tar.gz
Imported WebKit commit a5ae8a56a48e44ebfb9b81aaa5488affaffdb175 (http://svn.webkit.org/repository/webkit/trunk@126420)
New snapshot with OS X 10.6 build fix
Diffstat (limited to 'Source/WebCore/dom/Element.cpp')
-rw-r--r--Source/WebCore/dom/Element.cpp30
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