Changeset 148088 in webkit


Ignore:
Timestamp:
Apr 10, 2013 3:48:30 AM (11 years ago)
Author:
mario@webkit.org
Message:

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

Patch by Anton Obzhirov <Anton Obzhirov> 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:
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r148025 r148088  
     12013-04-10  Anton Obzhirov  <a.obzhirov@samsung.com>
     2
     3        [GTK] Add support for Page Visibility
     4        https://bugs.webkit.org/show_bug.cgi?id=97324
     5
     6        Reviewed by Sam Weinig.
     7
     8        Page Visibility has been enabled for GTK port.
     9        New GTK unittest has been added.
     10
     11        * Source/autotools/SetupWebKitFeatures.m4:
     12
    1132013-04-09  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
    214
  • trunk/LayoutTests/ChangeLog

    r148085 r148088  
     12013-04-10  Anton Obzhirov  <a.obzhirov@samsung.com>
     2
     3        [GTK] Add support for Page Visibility
     4        https://bugs.webkit.org/show_bug.cgi?id=97324
     5
     6        Reviewed by Sam Weinig.
     7
     8        * platform/gtk/TestExpectations:
     9
    1102013-04-10  Zoltan Arvai  <zarvai@inf.u-szeged.hu>
    211
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r148059 r148088  
    242242webkit.org/b/98942 fast/workers/worker-storagequota-query-usage.html [ Failure ]
    243243webkit.org/b/98942 fast/workers/shared-worker-storagequota-query-usage.html [ Failure ]
    244 
    245 # This platform does not support the Page Visibility API.
    246 webkit.org/b/97324 fast/events/page-visibility-iframe-delete-test.html [ Skip ]
    247 webkit.org/b/97324 fast/events/page-visibility-iframe-move-test.html [ Skip ]
    248 webkit.org/b/97324 fast/events/page-visibility-iframe-propagation-test.html [ Skip ]
    249 webkit.org/b/97324 fast/events/page-visibility-null-view.html [ Skip ]
    250 webkit.org/b/97324 fast/events/page-visibility-transition-test.html [ Skip ]
    251244
    252245# GTK doesn't support smart replace.
  • trunk/Source/WebKit/gtk/ChangeLog

    r147924 r148088  
     12013-04-10  Anton Obzhirov  <a.obzhirov@samsung.com>
     2
     3        [GTK] Add support for Page Visibility
     4        https://bugs.webkit.org/show_bug.cgi?id=97324
     5
     6        Reviewed by Sam Weinig.
     7
     8        Implemented access to page visibility API for GTK test runner.
     9
     10        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
     11        (DumpRenderTreeSupportGtk::setPageVisibility):
     12        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
     13
    1142013-04-08  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp

    r145849 r148088  
    740740    s_authenticationCallback = authenticationCallback;
    741741}
     742
     743void DumpRenderTreeSupportGtk::setPageVisibility(WebKitWebView* webView, WebCore::PageVisibilityState visibilityState, bool isInitialState)
     744{
     745#if ENABLE(PAGE_VISIBILITY_API)
     746    Page* page = core(webView);
     747    if (!page)
     748        return;
     749
     750    page->setVisibilityState(visibilityState, isInitialState);
     751#endif
     752}
  • trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h

    r145849 r148088  
    2222
    2323#include "JSStringRef.h"
     24#include "PageVisibilityState.h"
    2425#include <atk/atk.h>
    2526#include <glib.h>
     
    139140    static void setAuthenticationCallback(AuthenticationCallback);
    140141    static AuthenticationCallback s_authenticationCallback;
     142    static void setPageVisibility(WebKitWebView*, WebCore::PageVisibilityState, bool);
    141143
    142144private:
  • trunk/Source/WebKit2/ChangeLog

    r148083 r148088  
     12013-04-10  Anton Obzhirov  <a.obzhirov@samsung.com>
     2
     3        [GTK] Add support for Page Visibility
     4        https://bugs.webkit.org/show_bug.cgi?id=97324
     5
     6        Reviewed by Sam Weinig.
     7
     8        Added new unittest to test page visibility using GTK Widget visibility API.
     9
     10        * UIProcess/API/gtk/tests/TestWebKitWebView.cpp:
     11        (testWebViewPageVisibility):
     12        (beforeAll):
     13        * UIProcess/API/gtk/tests/WebViewTest.cpp:
     14        (WebViewTest::showInWindow):
     15        * UIProcess/API/gtk/tests/WebViewTest.h:
     16
    1172013-04-10  Zan Dobersek  <zdobersek@igalia.com>
    218
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp

    r144969 r148088  
    10861086}
    10871087
     1088// To test page visibility API. Currently only 'visible' and 'hidden' states are implemented fully in WebCore.
     1089// See also http://www.w3.org/TR/2011/WD-page-visibility-20110602/ and https://developers.google.com/chrome/whitepapers/pagevisibility
     1090static void testWebViewPageVisibility(WebViewTest* test, gconstpointer)
     1091{
     1092    test->loadHtml("<html><title></title>"
     1093        "<body><p>Test Web Page Visibility</p>"
     1094        "<script>"
     1095        "document.addEventListener(\"webkitvisibilitychange\", onVisibilityChange, false);"
     1096        "function onVisibilityChange() {"
     1097        "    document.title = document.webkitVisibilityState;"
     1098        "}"
     1099        "</script>"
     1100        "</body></html>",
     1101        0);
     1102
     1103    // Wait untill the page is loaded. Initial visibility should be 'hidden'.
     1104    test->waitUntilLoadFinished();
     1105
     1106    GOwnPtr<GError> error;
     1107    WebKitJavascriptResult* javascriptResult = test->runJavaScriptAndWaitUntilFinished("document.webkitVisibilityState;", &error.outPtr());
     1108    g_assert(javascriptResult);
     1109    g_assert(!error.get());
     1110    GOwnPtr<char> valueString(WebViewTest::javascriptResultToCString(javascriptResult));
     1111    g_assert_cmpstr(valueString.get(), ==, "hidden");
     1112
     1113    javascriptResult = test->runJavaScriptAndWaitUntilFinished("document.webkitHidden;", &error.outPtr());
     1114    g_assert(javascriptResult);
     1115    g_assert(!error.get());
     1116    g_assert(WebViewTest::javascriptResultToBoolean(javascriptResult));
     1117
     1118    // Show the page. The visibility should be updated to 'visible'.
     1119    test->showInWindow();
     1120    test->waitUntilTitleChanged();
     1121
     1122    javascriptResult = test->runJavaScriptAndWaitUntilFinished("document.webkitVisibilityState;", &error.outPtr());
     1123    g_assert(javascriptResult);
     1124    g_assert(!error.get());
     1125    valueString.set(WebViewTest::javascriptResultToCString(javascriptResult));
     1126    g_assert_cmpstr(valueString.get(), ==, "visible");
     1127
     1128    javascriptResult = test->runJavaScriptAndWaitUntilFinished("document.webkitHidden;", &error.outPtr());
     1129    g_assert(javascriptResult);
     1130    g_assert(!error.get());
     1131    g_assert(!WebViewTest::javascriptResultToBoolean(javascriptResult));
     1132
     1133    // Hide the page. The visibility should be updated to 'hidden'.
     1134    gtk_widget_hide(GTK_WIDGET(test->m_webView));
     1135    test->waitUntilTitleChanged();
     1136
     1137    javascriptResult = test->runJavaScriptAndWaitUntilFinished("document.webkitVisibilityState;", &error.outPtr());
     1138    g_assert(javascriptResult);
     1139    g_assert(!error.get());
     1140    valueString.set(WebViewTest::javascriptResultToCString(javascriptResult));
     1141    g_assert_cmpstr(valueString.get(), ==, "hidden");
     1142
     1143    javascriptResult = test->runJavaScriptAndWaitUntilFinished("document.webkitHidden;", &error.outPtr());
     1144    g_assert(javascriptResult);
     1145    g_assert(!error.get());
     1146    g_assert(WebViewTest::javascriptResultToBoolean(javascriptResult));
     1147}
     1148
    10881149void beforeAll()
    10891150{
     
    11061167    SaveWebViewTest::add("WebKitWebView", "save", testWebViewSave);
    11071168    WebViewTest::add("WebKitWebView", "view-mode", testWebViewMode);
     1169    WebViewTest::add("WebKitWebView", "page-visibility", testWebViewPageVisibility);
    11081170}
    11091171
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp

    r130755 r148088  
    176176}
    177177
     178void WebViewTest::showInWindow(GtkWindowType windowType)
     179{
     180    g_assert(!m_parentWindow);
     181    m_parentWindow = gtk_window_new(windowType);
     182    gtk_container_add(GTK_CONTAINER(m_parentWindow), GTK_WIDGET(m_webView));
     183    gtk_widget_show(GTK_WIDGET(m_webView));
     184    gtk_widget_show(m_parentWindow);
     185}
     186
    178187void WebViewTest::showInWindowAndWaitUntilMapped(GtkWindowType windowType)
    179188{
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h

    r130755 r148088  
    4747    void waitUntilTitleChangedTo(const char* expectedTitle);
    4848    void waitUntilTitleChanged();
     49    void showInWindow(GtkWindowType = GTK_WINDOW_POPUP);
    4950    void showInWindowAndWaitUntilMapped(GtkWindowType = GTK_WINDOW_POPUP);
    5051    void resizeView(int width, int height);
  • trunk/Source/autotools/SetupWebKitFeatures.m4

    r147967 r148088  
    152152    ENABLE_NOTIFICATIONS=0 \
    153153    ENABLE_ORIENTATION_EVENTS=0 \
    154     ENABLE_PAGE_VISIBILITY_API=0 \
     154    ENABLE_PAGE_VISIBILITY_API=1 \
    155155    ENABLE_PERFORMANCE_TIMELINE=0 \
    156156    ENABLE_PROGRESS_ELEMENT=1 \
  • trunk/Tools/ChangeLog

    r148086 r148088  
     12013-04-10  Anton Obzhirov  <a.obzhirov@samsung.com>
     2
     3        [GTK] Add support for Page Visibility
     4        https://bugs.webkit.org/show_bug.cgi?id=97324
     5
     6        Reviewed by Sam Weinig.
     7
     8        Implemented test runner API for page visibility layout tests.
     9
     10        * DumpRenderTree/gtk/TestRunnerGtk.cpp:
     11        (TestRunner::resetPageVisibility):
     12        (TestRunner::setPageVisibility):
     13        * Scripts/webkitperl/FeatureList.pm:
     14
    1152013-04-10  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
    216
  • trunk/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp

    r145940 r148088  
    908908void TestRunner::resetPageVisibility()
    909909{
     910    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
     911    DumpRenderTreeSupportGtk::setPageVisibility(webView, WebCore::PageVisibilityStateVisible, true);
     912}
     913
     914void TestRunner::setPageVisibility(const char* visibility)
     915{
     916    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
     917    String visibilityString(visibility);
     918    WebCore::PageVisibilityState visibilityState = WebCore::PageVisibilityStateVisible;
     919
     920    if (visibilityString == "visible")
     921        visibilityState = WebCore::PageVisibilityStateVisible;
     922    else if (visibilityString == "hidden")
     923        visibilityState = WebCore::PageVisibilityStateHidden;
     924    else
     925        return;
     926
     927    DumpRenderTreeSupportGtk::setPageVisibility(webView, visibilityState, false);
     928}
     929
     930void TestRunner::setAutomaticLinkDetectionEnabled(bool)
     931{
    910932    // FIXME: Implement this.
    911933}
    912934
    913 void TestRunner::setPageVisibility(const char*)
     935void TestRunner::setStorageDatabaseIdleInterval(double)
    914936{
    915937    // FIXME: Implement this.
    916938}
    917939
    918 void TestRunner::setAutomaticLinkDetectionEnabled(bool)
    919 {
    920     // FIXME: Implement this.
    921 }
    922 
    923 void TestRunner::setStorageDatabaseIdleInterval(double)
    924 {
    925     // FIXME: Implement this.
    926 }
    927 
    928940void TestRunner::closeIdleLocalStorageDatabases()
    929941{
  • trunk/Tools/Scripts/webkitperl/FeatureList.pm

    r147998 r148088  
    380380
    381381    { option => "page-visibility-api", desc => "Toggle Page Visibility API support",
    382       define => "ENABLE_PAGE_VISIBILITY_API", default => (isBlackBerry() || isEfl()), value => \$pageVisibilityAPISupport },
     382      define => "ENABLE_PAGE_VISIBILITY_API", default => (isBlackBerry() || isEfl() || isGtk()), value => \$pageVisibilityAPISupport },
    383383
    384384    { option => "performance-timeline", desc => "Toggle Performance Timeline support",
Note: See TracChangeset for help on using the changeset viewer.