Title: [148088] trunk
Revision
148088
Author
[email protected]
Date
2013-04-10 03:48:30 -0700 (Wed, 10 Apr 2013)

Log Message

[GTK] Add support for Page Visibility
https://bugs.webkit.org/show_bug.cgi?id=97324

Patch by Anton Obzhirov <[email protected]> on 2013-04-10
Reviewed by Sam Weinig.

.:

Page Visibility has been enabled for GTK port.
New GTK unittest has been added.

* Source/autotools/SetupWebKitFeatures.m4:

Source/WebKit/gtk:

Implemented access to page visibility API for GTK test runner.

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::setPageVisibility):
* WebCoreSupport/DumpRenderTreeSupportGtk.h:

Source/WebKit2:

Added new unittest to test page visibility using GTK Widget visibility API.

* UIProcess/API/gtk/tests/TestWebKitWebView.cpp:
(testWebViewPageVisibility):
(beforeAll):
* UIProcess/API/gtk/tests/WebViewTest.cpp:
(WebViewTest::showInWindow):
* UIProcess/API/gtk/tests/WebViewTest.h:

Tools:

Implemented test runner API for page visibility layout tests.

* DumpRenderTree/gtk/TestRunnerGtk.cpp:
(TestRunner::resetPageVisibility):
(TestRunner::setPageVisibility):
* Scripts/webkitperl/FeatureList.pm:

LayoutTests:

* platform/gtk/TestExpectations:

Modified Paths

Diff

Modified: trunk/ChangeLog (148087 => 148088)


--- trunk/ChangeLog	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/ChangeLog	2013-04-10 10:48:30 UTC (rev 148088)
@@ -1,3 +1,15 @@
+2013-04-10  Anton Obzhirov  <[email protected]>
+
+        [GTK] Add support for Page Visibility
+        https://bugs.webkit.org/show_bug.cgi?id=97324
+
+        Reviewed by Sam Weinig.
+
+        Page Visibility has been enabled for GTK port.
+        New GTK unittest has been added.
+
+        * Source/autotools/SetupWebKitFeatures.m4:
+
 2013-04-09  Raphael Kubo da Costa  <[email protected]>
 
         [EFL] Declare TEST_THEME_DIR in a single place.

Modified: trunk/LayoutTests/ChangeLog (148087 => 148088)


--- trunk/LayoutTests/ChangeLog	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/LayoutTests/ChangeLog	2013-04-10 10:48:30 UTC (rev 148088)
@@ -1,3 +1,12 @@
+2013-04-10  Anton Obzhirov  <[email protected]>
+
+        [GTK] Add support for Page Visibility
+        https://bugs.webkit.org/show_bug.cgi?id=97324
+
+        Reviewed by Sam Weinig.
+
+        * platform/gtk/TestExpectations:
+
 2013-04-10  Zoltan Arvai  <[email protected]>
 
         [Qt] Unreviewed gardening. Rebaselining after r148049.

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (148087 => 148088)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2013-04-10 10:48:30 UTC (rev 148088)
@@ -242,13 +242,6 @@
 webkit.org/b/98942 fast/workers/worker-storagequota-query-usage.html [ Failure ]
 webkit.org/b/98942 fast/workers/shared-worker-storagequota-query-usage.html [ Failure ]
 
-# This platform does not support the Page Visibility API.
-webkit.org/b/97324 fast/events/page-visibility-iframe-delete-test.html [ Skip ]
-webkit.org/b/97324 fast/events/page-visibility-iframe-move-test.html [ Skip ]
-webkit.org/b/97324 fast/events/page-visibility-iframe-propagation-test.html [ Skip ]
-webkit.org/b/97324 fast/events/page-visibility-null-view.html [ Skip ]
-webkit.org/b/97324 fast/events/page-visibility-transition-test.html [ Skip ]
-
 # GTK doesn't support smart replace.
 webkit.org/b/61661 editing/pasteboard/drag-drop-list.html [ Failure ]
 

Modified: trunk/Source/WebKit/gtk/ChangeLog (148087 => 148088)


--- trunk/Source/WebKit/gtk/ChangeLog	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Source/WebKit/gtk/ChangeLog	2013-04-10 10:48:30 UTC (rev 148088)
@@ -1,3 +1,16 @@
+2013-04-10  Anton Obzhirov  <[email protected]>
+
+        [GTK] Add support for Page Visibility
+        https://bugs.webkit.org/show_bug.cgi?id=97324
+
+        Reviewed by Sam Weinig.
+
+        Implemented access to page visibility API for GTK test runner.
+
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::setPageVisibility):
+        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
+
 2013-04-08  Carlos Garcia Campos  <[email protected]>
 
         [GTK] DOM objects created wrapping a base class have incorrect GObject type

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp (148087 => 148088)


--- trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp	2013-04-10 10:48:30 UTC (rev 148088)
@@ -739,3 +739,14 @@
 {
     s_authenticationCallback = authenticationCallback;
 }
+
+void DumpRenderTreeSupportGtk::setPageVisibility(WebKitWebView* webView, WebCore::PageVisibilityState visibilityState, bool isInitialState)
+{
+#if ENABLE(PAGE_VISIBILITY_API)
+    Page* page = core(webView);
+    if (!page)
+        return;
+
+    page->setVisibilityState(visibilityState, isInitialState);
+#endif
+}

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h (148087 => 148088)


--- trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h	2013-04-10 10:48:30 UTC (rev 148088)
@@ -21,6 +21,7 @@
 #define DumpRenderTreeSupportGtk_h
 
 #include "JSStringRef.h"
+#include "PageVisibilityState.h"
 #include <atk/atk.h>
 #include <glib.h>
 #include <webkit/webkitdefines.h>
@@ -138,6 +139,7 @@
     typedef bool (*AuthenticationCallback) (CString& username, CString& password);
     static void setAuthenticationCallback(AuthenticationCallback);
     static AuthenticationCallback s_authenticationCallback;
+    static void setPageVisibility(WebKitWebView*, WebCore::PageVisibilityState, bool);
 
 private:
     static bool s_drtRun;

Modified: trunk/Source/WebKit2/ChangeLog (148087 => 148088)


--- trunk/Source/WebKit2/ChangeLog	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-10 10:48:30 UTC (rev 148088)
@@ -1,3 +1,19 @@
+2013-04-10  Anton Obzhirov  <[email protected]>
+
+        [GTK] Add support for Page Visibility
+        https://bugs.webkit.org/show_bug.cgi?id=97324
+
+        Reviewed by Sam Weinig.
+
+        Added new unittest to test page visibility using GTK Widget visibility API.
+
+        * UIProcess/API/gtk/tests/TestWebKitWebView.cpp:
+        (testWebViewPageVisibility):
+        (beforeAll):
+        * UIProcess/API/gtk/tests/WebViewTest.cpp:
+        (WebViewTest::showInWindow):
+        * UIProcess/API/gtk/tests/WebViewTest.h:
+
 2013-04-10  Zan Dobersek  <[email protected]>
 
         REGRESSION (r146518): WebKit2APITests/TestInspector is failing

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp (148087 => 148088)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp	2013-04-10 10:48:30 UTC (rev 148088)
@@ -1085,6 +1085,67 @@
     g_assert_cmpstr(valueString.get(), ==, indexHTML);
 }
 
