Move focus management API from HTMLDocument to Document
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Apr 2014 21:40:26 +0000 (21:40 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Apr 2014 21:40:26 +0000 (21:40 +0000)
commit604498f8631adfdb9fa14c352031abfa36bab6a0
tree2e89b54d737fbe8ee8c4c0e62cdfb940a9502271
parent134dd68fb5e6d0d34a896632526493486f778598
Move focus management API from HTMLDocument to Document
https://bugs.webkit.org/show_bug.cgi?id=131079
<rdar://problem/16220103>

Reviewed by Timothy Hatcher.

Source/WebCore:

Merged from Blink (patch by Christophe Dumez):
https://src.chromium.org/viewvc/blink?view=rev&revision=165515

Move hasFocus() and attribute activeElement from interface HTMLDocument
to DOMDocument as per section Focus management APIs of the HTML5 standard:
<http://www.whatwg.org/specs/web-apps/current-work/#focus-management-apis> (1 April 2014).

Test: fast/dom/Document/xml-document-focus.xml

* bindings/objc/PublicDOMInterfaces.h: Moved hasFocus() and property activeElement from
interface DOMHTMLDocument to DOMDocument.
* dom/Document.cpp:
(WebCore::Document::activeElement): Added.
(WebCore::Document::hasFocus): Added.
* dom/Document.h:
* dom/Document.idl:
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::activeElement): Deleted.
(WebCore::HTMLDocument::hasFocus): Deleted.
* html/HTMLDocument.h:
* html/HTMLDocument.idl:

LayoutTests:

Derived from a Blink patch by Christophe Dumez:
https://src.chromium.org/viewvc/blink?view=rev&revision=165515

Made the test in <https://src.chromium.org/viewvc/blink?view=rev&revision=165515> a valid XHTML
document. Additionally taught LayoutTests/resources/{js-test, js-test-pre}.js to create actual
HTML elements so that these scripts can be used to write DRT tests in XML documents.

* fast/dom/Document/xml-document-focus-expected.txt: Added.
* fast/dom/Document/xml-document-focus.xml: Added.
* resources/js-test-pre.js: Added function createHTMLElement() and modified code to use it
instead of document.createElement() so as to work around <https://bugs.webkit.org/show_bug.cgi?id=131074>.
* resources/js-test.js: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Document/xml-document-focus-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Document/xml-document-focus.xml [new file with mode: 0644]
LayoutTests/resources/js-test-pre.js
LayoutTests/resources/js-test.js
Source/WebCore/ChangeLog
Source/WebCore/bindings/objc/PublicDOMInterfaces.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/html/HTMLDocument.cpp
Source/WebCore/html/HTMLDocument.h
Source/WebCore/html/HTMLDocument.idl