Changeset 90809 in webkit


Ignore:
Timestamp:
Jul 11, 2011 11:26:04 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Optimize HTMLInputElement::updateCheckedRadioButtons
https://bugs.webkit.org/show_bug.cgi?id=62840

Patch by Zeng Huiqing <huiqing.zeng@intel.com> on 2011-07-11
Reviewed by Kent Tamura.

No new tests.

  • dom/Document.h:

(WebCore::Document::getFormElements):

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::updateCheckedRadioButtons):
(WebCore::HTMLInputElement::setChecked):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90807 r90809  
     12011-07-11  Zeng Huiqing  <huiqing.zeng@intel.com>
     2
     3        Optimize HTMLInputElement::updateCheckedRadioButtons
     4        https://bugs.webkit.org/show_bug.cgi?id=62840
     5
     6        Reviewed by Kent Tamura.
     7
     8        No new tests.
     9
     10        * dom/Document.h:
     11        (WebCore::Document::getFormElements):
     12        * html/HTMLInputElement.cpp:
     13        (WebCore::HTMLInputElement::updateCheckedRadioButtons):
     14        (WebCore::HTMLInputElement::setChecked):
     15
    1162011-06-23  Pratik Solanki  <psolanki@apple.com>
    217
  • trunk/Source/WebCore/dom/Document.h

    r90517 r90809  
    219219    virtual ~Document();
    220220
     221    typedef ListHashSet<Element*, 64> FormElementListHashSet;
     222    const FormElementListHashSet* getFormElements() const { return &m_formElementsWithState; }   
     223
    221224    MediaQueryMatcher* mediaQueryMatcher();
    222225
     
    12271230    StyleSheetCandidateListHashSet m_styleSheetCandidateNodes; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>)
    12281231
    1229     typedef ListHashSet<Element*, 64> FormElementListHashSet;
    12301232    FormElementListHashSet m_formElementsWithState;
    12311233    typedef ListHashSet<RefPtr<FormAssociatedElement>, 32> FormAssociatedElementListHashSet;
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r90763 r90809  
    190190        }
    191191    } else {
    192         // FIXME: Traversing the document is inefficient.
    193         for (Node* node = document()->body(); node; node = node->traverseNextNode()) {
    194             if (!node->isElementNode())
    195                 continue;
    196             Element* element = static_cast<Element*>(node);
     192        typedef Document::FormElementListHashSet::const_iterator Iterator;
     193        Iterator end = document()->getFormElements()->end();
     194        for (Iterator it = document()->getFormElements()->begin(); it != end; ++it) {
     195            Element* element = *it;
    197196            if (element->formControlName() != name())
    198197                continue;
     
    889888    m_isChecked = nowChecked;
    890889    setNeedsStyleRecalc();
    891 
    892     updateCheckedRadioButtons();
     890    if (isRadioButton())
     891        updateCheckedRadioButtons();
    893892    setNeedsValidityCheck();
    894893
Note: See TracChangeset for help on using the changeset viewer.