Changeset 150695 in webkit


Ignore:
Timestamp:
May 25, 2013 4:56:01 PM (11 years ago)
Author:
Simon Fraser
Message:

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:
Location:
trunk
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r150694 r150695  
     12013-05-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Unprefix Page Visibility API
     4        https://bugs.webkit.org/show_bug.cgi?id=102340
     5
     6        Reviewed by Tim Horton.
     7       
     8        Remove prefixes, adjust to state name changes.
     9
     10        * fast/events/page-visibility-iframe-delete-test.html:
     11        * fast/events/page-visibility-iframe-move-test-expected.txt:
     12        * fast/events/page-visibility-iframe-move-test.html:
     13        * fast/events/page-visibility-iframe-propagation-test-expected.txt:
     14        * fast/events/page-visibility-iframe-propagation-test.html:
     15        * fast/events/page-visibility-null-view-expected.txt:
     16        * fast/events/page-visibility-null-view.html:
     17        * fast/events/page-visibility-transition-test-expected.txt:
     18        * fast/events/page-visibility-transition-test.html:
     19
    1202013-05-25  Filip Pizlo  <fpizlo@apple.com>
    221
  • trunk/LayoutTests/fast/events/page-visibility-iframe-delete-test.html

    r140469 r150695  
    3333
    3434    document.addEventListener(
    35         "webkitvisibilitychange", onMainPageVisibilityChange, false);
     35        "visibilitychange", onMainPageVisibilityChange, false);
    3636    frame2.contentDocument.addEventListener(
    37         "webkitvisibilitychange", onFrame2VisibilityChange, false);
     37        "visibilitychange", onFrame2VisibilityChange, false);
    3838    // Change the visibility of the current page to invisible.
    3939    if (window.testRunner) {
  • trunk/LayoutTests/fast/events/page-visibility-iframe-move-test-expected.txt

    r87802 r150695  
    66Window 1 Loaded
    77Window 2 Loaded
    8 PASS window.document.webkitHidden is false
    9 PASS window2.document.webkitHidden is false
    10 PASS iframe.contentDocument.webkitHidden is false
    11 PASS window.document.webkitHidden is true
    12 PASS window2.document.webkitHidden is false
    13 PASS iframe.contentDocument.webkitHidden is false
     8PASS window.document.hidden is false
     9PASS window2.document.hidden is false
     10PASS iframe.contentDocument.hidden is false
     11PASS window.document.hidden is true
     12PASS window2.document.hidden is false
     13PASS iframe.contentDocument.hidden is false
    1414Adopted iframe to Window 1
    15 PASS window.document.webkitHidden is true
    16 PASS window2.document.webkitHidden is false
    17 PASS iframe.contentDocument.webkitHidden is true
     15PASS window.document.hidden is true
     16PASS window2.document.hidden is false
     17PASS iframe.contentDocument.hidden is true
    1818PASS successfullyParsed is true
    1919
  • trunk/LayoutTests/fast/events/page-visibility-iframe-move-test.html

    r120792 r150695  
    1818    iframe = window2.document.getElementById("iframe");
    1919
    20     shouldBeFalse("window.document.webkitHidden");
    21     shouldBeFalse("window2.document.webkitHidden");
    22     shouldBeFalse("iframe.contentDocument.webkitHidden");
     20    shouldBeFalse("window.document.hidden");
     21    shouldBeFalse("window2.document.hidden");
     22    shouldBeFalse("iframe.contentDocument.hidden");
    2323
    2424    // Change the visibility of the current page to invisible.
     
    3030
    3131function onVisibilityChange() {
    32     shouldBeTrue("window.document.webkitHidden");
    33     shouldBeFalse("window2.document.webkitHidden");
    34     shouldBeFalse("iframe.contentDocument.webkitHidden");
     32    shouldBeTrue("window.document.hidden");
     33    shouldBeFalse("window2.document.hidden");
     34    shouldBeFalse("iframe.contentDocument.hidden");
    3535
    3636    window.document.adoptNode(iframe);
     
    3838    debug("Adopted iframe to Window 1");
    3939
    40     shouldBeTrue("window.document.webkitHidden");
    41     shouldBeFalse("window2.document.webkitHidden");
    42     shouldBeTrue("iframe.contentDocument.webkitHidden");
     40    shouldBeTrue("window.document.hidden");
     41    shouldBeFalse("window2.document.hidden");
     42    shouldBeTrue("iframe.contentDocument.hidden");
    4343
    4444    window2.close();
     
    5454
    5555    debug("Window 1 Loaded");
    56     document.addEventListener("webkitvisibilitychange",
     56    document.addEventListener("visibilitychange",
    5757                              onVisibilityChange, false);
    5858
  • trunk/LayoutTests/fast/events/page-visibility-iframe-propagation-test-expected.txt

    r87802 r150695  
    55
    66Main Page:
    7 PASS document.webkitVisibilityState is "visible"
    8 PASS document.webkitHidden is false
     7PASS document.visibilityState is "visible"
     8PASS document.hidden is false
    99Child Frame:
    10 PASS childFrame.contentDocument.webkitVisibilityState is "visible"
    11 PASS childFrame.contentDocument.webkitHidden is false
     10PASS childFrame.contentDocument.visibilityState is "visible"
     11PASS childFrame.contentDocument.hidden is false
    1212Main Page:
    13 PASS document.webkitVisibilityState is "hidden"
    14 PASS document.webkitHidden is true
     13PASS document.visibilityState is "hidden"
     14PASS document.hidden is true
    1515Child Frame:
    16 PASS childFrame.contentDocument.webkitVisibilityState is "hidden"
    17 PASS childFrame.contentDocument.webkitHidden is true
     16PASS childFrame.contentDocument.visibilityState is "hidden"
     17PASS childFrame.contentDocument.hidden is true
    1818Main Page:
    19 PASS document.webkitVisibilityState is "visible"
    20 PASS document.webkitHidden is false
     19PASS document.visibilityState is "visible"
     20PASS document.hidden is false
    2121Child Frame:
    22 PASS childFrame.contentDocument.webkitVisibilityState is "visible"
    23 PASS childFrame.contentDocument.webkitHidden is false
     22PASS childFrame.contentDocument.visibilityState is "visible"
     23PASS childFrame.contentDocument.hidden is false
    2424PASS successfullyParsed is true
    2525
  • trunk/LayoutTests/fast/events/page-visibility-iframe-propagation-test.html

    r120792 r150695  
    2222function checkIsPageVisible() {
    2323    debug("Main Page:");
    24     shouldBeEqualToString("document.webkitVisibilityState", "visible");
    25     shouldBeFalse("document.webkitHidden");
     24    shouldBeEqualToString("document.visibilityState", "visible");
     25    shouldBeFalse("document.hidden");
    2626}
    2727
    2828function checkIsPageHidden() {
    2929    debug("Main Page:");
    30     shouldBeEqualToString("document.webkitVisibilityState", "hidden");
    31     shouldBeTrue("document.webkitHidden");
     30    shouldBeEqualToString("document.visibilityState", "hidden");
     31    shouldBeTrue("document.hidden");
    3232}
    3333
    3434function checkIsChildFrameVisible() {
    3535    debug("Child Frame:");
    36     shouldBeEqualToString("childFrame.contentDocument.webkitVisibilityState",
     36    shouldBeEqualToString("childFrame.contentDocument.visibilityState",
    3737                          "visible");
    38     shouldBeFalse("childFrame.contentDocument.webkitHidden");
     38    shouldBeFalse("childFrame.contentDocument.hidden");
    3939}
    4040
    4141function checkIsChildFrameHidden() {
    4242    debug("Child Frame:");
    43     shouldBeEqualToString("childFrame.contentDocument.webkitVisibilityState",
     43    shouldBeEqualToString("childFrame.contentDocument.visibilityState",
    4444                          "hidden");
    45     shouldBeTrue("childFrame.contentDocument.webkitHidden");
     45    shouldBeTrue("childFrame.contentDocument.hidden");
    4646}
    4747
     
    5757    childFrame = document.getElementById("childFrame");
    5858    childFrame.contentDocument.addEventListener(
    59         "webkitvisibilitychange", onChildFrameVisibilityChange, false);
    60     document.addEventListener("webkitvisibilitychange",
     59        "visibilitychange", onChildFrameVisibilityChange, false);
     60    document.addEventListener("visibilitychange",
    6161                              onVisibilityChange, false);
    6262
  • trunk/LayoutTests/fast/events/page-visibility-null-view-expected.txt

    r131530 r150695  
    55
    66PASS subdocument.defaultView == null is true
    7 PASS subdocument.webkitVisibilityState is "hidden"
    8 PASS subdocument.webkitHidden is true
     7PASS subdocument.visibilityState is "hidden"
     8PASS subdocument.hidden is true
    99PASS successfullyParsed is true
    1010
  • trunk/LayoutTests/fast/events/page-visibility-null-view.html

    r131530 r150695  
    1010
    1111shouldBeTrue("subdocument.defaultView == null");
    12 shouldBeEqualToString("subdocument.webkitVisibilityState", "hidden");
    13 shouldBeTrue("subdocument.webkitHidden");
     12shouldBeEqualToString("subdocument.visibilityState", "hidden");
     13shouldBeTrue("subdocument.hidden");
    1414
    1515</script>
  • trunk/LayoutTests/fast/events/page-visibility-transition-test-expected.txt

    r112664 r150695  
    44
    55
    6 PASS document.webkitVisibilityState is "visible"
    7 PASS document.webkitHidden is false
    8 PASS document.webkitVisibilityState is "hidden"
    9 PASS document.webkitHidden is true
    10 PASS document.webkitVisibilityState is "hidden"
    11 PASS document.webkitHidden is true
    12 PASS document.webkitVisibilityState is "prerender"
    13 PASS document.webkitHidden is true
    14 PASS document.webkitVisibilityState is "visible"
    15 PASS document.webkitHidden is false
    16 PASS document.webkitVisibilityState is "preview"
    17 PASS document.webkitHidden is true
    18 PASS document.webkitVisibilityState is "visible"
    19 PASS document.webkitHidden is false
     6PASS document.visibilityState is "visible"
     7PASS document.hidden is false
     8PASS document.visibilityState is "hidden"
     9PASS document.hidden is true
     10PASS document.visibilityState is "hidden"
     11PASS document.hidden is true
     12PASS document.visibilityState is "prerender"
     13PASS document.hidden is true
     14PASS document.visibilityState is "visible"
     15PASS document.hidden is false
     16PASS document.visibilityState is "unloaded"
     17PASS document.hidden is true
     18PASS document.visibilityState is "visible"
     19PASS document.hidden is false
    2020PASS successfullyParsed is true
    2121
  • trunk/LayoutTests/fast/events/page-visibility-transition-test.html

    r120792 r150695  
    2525}
    2626
    27 function makePagePreview() {
     27function makePageUnloaded() {
    2828    if (window.testRunner)
    29         testRunner.setPageVisibility("preview");
     29        testRunner.setPageVisibility("unloaded");
    3030}
    3131
    3232function checkIsPageVisible() {
    33     shouldBeEqualToString("document.webkitVisibilityState", "visible");
    34     shouldBeFalse("document.webkitHidden");
     33    shouldBeEqualToString("document.visibilityState", "visible");
     34    shouldBeFalse("document.hidden");
    3535}
    3636
    3737function checkIsPageHidden() {
    38     shouldBeEqualToString("document.webkitVisibilityState", "hidden");
    39     shouldBeTrue("document.webkitHidden");
     38    shouldBeEqualToString("document.visibilityState", "hidden");
     39    shouldBeTrue("document.hidden");
    4040}
    4141
    4242function checkIsPagePrerendering() {
    43     shouldBeEqualToString("document.webkitVisibilityState", "prerender");
    44     shouldBeTrue("document.webkitHidden");
     43    shouldBeEqualToString("document.visibilityState", "prerender");
     44    shouldBeTrue("document.hidden");
    4545}
    4646
    47 function checkIsPageInPreview() {
    48     shouldBeEqualToString("document.webkitVisibilityState", "preview");
    49     shouldBeTrue("document.webkitHidden");
     47function checkIsPageInUnloaded() {
     48    shouldBeEqualToString("document.visibilityState", "unloaded");
     49    shouldBeTrue("document.hidden");
    5050}
    5151
     
    5656//  3 - prerender (should fire event).
    5757//  4 - visible (should fire event).
    58 //  5 - preview (should fire event).
     58//  5 - unloaded (should fire event).
    5959//  6 - visible (should fire event).
    6060var numVisibilityChanges = 0;
     
    6262function startTest() {
    6363    document.addEventListener(
    64         "webkitvisibilitychange", onVisibilityChange, false);
     64        "visibilitychange", onVisibilityChange, false);
    6565    checkIsPageVisible();
    6666    numVisibilityChanges++;
     
    9696        checkIsPageVisible();
    9797        numVisibilityChanges++;
    98         makePagePreview();
     98        makePageUnloaded();
    9999        return;
    100100    } else if (numVisibilityChanges == 5) {
    101         checkIsPageInPreview();
     101        checkIsPageInUnloaded();
    102102        numVisibilityChanges++;
    103103        makePageVisible();
  • trunk/Source/WebCore/ChangeLog

    r150692 r150695  
     12013-05-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Unprefix Page Visibility API
     4        https://bugs.webkit.org/show_bug.cgi?id=102340
     5
     6        Reviewed by Tim Horton.
     7       
     8        Remove prefixes from the document properties, and the visibilitychanged event.
     9       
     10        Rename the "preview" state to "unloaded". The "unloaded" state is never
     11        reached yet (see https://bugs.webkit.org/show_bug.cgi?id=116769).
     12       
     13        Add some comments to places where we should update the visibility state
     14        when going in and out of the page cache, but cannot safely do so yet.
     15
     16        Tested by existing Page Visibility tests.
     17
     18        * dom/Document.cpp:
     19        (WebCore::Document::pageVisibilityState):
     20        (WebCore::Document::visibilityState):
     21        (WebCore::Document::hidden):
     22        (WebCore::Document::dispatchVisibilityStateChangeEvent):
     23        * dom/Document.h:
     24        * dom/Document.idl:
     25        * dom/EventNames.h:
     26        * history/CachedFrame.cpp:
     27        (WebCore::CachedFrameBase::restore):
     28        * loader/FrameLoader.cpp:
     29        (WebCore::FrameLoader::stopLoading):
     30        * page/Page.cpp:
     31        (WebCore::Page::setVisibilityState):
     32        * page/PageVisibilityState.cpp:
     33        (WebCore::pageVisibilityStateString):
     34        * page/PageVisibilityState.h:
     35
    1362013-05-25  Andreas Kling  <akling@apple.com>
    237
  • trunk/Source/WebCore/dom/Document.cpp

    r150686 r150695  
    15991599
    16001600#if ENABLE(PAGE_VISIBILITY_API)
    1601 PageVisibilityState Document::visibilityState() const
     1601PageVisibilityState Document::pageVisibilityState() const
    16021602{
    16031603    // The visibility of the document is inherited from the visibility of the
     
    16101610}
    16111611
    1612 String Document::webkitVisibilityState() const
    1613 {
    1614     return pageVisibilityStateString(visibilityState());
    1615 }
    1616 
    1617 bool Document::webkitHidden() const
    1618 {
    1619     return visibilityState() != PageVisibilityStateVisible;
     1612String Document::visibilityState() const
     1613{
     1614    return pageVisibilityStateString(pageVisibilityState());
     1615}
     1616
     1617bool Document::hidden() const
     1618{
     1619    return pageVisibilityState() != PageVisibilityStateVisible;
    16201620}
    16211621
    16221622void Document::dispatchVisibilityStateChangeEvent()
    16231623{
    1624     dispatchEvent(Event::create(eventNames().webkitvisibilitychangeEvent, false, false));
     1624    dispatchEvent(Event::create(eventNames().visibilitychangeEvent, false, false));
    16251625}
    16261626#endif
  • trunk/Source/WebCore/dom/Document.h

    r150683 r150695  
    318318#endif
    319319#if ENABLE(PAGE_VISIBILITY_API)
    320     DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitvisibilitychange);
     320    DEFINE_ATTRIBUTE_EVENT_LISTENER(visibilitychange);
    321321#endif
    322322#if ENABLE(CSP_NEXT)
     
    411411
    412412#if ENABLE(PAGE_VISIBILITY_API)
    413     String webkitVisibilityState() const;
    414     bool webkitHidden() const;
     413    String visibilityState() const;
     414    bool hidden() const;
    415415    void dispatchVisibilityStateChangeEvent();
    416416#endif
     
    12691269
    12701270#if ENABLE(PAGE_VISIBILITY_API)
    1271     PageVisibilityState visibilityState() const;
     1271    PageVisibilityState pageVisibilityState() const;
    12721272#endif
    12731273
  • trunk/Source/WebCore/dom/Document.idl

    r149368 r150695  
    380380
    381381    // Page visibility API.
    382     [Conditional=PAGE_VISIBILITY_API] readonly attribute DOMString webkitVisibilityState;
    383     [Conditional=PAGE_VISIBILITY_API] readonly attribute boolean webkitHidden;
     382    [Conditional=PAGE_VISIBILITY_API] readonly attribute DOMString visibilityState;
     383    [Conditional=PAGE_VISIBILITY_API] readonly attribute boolean hidden;
    384384
    385385    // Security Policy API: http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#script-interfaces
  • trunk/Source/WebCore/dom/EventNames.h

    r150356 r150695  
    122122    macro(upgradeneeded) \
    123123    macro(versionchange) \
    124     macro(webkitvisibilitychange) \
     124    macro(visibilitychange) \
    125125    macro(write) \
    126126    macro(writeend) \
  • trunk/Source/WebCore/history/CachedFrame.cpp

    r150560 r150695  
    134134        m_childFrames[i]->open();
    135135
     136    // FIXME: update Page Visibility state here.
     137    // https://bugs.webkit.org/show_bug.cgi?id=116770
     138
    136139    m_document->enqueuePageshowEvent(PageshowEventPersisted);
    137140   
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r150293 r150695  
    403403                        m_frame->document()->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document());
    404404                    }
     405
     406                    // FIXME: update Page Visibility state here.
     407                    // https://bugs.webkit.org/show_bug.cgi?id=116770
     408
    405409                    if (!m_frame->document()->inPageCache()) {
    406410                        RefPtr<Event> unloadEvent(Event::create(eventNames().unloadEvent, false, false));
  • trunk/Source/WebCore/page/Page.cpp

    r150633 r150695  
    12531253void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitialState)
    12541254{
     1255    // FIXME: the visibility state needs to be stored on the top-level document
     1256    // https://bugs.webkit.org/show_bug.cgi?id=116769
    12551257#if ENABLE(PAGE_VISIBILITY_API)
    12561258    if (m_visibilityState == visibilityState)
  • trunk/Source/WebCore/page/PageVisibilityState.cpp

    r127062 r150695  
    4141    DEFINE_STATIC_LOCAL(const String, hidden, (ASCIILiteral("hidden")));
    4242    DEFINE_STATIC_LOCAL(const String, prerender, (ASCIILiteral("prerender")));
    43     DEFINE_STATIC_LOCAL(const String, preview, (ASCIILiteral("preview")));
     43    DEFINE_STATIC_LOCAL(const String, unloaded, (ASCIILiteral("unloaded")));
    4444
    4545    switch (state) {
     
    5050    case PageVisibilityStatePrerender:
    5151        return prerender;
    52     case PageVisibilityStatePreview:
    53         return preview;
     52    case PageVisibilityStateUnloaded:
     53        return unloaded;
    5454    }
    5555
  • trunk/Source/WebCore/page/PageVisibilityState.h

    r112664 r150695  
    4242    PageVisibilityStateHidden,
    4343    PageVisibilityStatePrerender,
    44     PageVisibilityStatePreview
     44    PageVisibilityStateUnloaded
    4545};
    4646
  • trunk/Source/WebKit/efl/ChangeLog

    r150680 r150695  
     12013-05-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Unprefix Page Visibility API
     4        https://bugs.webkit.org/show_bug.cgi?id=102340
     5
     6        Reviewed by Tim Horton.
     7
     8        Rename "preview" state to "unloaded" state.
     9
     10        * WebCoreSupport/AssertMatchingEnums.cpp:
     11        * ewk/ewk_view.h:
     12
    1132013-05-24  Seokju Kwon  <seokju.kwon@gmail.com>
    214
  • trunk/Source/WebKit/efl/WebCoreSupport/AssertMatchingEnums.cpp

    r148355 r150695  
    5353COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_HIDDEN, PageVisibilityStateHidden);
    5454COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_PRERENDER, PageVisibilityStatePrerender);
    55 COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_PREVIEW, PageVisibilityStatePreview);
     55COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_UNLOADED, PageVisibilityStateUnloaded);
    5656#endif
    5757
  • trunk/Source/WebKit/efl/ewk/ewk_view.h

    r150663 r150695  
    24882488    EWK_PAGE_VISIBILITY_STATE_HIDDEN,
    24892489    EWK_PAGE_VISIBILITY_STATE_PRERENDER,
    2490     EWK_PAGE_VISIBILITY_STATE_PREVIEW
     2490    EWK_PAGE_VISIBILITY_STATE_UNLOADED
    24912491};
    24922492/// Creates a type name for @a _Ewk_Page_Visibility_State.
  • trunk/Source/WebKit/mac/ChangeLog

    r150688 r150695  
     12013-05-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Unprefix Page Visibility API
     4        https://bugs.webkit.org/show_bug.cgi?id=102340
     5
     6        Reviewed by Tim Horton.
     7
     8        Renaming of the "preview" state to "unloaded".
     9
     10        * WebView/WebView.mm:
     11        * WebView/WebViewPrivate.h:
     12
    1132013-05-25  Dan Bernstein  <mitz@apple.com>
    214
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r150663 r150695  
    422422    case WebPageVisibilityStatePrerender:
    423423        return PageVisibilityStatePrerender;
    424     case WebPageVisibilityStatePreview:
    425         return PageVisibilityStatePreview;
     424    case WebPageVisibilityStateUnloaded:
     425        return PageVisibilityStateUnloaded;
    426426    }
    427427
  • trunk/Source/WebKit/mac/WebView/WebViewPrivate.h

    r147447 r150695  
    120120    WebPageVisibilityStateHidden,
    121121    WebPageVisibilityStatePrerender,
    122     WebPageVisibilityStatePreview
     122    WebPageVisibilityStateUnloaded
    123123} WebPageVisibilityState;
    124124
  • trunk/Source/WebKit2/ChangeLog

    r150692 r150695  
     12013-05-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Unprefix Page Visibility API
     4        https://bugs.webkit.org/show_bug.cgi?id=102340
     5
     6        Reviewed by Tim Horton.
     7       
     8        Renaming of the "preview" state to "unloaded".
     9
     10        * Shared/API/c/WKPageVisibilityTypes.h:
     11        * Shared/API/c/WKSharedAPICast.h:
     12        (WebKit::toPageVisibilityState):
     13
    1142013-05-25  Andreas Kling  <akling@apple.com>
    215
  • trunk/Source/WebKit2/Shared/API/c/WKPageVisibilityTypes.h

    r141010 r150695  
    3535    kWKPageVisibilityStateHidden,
    3636    kWKPageVisibilityStatePrerender,
    37     kWKPageVisibilityStatePreview
     37    kWKPageVisibilityStateUnloaded
    3838};
    3939typedef uint32_t WKPageVisibilityState;
  • trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h

    r150277 r150695  
    842842    case kWKPageVisibilityStatePrerender:
    843843        return WebCore::PageVisibilityStatePrerender;
    844     case kWKPageVisibilityStatePreview:
    845         return WebCore::PageVisibilityStatePreview;
     844    case kWKPageVisibilityStateUnloaded:
     845        return WebCore::PageVisibilityStateUnloaded;
    846846    }
    847847
  • trunk/Tools/ChangeLog

    r150677 r150695  
     12013-05-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Unprefix Page Visibility API
     4        https://bugs.webkit.org/show_bug.cgi?id=102340
     5
     6        Reviewed by Tim Horton.
     7       
     8        Rename "preview" state to "unloaded" state, and adjust the tests
     9        to test for it.
     10
     11        * DumpRenderTree/mac/TestRunnerMac.mm:
     12        (TestRunner::setPageVisibility):
     13        * TestWebKitAPI/Tests/WebKit2/PageVisibilityState.cpp:
     14        (TestWebKitAPI::setPageVisibilityStateWithEvalContinuation):
     15        (TestWebKitAPI::didRunStep2StateChangeHiddenToPrerender):
     16        (TestWebKitAPI::didRunStep3StateChangePrerenderToUnloaded):
     17        (TestWebKitAPI::didRunStep4InStateUnloaded):
     18        * TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.html:
     19        * TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:
     20        (TestWebKitAPI::PageVisibilityStateWithWindowChanges::runTest):
     21        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     22        (WTR::TestRunner::setPageVisibility):
     23
    1242013-05-24  Brent Fulgham  <bfulgham@apple.com>
    225
  • trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm

    r149922 r150695  
    10751075    else if (!strcmp(newVisibility, "prerender"))
    10761076        [webView _setVisibilityState:WebPageVisibilityStatePrerender isInitialState:NO];
    1077     else if (!strcmp(newVisibility, "preview"))
    1078         [webView _setVisibilityState:WebPageVisibilityStatePreview isInitialState:NO];
     1077    else if (!strcmp(newVisibility, "unloaded"))
     1078        [webView _setVisibilityState:WebPageVisibilityStateUnloaded isInitialState:NO];
    10791079}
    10801080
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageVisibilityState.cpp

    r141011 r150695  
    3838static void didRunStep1StateChangeVisibleToHidden(WKSerializedScriptValueRef, WKErrorRef, void*);
    3939static void didRunStep2StateChangeHiddenToPrerender(WKSerializedScriptValueRef, WKErrorRef, void*);
    40 static void didRunStep3StateChangePrerenderToPreview(WKSerializedScriptValueRef, WKErrorRef, void*);
    41 static void didRunStep4InStatePreview(WKSerializedScriptValueRef, WKErrorRef, void*);
     40static void didRunStep3StateChangePrerenderToUnloaded(WKSerializedScriptValueRef, WKErrorRef, void*);
     41static void didRunStep4InStateUnloaded(WKSerializedScriptValueRef, WKErrorRef, void*);
    4242
    4343static void setPageVisibilityStateWithEvalContinuation(PlatformWebView* webView, WKPageVisibilityState visibilityState, WKPageRunJavaScriptFunction callback)
    4444{
    4545    WKPageSetVisibilityState(webView->page(), visibilityState, false);
    46     WKRetainPtr<WKStringRef> javaScriptString(AdoptWK, WKStringCreateWithUTF8CString("document.webkitVisibilityState"));
     46    WKRetainPtr<WKStringRef> javaScriptString(AdoptWK, WKStringCreateWithUTF8CString("document.visibilityState"));
    4747    WKPageRunJavaScriptInMainFrame(webView->page(), javaScriptString.get(), static_cast<void*>(webView), callback);
    4848}
     
    8181{
    8282    assertSerializedScriptValueIsStringValue(resultSerializedScriptValue, error, "hidden");
    83     setPageVisibilityStateWithEvalContinuation(static_cast<PlatformWebView*>(context), kWKPageVisibilityStatePrerender, didRunStep3StateChangePrerenderToPreview);
     83    setPageVisibilityStateWithEvalContinuation(static_cast<PlatformWebView*>(context), kWKPageVisibilityStatePrerender, didRunStep3StateChangePrerenderToUnloaded);
    8484}
    8585
    86 static void didRunStep3StateChangePrerenderToPreview(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* context)
     86static void didRunStep3StateChangePrerenderToUnloaded(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* context)
    8787{
    8888    assertSerializedScriptValueIsStringValue(resultSerializedScriptValue, error, "prerender");
    89     setPageVisibilityStateWithEvalContinuation(static_cast<PlatformWebView*>(context), kWKPageVisibilityStatePreview, didRunStep4InStatePreview);
     89    setPageVisibilityStateWithEvalContinuation(static_cast<PlatformWebView*>(context), kWKPageVisibilityStateUnloaded, didRunStep4InStateUnloaded);
    9090}
    9191
    92 static void didRunStep4InStatePreview(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* context)
     92static void didRunStep4InStateUnloaded(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* context)
    9393{
    94     assertSerializedScriptValueIsStringValue(resultSerializedScriptValue, error, "preview");
     94    assertSerializedScriptValueIsStringValue(resultSerializedScriptValue, error, "unloaded");
    9595    testDone = true;
    9696}
  • trunk/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.html

    r141011 r150695  
    11<script>
    2 document.addEventListener("webkitvisibilitychange", function(event) {
     2document.addEventListener("visibilitychange", function(event) {
    33    // Send a signal to the test controller via alert.
    4     alert('webkitvisibilitychange');
     4    alert('visibilitychange');
    55});
    66</script>
  • trunk/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm

    r149716 r150695  
    109109    EXPECT_NULL([view window]);
    110110    EXPECT_NULL([view superview]);
    111     EXPECT_JS_EQ(view, "document.webkitVisibilityState", "hidden");
     111    EXPECT_JS_EQ(view, "document.visibilityState", "hidden");
    112112
    113113    // Add it to a non-visible window. PageVisibility should still be "hidden".
     
    117117    EXPECT_NOT_NULL([view superview]);
    118118    EXPECT_FALSE([window.get() isVisible]);
    119     EXPECT_JS_EQ(view, "document.webkitVisibilityState", "hidden");
     119    EXPECT_JS_EQ(view, "document.visibilityState", "hidden");
    120120
    121121    // Make the window visible. PageVisibility should become "visible".
     
    124124    EXPECT_TRUE([window.get() isVisible]);
    125125    Util::run(&didGetPageSignalToContinue);
    126     EXPECT_JS_EQ(view, "document.webkitVisibilityState", "visible");
     126    EXPECT_JS_EQ(view, "document.visibilityState", "visible");
    127127
    128128    // Minimize the window. PageVisibility should become "hidden".
     
    130130    [window.get() miniaturize:nil];
    131131    Util::run(&didGetPageSignalToContinue);
    132     EXPECT_JS_EQ(view, "document.webkitVisibilityState", "hidden");
     132    EXPECT_JS_EQ(view, "document.visibilityState", "hidden");
    133133
    134134    // Deminimize the window. PageVisibility should become "visible".
     
    136136    [window.get() deminiaturize:nil];
    137137    Util::run(&didGetPageSignalToContinue);
    138     EXPECT_JS_EQ(view, "document.webkitVisibilityState", "visible");
     138    EXPECT_JS_EQ(view, "document.visibilityState", "visible");
    139139
    140140    // Remove the WebView from its superview. PageVisibility should become "hidden".
     
    145145    EXPECT_TRUE([window.get() isVisible]);
    146146    Util::run(&didGetPageSignalToContinue);
    147     EXPECT_JS_EQ(view, "document.webkitVisibilityState", "hidden");
     147    EXPECT_JS_EQ(view, "document.visibilityState", "hidden");
    148148}
    149149   
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r150090 r150695  
    495495    else if (JSStringIsEqualToUTF8CString(state, "prerender"))
    496496        visibilityState = kWKPageVisibilityStatePrerender;
    497     else if (JSStringIsEqualToUTF8CString(state, "preview"))
    498         visibilityState = kWKPageVisibilityStatePreview;
     497    else if (JSStringIsEqualToUTF8CString(state, "unloaded"))
     498        visibilityState = kWKPageVisibilityStateUnloaded;
    499499
    500500    InjectedBundle::shared().setVisibilityState(visibilityState, false);
Note: See TracChangeset for help on using the changeset viewer.