Changeset 102741 in webkit


Ignore:
Timestamp:
Dec 13, 2011 10:14:46 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[Forms] Default selection of select(menulist) should not be disabled
https://bugs.webkit.org/show_bug.cgi?id=74270

Patch by Yosifumi Inoue <yosin@chromium.org> on 2011-12-13
Reviewed by Kent Tamura.

Source/WebCore:

This patch changes default selection of select(menulist) element to

  1. Selected option element. If there are multiple options which have selected state, we pick the largest index option up. (same as current)
  2. Non-disabled option element (new behavior)
  3. The first option if all options are disabled. (new behavior)

Tests: fast/forms/select/menulist-disabled-option-expected.html

fast/forms/select/menulist-disabled-option.html

  • html/HTMLSelectElement.cpp:

(WebCore::HTMLSelectElement::recalcListItems): Implement new logic for selection.

LayoutTests:

basic-selects.html will fail because select element displays disabled
option element "foo" at index 0 as default selection. This should be
non-disabled option "bar" at index 1.

menulist-disabled-option-expected.html checks default selection of
select(menulist) with disabled option element.

  • fast/forms/select/menulist-disabled-option-expected.html: Added.
  • fast/forms/select/menulist-disabled-option.html: Added.
  • platform/chromium/test_expectations.txt: Add fast/forms/basic-selects.html
  • platform/gtk/test_expectations.txt: Add fast/forms/basic-selects.html
  • platform/mac/test_expectations.txt: Add fast/forms/basic-selects.html
  • platform/qt/test_expectations.txt: Add fast/forms/basic-selects.html
  • platform/win/test_expectations.txt: Add fast/forms/basic-selects.html
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r102734 r102741  
     12011-12-13  Yosifumi Inoue  <yosin@chromium.org>
     2
     3        [Forms] Default selection of select(menulist) should not be disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=74270
     5
     6        Reviewed by Kent Tamura.
     7
     8        basic-selects.html will fail because select element displays disabled
     9        option element "foo" at index 0 as default selection. This should be
     10        non-disabled option "bar" at index 1.
     11
     12        menulist-disabled-option-expected.html checks default selection of
     13        select(menulist) with disabled option element.
     14
     15        * fast/forms/select/menulist-disabled-option-expected.html: Added.
     16        * fast/forms/select/menulist-disabled-option.html: Added.
     17        * platform/chromium/test_expectations.txt: Add fast/forms/basic-selects.html
     18        * platform/gtk/test_expectations.txt: Add fast/forms/basic-selects.html
     19        * platform/mac/test_expectations.txt: Add fast/forms/basic-selects.html
     20        * platform/qt/test_expectations.txt: Add fast/forms/basic-selects.html
     21        * platform/win/test_expectations.txt: Add fast/forms/basic-selects.html
     22
    1232011-12-13  Hajime Morrita  <morrita@chromium.org>
    224
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r102729 r102741  
    11071107BUGWK70748 CPU : fast/css/nested-rounded-corners.html = IMAGE
    11081108BUGWK70748 CPU : fast/css/text-input-with-webkit-border-radius.html = IMAGE
    1109 BUGWK70748 CPU : fast/forms/basic-selects.html = IMAGE
    11101109BUGWK70748 CPU : fast/forms/validation-message-appearance.html = IMAGE
    11111110BUGWK70748 CPU : fast/repaint/shadow-multiple-horizontal.html = IMAGE
     
    39553954BUGWK73838 LEOPARD DEBUG : animations/animation-add-events-in-handler.html = CRASH
    39563955
     3956BUGWK74270 : fast/forms/basic-selects.html = FAIL
     3957
    39573958// Need rebaseline on Linux and Win GPU
    39583959BUGWK73905 GPU LINUX : media/video-layer-crash.html = IMAGE+TEXT
  • trunk/LayoutTests/platform/gtk/test_expectations.txt

    r102607 r102741  
    9090
    9191BUGWK73766 : css3/unicode-bidi-isolate-aharon-failing.html = FAIL
     92
     93BUGWK74270 : fast/forms/basic-selects.html = FAIL
     94
  • trunk/LayoutTests/platform/mac/test_expectations.txt

    r101950 r102741  
    3737
    3838BUGWK73766 : css3/unicode-bidi-isolate-aharon-failing.html = FAIL
     39
     40BUGWK74270 : fast/forms/basic-selects.html = FAIL
     41
  • trunk/LayoutTests/platform/qt/test_expectations.txt

    r101950 r102741  
    2020
    2121BUGWK73766 : css3/unicode-bidi-isolate-aharon-failing.html = FAIL
     22
     23BUGWK74270 : fast/forms/basic-selects.html = FAIL
     24
  • trunk/LayoutTests/platform/win/test_expectations.txt

    r101950 r102741  
    1515
    1616BUGWK73766 : css3/unicode-bidi-isolate-aharon-failing.html = FAIL
     17
     18BUGWK74270 : fast/forms/basic-selects.html = FAIL
     19
  • trunk/Source/WebCore/ChangeLog

    r102740 r102741  
     12011-12-13  Yosifumi Inoue  <yosin@chromium.org>
     2
     3        [Forms] Default selection of select(menulist) should not be disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=74270
     5
     6        Reviewed by Kent Tamura.
     7
     8        This patch changes default selection of select(menulist) element to
     9          1. Selected option element. If there are multiple options which have
     10             selected state, we pick the largest index option up. (same as current)
     11          2. Non-disabled option element (new behavior)
     12          3. The first option if all options are disabled. (new behavior)
     13
     14        Tests: fast/forms/select/menulist-disabled-option-expected.html
     15               fast/forms/select/menulist-disabled-option.html
     16
     17        * html/HTMLSelectElement.cpp:
     18        (WebCore::HTMLSelectElement::recalcListItems): Implement new logic for selection.
     19
    1202011-12-13  Simon Fraser  <simon.fraser@apple.com>
    221
  • trunk/Source/WebCore/html/HTMLSelectElement.cpp

    r102419 r102741  
    692692
    693693    HTMLOptionElement* foundSelected = 0;
     694    HTMLOptionElement* firstOption = 0;
    694695    for (Node* currentNode = this->firstChild(); currentNode;) {
    695696        if (!currentNode->isHTMLElement()) {
     
    715716
    716717            if (updateSelectedStates && !m_multiple) {
    717                 if (!foundSelected && (m_size <= 1 || toHTMLOptionElement(current)->selected())) {
    718                     foundSelected = toHTMLOptionElement(current);
     718                HTMLOptionElement* option = toHTMLOptionElement(current);
     719                if (!firstOption)
     720                    firstOption = option;
     721                if (option->selected()) {
     722                    if (foundSelected)
     723                        foundSelected->setSelectedState(false);
     724                    foundSelected = option;
     725                } else if (m_size <= 1 && !foundSelected && !option->disabled()) {
     726                    foundSelected = option;
    719727                    foundSelected->setSelectedState(true);
    720                 } else if (foundSelected && toHTMLOptionElement(current)->selected()) {
    721                     foundSelected->setSelectedState(false);
    722                     foundSelected = toHTMLOptionElement(current);
    723728                }
    724729            }
     
    736741        currentNode = currentNode->traverseNextSibling(this);
    737742    }
     743
     744    if (!foundSelected && m_size <= 1 && firstOption && !firstOption->selected())
     745        firstOption->setSelectedState(true);
    738746}
    739747
Note: See TracChangeset for help on using the changeset viewer.