+// To test page visibility API. Currently only 'visible' and 'hidden' states are implemented fully in WebCore.
+// See also http://www.w3.org/TR/2011/WD-page-visibility-20110602/ and https://developers.google.com/chrome/whitepapers/pagevisibility
+static void testWebViewPageVisibility(WebViewTest* test, gconstpointer)
+{
+    test->loadHtml("<html><title></title>"
+        "<body><p>Test Web Page Visibility</p>"
+        "<script>"
+        "document.addEventListener(\"webkitvisibilitychange\", onVisibilityChange, false);"
+        "function onVisibilityChange() {"
+        "    document.title = document.webkitVisibilityState;"
+        "}"
+        "</script>"
+        "</body></html>",
+        0);
+
+    // Wait untill the page is loaded. Initial visibility should be 'hidden'.
+    test->waitUntilLoadFinished();
+
+    GOwnPtr<GError> error;
+    WebKitJavascriptResult* _javascript_Result = test->runJavaScriptAndWaitUntilFinished("document.webkitVisibilityState;", &error.outPtr());
+    g_assert(_javascript_Result);
+    g_assert(!error.get());
+    GOwnPtr<char> valueString(WebViewTest::_javascript_ResultToCString(_javascript_Result));
+    g_assert_cmpstr(valueString.get(), ==, "hidden");
+
+    _javascript_Result = test->runJavaScriptAndWaitUntilFinished("document.webkitHidden;", &error.outPtr());
+    g_assert(_javascript_Result);
+    g_assert(!error.get());
+    g_assert(WebViewTest::_javascript_ResultToBoolean(_javascript_Result));
+
+    // Show the page. The visibility should be updated to 'visible'.
+    test->showInWindow();
+    test->waitUntilTitleChanged();
+
+    _javascript_Result = test->runJavaScriptAndWaitUntilFinished("document.webkitVisibilityState;", &error.outPtr());
+    g_assert(_javascript_Result);
+    g_assert(!error.get());
+    valueString.set(WebViewTest::_javascript_ResultToCString(_javascript_Result));
+    g_assert_cmpstr(valueString.get(), ==, "visible");
+
+    _javascript_Result = test->runJavaScriptAndWaitUntilFinished("document.webkitHidden;", &error.outPtr());
+    g_assert(_javascript_Result);
+    g_assert(!error.get());
+    g_assert(!WebViewTest::_javascript_ResultToBoolean(_javascript_Result));
+
+    // Hide the page. The visibility should be updated to 'hidden'.
+    gtk_widget_hide(GTK_WIDGET(test->m_webView));
+    test->waitUntilTitleChanged();
+
+    _javascript_Result = test->runJavaScriptAndWaitUntilFinished("document.webkitVisibilityState;", &error.outPtr());
+    g_assert(_javascript_Result);
+    g_assert(!error.get());
+    valueString.set(WebViewTest::_javascript_ResultToCString(_javascript_Result));
+    g_assert_cmpstr(valueString.get(), ==, "hidden");
+
+    _javascript_Result = test->runJavaScriptAndWaitUntilFinished("document.webkitHidden;", &error.outPtr());
+    g_assert(_javascript_Result);
+    g_assert(!error.get());
+    g_assert(WebViewTest::_javascript_ResultToBoolean(_javascript_Result));
+}
+
 void beforeAll()
 {
     WebViewTest::add("WebKitWebView", "default-context", testWebViewDefaultContext);
@@ -1105,6 +1166,7 @@
     FormClientTest::add("WebKitWebView", "submit-form", testWebViewSubmitForm);
     SaveWebViewTest::add("WebKitWebView", "save", testWebViewSave);
     WebViewTest::add("WebKitWebView", "view-mode", testWebViewMode);
+    WebViewTest::add("WebKitWebView", "page-visibility", testWebViewPageVisibility);
 }
 
 void afterAll()

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp (148087 => 148088)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp	2013-04-10 10:48:30 UTC (rev 148088)
@@ -175,6 +175,15 @@
     return FALSE;
 }
 
