Move Element.contains to Node
authorarv@chromium.org <arv@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Sep 2011 19:38:18 +0000 (19:38 +0000)
committerarv@chromium.org <arv@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Sep 2011 19:38:18 +0000 (19:38 +0000)
commit193fd6b13681e2c78fb1aa8b6e8645ae26cf8936
tree3b1a7dc7e9ff9a60bec176e4d357eba67c82821b
parentfeda6f61b12465b1862d14d93ccc5b1ea48f60a3
Move Element.contains to Node
https://bugs.webkit.org/show_bug.cgi?id=67651

Reviewed by Darin Adler.

This moves the contains method from Element to Node as in the DOM4 working draft:
http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-contains

This also special cases Document contains to make it O(1) instead of O(depth).

Source/WebCore:

Tests: fast/dom/Node/contains-method.html
       perf/document-contains.html

* dom/Element.idl:
* dom/Node.cpp:
(WebCore::Node::contains): Added document special case.
* dom/Node.idl:
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::mergeParagraphs): Added a null check.

LayoutTests:

* fast/dom/Element/contains-method-expected.txt: Removed.
* fast/dom/Element/script-tests/contains-method.js: Removed.
* fast/dom/Node/contains-method-expected.txt: Added.
* fast/dom/Node/contains-method.html: Renamed from LayoutTests/fast/dom/Element/contains-method.html.
* fast/dom/Node/script-tests/contains-method.js: Added. Expanded tests.
* fast/dom/Window/window-properties-expected.txt:
* perf/document-contains-expected.txt: Added.
* perf/document-contains.html: Added.
                               Perf test to ensure that document.contains is O(1).
* platform/gtk/fast/dom/Window/window-properties-expected.txt:
* platform/mac/fast/dom/Window/window-properties-expected.txt:
* platform/qt-wk2/fast/dom/Window/window-properties-expected.txt:
* platform/qt/fast/dom/Window/window-properties-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94781 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Element/contains-method-expected.txt [deleted file]
LayoutTests/fast/dom/Element/script-tests/contains-method.js [deleted file]
LayoutTests/fast/dom/Node/contains-method-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Node/contains-method.html [moved from LayoutTests/fast/dom/Element/contains-method.html with 100% similarity]
LayoutTests/fast/dom/Node/script-tests/contains-method.js [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-properties-expected.txt
LayoutTests/perf/document-contains-expected.txt [new file with mode: 0644]
LayoutTests/perf/document-contains.html [new file with mode: 0644]
LayoutTests/platform/gtk/fast/dom/Window/window-properties-expected.txt
LayoutTests/platform/mac/fast/dom/Window/window-properties-expected.txt
LayoutTests/platform/qt-wk2/fast/dom/Window/window-properties-expected.txt
LayoutTests/platform/qt/fast/dom/Window/window-properties-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.idl
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.idl
Source/WebCore/editing/DeleteSelectionCommand.cpp