Skip to content
  • commit-queue@webkit.org's avatar
    [Forms] The option element should not be form associated element. · a0dc317e
    commit-queue@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=79764
    
    Patch by Yoshifumi Inoue <yosin@chromium.org> on 2012-03-22
    Reviewed by Kent Tamura.
    
    Source/WebCore:
    
    This patch changes base class of HTMLOptionELement to HTMLElement
    from HTMLFormControlElement for saving memory space and iteration
    time of extra "option" elements in HTMLFormElement::m_formAssociatedElements
    and matching the HTML5 specification for ease of maintenance.
    
    This patch changes behavior of handling of CSS pseudo classes "invalid"
    and "valid". The "option" elements no longer use these CSS pseudo classes
    as HTML5 specification. This bug was filed in https://bugs.webkit.org/show_bug.cgi?id=80088
    
    Changes of TextIterator is lead by usage of isFormControlElement. This
    changes will be replaced with more meaningful predicate as part of
    https://bugs.webkit.org/show_bug.cgi?id=80381
    
    No new tests but updated select-live-pseudo-selectors.html test.
    
    * css/CSSStyleSelector.cpp:
    (WebCore::CSSStyleSelector::canShareStyleWithElement): Added checking of the "option" element and returns false as HTMLFormControlElement.
    * css/SelectorChecker.cpp:
    (WebCore::SelectorChecker::checkOneSelector): Removed isFormControlElement for PseudoDisabled and PseudoChecked.
    * html/HTMLKeygenElement.cpp:
    (WebCore::HTMLKeygenElement::HTMLKeygenElement): Removed form parameter of call site of HTMLOptionElement::create.
    * html/HTMLOptionElement.cpp:
    (WebCore::HTMLOptionElement::HTMLOptionElement): Removed form parameter which no longer needed. Changed base class in initialization list. Added m_disabled initialization.
    (WebCore::HTMLOptionElement::create): Removed form parameter which no longer needed.
    (WebCore::HTMLOptionElement::attach): Changeid base class.
    (WebCore::HTMLOptionElement::detach): Changed base class.
    (WebCore::HTMLOptionElement::parseAttribute): Changed base class. Added "disabled" attribute handling.
    (WebCore::HTMLOptionElement::childrenChanged): Changed base class.
    (WebCore::HTMLOptionElement::insertedIntoTree): Changed base class.
    * html/HTMLOptionElement.h:
    (HTMLOptionElement): Added new member variable m_disabled which was in HTMLFormControlElement.
    (WebCore::HTMLOptionElement::ownElementDisabled): Changed for using m_disabled.
    * html/HTMLTagNames.in: Removed constructorNeedsFormElement for the "option" element, which was used for passing form parameter to create function.
    
    LayoutTests:
    
    This patch fixes a bug in select-live-pseudo-selectors.js, adds
    assertions to improve coverage, and updates test expectation for
    behavior changes (makes the "option" element uses CSS pseudo class
    ":valid".)
    
    * fast/forms/resources/select-live-pseudo-selectors.js:
    (mouseDownOnSelect): Copied from listbox-selection.html for replacing broken simulateClick which used position and size of the "option" element, but these values are zero. Note: five files use mouseDownOnSelect. We'll share this function in future tracked by https://bugs.webkit.org/show_bug.cgi?id=81496.
    (backgroundOf): Added String parameter support for ease of writing test case.
    * fast/forms/select-live-pseudo-selectors-expected.txt: Added check fo background color of the "selection" element. Changed expected color of the "option" element because the "option" element doesn't support CSS pseudo class ":valid". This also covers bug 80088.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@111659 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    a0dc317e