summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/html/HTMLElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/html/HTMLElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLElement.cpp75
1 files changed, 57 insertions, 18 deletions
diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp
index af3115c..b7eca06 100644
--- a/Source/WebCore/html/HTMLElement.cpp
+++ b/Source/WebCore/html/HTMLElement.cpp
@@ -190,6 +190,10 @@ void HTMLElement::parseMappedAttribute(Attribute* attr)
setAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == onfocusoutAttr) {
setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, attr));
+ } else if (attr->name() == onformchangeAttr) {
+ setAttributeEventListener(eventNames().formchangeEvent, createAttributeEventListener(this, attr));
+ } else if (attr->name() == onforminputAttr) {
+ setAttributeEventListener(eventNames().forminputEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == onblurAttr) {
setAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == onkeydownAttr) {
@@ -685,19 +689,18 @@ bool HTMLElement::isContentRichlyEditable() const
String HTMLElement::contentEditable() const
{
- if (!renderer())
- return "false";
-
- switch (renderer()->style()->userModify()) {
- case READ_WRITE:
- return "true";
- case READ_ONLY:
- return "false";
- case READ_WRITE_PLAINTEXT_ONLY:
- return "plaintext-only";
- default:
- return "inherit";
- }
+ const AtomicString& value = fastGetAttribute(contenteditableAttr);
+
+ if (value.isNull())
+ return "inherit";
+ if (value.isEmpty() || equalIgnoringCase(value, "true"))
+ return "true";
+ if (equalIgnoringCase(value, "false"))
+ return "false";
+ if (equalIgnoringCase(value, "plaintext-only"))
+ return "plaintext-only";
+
+ return "inherit";
}
void HTMLElement::setContentEditable(Attribute* attr)
@@ -726,14 +729,16 @@ void HTMLElement::setContentEditable(Attribute* attr)
}
}
-void HTMLElement::setContentEditable(const String &enabled)
+void HTMLElement::setContentEditable(const String& enabled, ExceptionCode& ec)
{
- if (enabled == "inherit") {
- ExceptionCode ec;
+ if (equalIgnoringCase(enabled, "true"))
+ setAttribute(contenteditableAttr, "true", ec);
+ else if (equalIgnoringCase(enabled, "false"))
+ setAttribute(contenteditableAttr, "false", ec);
+ else if (equalIgnoringCase(enabled, "inherit"))
removeAttribute(contenteditableAttr, ec);
- }
else
- setAttribute(contenteditableAttr, enabled.isEmpty() ? "true" : enabled);
+ ec = SYNTAX_ERR;
}
bool HTMLElement::draggable() const
@@ -837,6 +842,40 @@ HTMLFormElement* HTMLElement::virtualForm() const
return findFormAncestor();
}
+HTMLFormElement* HTMLElement::shadowAncestorOwnerForm()
+{
+ Node* ancestorNode = shadowAncestorNode();
+ if (!ancestorNode)
+ return form();
+
+ if (!ancestorNode->isHTMLElement())
+ return 0;
+ HTMLElement* ancestorHTML = static_cast<HTMLElement*>(ancestorNode);
+ if (!ancestorHTML)
+ return 0;
+ return ancestorHTML->form();
+}
+
+void HTMLElement::dispatchChangeEvents()
+{
+ RefPtr<HTMLElement> protector(this);
+ RefPtr<HTMLFormElement> ownerForm(shadowAncestorOwnerForm());
+
+ Node::dispatchChangeEvents();
+ if (ownerForm)
+ ownerForm->dispatchFormChange();
+}
+
+void HTMLElement::dispatchInputEvents()
+{
+ RefPtr<HTMLElement> protector(this);
+ RefPtr<HTMLFormElement> ownerForm(shadowAncestorOwnerForm());
+
+ Node::dispatchInputEvents();
+ if (ownerForm)
+ ownerForm->dispatchFormInput();
+}
+
} // namespace WebCore
#ifndef NDEBUG