| Differences between
and this patch
- a/LayoutTests/ChangeLog +14 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-05-15  Kenichi Ishibashi  <bashi@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
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
1
2011-05-12  MORITA Hajime  <morrita@google.com>
15
2011-05-12  MORITA Hajime  <morrita@google.com>
2
16
3
        Reviewed by Dimitri Glazkov.
17
        Reviewed by Dimitri Glazkov.
- a/LayoutTests/fast/forms/focus-with-display-block-expected.txt +16 lines
Line 0 a/LayoutTests/fast/forms/focus-with-display-block-expected.txt_sec1
1
This test ensures that <output>, <meter> and <progress> are not focused.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
- Moves the focus by using keyDown() in DRT, otherwise using element.focus().
7
- checkFocus() returns true when <output>, <meter> and <progress> do not have focus.
8
PASS checkFocus() is true
9
PASS checkFocus() is true
10
PASS checkFocus() is true
11
PASS checkFocus() is true
12
PASS successfullyParsed is true
13
14
TEST COMPLETE
15
Text in output element
16
- a/LayoutTests/fast/forms/focus-with-display-block.html +63 lines
Line 0 a/LayoutTests/fast/forms/focus-with-display-block.html_sec1
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2
<html>
3
<head>
4
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
5
<script src="../../fast/js/resources/js-test-pre.js"></script>
6
<style>
7
output, meter, progress {
8
    display: block;
9
}
10
</style>
11
</head>
12
<body>
13
<p id="description"></p>
14
<div id="console"></div>
15
<script>
16
description('This test ensures that &lt;output&gt;, &lt;meter&gt; and &lt;progress&gt; are not focused.');
17
18
function moveFocus(element) {
19
    if (window.layoutTestController)
20
        eventSender.keyDown('\t');
21
    else
22
        element.focus();
23
}
24
25
function checkFocus() {
26
    var active = document.activeElement.nodeName;
27
    if (active == "OUTPUT" || active == "METER" || active == "PROGRESS") {
28
        debug(active + ' should not have focus.');
29
        return false;
30
    }
31
    return true;
32
}
33
34
var input = document.createElement('input');
35
var output = document.createElement('output');
36
var progress = document.createElement('progress');
37
var meter = document.createElement('meter');
38
39
// Set a placeholder text to the output element to display the element.
40
output.innerHTML = 'Text in output element';
41
42
document.body.appendChild(input);
43
document.body.appendChild(output);
44
document.body.appendChild(progress);
45
document.body.appendChild(meter);
46
47
debug('- Moves the focus by using keyDown() in DRT, otherwise using element.focus().');
48
debug('- checkFocus() returns true when &lt;output&gt;, &lt;meter&gt; and &lt;progress&gt; do not have focus.');
49
50
moveFocus(input);
51
shouldBeTrue('checkFocus()');
52
moveFocus(output);
53
shouldBeTrue('checkFocus()');
54
moveFocus(progress);
55
shouldBeTrue('checkFocus()');
56
moveFocus(meter);
57
shouldBeTrue('checkFocus()');
58
59
var successfullyParsed = true;
60
</script>
61
<script src="../../fast/js/resources/js-test-post.js"></script>
62
</body>
63
</html>
- a/LayoutTests/platform/mac/accessibility/progressbar.html -2 / +2 lines
Lines 12-19 var successfullyParsed = false; a/LayoutTests/platform/mac/accessibility/progressbar.html_sec1
12
<span tabindex="0" role="progressbar" id="progressbar1" aria-valuenow=7 aria-valuemin=0 aria-valuemax=10>X</span>
12
<span tabindex="0" role="progressbar" id="progressbar1" aria-valuenow=7 aria-valuemin=0 aria-valuemax=10>X</span>
13
<span tabindex="0" role="progressbar" id="progressbar2" aria-valuemax=10>X</span>
13
<span tabindex="0" role="progressbar" id="progressbar2" aria-valuemax=10>X</span>
14
14
15
<progress id="progressbar3" value=7 max=10></progress>
15
<progress tabindex="0" id="progressbar3" value=7 max=10></progress>
16
<progress id="progressbar4"></progress>
16
<progress tabindex="0" id="progressbar4"></progress>
17
17
18
<p id="description"></p>
18
<p id="description"></p>
19
<div id="console"></div>
19
<div id="console"></div>
- a/Source/WebCore/ChangeLog +27 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-05-15  Kenichi Ishibashi  <bashi@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
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
1
2011-05-12  MORITA Hajime  <morrita@google.com>
28
2011-05-12  MORITA Hajime  <morrita@google.com>
2
29
3
        ShadowContentElement should affect the order of renderer children
30
        ShadowContentElement should affect the order of renderer children
- a/Source/WebCore/html/HTMLFormControlElement.h -2 / +1 lines
Lines 117-122 protected: a/Source/WebCore/html/HTMLFormControlElement.h_sec1
117
    virtual void removedFromDocument();
117
    virtual void removedFromDocument();
118
    virtual void willMoveToNewOwnerDocument();
118
    virtual void willMoveToNewOwnerDocument();
119
119
120
    virtual bool supportsFocus() const;
120
    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
121
    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
121
    virtual bool isMouseFocusable() const;
