Changeset 50315 in webkit


Ignore:
Timestamp:
Oct 29, 2009 7:39:01 PM (15 years ago)
Author:
eric@webkit.org
Message:

2009-10-29 Erik Arvidsson <arv@chromium.org>

Reviewed by Eric Seidel.

Make links mouse focusable only on GTK and QT.

Links are now always mouse focusable on GTK and QT. On other platforms
the link needs a tabIndex or it needs to be contentEditable.

https://bugs.webkit.org/show_bug.cgi?id=26856

  • fast/events/click-focus-anchor-expected.txt:
  • fast/events/click-focus-anchor.html:
  • platform/gtk/fast/events/click-focus-anchor-expected.txt: Added.
  • platform/mac/fast/events/click-focus-anchor-expected.txt: Removed.
  • platform/qt/fast/events/click-focus-anchor-expected.txt: Added.

2009-10-29 Erik Arvidsson <arv@chromium.org>

Reviewed by Eric Seidel.

Make links mouse focusable only on GTK and QT.

Links are now always mouse focusable on GTK and QT. On other platforms
the link needs a tabIndex or it needs to be contentEditable.

https://bugs.webkit.org/show_bug.cgi?id=26856

  • html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::isMouseFocusable):
Location:
trunk
Files:
3 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r50314 r50315  
     12009-10-29  Erik Arvidsson  <arv@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Make links mouse focusable only on GTK and QT.
     6
     7        Links are now always mouse focusable on GTK and QT. On other platforms
     8        the link needs a tabIndex or it needs to be contentEditable.
     9
     10        https://bugs.webkit.org/show_bug.cgi?id=26856
     11
     12        * fast/events/click-focus-anchor-expected.txt:
     13        * fast/events/click-focus-anchor.html:
     14        * platform/gtk/fast/events/click-focus-anchor-expected.txt: Added.
     15        * platform/mac/fast/events/click-focus-anchor-expected.txt: Removed.
     16        * platform/qt/fast/events/click-focus-anchor-expected.txt: Added.
     17
    1182009-10-29  Jonathan Dixon  <joth@chromium.org>
    219
  • trunk/LayoutTests/fast/events/click-focus-anchor-expected.txt

    r49619 r50315  
    11This test ensures that we can click to focus an a element. Click on the element below.
    22
    3 Focusable anchor with tab index
    4 
    5 Focusable anchor
     3The expected result is platform specific. GTK and QT allows all links to be mouse focusable.
    64
    75Result
    86
    9 PASS
    10 PASS
     7
     8a1 received focus (focusable)
     9a4 received focus (focusable)
     10a5 received focus (focusable)
  • trunk/LayoutTests/fast/events/click-focus-anchor.html

    r49914 r50315  
    88Click on the element below.
    99
    10 <p><a tabindex=0 onfocus="pass('r1')" id=t1>Focusable anchor with tab index</a>
    11 <p><a onfocus="pass('r2')" id=t2 href="#">Focusable anchor</a>
     10<p>The expected result is platform specific. GTK and QT allows all links to be
     11mouse focusable.
     12
     13<div id=test-container>
     14<p><a id=a1 tabindex=0 title="focusable">Anchor with tab index</a>
     15<p><a id=a2 title="not focusable">Anchor without tab index</a>
     16<p><a id=a3 href="#" title="focusable on GTK and QT">Link without tab index</a>
     17<p><a id=a4 href="#" tabindex=0 title="focusable">Link with tab index</a>
     18<p><a id=a5 href="#" contentEditable title="focusable">Link with contentEditable</a>
     19<p contentEditable><a id=a6 href="#" focusable="not focusable">Link inside contentEditable</a>
     20</div>
    1221
    1322<p>Result
    1423
    15 <pre id=r1>FAIL</pre>
    16 <pre id=r2>FAIL</pre>
     24<pre id=out></pre>
    1725
    1826<script>
    1927
    20 function pass(id)
     28function log(s)
    2129{
    22     var el = document.getElementById(id);
    23     el.textContent = 'PASS';
     30    var el = document.getElementById('out');
     31    el.textContent += '\n' + s;
     32}
     33
     34function handleFocus(e)
     35{
     36    var el = e.target;
     37    log(el.id + ' received focus (' + el.title + ')');
    2438}
    2539
    2640if (window.layoutTestController) {
    2741    layoutTestController.dumpAsText();
    28     layoutTestController.overridePreference('WebKitTabToLinksPreferenceKey', false);
    2942}
    3043
     
    3447        return;
    3548
    36     var aElement = document.getElementById('t1');
    37     eventSender.mouseMoveTo(aElement.offsetLeft + 2, aElement.offsetTop + 2);
    38     eventSender.mouseDown();   
    39     eventSender.mouseUp();   
     49    for (var i = 1; i <= 6; i++) {
     50        var aElement = document.getElementById('a' + i);
     51        aElement.onfocus = handleFocus;
     52        eventSender.mouseMoveTo(aElement.offsetLeft + 2, aElement.offsetTop + 2);
     53        eventSender.mouseDown();
     54        eventSender.mouseUp();
     55    }
    4056
    41     aElement = document.getElementById('t2');
    42     eventSender.mouseMoveTo(aElement.offsetLeft + 2, aElement.offsetTop + 2);
    43     eventSender.mouseDown();   
    44     eventSender.mouseUp();   
     57    var tc = document.getElementById('test-container');
     58    tc.parentNode.removeChild(tc);
    4559};
    4660
  • trunk/WebCore/ChangeLog

    r50312 r50315  
     12009-10-29  Erik Arvidsson  <arv@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Make links mouse focusable only on GTK and QT.
     6
     7        Links are now always mouse focusable on GTK and QT. On other platforms
     8        the link needs a tabIndex or it needs to be contentEditable.
     9
     10        https://bugs.webkit.org/show_bug.cgi?id=26856
     11
     12        * html/HTMLAnchorElement.cpp:
     13        (WebCore::HTMLAnchorElement::isMouseFocusable):
     14
    1152009-10-29  Dan Bernstein  <mitz@apple.com>
    216
  • trunk/WebCore/html/HTMLAnchorElement.cpp

    r49809 r50315  
    7070{
    7171    // Anchor elements should be mouse focusable, https://bugs.webkit.org/show_bug.cgi?id=26856
    72 #if PLATFORM(MAC)
     72#if !PLATFORM(GTK) && !PLATFORM(QT)
    7373    if (isLink())
    74         return false;
     74        // Only allow links with tabIndex or contentEditable to be mouse focusable.
     75        return HTMLElement::supportsFocus();
    7576#endif
     77
    7678    // Allow tab index etc to control focus.
    7779    return HTMLElement::isMouseFocusable();
Note: See TracChangeset for help on using the changeset viewer.