Title: [150683] trunk/Source/WebCore
- Revision
- 150683
- Author
- [email protected]
- Date
- 2013-05-25 02:08:38 -0700 (Sat, 25 May 2013)
Log Message
Document::formController() should return a reference.
<http://webkit.org/b/116758>
Reviewed by Antti Koivisto.
The formController() is created on demand, so return a reference instead.
* dom/Document.h:
* dom/Document.cpp:
(WebCore::Document::formController):
(WebCore::Document::setStateForNewFormElements):
* html/HTMLFormControlElementWithState.cpp:
(WebCore::HTMLFormControlElementWithState::HTMLFormControlElementWithState):
(WebCore::HTMLFormControlElementWithState::~HTMLFormControlElementWithState):
(WebCore::HTMLFormControlElementWithState::didMoveToNewDocument):
(WebCore::HTMLFormControlElementWithState::finishParsingChildren):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::~HTMLFormElement):
(WebCore::HTMLFormElement::finishParsingChildren):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::~HTMLInputElement):
(WebCore::HTMLInputElement::didMoveToNewDocument):
(WebCore::HTMLInputElement::checkedRadioButtons):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (150682 => 150683)
--- trunk/Source/WebCore/ChangeLog 2013-05-25 08:29:42 UTC (rev 150682)
+++ trunk/Source/WebCore/ChangeLog 2013-05-25 09:08:38 UTC (rev 150683)
@@ -1,3 +1,29 @@
+2013-05-25 Andreas Kling <[email protected]>
+
+ Document::formController() should return a reference.
+ <http://webkit.org/b/116758>
+
+ Reviewed by Antti Koivisto.
+
+ The formController() is created on demand, so return a reference instead.
+
+ * dom/Document.h:
+ * dom/Document.cpp:
+ (WebCore::Document::formController):
+ (WebCore::Document::setStateForNewFormElements):
+ * html/HTMLFormControlElementWithState.cpp:
+ (WebCore::HTMLFormControlElementWithState::HTMLFormControlElementWithState):
+ (WebCore::HTMLFormControlElementWithState::~HTMLFormControlElementWithState):
+ (WebCore::HTMLFormControlElementWithState::didMoveToNewDocument):
+ (WebCore::HTMLFormControlElementWithState::finishParsingChildren):
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::~HTMLFormElement):
+ (WebCore::HTMLFormElement::finishParsingChildren):
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::~HTMLInputElement):
+ (WebCore::HTMLInputElement::didMoveToNewDocument):
+ (WebCore::HTMLInputElement::checkedRadioButtons):
+
2013-05-25 Sergio Villar Senin <[email protected]>
Reducing CSS code duplication in declaration list error recovery
Modified: trunk/Source/WebCore/dom/Document.cpp (150682 => 150683)
--- trunk/Source/WebCore/dom/Document.cpp 2013-05-25 08:29:42 UTC (rev 150682)
+++ trunk/Source/WebCore/dom/Document.cpp 2013-05-25 09:08:38 UTC (rev 150683)
@@ -1644,11 +1644,11 @@
return DOCUMENT_NODE;
}
-FormController* Document::formController()
+FormController& Document::formController()
{
if (!m_formController)
m_formController = FormController::create();
- return m_formController.get();
+ return *m_formController;
}
Vector<String> Document::formElementsState() const
@@ -1662,7 +1662,7 @@
{
if (!stateVector.size() && !m_formController)
return;
- formController()->setStateForNewFormElements(stateVector);
+ formController().setStateForNewFormElements(stateVector);
}
FrameView* Document::view() const
Modified: trunk/Source/WebCore/dom/Document.h (150682 => 150683)
--- trunk/Source/WebCore/dom/Document.h 2013-05-25 08:29:42 UTC (rev 150682)
+++ trunk/Source/WebCore/dom/Document.h 2013-05-25 09:08:38 UTC (rev 150683)
@@ -491,8 +491,7 @@
void evaluateMediaQueryList();
- // Never returns 0.
- FormController* formController();
+ FormController& formController();
Vector<String> formElementsState() const;
void setStateForNewFormElements(const Vector<String>&);
Modified: trunk/Source/WebCore/html/HTMLFormControlElementWithState.cpp (150682 => 150683)
--- trunk/Source/WebCore/html/HTMLFormControlElementWithState.cpp 2013-05-25 08:29:42 UTC (rev 150682)
+++ trunk/Source/WebCore/html/HTMLFormControlElementWithState.cpp 2013-05-25 09:08:38 UTC (rev 150683)
@@ -37,19 +37,19 @@
HTMLFormControlElementWithState::HTMLFormControlElementWithState(const QualifiedName& tagName, Document* doc, HTMLFormElement* f)
: HTMLFormControlElement(tagName, doc, f)
{
- document()->formController()->registerFormElementWithState(this);
+ document()->formController().registerFormElementWithState(this);
}
HTMLFormControlElementWithState::~HTMLFormControlElementWithState()
{
- document()->formController()->unregisterFormElementWithState(this);
+ document()->formController().unregisterFormElementWithState(this);
}
void HTMLFormControlElementWithState::didMoveToNewDocument(Document* oldDocument)
{
if (oldDocument)
- oldDocument->formController()->unregisterFormElementWithState(this);
- document()->formController()->registerFormElementWithState(this);
+ oldDocument->formController().unregisterFormElementWithState(this);
+ document()->formController().registerFormElementWithState(this);
HTMLFormControlElement::didMoveToNewDocument(oldDocument);
}
@@ -84,7 +84,7 @@
void HTMLFormControlElementWithState::finishParsingChildren()
{
HTMLFormControlElement::finishParsingChildren();
- document()->formController()->restoreControlStateFor(*this);
+ document()->formController().restoreControlStateFor(*this);
}
bool HTMLFormControlElementWithState::isFormControlElementWithState() const
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (150682 => 150683)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2013-05-25 08:29:42 UTC (rev 150682)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2013-05-25 09:08:38 UTC (rev 150683)
@@ -87,7 +87,7 @@
HTMLFormElement::~HTMLFormElement()
{
- document()->formController()->willDeleteForm(this);
+ document()->formController().willDeleteForm(this);
if (!shouldAutocomplete())
document()->unregisterForPageCacheSuspensionCallbacks(this);
@@ -676,7 +676,7 @@
void HTMLFormElement::finishParsingChildren()
{
HTMLElement::finishParsingChildren();
- document()->formController()->restoreControlStateIn(*this);
+ document()->formController().restoreControlStateIn(*this);
}
void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& source)
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (150682 => 150683)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2013-05-25 08:29:42 UTC (rev 150682)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2013-05-25 09:08:38 UTC (rev 150683)
@@ -174,7 +174,7 @@
// setForm(0) may register this to a document-level radio button group.
// We should unregister it to avoid accessing a deleted object.
if (isRadioButton())
- document()->formController()->checkedRadioButtons().removeButton(this);
+ document()->formController().checkedRadioButtons().removeButton(this);
#if ENABLE(TOUCH_EVENTS)
if (m_hasTouchEventHandler)
document()->didRemoveEventTargetNode(this);
@@ -1536,7 +1536,7 @@
if (needsSuspensionCallback)
oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
if (isRadioButton())
- oldDocument->formController()->checkedRadioButtons().removeButton(this);
+ oldDocument->formController().checkedRadioButtons().removeButton(this);
#if ENABLE(TOUCH_EVENTS)
if (m_hasTouchEventHandler)
oldDocument->didRemoveEventTargetNode(this);
@@ -1850,7 +1850,7 @@
if (HTMLFormElement* formElement = form())
return &formElement->checkedRadioButtons();
if (inDocument())
- return &document()->formController()->checkedRadioButtons();
+ return &document()->formController().checkedRadioButtons();
return 0;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes