diff options
author | simon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | 2013-05-25 23:56:01 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-09 09:55:36 +0200 |
commit | f3484678deb631b7d994dd400b609dcb7bbbc04b (patch) | |
tree | ac9039ad86485ee18607e15adca2fc6b643ddc8f /Tools/TestWebKitAPI | |
parent | 412ec5284b300668101a1db137e08a729008d164 (diff) | |
download | qtwebkit-f3484678deb631b7d994dd400b609dcb7bbbc04b.tar.gz |
Unprefix Page Visibility API
https://bugs.webkit.org/show_bug.cgi?id=102340
Source/WebCore:
Reviewed by Tim Horton.
Remove prefixes from the document properties, and the visibilitychanged event.
Rename the "preview" state to "unloaded". The "unloaded" state is never
reached yet (see https://bugs.webkit.org/show_bug.cgi?id=116769).
Add some comments to places where we should update the visibility state
when going in and out of the page cache, but cannot safely do so yet.
Tested by existing Page Visibility tests.
* dom/Document.cpp:
(WebCore::Document::pageVisibilityState):
(WebCore::Document::visibilityState):
(WebCore::Document::hidden):
(WebCore::Document::dispatchVisibilityStateChangeEvent):
* dom/Document.h:
* dom/Document.idl:
* dom/EventNames.h:
* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::stopLoading):
* page/Page.cpp:
(WebCore::Page::setVisibilityState):
* page/PageVisibilityState.cpp:
(WebCore::pageVisibilityStateString):
* page/PageVisibilityState.h:
Source/WebKit/efl:
Reviewed by Tim Horton.
Rename "preview" state to "unloaded" state.
* WebCoreSupport/AssertMatchingEnums.cpp:
* ewk/ewk_view.h:
Source/WebKit/mac:
Reviewed by Tim Horton.
Renaming of the "preview" state to "unloaded".
* WebView/WebView.mm:
* WebView/WebViewPrivate.h:
Source/WebKit2:
Reviewed by Tim Horton.
Renaming of the "preview" state to "unloaded".
* Shared/API/c/WKPageVisibilityTypes.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toPageVisibilityState):
Tools:
Reviewed by Tim Horton.
Rename "preview" state to "unloaded" state, and adjust the tests
to test for it.
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setPageVisibility):
* TestWebKitAPI/Tests/WebKit2/PageVisibilityState.cpp:
(TestWebKitAPI::setPageVisibilityStateWithEvalContinuation):
(TestWebKitAPI::didRunStep2StateChangeHiddenToPrerender):
(TestWebKitAPI::didRunStep3StateChangePrerenderToUnloaded):
(TestWebKitAPI::didRunStep4InStateUnloaded):
* TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.html:
* TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:
(TestWebKitAPI::PageVisibilityStateWithWindowChanges::runTest):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setPageVisibility):
LayoutTests:
Reviewed by Tim Horton.
Remove prefixes, adjust to state name changes.
* fast/events/page-visibility-iframe-delete-test.html:
* fast/events/page-visibility-iframe-move-test-expected.txt:
* fast/events/page-visibility-iframe-move-test.html:
* fast/events/page-visibility-iframe-propagation-test-expected.txt:
* fast/events/page-visibility-iframe-propagation-test.html:
* fast/events/page-visibility-null-view-expected.txt:
* fast/events/page-visibility-null-view.html:
* fast/events/page-visibility-transition-test-expected.txt:
* fast/events/page-visibility-transition-test.html:
Change-Id: I9751efeae0bab8136a63c7e22ad0d513fc8ceb0c
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150695 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Tools/TestWebKitAPI')
3 files changed, 16 insertions, 16 deletions
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/PageVisibilityState.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/PageVisibilityState.cpp index 8aa7495b5..8907b92e5 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/PageVisibilityState.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/PageVisibilityState.cpp @@ -37,13 +37,13 @@ static bool testDone; static void didRunStep1StateChangeVisibleToHidden(WKSerializedScriptValueRef, WKErrorRef, void*); static void didRunStep2StateChangeHiddenToPrerender(WKSerializedScriptValueRef, WKErrorRef, void*); -static void didRunStep3StateChangePrerenderToPreview(WKSerializedScriptValueRef, WKErrorRef, void*); -static void didRunStep4InStatePreview(WKSerializedScriptValueRef, WKErrorRef, void*); +static void didRunStep3StateChangePrerenderToUnloaded(WKSerializedScriptValueRef, WKErrorRef, void*); +static void didRunStep4InStateUnloaded(WKSerializedScriptValueRef, WKErrorRef, void*); static void setPageVisibilityStateWithEvalContinuation(PlatformWebView* webView, WKPageVisibilityState visibilityState, WKPageRunJavaScriptFunction callback) { WKPageSetVisibilityState(webView->page(), visibilityState, false); - WKRetainPtr<WKStringRef> javaScriptString(AdoptWK, WKStringCreateWithUTF8CString("document.webkitVisibilityState")); + WKRetainPtr<WKStringRef> javaScriptString(AdoptWK, WKStringCreateWithUTF8CString("document.visibilityState")); WKPageRunJavaScriptInMainFrame(webView->page(), javaScriptString.get(), static_cast<void*>(webView), callback); } @@ -80,18 +80,18 @@ static void didRunStep1StateChangeVisibleToHidden(WKSerializedScriptValueRef res static void didRunStep2StateChangeHiddenToPrerender(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* context) { assertSerializedScriptValueIsStringValue(resultSerializedScriptValue, error, "hidden"); - setPageVisibilityStateWithEvalContinuation(static_cast<PlatformWebView*>(context), kWKPageVisibilityStatePrerender, didRunStep3StateChangePrerenderToPreview); + setPageVisibilityStateWithEvalContinuation(static_cast<PlatformWebView*>(context), kWKPageVisibilityStatePrerender, didRunStep3StateChangePrerenderToUnloaded); } -static void didRunStep3StateChangePrerenderToPreview(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* context) +static void didRunStep3StateChangePrerenderToUnloaded(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* context) { assertSerializedScriptValueIsStringValue(resultSerializedScriptValue, error, "prerender"); - setPageVisibilityStateWithEvalContinuation(static_cast<PlatformWebView*>(context), kWKPageVisibilityStatePreview, didRunStep4InStatePreview); + setPageVisibilityStateWithEvalContinuation(static_cast<PlatformWebView*>(context), kWKPageVisibilityStateUnloaded, didRunStep4InStateUnloaded); } -static void didRunStep4InStatePreview(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* context) +static void didRunStep4InStateUnloaded(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* context) { - assertSerializedScriptValueIsStringValue(resultSerializedScriptValue, error, "preview"); + assertSerializedScriptValueIsStringValue(resultSerializedScriptValue, error, "unloaded"); testDone = true; } diff --git a/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.html b/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.html index 8a2bdc6a2..bded58089 100644 --- a/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.html +++ b/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.html @@ -1,6 +1,6 @@ <script> -document.addEventListener("webkitvisibilitychange", function(event) { +document.addEventListener("visibilitychange", function(event) { // Send a signal to the test controller via alert. - alert('webkitvisibilitychange'); + alert('visibilitychange'); }); </script> diff --git a/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm b/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm index cec138cb7..9254ffb60 100644 --- a/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm +++ b/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm @@ -108,7 +108,7 @@ void PageVisibilityStateWithWindowChanges::runTest(View view) // This WebView does not have a window and superview. PageVisibility should be "hidden". EXPECT_NULL([view window]); EXPECT_NULL([view superview]); - EXPECT_JS_EQ(view, "document.webkitVisibilityState", "hidden"); + EXPECT_JS_EQ(view, "document.visibilityState", "hidden"); // Add it to a non-visible window. PageVisibility should still be "hidden". RetainPtr<NSWindow> window(AdoptNS, [[NSWindow alloc] initWithContentRect:view.frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]); @@ -116,26 +116,26 @@ void PageVisibilityStateWithWindowChanges::runTest(View view) EXPECT_NOT_NULL([view window]); EXPECT_NOT_NULL([view superview]); EXPECT_FALSE([window.get() isVisible]); - EXPECT_JS_EQ(view, "document.webkitVisibilityState", "hidden"); + EXPECT_JS_EQ(view, "document.visibilityState", "hidden"); // Make the window visible. PageVisibility should become "visible". didGetPageSignalToContinue = false; [window.get() makeKeyAndOrderFront:nil]; EXPECT_TRUE([window.get() isVisible]); Util::run(&didGetPageSignalToContinue); - EXPECT_JS_EQ(view, "document.webkitVisibilityState", "visible"); + EXPECT_JS_EQ(view, "document.visibilityState", "visible"); // Minimize the window. PageVisibility should become "hidden". didGetPageSignalToContinue = false; [window.get() miniaturize:nil]; Util::run(&didGetPageSignalToContinue); - EXPECT_JS_EQ(view, "document.webkitVisibilityState", "hidden"); + EXPECT_JS_EQ(view, "document.visibilityState", "hidden"); // Deminimize the window. PageVisibility should become "visible". didGetPageSignalToContinue = false; [window.get() deminiaturize:nil]; Util::run(&didGetPageSignalToContinue); - EXPECT_JS_EQ(view, "document.webkitVisibilityState", "visible"); + EXPECT_JS_EQ(view, "document.visibilityState", "visible"); // Remove the WebView from its superview. PageVisibility should become "hidden". didGetPageSignalToContinue = false; @@ -144,7 +144,7 @@ void PageVisibilityStateWithWindowChanges::runTest(View view) EXPECT_NULL([view superview]); EXPECT_TRUE([window.get() isVisible]); Util::run(&didGetPageSignalToContinue); - EXPECT_JS_EQ(view, "document.webkitVisibilityState", "hidden"); + EXPECT_JS_EQ(view, "document.visibilityState", "hidden"); } TEST_F(PageVisibilityStateWithWindowChanges, WebKit) |