summaryrefslogtreecommitdiffstats
path: root/WebCore/dom/Element.cpp
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-06-28 16:42:48 +0100
committerKristian Monsen <kristianm@google.com>2010-07-02 10:29:56 +0100
commit06ea8e899e48f1f2f396b70e63fae369f2f23232 (patch)
tree20c1428cd05c76f32394ab354ea35ed99acd86d8 /WebCore/dom/Element.cpp
parent72aad67af14193199e29cdd5c4ddc095a8b9a8a8 (diff)
downloadexternal_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.zip
external_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.tar.gz
external_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.tar.bz2
Merge WebKit at r61871: Initial merge by git.
Change-Id: I6cff43abca9cc4782e088a469ad4f03f166a65d5
Diffstat (limited to 'WebCore/dom/Element.cpp')
-rw-r--r--WebCore/dom/Element.cpp55
1 files changed, 45 insertions, 10 deletions
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index c1c798b..adbb720 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -4,7 +4,7 @@
* (C) 2001 Peter Kelly (pmk@post.com)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* (C) 2007 David Smith (catfish.man@gmail.com)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* (C) 2007 Eric Seidel (eric@webkit.org)
*
* This library is free software; you can redistribute it and/or
@@ -42,7 +42,6 @@
#include "FrameView.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
-#include "HTMLDocumentParser.h"
#include "InspectorController.h"
#include "NodeList.h"
#include "NodeRenderStyle.h"
@@ -52,7 +51,6 @@
#include "RenderWidget.h"
#include "TextIterator.h"
#include "XMLNames.h"
-#include "XMLDocumentParser.h"
#include <wtf/text/CString.h>
#if ENABLE(SVG)
@@ -93,12 +91,12 @@ NodeRareData* Element::createRareData()
PassRefPtr<DocumentFragment> Element::createContextualFragment(const String& markup, FragmentScriptingPermission scriptingPermission)
{
- RefPtr<DocumentFragment> fragment = DocumentFragment::create(document());
-
+ RefPtr<DocumentFragment> fragment = document()->createDocumentFragment();
+
if (document()->isHTMLDocument())
- parseHTMLDocumentFragment(markup, fragment.get(), scriptingPermission);
+ fragment->parseHTML(markup, scriptingPermission);
else {
- if (!parseXMLDocumentFragment(markup, fragment.get(), this, scriptingPermission))
+ if (!fragment->parseXML(markup, this, scriptingPermission))
// FIXME: We should propagate a syntax error exception out here.
return 0;
}
@@ -189,7 +187,7 @@ void Element::setCStringAttribute(const QualifiedName& name, const char* cString
void Element::setBooleanAttribute(const QualifiedName& name, bool b)
{
if (b)
- setAttribute(name, name.localName());
+ setAttribute(name, emptyAtom);
else {
ExceptionCode ex;
removeAttribute(name, ex);
@@ -639,6 +637,8 @@ void Element::updateAfterAttributeChanged(Attribute* attr)
document()->axObjectCache()->contentChanged(renderer());
} else if (attrName == aria_selectedAttr)
document()->axObjectCache()->selectedChildrenChanged(renderer());
+ else if (attrName == aria_expandedAttr)
+ document()->axObjectCache()->handleAriaExpandedChange(renderer());
}
void Element::recalcStyleIfNeededAfterAttributeChanged(Attribute* attr)
@@ -1098,7 +1098,7 @@ void Element::dispatchAttrRemovalEvent(Attribute*)
if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER))
return;
ExceptionCode ec = 0;
- dispatchEvent(new MutationEvent(DOMAttrModifiedEvent, true, false, attr, attr->value(),
+ dispatchEvent(MutationEvent::create(DOMAttrModifiedEvent, true, attr, attr->value(),
attr->value(), document()->attrName(attr->id()), MutationEvent::REMOVAL), ec);
#endif
}
@@ -1111,7 +1111,7 @@ void Element::dispatchAttrAdditionEvent(Attribute*)
if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER))
return;
ExceptionCode ec = 0;
- dispatchEvent(new MutationEvent(DOMAttrModifiedEvent, true, false, attr, attr->value(),
+ dispatchEvent(MutationEvent::create(DOMAttrModifiedEvent, true, attr, attr->value(),
attr->value(), document()->attrName(attr->id()), MutationEvent::ADDITION), ec);
#endif
}
@@ -1531,4 +1531,39 @@ KURL Element::getURLAttribute(const QualifiedName& name) const
return document()->completeURL(deprecatedParseURL(getAttribute(name)));
}
+int Element::getIntegralAttribute(const QualifiedName& attributeName) const
+{
+ return getAttribute(attributeName).string().toInt();
+}
+
+void Element::setIntegralAttribute(const QualifiedName& attributeName, int value)
+{
+ // FIXME: Need an AtomicString version of String::number.
+ ExceptionCode ec;
+ setAttribute(attributeName, String::number(value), ec);
+}
+
+unsigned Element::getUnsignedIntegralAttribute(const QualifiedName& attributeName) const
+{
+ return getAttribute(attributeName).string().toUInt();
+}
+
+void Element::setUnsignedIntegralAttribute(const QualifiedName& attributeName, unsigned value)
+{
+ // FIXME: Need an AtomicString version of String::number.
+ ExceptionCode ec;
+ setAttribute(attributeName, String::number(value), ec);
+}
+
+#if ENABLE(SVG)
+bool Element::childShouldCreateRenderer(Node* child) const
+{
+ // Only create renderers for SVG elements whose parents are SVG elements, or for proper <svg xmlns="svgNS"> subdocuments.
+ if (child->isSVGElement())
+ return child->hasTagName(SVGNames::svgTag) || isSVGElement();
+
+ return Node::childShouldCreateRenderer(child);
+}
+#endif
+
} // namespace WebCore