[Shadow DOM] Add Reified DOM Tree traversal internal APIs.
authorhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 06:44:15 +0000 (06:44 +0000)
committerhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 06:44:15 +0000 (06:44 +0000)
commitaecde8c3fdaf0c7eb04feced5f9e4d6e4bb96dba
tree95586c0441b42dbd6011331e5b728fcaa7387f44
parent8d67e5d4ebcf964db340615f3918cf28ce7d558d
[Shadow DOM] Add Reified DOM Tree traversal internal APIs.
https://bugs.webkit.org/show_bug.cgi?id=79197

Reviewed by Dimitri Glazkov.

Add internal APIs which can be used to traverse Reified DOM tree, which is
a result of node distribution algorithm explained in Shadow DOM spec.
https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html

Every public functions defined in ReifiedTreeTraversal are static
functions and are named in a similar way to ones defined in WebCore::Node class.
The only difference is that ReifiedTreeTraversal APIs consider shadow
hosts and also traverse nodes is Shadow DOM subtrees, crossing shadow's upper and lower boundary
transparently.

There is no actual client which uses these APIs. Follow-up patches for FocusNavigation
and EventDispatcher will use the APIs so that they can traverse node in reified tree order.

.:

* Source/autotools/symbols.filter:

Source/WebCore:

Test: fast/dom/shadow/reified-tree-traversal.html

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.exp.in:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/ReifiedTreeTraversal.cpp: Added.
(WebCore):
(WebCore::isShadowHost):
(WebCore::shadowTreeFor):
(WebCore::shadowTreeOfParent):
(WebCore::ReifiedTreeTraversal::firstChild):
(WebCore::ReifiedTreeTraversal::lastChild):
(WebCore::ReifiedTreeTraversal::lastChildWithoutCrossingUpperBoundary):
(WebCore::ReifiedTreeTraversal::traverseChild):
(WebCore::ReifiedTreeTraversal::traverseLightChildren):
(WebCore::ReifiedTreeTraversal::traverseNode):
(WebCore::ReifiedTreeTraversal::nextSibling):
(WebCore::ReifiedTreeTraversal::previousSibling):
(WebCore::ReifiedTreeTraversal::traverseSiblingOrBackToInsertionPoint):
(WebCore::ReifiedTreeTraversal::traverseSiblingInCurrentTree):
(WebCore::ReifiedTreeTraversal::traverseSiblingOrBackToYoungerShadowRoot):
(WebCore::ReifiedTreeTraversal::escapeFallbackContentElement):
(WebCore::ReifiedTreeTraversal::traverseNodeEscapingFallbackContents):
(WebCore::ReifiedTreeTraversal::parentNode):
(WebCore::ReifiedTreeTraversal::parentNodeWithoutCrossingUpperBoundary):
(WebCore::ReifiedTreeTraversal::parentNodeOrBackToInsertionPoint):
(WebCore::ReifiedTreeTraversal::parentNodeInCurrentTree):
(WebCore::ReifiedTreeTraversal::parentNodeBackToYoungerShadowRootOrHost):
(WebCore::ReifiedTreeTraversal::adjustedParentNode):
(WebCore::ReifiedTreeTraversal::traverseNextNode):
(WebCore::ReifiedTreeTraversal::traverseNextNodeWithoutCrossingUpperBoundary):
(WebCore::ReifiedTreeTraversal::traversePreviousNode):
(WebCore::ReifiedTreeTraversal::traversePreviousNodeWithoutCrossingUpperBoundary):
* dom/ReifiedTreeTraversal.h: Added.
(WebCore):
(ReifiedTreeTraversal):
* dom/ShadowTree.cpp:
(WebCore::ShadowTree::insertionPointFor):
(WebCore::ShadowTree::selectionFor):
(WebCore):
* dom/ShadowTree.h:
(WebCore):
(ShadowTree):
* html/shadow/HTMLContentSelector.cpp:
(WebCore::HTMLContentSelector::findFor):
* html/shadow/HTMLContentSelector.h:
(HTMLContentSelectionSet):
(WebCore::HTMLContentSelectionSet::find):
(HTMLContentSelector):
* html/shadow/InsertionPoint.h:
(WebCore::isInsertionPoint):
(WebCore::toInsertionPoint):
(WebCore):
* testing/Internals.cpp:
(WebCore::Internals::nextSiblingInReifiedTree):
(WebCore):
(WebCore::Internals::firstChildInReifiedTree):
(WebCore::Internals::lastChildInReifiedTree):
(WebCore::Internals::traverseNextNodeInReifiedTree):
(WebCore::Internals::traversePreviousNodeInReifiedTree):
* testing/Internals.h:
(Internals):
* testing/Internals.idl:

Source/WebKit2:

* win/WebKit2.def:
* win/WebKit2CFLite.def:

LayoutTests:

* fast/dom/shadow/reified-tree-traversal-expected.txt: Added.
* fast/dom/shadow/reified-tree-traversal.html: Added.
* platform/efl/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
* platform/wincairo/Skipped:
* platform/wk2/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112055 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/fast/dom/shadow/reified-tree-traversal-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/shadow/reified-tree-traversal.html [new file with mode: 0644]
LayoutTests/platform/efl/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
LayoutTests/platform/wincairo/Skipped
LayoutTests/platform/wk2/Skipped
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/ReifiedTreeTraversal.cpp [new file with mode: 0644]
Source/WebCore/dom/ReifiedTreeTraversal.h [new file with mode: 0644]
Source/WebCore/dom/ShadowTree.cpp
Source/WebCore/dom/ShadowTree.h
Source/WebCore/html/shadow/HTMLContentSelector.cpp
Source/WebCore/html/shadow/HTMLContentSelector.h
Source/WebCore/html/shadow/InsertionPoint.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit2/ChangeLog
Source/WebKit2/win/WebKit2.def
Source/WebKit2/win/WebKit2CFLite.def
Source/autotools/symbols.filter