Changeset 150683 in webkit


Ignore:
Timestamp:
May 25, 2013 2:08:38 AM (11 years ago)
Author:
akling@apple.com
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):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150682 r150683  
     12013-05-25  Andreas Kling  <akling@apple.com>
     2
     3        Document::formController() should return a reference.
     4        <http://webkit.org/b/116758>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        The formController() is created on demand, so return a reference instead.
     9
     10        * dom/Document.h:
     11        * dom/Document.cpp:
     12        (WebCore::Document::formController):
     13        (WebCore::Document::setStateForNewFormElements):
     14        * html/HTMLFormControlElementWithState.cpp:
     15        (WebCore::HTMLFormControlElementWithState::HTMLFormControlElementWithState):
     16        (WebCore::HTMLFormControlElementWithState::~HTMLFormControlElementWithState):
     17        (WebCore::HTMLFormControlElementWithState::didMoveToNewDocument):
     18        (WebCore::HTMLFormControlElementWithState::finishParsingChildren):
     19        * html/HTMLFormElement.cpp:
     20        (WebCore::HTMLFormElement::~HTMLFormElement):
     21        (WebCore::HTMLFormElement::finishParsingChildren):
     22        * html/HTMLInputElement.cpp:
     23        (WebCore::HTMLInputElement::~HTMLInputElement):
     24        (WebCore::HTMLInputElement::didMoveToNewDocument):
     25        (WebCore::HTMLInputElement::checkedRadioButtons):
     26
    1272013-05-25  Sergio Villar Senin  <svillar@igalia.com>
    228
  • trunk/Source/WebCore/dom/Document.cpp

    r150560 r150683  
    16451645}
    16461646
    1647 FormController* Document::formController()
     1647FormController& Document::formController()
    16481648{
    16491649    if (!m_formController)
    16501650        m_formController = FormController::create();
    1651     return m_formController.get();
     1651    return *m_formController;
    16521652}
    16531653
     
    16631663    if (!stateVector.size() && !m_formController)
    16641664        return;
    1665     formController()->setStateForNewFormElements(stateVector);
     1665    formController().setStateForNewFormElements(stateVector);
    16661666}
    16671667
  • trunk/Source/WebCore/dom/Document.h

    r150560 r150683  
    492492    void evaluateMediaQueryList();
    493493
    494     // Never returns 0.
    495     FormController* formController();
     494    FormController& formController();
    496495    Vector<String> formElementsState() const;
    497496    void setStateForNewFormElements(const Vector<String>&);
  • trunk/Source/WebCore/html/HTMLFormControlElementWithState.cpp

    r150214 r150683  
    3838    : HTMLFormControlElement(tagName, doc, f)
    3939{
    40     document()->formController()->registerFormElementWithState(this);
     40    document()->formController().registerFormElementWithState(this);
    4141}
    4242
    4343HTMLFormControlElementWithState::~HTMLFormControlElementWithState()
    4444{
    45     document()->formController()->unregisterFormElementWithState(this);
     45    document()->formController().unregisterFormElementWithState(this);
    4646}
    4747
     
    4949{
    5050    if (oldDocument)
    51         oldDocument->formController()->unregisterFormElementWithState(this);
    52     document()->formController()->registerFormElementWithState(this);
     51        oldDocument->formController().unregisterFormElementWithState(this);
     52    document()->formController().registerFormElementWithState(this);
    5353    HTMLFormControlElement::didMoveToNewDocument(oldDocument);
    5454}
     
    8585{
    8686    HTMLFormControlElement::finishParsingChildren();
    87     document()->formController()->restoreControlStateFor(*this);
     87    document()->formController().restoreControlStateFor(*this);
    8888}
    8989
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r149665 r150683  
    8888HTMLFormElement::~HTMLFormElement()
    8989{
    90     document()->formController()->willDeleteForm(this);
     90    document()->formController().willDeleteForm(this);
    9191    if (!shouldAutocomplete())
    9292        document()->unregisterForPageCacheSuspensionCallbacks(this);
     
    677677{
    678678    HTMLElement::finishParsingChildren();
    679     document()->formController()->restoreControlStateIn(*this);
     679    document()->formController().restoreControlStateIn(*this);
    680680}
    681681
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r150140 r150683  
    175175    // We should unregister it to avoid accessing a deleted object.
    176176    if (isRadioButton())
    177         document()->formController()->checkedRadioButtons().removeButton(this);
     177        document()->formController().checkedRadioButtons().removeButton(this);
    178178#if ENABLE(TOUCH_EVENTS)
    179179    if (m_hasTouchEventHandler)
     
    15371537            oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
    15381538        if (isRadioButton())
    1539             oldDocument->formController()->checkedRadioButtons().removeButton(this);
     1539            oldDocument->formController().checkedRadioButtons().removeButton(this);
    15401540#if ENABLE(TOUCH_EVENTS)
    15411541        if (m_hasTouchEventHandler)
     
    18511851        return &formElement->checkedRadioButtons();
    18521852    if (inDocument())
    1853         return &document()->formController()->checkedRadioButtons();
     1853        return &document()->formController().checkedRadioButtons();
    18541854    return 0;
    18551855}
Note: See TracChangeset for help on using the changeset viewer.