Commit aee865c5 authored by adele@apple.com's avatar adele@apple.com

WebCore:

        Reviewed by Beth.

        Fix for <rdar://problem/5779718> focus() does not work for anchor elements with no content

        If an anchor has zero size, don't exclude it from being focusable from JS, just exclude it
        from being keyboard focusable (using the tab key).

        * html/HTMLAnchorElement.cpp:
        (WebCore::HTMLAnchorElement::isFocusable):
        (WebCore::HTMLAnchorElement::isKeyboardFocusable):

LayoutTests:

        Reviewed by Beth.

        Test for <rdar://problem/5779718> focus() does not work for anchor elements with no content

        * fast/events/anchor-empty-focus-expected.txt: Added.
        * fast/events/anchor-empty-focus.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30761 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6c7794b0
2008-03-04 Adele Peterson <adele@apple.com>
Reviewed by Beth.
Test for <rdar://problem/5779718> focus() does not work for anchor elements with no content
* fast/events/anchor-empty-focus-expected.txt: Added.
* fast/events/anchor-empty-focus.html: Added.
2008-03-04 Dan Bernstein <mitz@apple.com>
- test for <rdar://problem/5622336> Burmese text does not render on http://www.myanmarbible.com/bible/Judson/html/index.html
This tests that focus() works on an empty anchor.
TEST PASSED
<html>
<head>
<script>
function test()
{
document.getElementById("anch").focus();
if (window.layoutTestController) {
layoutTestController.dumpAsText();
eventSender.keyDown('s');
}
}
</script>
</head>
<body onload="test()">
This tests that focus() works on an empty anchor.<br>
<a id="anch" href="#" onkeydown="document.getElementById('console').innerText = 'TEST PASSED'"></a>
<br>
<pre id="console">TEST FAILED</pre>
</body>
</html>
2008-03-04 Adele Peterson <adele@apple.com>
Reviewed by Beth.
Fix for <rdar://problem/5779718> focus() does not work for anchor elements with no content
If an anchor has zero size, don't exclude it from being focusable from JS, just exclude it
from being keyboard focusable (using the tab key).
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::isFocusable):
(WebCore::HTMLAnchorElement::isKeyboardFocusable):
2008-03-04 Chris Fleizach <cfleizach@apple.com>
Reviewed by Darin Adler.
......@@ -83,6 +83,25 @@ bool HTMLAnchorElement::isFocusable() const
if (!(m_isLink && renderer() && renderer()->style()->visibility() == VISIBLE))
return false;
return true;
}
bool HTMLAnchorElement::isMouseFocusable() const
{
return false;
}
bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const
{
if (!isFocusable())
return false;
if (!document()->frame())
return false;
if (!document()->frame()->eventHandler()->tabsToLinks(event))
return false;
// Before calling absoluteRects, check for the common case where the renderer
// or one of the continuations is non-empty, since this is a faster check and
// almost always returns true.
......@@ -102,22 +121,6 @@ bool HTMLAnchorElement::isFocusable() const
return false;
}
bool HTMLAnchorElement::isMouseFocusable() const
{
return false;
}
bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const
{
if (!isFocusable())
return false;
if (!document()->frame())
return false;
return document()->frame()->eventHandler()->tabsToLinks(event);
}
void HTMLAnchorElement::defaultEventHandler(Event* evt)
{
// React on clicks and on keypresses.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment