Index: Source/core/html/FormAssociatedElement.cpp |
diff --git a/Source/core/html/FormAssociatedElement.cpp b/Source/core/html/FormAssociatedElement.cpp |
index b1de0fc340b79633827c8d849734a7ede886a543..5b45b8bf06bb7f9d75b7d3eaf0bad9b69397dc06 100644 |
--- a/Source/core/html/FormAssociatedElement.cpp |
+++ b/Source/core/html/FormAssociatedElement.cpp |
@@ -135,7 +135,7 @@ void FormAssociatedElement::setForm(HTMLFormElement* newForm) |
m_form->removeFormElement(this); |
m_form = newForm; |
if (m_form) |
- m_form->registerFormElement(this); |
+ m_form->registerFormElement(*this); |
didChangeForm(); |
} |
@@ -274,19 +274,30 @@ bool FormAssociatedElement::isFormControlElementWithState() const |
return false; |
} |
-const HTMLElement* toHTMLElement(const FormAssociatedElement* associatedElement) |
+const HTMLElement& toHTMLElement(const FormAssociatedElement& associatedElement) |
{ |
- if (associatedElement->isFormControlElement()) |
+ if (associatedElement.isFormControlElement()) |
return toHTMLFormControlElement(associatedElement); |
// Assumes the element is an HTMLObjectElement |
return toHTMLObjectElement(associatedElement); |
} |
+const HTMLElement* toHTMLElement(const FormAssociatedElement* associatedElement) |
+{ |
+ ASSERT(associatedElement); |
+ return &toHTMLElement(*associatedElement); |
+} |
+ |
HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement) |
{ |
return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociatedElement*>(associatedElement))); |
} |
+HTMLElement& toHTMLElement(FormAssociatedElement& associatedElement) |
+{ |
+ return const_cast<HTMLElement&>(toHTMLElement(static_cast<const FormAssociatedElement&>(associatedElement))); |
+} |
+ |
PassOwnPtr<FormAttributeTargetObserver> FormAttributeTargetObserver::create(const AtomicString& id, FormAssociatedElement* element) |
{ |
return adoptPtr(new FormAttributeTargetObserver(id, element)); |