Add API to access closed shadowRoot in InjectedBundle
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jan 2016 20:29:30 +0000 (20:29 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jan 2016 20:29:30 +0000 (20:29 +0000)
commit9487319ceec68841e8258924775e3b188901312b
tree191b129c7d286c2210cde1a38bbd89ba3e9935b0
parent1b94fd374cc8d1075979d14f35a2ff62d07c0091
Add API to access closed shadowRoot in InjectedBundle
https://bugs.webkit.org/show_bug.cgi?id=153533

Reviewed by Antti Koivisto.

Source/WebCore:

Always return the shadow root in Element.shadowRootForBindings when the DOM wrapper world has
shadowRootIsAlwaysOpen set to true. Also renamed bindingShadowRoot to shadowRootForBindings
to be consistent.

* bindings/js/DOMWrapperWorld.h:
(WebCore::DOMWrapperWorld::setShadowRootIsAlwaysOpen): Added.
(WebCore::DOMWrapperWorld::shadowRootIsAlwaysOpen): Added.
* dom/Element.cpp:
(WebCore::Element::shadowRootForBindings): Renamed from bindingShadowRoot.
* dom/Element.h:
* dom/Element.idl:

Source/WebKit2:

Added WKBundleScriptWorldMakeAllShadowRootsOpen to make all shadow roots open.
This is needed to keep supporting certain browser-level features such as autofill.

* WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp:
(WKBundleScriptWorldMakeAllShadowRootsOpen): Added.
* WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h:
* WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
(WebKit::InjectedBundleScriptWorld::makeAllShadowRootsOpen): Added.
* WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:

Tools:

Added WebKit2 API test for WKBundleScriptWorldMakeAllShadowRootsOpen.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp: Added.
(TestWebKitAPI::runJavaScriptAlert):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/InjectedBundleMakrAllShadowRootOpen_Bundle.cpp: Added.
(TestWebKitAPI::InjectedBundleMakrAllShadowRootOpenTest::InjectedBundleMakrAllShadowRootOpenTest):
(TestWebKitAPI::InjectedBundleMakrAllShadowRootOpenTest::initialize):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@195686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/DOMWrapperWorld.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Element.idl
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootOpen_Bundle.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleMakeAllShadowRootsOpen.cpp [new file with mode: 0644]