Title: [99155] trunk
Revision
99155
Author
[email protected]
Date
2011-11-03 02:56:33 -0700 (Thu, 03 Nov 2011)

Log Message

[EFL] Enable the Page Visibility API.
https://bugs.webkit.org/show_bug.cgi?id=69127

Patch by Dongwoo Im <[email protected]> on 2011-11-03
Reviewed by Adam Barth.

.:

Build system changes to support ENABLE(PAGE_VISIBILITY_API) on EFL port.

* Source/cmake/OptionsEfl.cmake: Add enabled ENABLE_PAGE_VISIBILITY_API definition.
* Source/cmakeconfig.h.cmake: ditto.

Source/WebKit/efl:

Implement methods to enable the Page Visibility API on EFL port.
(http://www.w3.org/TR/page-visibility)

When the visibility status of the page is changed, browser could
inform the status to WebKit using the APIs below.

* ewk/ewk_view.cpp: Add setter/getter functions to query/set page visibility state.
(ewk_view_visibility_state_set): Sets the page visibility status.
(ewk_view_visibility_state_get): Gets the page visibility status.
* ewk/ewk_view.h: Add public prototypes.

LayoutTests:

* platform/efl/Skipped: Unskip all of the test cases of page visibility.

Modified Paths

Diff

Modified: trunk/ChangeLog (99154 => 99155)


--- trunk/ChangeLog	2011-11-03 09:27:11 UTC (rev 99154)
+++ trunk/ChangeLog	2011-11-03 09:56:33 UTC (rev 99155)
@@ -1,3 +1,15 @@
+2011-11-03  Dongwoo Im  <[email protected]>
+
+        [EFL] Enable the Page Visibility API.
+        https://bugs.webkit.org/show_bug.cgi?id=69127
+
+        Reviewed by Adam Barth.
+
+        Build system changes to support ENABLE(PAGE_VISIBILITY_API) on EFL port.
+
+        * Source/cmake/OptionsEfl.cmake: Add enabled ENABLE_PAGE_VISIBILITY_API definition.
+        * Source/cmakeconfig.h.cmake: ditto.
+
 2011-10-28  Adam Barth  <[email protected]>
 
         Rename ExceptionCodeDescription.in to DOMExceptions.in

Modified: trunk/LayoutTests/ChangeLog (99154 => 99155)


--- trunk/LayoutTests/ChangeLog	2011-11-03 09:27:11 UTC (rev 99154)
+++ trunk/LayoutTests/ChangeLog	2011-11-03 09:56:33 UTC (rev 99155)
@@ -1,3 +1,12 @@
+2011-11-03  Dongwoo Im  <[email protected]>
+
+        [EFL] Enable the Page Visibility API.
+        https://bugs.webkit.org/show_bug.cgi?id=69127
+
+        Reviewed by Adam Barth.
+
+        * platform/efl/Skipped: Unskip all of the test cases of page visibility.
+
 2011-11-03  Andrey Kosyakov  <[email protected]>
 
         Unreviewed. Cleaned up obsolete suppressions.

Modified: trunk/LayoutTests/platform/efl/Skipped (99154 => 99155)


--- trunk/LayoutTests/platform/efl/Skipped	2011-11-03 09:27:11 UTC (rev 99154)
+++ trunk/LayoutTests/platform/efl/Skipped	2011-11-03 09:56:33 UTC (rev 99155)
@@ -1080,12 +1080,6 @@
 svg/custom/image-with-prefix-in-webarchive.svg
 webarchive
 
-# The EFL port has no support for the Page Visibility API
-fast/events/page-visibility-iframe-delete-test.html
-fast/events/page-visibility-iframe-move-test.html
-fast/events/page-visibility-iframe-propagation-test.html
-fast/events/page-visibility-transition-test.html
-
 # The EFL port has no support for webtiming
 fast/dom/Window/window-properties-performance.html
 fast/dom/navigation-type-back-forward.html

Modified: trunk/Source/WebKit/efl/ChangeLog (99154 => 99155)


--- trunk/Source/WebKit/efl/ChangeLog	2011-11-03 09:27:11 UTC (rev 99154)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-11-03 09:56:33 UTC (rev 99155)
@@ -1,3 +1,21 @@
+2011-11-03  Dongwoo Im  <[email protected]>
+
+        [EFL] Enable the Page Visibility API.
+        https://bugs.webkit.org/show_bug.cgi?id=69127
+
+        Reviewed by Adam Barth.
+
+        Implement methods to enable the Page Visibility API on EFL port.
+        (http://www.w3.org/TR/page-visibility)
+
+        When the visibility status of the page is changed, browser could
+        inform the status to WebKit using the APIs below.
+
+        * ewk/ewk_view.cpp: Add setter/getter functions to query/set page visibility state.
+        (ewk_view_visibility_state_set): Sets the page visibility status.
+        (ewk_view_visibility_state_get): Gets the page visibility status.
+        * ewk/ewk_view.h: Add public prototypes.
+
 2011-11-02  Tom Sepez  <[email protected]>
 
         XSSAuditor is silent

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (99154 => 99155)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-11-03 09:27:11 UTC (rev 99154)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-11-03 09:56:33 UTC (rev 99155)
@@ -3874,6 +3874,55 @@
     evas_object_smart_callback_call(ewkView, "editorclient,contents,changed", 0);
 }
 
+Eina_Bool ewk_view_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State pageVisibleState, Eina_Bool initialState)
+{
+#if ENABLE(PAGE_VISIBILITY_API)
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EINA_FALSE);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EINA_FALSE);
+
+    switch (pageVisibleState) {
+    case EWK_PAGE_VISIBILITY_STATE_VISIBLE:
+        priv->page->setVisibilityState(WebCore::PageVisibilityStateVisible, initialState);
+        break;
+    case EWK_PAGE_VISIBILITY_STATE_HIDDEN:
+        priv->page->setVisibilityState(WebCore::PageVisibilityStateHidden, initialState);
+        break;
+    case EWK_PAGE_VISIBILITY_STATE_PRERENDER:
+        priv->page->setVisibilityState(WebCore::PageVisibilityStatePrerender, initialState);
+        break;
+    default:
+        return EINA_FALSE;
+    }
+
+    return EINA_TRUE;
+#else
+    DBG("PAGE_VISIBILITY_API is disabled.");
+    return EINA_FALSE;
+#endif
+}
+
+Ewk_Page_Visibility_State ewk_view_visibility_state_get(const Evas_Object* ewkView)
+{
+#if ENABLE(PAGE_VISIBILITY_API)
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EWK_PAGE_VISIBILITY_STATE_VISIBLE);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EWK_PAGE_VISIBILITY_STATE_VISIBLE);
+
+    switch (priv->page->visibilityState()) {
+    case WebCore::PageVisibilityStateVisible:
+        return EWK_PAGE_VISIBILITY_STATE_VISIBLE;
+    case WebCore::PageVisibilityStateHidden:
+        return EWK_PAGE_VISIBILITY_STATE_HIDDEN;
+    case WebCore::PageVisibilityStatePrerender:
+        return EWK_PAGE_VISIBILITY_STATE_PRERENDER;
+    default:
+        return EWK_PAGE_VISIBILITY_STATE_VISIBLE;
+    }
+#else
+    DBG("PAGE_VISIBILITY_API is disabled.");
+    return EWK_PAGE_VISIBILITY_STATE_VISIBLE;
+#endif
+}
+
 namespace EWKPrivate {
 
 WebCore::Page *corePage(const Evas_Object *ewkView)

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (99154 => 99155)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-11-03 09:27:11 UTC (rev 99154)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-11-03 09:56:33 UTC (rev 99155)
@@ -2218,6 +2218,51 @@
  */
 EAPI Eina_Bool ewk_view_protocol_handler_unset(Evas_Object* o);
 
+/// Defines the page visibility status.
+enum _Ewk_Page_Visibility_State {
+    EWK_PAGE_VISIBILITY_STATE_VISIBLE,
+    EWK_PAGE_VISIBILITY_STATE_HIDDEN,
+    EWK_PAGE_VISIBILITY_STATE_PRERENDER
+};
+/// Creates a type name for @a _Ewk_Page_Visibility_State.
+typedef enum _Ewk_Page_Visibility_State Ewk_Page_Visibility_State;
+
+/**
+ * Sets the visibility state of the page.
+ *
+ * This function let WebKit knows the visibility status of the page.
+ * WebKit will save the current status, and fire a "visibilitychange"
+ * event which web application can listen. Web application could slow
+ * down or stop itself when it gets a "visibilitychange" event and its
+ * visibility state is hidden. If its visibility state is visible, then
+ * the web application could use more resources.
+ *
+ * This feature makes that web application could use the resources efficiently,
+ * such as power, CPU, and etc.
+ *
+ * If more detailed description is needed, please see the specification.
+ * (http://www.w3.org/TR/page-visibility)
+ *
+ * @param o view object to set the visibility state.
+ * @param page_visible_state the visible state of the page to set.
+ * @param initial_state @c EINA_TRUE if this function is called at page initialization time,
+ *                      @c EINA_FALSE otherwise.
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure.
+ */
+EAPI Eina_Bool ewk_view_visibility_state_set(Evas_Object* o, Ewk_Page_Visibility_State page_visible_state, Eina_Bool initial_state);
+
+/**
+ * Gets the visibility state of the page.
+ *
+ * @param o view object
+ *
+ * @return enum value of @a Ewk_Page_Visibility_State that indicates current visibility status of the page.
+ *
+ * @see ewk_view_visibility_state_set()
+ */
+EAPI Ewk_Page_Visibility_State ewk_view_visibility_state_get(const Evas_Object *o);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/cmake/OptionsEfl.cmake (99154 => 99155)


--- trunk/Source/cmake/OptionsEfl.cmake	2011-11-03 09:27:11 UTC (rev 99154)
+++ trunk/Source/cmake/OptionsEfl.cmake	2011-11-03 09:56:33 UTC (rev 99155)
@@ -83,6 +83,7 @@
 WEBKIT_FEATURE(ENABLE_NETSCAPE_PLUGIN_API "Enable Netscape plugin API" DEFAULT OFF)
 WEBKIT_FEATURE(ENABLE_NOTIFICATIONS "Enable notifications" DEFAULT OFF)
 WEBKIT_FEATURE(ENABLE_ORIENTATION_EVENTS "Enable orientation events" DEFAULT OFF)
+WEBKIT_FEATURE(ENABLE_PAGE_VISIBILITY_API "Enable Page Visibility API" DEFAULT ON)
 WEBKIT_FEATURE(ENABLE_PROGRESS_TAG "Enable progress tag" DEFAULT ON)
 WEBKIT_FEATURE(ENABLE_SHARED_WORKERS "Enable shared workers" DEFAULT ON)
 WEBKIT_FEATURE(ENABLE_SVG "Enable SVG" DEFAULT ON)

Modified: trunk/Source/cmakeconfig.h.cmake (99154 => 99155)


--- trunk/Source/cmakeconfig.h.cmake	2011-11-03 09:27:11 UTC (rev 99154)
+++ trunk/Source/cmakeconfig.h.cmake	2011-11-03 09:56:33 UTC (rev 99155)
@@ -30,6 +30,7 @@
 #cmakedefine01 ENABLE_NETSCAPE_PLUGIN_API
 #cmakedefine01 ENABLE_NOTIFICATIONS
 #cmakedefine01 ENABLE_ORIENTATION_EVENTS
+#cmakedefine01 ENABLE_PAGE_VISIBILITY_API
 #cmakedefine01 ENABLE_PROGRESS_TAG
 #cmakedefine01 ENABLE_SHARED_WORKERS
 #cmakedefine01 ENABLE_SVG
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to