122
    virtual bool isMouseFocusable() const;
122
123
Lines 139-146 private: a/Source/WebCore/html/HTMLFormControlElement.h_sec2
139
140
140
    virtual bool isFormControlElement() const { return true; }
141
    virtual bool isFormControlElement() const { return true; }
141
142
142
    virtual bool supportsFocus() const;
143
144
    virtual short tabIndex() const;
143
    virtual short tabIndex() const;
145
144
146
    virtual HTMLFormElement* virtualForm() const;
145
    virtual HTMLFormElement* virtualForm() const;
- a/Source/WebCore/html/HTMLMeterElement.cpp +5 lines
Lines 66-71 const AtomicString& HTMLMeterElement::formControlType() const a/Source/WebCore/html/HTMLMeterElement.cpp_sec1
66
    return meter;
66
    return meter;
67
}
67
}
68
68
69
bool HTMLMeterElement::supportsFocus() const
70
{
71
    return Node::supportsFocus() && !disabled();
72
}
73
69
void HTMLMeterElement::parseMappedAttribute(Attribute* attribute)
74
void HTMLMeterElement::parseMappedAttribute(Attribute* attribute)
70
{
75
{
71
    if (attribute->name() == valueAttr || attribute->name() == minAttr || attribute->name() == maxAttr || attribute->name() == lowAttr || attribute->name() == highAttr || attribute->name() == optimumAttr)
76
    if (attribute->name() == valueAttr || attribute->name() == minAttr || attribute->name() == maxAttr || attribute->name() == lowAttr || attribute->name() == highAttr || attribute->name() == optimumAttr)
- a/Source/WebCore/html/HTMLMeterElement.h +2 lines
Lines 65-70 private: a/Source/WebCore/html/HTMLMeterElement.h_sec1
65
    HTMLMeterElement(const QualifiedName&, Document*, HTMLFormElement*);
65
    HTMLMeterElement(const QualifiedName&, Document*, HTMLFormElement*);
66
    virtual ~HTMLMeterElement();
66
    virtual ~HTMLMeterElement();
67
67
68
    virtual bool supportsFocus() const;
69
68
    virtual bool recalcWillValidate() const { return false; }
70
    virtual bool recalcWillValidate() const { return false; }
69
    virtual const AtomicString& formControlType() const;
71
    virtual const AtomicString& formControlType() const;
70
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
72
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- a/Source/WebCore/html/HTMLOutputElement.cpp +5 lines
Lines 56-61 const AtomicString& HTMLOutputElement::formControlType() const a/Source/WebCore/html/HTMLOutputElement.cpp_sec1
56
    return output;
56
    return output;
57
}
57
}
58
58
59
bool HTMLOutputElement::supportsFocus() const
60
{
61
    return Node::supportsFocus() && !disabled();
62
}
63
59
void HTMLOutputElement::parseMappedAttribute(Attribute* attr)
64
void HTMLOutputElement::parseMappedAttribute(Attribute* attr)
60
{
65
{
61
    if (attr->name() == HTMLNames::forAttr)
66
    if (attr->name() == HTMLNames::forAttr)
- a/Source/WebCore/html/HTMLOutputElement.h +1 lines
Lines 58-63 private: a/Source/WebCore/html/HTMLOutputElement.h_sec1
58
    virtual void parseMappedAttribute(Attribute*);
58
    virtual void parseMappedAttribute(Attribute*);
59
    virtual const AtomicString& formControlType() const;
59
    virtual const AtomicString& formControlType() const;
60
    virtual bool isEnumeratable() const { return true; }
60
    virtual bool isEnumeratable() const { return true; }
61
    virtual bool supportsFocus() const;
61
    virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
62
    virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
62
    virtual void reset();
63
    virtual void reset();
63
64
- a/Source/WebCore/html/HTMLProgressElement.cpp +5 lines
Lines 64-69 RenderObject* HTMLProgressElement::createRenderer(RenderArena* arena, RenderStyl a/Source/WebCore/html/HTMLProgressElement.cpp_sec1
64
    return new (arena) RenderProgress(this);
64
    return new (arena) RenderProgress(this);
65
}
65
}
66
66
67
bool HTMLProgressElement::supportsFocus() const
68
{
69
    return Node::supportsFocus() && !disabled();
70
}
71
67
const AtomicString& HTMLProgressElement::formControlType() const
72
const AtomicString& HTMLProgressElement::formControlType() const
68
{
73
{
69
    DEFINE_STATIC_LOCAL(const AtomicString, progress, ("progress"));
74
    DEFINE_STATIC_LOCAL(const AtomicString, progress, ("progress"));
- a/Source/WebCore/html/HTMLProgressElement.h +2 lines
Lines 49-54 private: a/Source/WebCore/html/HTMLProgressElement.h_sec1
49
    HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
49
    HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
50
    virtual ~HTMLProgressElement();
50
    virtual ~HTMLProgressElement();
51
51
52
    virtual bool supportsFocus() const;
53
52
    virtual bool recalcWillValidate() const { return false; }
54
    virtual bool recalcWillValidate() const { return false; }
53
55
54
    virtual const AtomicString& formControlType() const;
56
    virtual const AtomicString& formControlType() const;

Return to Bug 60602