Changeset 76662 in webkit


Ignore:
Timestamp:
Jan 25, 2011 7:50:52 PM (13 years ago)
Author:
tkent@chromium.org
Message:

2011-01-25 Kent Tamura <tkent@chromium.org>

Reviewed by Dimitri Glazkov.

Range and number inputs should reject increment and decrement by
keyboard or mouse wheel if they are disabled or read-only
https://bugs.webkit.org/show_bug.cgi?id=53151

Add checks for 'disabled' and 'readOnly'.

  • fast/forms/input-number-keyoperation-expected.txt:
  • fast/forms/input-number-wheel-expected.txt:
  • fast/forms/range-keyoperation-expected.txt:
  • fast/forms/range-keyoperation.html:
  • fast/forms/script-tests/input-number-keyoperation.js:
  • fast/forms/script-tests/input-number-wheel.js:

2011-01-25 Kent Tamura <tkent@chromium.org>

Reviewed by Dimitri Glazkov.

Range and number inputs should reject increment and decrement by
keyboard or mouse wheel if they are disabled or read-only
https://bugs.webkit.org/show_bug.cgi?id=53151

  • html/RangeInputType.cpp: (WebCore::RangeInputType::handleKeydownEvent): Check disabled() and readOnly().
  • html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): ditto. (WebCore::TextFieldInputType::handleWheelEventForSpinButton): ditto.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76652 r76662  
     12011-01-25  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Range and number inputs should reject increment and decrement by
     6        keyboard or mouse wheel if they are disabled or read-only
     7        https://bugs.webkit.org/show_bug.cgi?id=53151
     8
     9        Add checks for 'disabled' and 'readOnly'.
     10
     11        * fast/forms/input-number-keyoperation-expected.txt:
     12        * fast/forms/input-number-wheel-expected.txt:
     13        * fast/forms/range-keyoperation-expected.txt:
     14        * fast/forms/range-keyoperation.html:
     15        * fast/forms/script-tests/input-number-keyoperation.js:
     16        * fast/forms/script-tests/input-number-wheel.js:
     17
    1182011-01-25  Cris Neckar  <cdn@chromium.org>
    219
  • trunk/LayoutTests/fast/forms/input-number-keyoperation-expected.txt

    r63586 r76662  
    1010Press the down arrow key:
    1111PASS input.value is "123"
     12Disable input element:
     13PASS input.value is "123"
     14Read-only input element:
     15PASS input.value is "123"
    1216PASS successfullyParsed is true
    1317
  • trunk/LayoutTests/fast/forms/input-number-wheel-expected.txt

    r64616 r76662  
    1212Wheel down by 256:
    1313PASS input.value is "0"
     14Disabled input element:
     15PASS input.value is "0"
     16Read-only input element:
     17PASS input.value is "0"
    1418PASS successfullyParsed is true
    1519
  • trunk/LayoutTests/fast/forms/range-keyoperation-expected.txt

    r68024 r76662  
    4545PASS input.value is "2"
    4646
     47Disabled and read-only
     48PASS input.value is "1"
     49PASS input.value is "1"
     50
    4751PASS successfullyParsed is true
    4852
  • trunk/LayoutTests/fast/forms/range-keyoperation.html

    r68024 r76662  
    123123
    124124debug('');
     125debug('Disabled and read-only');
     126input.disabled = true;
     127input.value = '1';
     128input.step = '1';
     129input.min = '0';
     130input.max = '100';
     131sendKey(input, 'Up');
     132shouldBe('input.value', '"1"');
     133input.removeAttribute('disabled');
     134input.readOnly = true;
     135sendKey(input, 'Up');
     136shouldBe('input.value', '"1"');
     137
     138debug('');
    125139var successfullyParsed = true;
    126140</script>
  • trunk/LayoutTests/fast/forms/script-tests/input-number-keyoperation.js

    r63586 r76662  
    1818shouldBe('input.value', '"123"');
    1919
     20debug('Disable input element:');
     21input.disabled = true;
     22eventSender.keyDown('upArrow');
     23shouldBe('input.value', '"123"');
     24input.removeAttribute('disabled');
     25
     26debug('Read-only input element:');
     27input.readOnly = true;
     28eventSender.keyDown('upArrow');
     29shouldBe('input.value', '"123"');
     30
    2031var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/input-number-wheel.js

    r64616 r76662  
    3030shouldBe('input.value', '"0"');
    3131
     32debug('Disabled input element:');
     33input.disabled = true;
     34dispatchWheelEvent(input, 0, 1);
     35shouldBe('input.value', '"0"');
     36input.removeAttribute('disabled');
     37
     38debug('Read-only input element:');
     39input.readOnly = true;
     40dispatchWheelEvent(input, 0, 1);
     41shouldBe('input.value', '"0"');
     42
    3243var successfullyParsed = true;
  • trunk/Source/WebCore/ChangeLog

    r76661 r76662  
     12011-01-25  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Range and number inputs should reject increment and decrement by
     6        keyboard or mouse wheel if they are disabled or read-only
     7        https://bugs.webkit.org/show_bug.cgi?id=53151
     8
     9        * html/RangeInputType.cpp:
     10        (WebCore::RangeInputType::handleKeydownEvent): Check disabled() and readOnly().
     11        * html/TextFieldInputType.cpp:
     12        (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): ditto.
     13        (WebCore::TextFieldInputType::handleWheelEventForSpinButton): ditto.
     14
    1152011-01-25  Kent Tamura  <tkent@chromium.org>
    216
  • trunk/Source/WebCore/html/RangeInputType.cpp

    r76147 r76662  
    155155void RangeInputType::handleKeydownEvent(KeyboardEvent* event)
    156156{
     157    if (element()->disabled() || element()->readOnly())
     158        return;
    157159    const String& key = event->keyIdentifier();
    158160    if (key != "Up" && key != "Right" && key != "Down" && key != "Left")
  • trunk/Source/WebCore/html/TextFieldInputType.cpp

    r74895 r76662  
    6565void TextFieldInputType::handleKeydownEventForSpinButton(KeyboardEvent* event)
    6666{
     67    if (element()->disabled() || element()->readOnly())
     68        return;
    6769    const String& key = event->keyIdentifier();
    6870    int step = 0;
     
    7981void TextFieldInputType::handleWheelEventForSpinButton(WheelEvent* event)
    8082{
     83    if (element()->disabled() || element()->readOnly())
     84        return;
    8185    int step = 0;
    8286    if (event->wheelDeltaY() > 0)
Note: See TracChangeset for help on using the changeset viewer.