WebCore:
authoradele@apple.com <adele@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Mar 2008 01:30:28 +0000 (01:30 +0000)
committeradele@apple.com <adele@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Mar 2008 01:30:28 +0000 (01:30 +0000)
commit1467e8e7f7f7a74c27712e1f124176f3ac5f41f8
tree3b66957f6a3fb3d02d884c02e9b87a6982e11213
parent630166afc94bc615b7da1ea424d4424f94cfefb0
WebCore:

        Reviewed by Darin.

        Fixes for for <rdar://problem/5785892> Implement activeElement attribute for HTMLDocument (HTML5)
        and <rdar://problem/5785895> Implement hasFocus() for HTMLDocument (HTML5)

        Tests: fast/dom/HTMLDocument/activeElement.html
               fast/dom/HTMLDocument/hasFocus.html

        * html/HTMLDocument.cpp:
        (WebCore::HTMLDocument::activeElement): Added. Returns the focused element, or the body element if nothing's focused.
        (WebCore::HTMLDocument::hasFocus): Added. Returns whether or not the document has focus (inclusive of sub-frames).
        * html/HTMLDocument.h: Added methods for activeElement and hasFocus.
        * html/HTMLDocument.idl: Added definitions for activeElement and hasFocus.

WebKitTools:

        Reviewed by Darin.

        Updated for testing <rdar://problem/5785895> Implement hasFocus() for HTMLDocument (HTML5)

        * DumpRenderTree/mac/UIDelegate.mm:
        (-[UIDelegate webViewFocus:]): Remove duplicate code that was also in LayoutTestController::setWindowIsKey
        (-[UIDelegate webViewUnfocus:]): Added.  In Safari, the default is to focus another window if there is one.
         To easily test cases where the window is unfocused, I made this just call setWindowIsKey(false).

LayoutTests:

        Reviewed by Darin.

        Tests for <rdar://problem/5785892> Implement activeElement attribute for HTMLDocument (HTML5)
        and <rdar://problem/5785895> Implement hasFocus() for HTMLDocument (HTML5)

        * fast/dom/HTMLDocument/activeElement-expected.txt: Added.
        * fast/dom/HTMLDocument/activeElement.html: Added.
        * fast/dom/HTMLDocument/hasFocus-expected.txt: Added.
        * fast/dom/HTMLDocument/hasFocus.html: Added.
        * fast/dom/HTMLDocument/resources/hasFocus-iframe.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30866 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLDocument/activeElement-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLDocument/activeElement.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLDocument/hasFocus-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLDocument/hasFocus.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLDocument/resources/hasFocus-iframe.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLDocument.cpp
WebCore/html/HTMLDocument.h
WebCore/html/HTMLDocument.idl
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/mac/UIDelegate.mm