Changeset 86526 in webkit


Ignore:
Timestamp:
May 15, 2011 10:59:46 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-15 Kenichi Ishibashi <bashi@chromium.org>

Reviewed by Kent Tamura.

<output>, <meter> and <progress> elements with display:block can be focused if you try to tab to it
https://bugs.webkit.org/show_bug.cgi?id=60602

Add a test that ensures <output>, <meter> and <progress> are not focused.
Add tabindex attributes to <progress> elements in progressbar.html so that these elements can be focused.

  • fast/forms/focus-with-display-block-expected.txt: Added.
  • fast/forms/focus-with-display-block.html: Added.
  • platform/mac/accessibility/progressbar.html: Added tabindex attributes to progress elements.

2011-05-15 Kenichi Ishibashi <bashi@chromium.org>

Reviewed by Kent Tamura.

<output>, <meter> and <progress> elements with display:block can be focused if you try to tab to it
https://bugs.webkit.org/show_bug.cgi?id=60602

HTMLFormControlElement::isFocusable() returns true when the element is
visible as a block element. However, for output, meter, and progress
elements, the function should not return true unless they have
tabindex attributes. Override supportsFocus() of these elements to
apply the result of Node::supportsFocus() because it takes care of
whether the element has tabindex or not.

Test: fast/forms/focus-with-display-block.html

  • html/HTMLFormControlElement.h: Made supportsFocus() protected.
  • html/HTMLMeterElement.cpp: (WebCore::HTMLMeterElement::supportsFocus): Added.
  • html/HTMLMeterElement.h:
  • html/HTMLOutputElement.cpp: (WebCore::HTMLOutputElement::supportsFocus): Added.
  • html/HTMLOutputElement.h:
  • html/HTMLProgressElement.cpp: (WebCore::HTMLProgressElement::supportsFocus): Added.
  • html/HTMLProgressElement.h:
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86521 r86526  
     12011-05-15  Kenichi Ishibashi  <bashi@chromium.org>
     2
     3        Reviewed by Kent Tamura.
     4
     5        <output>, <meter> and <progress> elements with display:block can be focused if you try to tab to it
     6        https://bugs.webkit.org/show_bug.cgi?id=60602
     7
     8        Add a test that ensures <output>, <meter> and <progress> are not focused.
     9        Add tabindex attributes to <progress> elements in progressbar.html so that these elements can be focused.
     10
     11        * fast/forms/focus-with-display-block-expected.txt: Added.
     12        * fast/forms/focus-with-display-block.html: Added.
     13        * platform/mac/accessibility/progressbar.html: Added tabindex attributes to progress elements.
     14
    1152011-05-12  MORITA Hajime  <morrita@google.com>
    216
  • trunk/LayoutTests/platform/mac/accessibility/progressbar.html

    r57494 r86526  
    1313<span tabindex="0" role="progressbar" id="progressbar2" aria-valuemax=10>X</span>
    1414
    15 <progress id="progressbar3" value=7 max=10></progress>
    16 <progress id="progressbar4"></progress>
     15<progress tabindex="0" id="progressbar3" value=7 max=10></progress>
     16<progress tabindex="0" id="progressbar4"></progress>
    1717
    1818<p id="description"></p>
  • trunk/Source/WebCore/ChangeLog

    r86525 r86526  
     12011-05-15  Kenichi Ishibashi  <bashi@chromium.org>
     2
     3        Reviewed by Kent Tamura.
     4
     5        <output>, <meter> and <progress> elements with display:block can be focused if you try to tab to it
     6        https://bugs.webkit.org/show_bug.cgi?id=60602
     7
     8        HTMLFormControlElement::isFocusable() returns true when the element is
     9        visible as a block element.  However, for output, meter, and progress
     10        elements, the function should not return true unless they have
     11        tabindex attributes.  Override supportsFocus() of these elements to
     12        apply the result of Node::supportsFocus() because it takes care of
     13        whether the element has tabindex or not.
     14
     15        Test: fast/forms/focus-with-display-block.html
     16
     17        * html/HTMLFormControlElement.h: Made supportsFocus() protected.
     18        * html/HTMLMeterElement.cpp:
     19        (WebCore::HTMLMeterElement::supportsFocus): Added.
     20        * html/HTMLMeterElement.h:
     21        * html/HTMLOutputElement.cpp:
     22        (WebCore::HTMLOutputElement::supportsFocus): Added.
     23        * html/HTMLOutputElement.h:
     24        * html/HTMLProgressElement.cpp:
     25        (WebCore::HTMLProgressElement::supportsFocus): Added.
     26        * html/HTMLProgressElement.h:
     27
    1282011-05-15  Jon Lee  <jonlee@apple.com>
    229
  • trunk/Source/WebCore/html/HTMLFormControlElement.h

    r86491 r86526  
    118118    virtual void willMoveToNewOwnerDocument();
    119119
     120    virtual bool supportsFocus() const;
    120121    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
    121122    virtual bool isMouseFocusable() const;
     
    139140
    140141    virtual bool isFormControlElement() const { return true; }
    141 
    142     virtual bool supportsFocus() const;
    143142
    144143    virtual short tabIndex() const;
  • trunk/Source/WebCore/html/HTMLMeterElement.cpp

    r83256 r86526  
    6767}
    6868
     69bool HTMLMeterElement::supportsFocus() const
     70{
     71    return Node::supportsFocus() && !disabled();
     72}
     73
    6974void HTMLMeterElement::parseMappedAttribute(Attribute* attribute)
    7075{
  • trunk/Source/WebCore/html/HTMLMeterElement.h

    r86491 r86526  
    6666    virtual ~HTMLMeterElement();
    6767
     68    virtual bool supportsFocus() const;
     69
    6870    virtual bool recalcWillValidate() const { return false; }
    6971    virtual const AtomicString& formControlType() const;
  • trunk/Source/WebCore/html/HTMLOutputElement.cpp

    r77902 r86526  
    5555    DEFINE_STATIC_LOCAL(const AtomicString, output, ("output"));
    5656    return output;
     57}
     58
     59bool HTMLOutputElement::supportsFocus() const
     60{
     61    return Node::supportsFocus() && !disabled();
    5762}
    5863
  • trunk/Source/WebCore/html/HTMLOutputElement.h

    r86491 r86526  
    5959    virtual const AtomicString& formControlType() const;
    6060    virtual bool isEnumeratable() const { return true; }
     61    virtual bool supportsFocus() const;
    6162    virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
    6263    virtual void reset();
  • trunk/Source/WebCore/html/HTMLProgressElement.cpp

    r84156 r86526  
    6363{
    6464    return new (arena) RenderProgress(this);
     65}
     66
     67bool HTMLProgressElement::supportsFocus() const
     68{
     69    return Node::supportsFocus() && !disabled();
    6570}
    6671
  • trunk/Source/WebCore/html/HTMLProgressElement.h

    r86491 r86526  
    5050    virtual ~HTMLProgressElement();
    5151
     52    virtual bool supportsFocus() const;
     53
    5254    virtual bool recalcWillValidate() const { return false; }
    5355
Note: See TracChangeset for help on using the changeset viewer.