Add a "preview" state to Page Visibility API implementation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Mar 2012 14:04:55 +0000 (14:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Mar 2012 14:04:55 +0000 (14:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81355

Patch by Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> on 2012-03-30
Reviewed by Adam Barth.

Updating the Page Visibility API implementation to the current spec version.

Source/WebCore:

This change is covered by fast/events/page-visibility-transition-test.html,
so no new tests needed.

* page/PageVisibilityState.cpp:
(WebCore::pageVisibilityStateString):
* page/PageVisibilityState.h:

Source/WebKit/chromium:

* public/WebPageVisibilityState.h:
* src/AssertMatchingEnums.cpp:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::setVisibilityState):

Source/WebKit/efl:

* WebCoreSupport/AssertMatchingEnums.cpp:
* ewk/ewk_view.h:

Tools:

* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::setPageVisibility):

LayoutTests:

* fast/events/page-visibility-transition-test-expected.txt:
* fast/events/page-visibility-transition-test.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112664 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/page-visibility-transition-test-expected.txt
LayoutTests/fast/events/page-visibility-transition-test.html
Source/WebCore/ChangeLog
Source/WebCore/page/PageVisibilityState.cpp
Source/WebCore/page/PageVisibilityState.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebPageVisibilityState.h
Source/WebKit/chromium/src/AssertMatchingEnums.cpp
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/AssertMatchingEnums.cpp
Source/WebKit/efl/ewk/ewk_view.h
Tools/ChangeLog
Tools/DumpRenderTree/chromium/LayoutTestController.cpp

index d20265a..2c05997 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-30  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        Add a "preview" state to Page Visibility API implementation
+        https://bugs.webkit.org/show_bug.cgi?id=81355
+
+        Reviewed by Adam Barth.
+
+        Updating the Page Visibility API implementation to the current spec version.
+
+        * fast/events/page-visibility-transition-test-expected.txt:
+        * fast/events/page-visibility-transition-test.html:
+
 2012-03-30  Alexander Pavlov  <apavlov@chromium.org>
 
         [Chromium] Unreviewed, updated fast/frames/valid.html expectation for LEOPARD.
index c92665b..69ef86c 100644 (file)
@@ -13,6 +13,10 @@ PASS document.webkitVisibilityState is "prerender"
 PASS document.webkitHidden is true
 PASS document.webkitVisibilityState is "visible"
 PASS document.webkitHidden is false
+PASS document.webkitVisibilityState is "preview"
+PASS document.webkitHidden is true
+PASS document.webkitVisibilityState is "visible"
+PASS document.webkitHidden is false
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 4aafa64..b0dd150 100644 (file)
@@ -24,6 +24,11 @@ function makePagePrerender() {
         layoutTestController.setPageVisibility("prerender");
 }
 
+function makePagePreview() {
+    if (window.layoutTestController)
+        layoutTestController.setPageVisibility("preview");
+}
+
 function checkIsPageVisible() {
     shouldBeEqualToString("document.webkitVisibilityState", "visible");
     shouldBeFalse("document.webkitHidden");
@@ -39,12 +44,19 @@ function checkIsPagePrerendering() {
     shouldBeTrue("document.webkitHidden");
 }
 
+function checkIsPageInPreview() {
+    shouldBeEqualToString("document.webkitVisibilityState", "preview");
+    shouldBeTrue("document.webkitHidden");
+}
+
 // We will try to change the visibility states as:
 //  0 - visible. (Initial - i.e. on load).
 //  1 - hidden (should fire event).
 //  2 - hidden (no event).
 //  3 - prerender (should fire event).
 //  4 - visible (should fire event).
+//  5 - preview (should fire event).
+//  6 - visible (should fire event).
 var numVisibilityChanges = 0;
 
 function startTest() {
@@ -83,6 +95,16 @@ function onVisibilityChange() {
     } else if (numVisibilityChanges == 4) {
         checkIsPageVisible();
         numVisibilityChanges++;
+        makePagePreview();
+        return;
+    } else if (numVisibilityChanges == 5) {
+        checkIsPageInPreview();
+        numVisibilityChanges++;
+        makePageVisible();
+        return;
+    } else if (numVisibilityChanges == 6) {
+        checkIsPageVisible();
+        numVisibilityChanges++;
         finishTest();
         return;
     } else {
index f534032..a8cbcbb 100644 (file)
@@ -1,3 +1,19 @@
+2012-03-30  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        Add a "preview" state to Page Visibility API implementation
+        https://bugs.webkit.org/show_bug.cgi?id=81355
+
+        Reviewed by Adam Barth.
+
+        Updating the Page Visibility API implementation to the current spec version.
+
+        This change is covered by fast/events/page-visibility-transition-test.html,
+        so no new tests needed.
+
+        * page/PageVisibilityState.cpp:
+        (WebCore::pageVisibilityStateString):
+        * page/PageVisibilityState.h:
+
 2012-03-30  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: [Regression] Execution line is not revealed after pretty print.
index 09fa603..de1196e 100644 (file)
@@ -40,6 +40,7 @@ String pageVisibilityStateString(PageVisibilityState state)
     DEFINE_STATIC_LOCAL(const String, visible, ("visible"));
     DEFINE_STATIC_LOCAL(const String, hidden, ("hidden"));
     DEFINE_STATIC_LOCAL(const String, prerender, ("prerender"));
+    DEFINE_STATIC_LOCAL(const String, preview, ("preview"));
 
     switch (state) {
     case PageVisibilityStateVisible:
@@ -48,6 +49,8 @@ String pageVisibilityStateString(PageVisibilityState state)
         return hidden;
     case PageVisibilityStatePrerender:
         return prerender;
+    case PageVisibilityStatePreview:
+        return preview;
     }
 
     ASSERT_NOT_REACHED();
index 3fab2e4..5105540 100644 (file)
@@ -40,7 +40,8 @@ namespace WebCore {
 enum PageVisibilityState {
     PageVisibilityStateVisible,
     PageVisibilityStateHidden,
-    PageVisibilityStatePrerender
+    PageVisibilityStatePrerender,
+    PageVisibilityStatePreview
 };
 
 #if ENABLE(PAGE_VISIBILITY_API)
index 00fda53..d5c6291 100644 (file)
@@ -1,3 +1,17 @@
+2012-03-30  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        Add a "preview" state to Page Visibility API implementation
+        https://bugs.webkit.org/show_bug.cgi?id=81355
+
+        Reviewed by Adam Barth.
+
+        Updating the Page Visibility API implementation to the current spec version.
+
+        * public/WebPageVisibilityState.h:
+        * src/AssertMatchingEnums.cpp:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::setVisibilityState):
+
 2012-03-30  Keishi Hattori  <keishi@webkit.org>
 
         Change ENABLE_INPUT_COLOR to ENABLE_INPUT_TYPE_COLOR and enable it for chromium
index be7705c..8eb867f 100644 (file)
@@ -38,7 +38,8 @@ namespace WebKit {
 enum WebPageVisibilityState {
     WebPageVisibilityStateVisible,
     WebPageVisibilityStateHidden,
-    WebPageVisibilityStatePrerender
+    WebPageVisibilityStatePrerender,
+    WebPageVisibilityStatePreview
 };
 
 } // namespace WebKit
index 38c80b9..e22ddb6 100644 (file)
@@ -504,6 +504,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentRenderLayer, Platfor
 COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateVisible, PageVisibilityStateVisible);
 COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateHidden, PageVisibilityStateHidden);
 COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStatePrerender, PageVisibilityStatePrerender);
+COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStatePreview, PageVisibilityStatePreview);
 
 #if ENABLE(MEDIA_STREAM)
 COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::TypeAudio, MediaStreamSource::TypeAudio);
index 1b3ab58..c3825a1 100644 (file)
@@ -3475,7 +3475,8 @@ void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
 #if ENABLE(PAGE_VISIBILITY_API)
     ASSERT(visibilityState == WebPageVisibilityStateVisible
            || visibilityState == WebPageVisibilityStateHidden
-           || visibilityState == WebPageVisibilityStatePrerender);
+           || visibilityState == WebPageVisibilityStatePrerender
+           || visibilityState == WebPageVisibilityStatePreview);
     m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int>(visibilityState)), isInitialState);
 #endif
 
index a1533bc..56b79e9 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-30  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        Add a "preview" state to Page Visibility API implementation
+        https://bugs.webkit.org/show_bug.cgi?id=81355
+
+        Reviewed by Adam Barth.
+
+        Updating the Page Visibility API implementation to the current spec version.
+
+        * WebCoreSupport/AssertMatchingEnums.cpp:
+        * ewk/ewk_view.h:
+
 2012-03-28  Nate Chapin  <japhet@chromium.org>
 
         Remove dispatchDidLoadMainResource callback, since no
index 158cf01..4a49f5f 100644 (file)
@@ -43,6 +43,7 @@
 COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_VISIBLE, PageVisibilityStateVisible);
 COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_HIDDEN, PageVisibilityStateHidden);
 COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_PRERENDER, PageVisibilityStatePrerender);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_PREVIEW, PageVisibilityStatePreview);
 #endif
 
 COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_SELECTION_NONE, VisibleSelection::NoSelection);
index 1c53335..253978d 100644 (file)
@@ -2262,7 +2262,8 @@ EAPI Eina_Bool ewk_view_js_object_add(Evas_Object *o, Ewk_JS_Object *obj, const
 enum _Ewk_Page_Visibility_State {
     EWK_PAGE_VISIBILITY_STATE_VISIBLE,
     EWK_PAGE_VISIBILITY_STATE_HIDDEN,
-    EWK_PAGE_VISIBILITY_STATE_PRERENDER
+    EWK_PAGE_VISIBILITY_STATE_PRERENDER,
+    EWK_PAGE_VISIBILITY_STATE_PREVIEW
 };
 /// Creates a type name for @a _Ewk_Page_Visibility_State.
 typedef enum _Ewk_Page_Visibility_State Ewk_Page_Visibility_State;
index 31cd05a..52792ba 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-30  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        Add a "preview" state to Page Visibility API implementation
+        https://bugs.webkit.org/show_bug.cgi?id=81355
+
+        Reviewed by Adam Barth.
+
+        Updating the Page Visibility API implementation to the current spec version.
+
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        (LayoutTestController::setPageVisibility):
+
 2012-03-30  Keishi Hattori  <keishi@webkit.org>
 
         Change ENABLE_INPUT_COLOR to ENABLE_INPUT_TYPE_COLOR and enable it for chromium
index 0baaede..226578b 100644 (file)
@@ -2187,6 +2187,8 @@ void LayoutTestController::setPageVisibility(const CppArgumentList& arguments, C
             m_shell->webView()->setVisibilityState(WebPageVisibilityStateHidden, false);
         else if (newVisibility == "prerender")
             m_shell->webView()->setVisibilityState(WebPageVisibilityStatePrerender, false);
+        else if (newVisibility == "preview")
+            m_shell->webView()->setVisibilityState(WebPageVisibilityStatePreview, false);
     }
 }