Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: Source/core/html/FormAssociatedElement.cpp

Issue 67473002: Have ElementTraversal / NodeTraversal's next() methods take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/FormAssociatedElement.h ('k') | Source/core/html/HTMLCollection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « Source/core/html/FormAssociatedElement.h ('k') | Source/core/html/HTMLCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698