+void WebViewTest::showInWindow(GtkWindowType windowType)
+{
+    g_assert(!m_parentWindow);
+    m_parentWindow = gtk_window_new(windowType);
+    gtk_container_add(GTK_CONTAINER(m_parentWindow), GTK_WIDGET(m_webView));
+    gtk_widget_show(GTK_WIDGET(m_webView));
+    gtk_widget_show(m_parentWindow);
+}
+
 void WebViewTest::showInWindowAndWaitUntilMapped(GtkWindowType windowType)
 {
     g_assert(!m_parentWindow);

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h (148087 => 148088)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h	2013-04-10 10:48:30 UTC (rev 148088)
@@ -46,6 +46,7 @@
     void waitUntilLoadFinished();
     void waitUntilTitleChangedTo(const char* expectedTitle);
     void waitUntilTitleChanged();
+    void showInWindow(GtkWindowType = GTK_WINDOW_POPUP);
     void showInWindowAndWaitUntilMapped(GtkWindowType = GTK_WINDOW_POPUP);
     void resizeView(int width, int height);
     const char* mainResourceData(size_t& mainResourceDataSize);

Modified: trunk/Source/autotools/SetupWebKitFeatures.m4 (148087 => 148088)


--- trunk/Source/autotools/SetupWebKitFeatures.m4	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Source/autotools/SetupWebKitFeatures.m4	2013-04-10 10:48:30 UTC (rev 148088)
@@ -151,7 +151,7 @@
     ENABLE_NETWORK_INFO=0 \
     ENABLE_NOTIFICATIONS=0 \
     ENABLE_ORIENTATION_EVENTS=0 \
-    ENABLE_PAGE_VISIBILITY_API=0 \
+    ENABLE_PAGE_VISIBILITY_API=1 \
     ENABLE_PERFORMANCE_TIMELINE=0 \
     ENABLE_PROGRESS_ELEMENT=1 \
     ENABLE_PROXIMITY_EVENTS=0 \

Modified: trunk/Tools/ChangeLog (148087 => 148088)


--- trunk/Tools/ChangeLog	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Tools/ChangeLog	2013-04-10 10:48:30 UTC (rev 148088)
@@ -1,3 +1,17 @@
+2013-04-10  Anton Obzhirov  <[email protected]>
+
+        [GTK] Add support for Page Visibility
+        https://bugs.webkit.org/show_bug.cgi?id=97324
+
+        Reviewed by Sam Weinig.
+
+        Implemented test runner API for page visibility layout tests.
+
+        * DumpRenderTree/gtk/TestRunnerGtk.cpp:
+        (TestRunner::resetPageVisibility):
+        (TestRunner::setPageVisibility):
+        * Scripts/webkitperl/FeatureList.pm:
+
 2013-04-10  Raphael Kubo da Costa  <[email protected]>
 
         [ATK] REGRESSION(r148033): Add a stub for AccessibilityUIElement::pathDescription().

Modified: trunk/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp (148087 => 148088)


--- trunk/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp	2013-04-10 10:48:30 UTC (rev 148088)
@@ -907,12 +907,24 @@
 
 void TestRunner::resetPageVisibility()
 {
-    // FIXME: Implement this.
+    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+    DumpRenderTreeSupportGtk::setPageVisibility(webView, WebCore::PageVisibilityStateVisible, true);
 }
 
-void TestRunner::setPageVisibility(const char*)
+void TestRunner::setPageVisibility(const char* visibility)
 {
-    // FIXME: Implement this.
+    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+    String visibilityString(visibility);
+    WebCore::PageVisibilityState visibilityState = WebCore::PageVisibilityStateVisible;
+
+    if (visibilityString == "visible")
+        visibilityState = WebCore::PageVisibilityStateVisible;
+    else if (visibilityString == "hidden")
+        visibilityState = WebCore::PageVisibilityStateHidden;
+    else
+        return;
+
+    DumpRenderTreeSupportGtk::setPageVisibility(webView, visibilityState, false);
 }
 
 void TestRunner::setAutomaticLinkDetectionEnabled(bool)

Modified: trunk/Tools/Scripts/webkitperl/FeatureList.pm (148087 => 148088)


--- trunk/Tools/Scripts/webkitperl/FeatureList.pm	2013-04-10 09:47:41 UTC (rev 148087)
+++ trunk/Tools/Scripts/webkitperl/FeatureList.pm	2013-04-10 10:48:30 UTC (rev 148088)
@@ -379,7 +379,7 @@
       define => "ENABLE_ORIENTATION_EVENTS", default => isBlackBerry(), value => \$orientationEventsSupport },
 
     { option => "page-visibility-api", desc => "Toggle Page Visibility API support",
-      define => "ENABLE_PAGE_VISIBILITY_API", default => (isBlackBerry() || isEfl()), value => \$pageVisibilityAPISupport },
+      define => "ENABLE_PAGE_VISIBILITY_API", default => (isBlackBerry() || isEfl() || isGtk()), value => \$pageVisibilityAPISupport },
 
     { option => "performance-timeline", desc => "Toggle Performance Timeline support",
       define => "ENABLE_PERFORMANCE_TIMELINE", default => isGtk(), value => \$performanceTimelineSupport },
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to