Changeset 63286 in webkit


Ignore:
Timestamp:
Jul 14, 2010 12:43:12 AM (14 years ago)
Author:
tkent@chromium.org
Message:

2010-07-14 Kent Tamura <tkent@chromium.org>

Reviewed by Darin Fisher.

<input type=number> UI: Support disabled/readonly states
https://bugs.webkit.org/show_bug.cgi?id=38568

  • fast/forms/input-appearance-spinbutton-disabled-readonly.html: Added.
  • platform/chromium/test_expectations.txt:
  • platform/gtk/Skipped:
  • platform/mac/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.checksum: Added.
  • platform/mac/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.png: Added.
  • platform/mac/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.txt: Added.
  • platform/mac/fast/forms/input-number-click-expected.txt:
  • platform/mac/fast/forms/input-number-click.html: Add tests for disabled/readonly states.
  • platform/qt/Skipped:
  • platform/win/Skipped:

2010-07-14 Kent Tamura <tkent@chromium.org>

Reviewed by Darin Fisher.

<input type=number> UI: Support disabled/readonly states
https://bugs.webkit.org/show_bug.cgi?id=38568

Implement isEnabledFormControl() and isReadOnlyFormControl() of
SpinButtonElement. They returns the states of the parent <input> element.
The existing isEnabledFormControl() had a bug. It didn't have 'const'
modifier.

Test: fast/forms/input-appearance-spinbutton-disabled-readonly.html

  • rendering/TextControlInnerElements.cpp: (WebCore::SpinButtonElement::defaultEventHandler):
    • If the input element is disabled or read-only, don't process events.
    • Protect 'input' object from destruction during focus().
    • Fix a hit-test issue. We don't need to add renderBox()->y() because 'local' is relative to the RenderBox.
    • Some code cleanup
  • rendering/TextControlInnerElements.h: (WebCore::SpinButtonElement::isEnabledFormControl): (WebCore::SpinButtonElement::isReadOnlyFormControl):
Location:
trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63284 r63286  
     12010-07-14  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        <input type=number> UI: Support disabled/readonly states
     6        https://bugs.webkit.org/show_bug.cgi?id=38568
     7
     8        * fast/forms/input-appearance-spinbutton-disabled-readonly.html: Added.
     9        * platform/chromium/test_expectations.txt:
     10        * platform/gtk/Skipped:
     11        * platform/mac/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.checksum: Added.
     12        * platform/mac/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.png: Added.
     13        * platform/mac/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.txt: Added.
     14        * platform/mac/fast/forms/input-number-click-expected.txt:
     15        * platform/mac/fast/forms/input-number-click.html:
     16          Add tests for disabled/readonly states.
     17        * platform/qt/Skipped:
     18        * platform/win/Skipped:
     19
    1202010-07-13  Brian Weinstein  <bweinstein@apple.com>
    221
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r63272 r63286  
    721721BUG20226 DEFER : fast/forms/input-list.html = FAIL
    722722BUG20226 DEFER : fast/forms/input-selectedoption.html = FAIL
     723
     724// Need to implement inner-spin-button or outer-spin-button
     725BUGWK38570 DEFER SKIP : fast/forms/input-appearance-spinbutton-disabled-readonly.html
    723726
    724727// Add support for inspector layout tests.
  • trunk/LayoutTests/platform/gtk/Skipped

    r63239 r63286  
    57575757media/video-controls-rendering.html
    57585758
     5759# Need to implement inner-spin-button or outer-spin-button
     5760fast/forms/input-appearance-spinbutton-disabled-readonly.html
     5761
    57595762# https://bugs.webkit.org/show_bug.cgi?id=35350
    57605763fast/events/show-modal-dialog-onblur-onfocus.html
  • trunk/LayoutTests/platform/mac/fast/forms/input-number-click-expected.txt

    r58564 r63286  
    55
    66
     7Initial value is 3.14, click the up button once
    78PASS i.value is "4.14"
     9Click the up button again.  The maximum value is 5.
    810PASS i.value is "4.14"
     11Click the down button four times
    912PASS i.value is "0.14"
     13Click the down button again. The minimum value is 0.
     14PASS i.value is "0.14"
     15Make the control "disabled" and click the up button
     16PASS i.value is "0.14"
     17Make the control "readOnly" and click the up button
    1018PASS i.value is "0.14"
    1119PASS successfullyParsed is true
  • trunk/LayoutTests/platform/mac/fast/forms/input-number-click.html

    r58564 r63286  
    1515
    1616if (window.eventSender) {
     17    debug('Initial value is 3.14, click the up button once');
    1718    // The spin control is at (130,-1) in the input element on Mac.
    1819    // The size is 15x22.
     
    2425    shouldBe('i.value', '"4.14"');
    2526
    26     // Click it again.
     27    debug('Click the up button again.  The maximum value is 5.');
    2728    eventSender.mouseDown();
    2829    eventSender.mouseUp();
     
    3031    shouldBe('i.value', '"4.14"');
    3132
    32     // Click the down button for times.
     33    debug('Click the down button four times');
    3334    eventSender.mouseMoveTo(i.offsetLeft + i.offsetWidth - 4, i.offsetTop + 15);
    3435    eventSender.mouseDown();
     
    4243    shouldBe('i.value', '"0.14"');
    4344
     45    debug('Click the down button again. The minimum value is 0.');
    4446    // The minimum value is 0.  So the value is not changed.
    4547    eventSender.mouseDown();
    4648    eventSender.mouseUp();
    4749    shouldBe('i.value', '"0.14"');
     50
     51    debug('Make the control "disabled" and click the up button');
     52    i.disabled = true;
     53    eventSender.mouseMoveTo(i.offsetLeft + i.offsetWidth - 4, i.offsetTop + 4);
     54    eventSender.mouseDown();
     55    eventSender.mouseUp();
     56    shouldBe('i.value', '"0.14"');
     57    i.disabled = false;
     58
     59    debug('Make the control "readOnly" and click the up button');
     60    i.readOnly = true;
     61    eventSender.mouseMoveTo(i.offsetLeft + i.offsetWidth - 4, i.offsetTop + 4);
     62    eventSender.mouseDown();
     63    eventSender.mouseUp();
     64    shouldBe('i.value', '"0.14"');
     65    i.readOnly = false;
    4866} else {
    4967  document.getElementById('console').innerHTML = 'No eventSender';
  • trunk/LayoutTests/platform/qt/Skipped

    r63270 r63286  
    54435443fast/text/bidi-explicit-embedding-past-end.html
    54445444
     5445# Need to implement inner-spin-button or outer-spin-button
     5446fast/forms/input-appearance-spinbutton-disabled-readonly.html
     5447
    54455448# Speech input is not yet enabled.
    54465449fast/forms/input-appearance-numberandspeech.html
  • trunk/LayoutTests/platform/win/Skipped

    r63260 r63286  
    936936printing/page-format-data.html
    937937
     938# Need to implement inner-spin-button
     939# https://bugs.webkit.org/show_bug.cgi?id=38381
     940fast/forms/input-appearance-spinbutton-disabled-readonly.html
     941
    938942# Speech input is not yet enabled.
    939943fast/forms/input-appearance-numberandspeech.html
  • trunk/WebCore/ChangeLog

    r63283 r63286  
     12010-07-14  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        <input type=number> UI: Support disabled/readonly states
     6        https://bugs.webkit.org/show_bug.cgi?id=38568
     7
     8        Implement isEnabledFormControl() and isReadOnlyFormControl() of
     9        SpinButtonElement. They returns the states of the parent <input> element.
     10        The existing isEnabledFormControl() had a bug. It didn't have 'const'
     11        modifier.
     12
     13        Test: fast/forms/input-appearance-spinbutton-disabled-readonly.html
     14
     15        * rendering/TextControlInnerElements.cpp:
     16        (WebCore::SpinButtonElement::defaultEventHandler):
     17         - If the input element is disabled or read-only, don't process events.
     18         - Protect 'input' object from destruction during focus().
     19         - Fix a hit-test issue. We don't need to add renderBox()->y() because
     20           'local' is relative to the RenderBox.
     21         - Some code cleanup
     22        * rendering/TextControlInnerElements.h:
     23        (WebCore::SpinButtonElement::isEnabledFormControl):
     24        (WebCore::SpinButtonElement::isReadOnlyFormControl):
     25
    1262010-07-13  Simon Fraser  <simon.fraser@apple.com>
    227
  • trunk/WebCore/rendering/TextControlInnerElements.cpp

    r62079 r63286  
    279279   
    280280    HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
     281    if (input->disabled() || input->isReadOnlyFormControl()) {
     282        if (!event->defaultHandled())
     283            HTMLDivElement::defaultEventHandler(event);
     284        return;
     285    }
     286
    281287    IntPoint local = roundedIntPoint(box->absoluteToLocal(mouseEvent->absoluteLocation(), false, true));
    282288    if (event->type() == eventNames().clickEvent) {
    283289        if (box->borderBoxRect().contains(local)) {
     290            RefPtr<Node> protector(input);
    284291            input->focus();
    285292            input->select();
    286             if (local.y() < box->y() + box->height() / 2)
     293            if (local.y() < box->height() / 2)
    287294                input->stepUpFromRenderer(1);
    288295            else
     
    299306            }
    300307            bool oldOnUpButton = m_onUpButton;
    301             m_onUpButton = local.y() < box->y() + box->height() / 2;
     308            m_onUpButton = local.y() < box->height() / 2;
    302309            if (m_onUpButton != oldOnUpButton)
    303310                renderer()->repaint();
  • trunk/WebCore/rendering/TextControlInnerElements.h

    r61752 r63286  
    9999
    100100    virtual bool isSpinButtonElement() const { return true; }
    101     virtual bool isEnabledFormControl() { return static_cast<Element*>(shadowAncestorNode())->isEnabledFormControl(); }
     101    // FIXME: shadowAncestorNode() should be const.
     102    virtual bool isEnabledFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isEnabledFormControl(); }
     103    virtual bool isReadOnlyFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isReadOnlyFormControl(); }
    102104    virtual void defaultEventHandler(Event*);
    103105
Note: See TracChangeset for help on using the changeset viewer.