LayoutTests/ChangeLog

 12011-05-05 Shishir Agrawal <shishir@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Implement Page Visibility API.
 6 https://bugs.webkit.org/show_bug.cgi?id=54181
 7
 8 * fast/events/page-visibility-iframe-delete-test-expected.txt: Added.
 9 * fast/events/page-visibility-iframe-delete-test.html: Added.
 10 * fast/events/page-visibility-iframe-move-test-expected.txt: Added.
 11 * fast/events/page-visibility-iframe-move-test.html: Added.
 12 * fast/events/page-visibility-iframe-propagation-test-expected.txt: Added.
 13 * fast/events/page-visibility-iframe-propagation-test.html: Added.
 14 * fast/events/page-visibility-transition-test-expected.txt: Added.
 15 * fast/events/page-visibility-transition-test.html: Added.
 16 * fast/events/resources/page-visibility-iframe-delete-test-frame.html: Added.
 17 * fast/events/resources/page-visibility-iframe-move-new-page.html: Added.
 18 * platform/chromium/test_expectations.txt:
 19 * platform/gtk/Skipped:
 20 * platform/mac/Skipped:
 21 * platform/qt/Skipped:
 22 * platform/win/Skipped:
 23
1242011-05-05 Andrey Kosyakov <caseq@chromium.org>
225
326 Unreviewed. Skip inspector/console/console-shadow-dom-access.html (crashes in debug)

LayoutTests/fast/events/page-visibility-iframe-delete-test-expected.txt

 1This test checks that the page visibility event proagation does not crash the browser when frames are added / deleted.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Loaded all frames.
 7Visibility of main document changed.
 8Visibility of sub frame 2 changed.
 9PASS successfullyParsed is true
 10
 11TEST COMPLETE
 12

LayoutTests/fast/events/page-visibility-iframe-delete-test.html

 1<html>
 2<body onload="startTest()">
 3
 4<p id="description"></p>
 5<div id="console"></div>
 6
 7<script src="../js/resources/js-test-pre.js"></script>
 8
 9<script>
 10
 11description("This test checks that the page visibility event proagation does not crash the browser when frames are added / deleted.");
 12
 13var jsTestIsAsync = true;
 14
 15var numVisibilityChanges = 0;
 16var frame1, frame2, frame3, frame4, frame5, subframe1, subFrame2, subFrame3;
 17
 18var docsLoaded = 0;
 19var mainPageVisibilityChangeDone = false;
 20var frame2VisiblityChangeDone = false;
 21
 22function startTest() {
 23 ++docsLoaded;
 24 if (docsLoaded < 8) {
 25 return;
 26 }
 27
 28 debug("Loaded all frames.");
 29
 30 frame1 = document.getElementById("topFrame1");
 31 frame2 = document.getElementById("topFrame2");
 32 frame3 = document.getElementById("topFrame3");
 33 frame4 = document.getElementById("topFrame4");
 34 subFrame1 = frame3.contentDocument.getElementById("subIframe1");
 35 subFrame2 = frame3.contentDocument.getElementById("subIframe2");
 36
 37 document.addEventListener(
 38 "webkitvisibilitystatechange", onMainPageVisibilityChange, false);
 39 frame2.contentDocument.addEventListener(
 40 "webkitvisibilitystatechange", onFrame2VisibilityChange, false);
 41 // Change the visibility of the current page to invisible.
 42 if (window.layoutTestController) {
 43 numVisibilityChanges++;
 44 layoutTestController.setPageVisibility("hidden");
 45 }
 46}
 47
 48function finishTest() {
 49 if (window.layoutTestController)
 50 layoutTestController.resetPageVisibility();
 51 finishJSTest();
 52}
 53
 54function onMainPageVisibilityChange() {
 55 if (mainPageVisibilityChangeDone && frame2VisiblityChangeDone) {
 56 finishTest();
 57 } else if (!mainPageVisibilityChangeDone) {
 58 debug("Visibility of main document changed.");
 59 // Delete frame 4.
 60 document.body.removeChild(frame4);
 61
 62 // Delete subframe 2.
 63 frame3.contentDocument.body.removeChild(subFrame2);
 64
 65 // Add a new frame to top level.
 66 frame5 = document.createElement("iframe");
 67 frame5.src = '';
 68 document.body.appendChild(frame5);
 69
 70 // Add a new frame to frame2.
 71 subFrame3 = frame2.contentDocument.createElement("iframe");
 72 subFrame3.src = '';
 73 frame2.contentDocument.body.appendChild(subFrame3);
 74
 75 mainPageVisibilityChangeDone = true;
 76 }
 77
 78 if (mainPageVisibilityChangeDone && frame2VisiblityChangeDone) {
 79 finishTest();
 80 }
 81}
 82
 83function onFrame2VisibilityChange() {
 84 if (mainPageVisibilityChangeDone && frame2VisiblityChangeDone) {
 85 finishTest();
 86 } else if (!frame2VisiblityChangeDone) {
 87 debug("Visibility of sub frame 2 changed.");
 88
 89 // Delete frame 1.
 90 document.body.removeChild(frame1);
 91
 92 frame2VisiblityChangeDone = true;
 93 }
 94
 95 if (mainPageVisibilityChangeDone && frame2VisiblityChangeDone) {
 96 finishTest();
 97 }
 98}
 99
 100var successfullyParsed = true;
 101
 102</script>
 103
 104<script src="../js/resources/js-test-post.js"></script>
 105
 106<iframe id="topFrame1" onload="startTest()" ></iframe>
 107<iframe id="topFrame2" onload="startTest()" ></iframe>
 108<iframe id="topFrame3" onload="startTest()" src="resources/page-visibility-iframe-delete-test-frame.html"></iframe>
 109<iframe id="topFrame4" onload="startTest()" ></iframe>
 110</body>
 111</html>

LayoutTests/fast/events/page-visibility-iframe-move-test-expected.txt

 1This test checks that an iframe that moves between pages with different visibility will have the correct visibility value.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Window 1 Loaded
 7Window 2 Loaded
 8PASS window.document.webkitIsVisible is true
 9PASS window2.document.webkitIsVisible is true
 10PASS iframe.contentDocument.webkitIsVisible is true
 11PASS window.document.webkitIsVisible is false
 12PASS window2.document.webkitIsVisible is true
 13PASS iframe.contentDocument.webkitIsVisible is true
 14Adopted iframe to Window 1
 15PASS window.document.webkitIsVisible is false
 16PASS window2.document.webkitIsVisible is true
 17PASS iframe.contentDocument.webkitIsVisible is false
 18PASS successfullyParsed is true
 19
 20TEST COMPLETE
 21

LayoutTests/fast/events/page-visibility-iframe-move-test.html

 1<html>
 2<body onload="startTest()">
 3
 4<p id="description"></p>
 5<div id="console"></div>
 6
 7<script src="../js/resources/js-test-pre.js"></script>
 8
 9<script>
 10
 11description("This test checks that an iframe that moves between pages with different visibility will have the correct visibility value.");
 12
 13var jsTestIsAsync = true;
 14
 15var window2, iframe;
 16var numVisibilityChanges = 0;
 17
 18function window2Loaded() {
 19 debug("Window 2 Loaded");
 20
 21 iframe = window2.document.getElementById("iframe");
 22
 23 shouldBeTrue("window.document.webkitIsVisible");
 24 shouldBeTrue("window2.document.webkitIsVisible");
 25 shouldBeTrue("iframe.contentDocument.webkitIsVisible");
 26
 27 // Change the visibility of the current page to invisible.
 28 if (window.layoutTestController) {
 29 numVisibilityChanges++;
 30 window.layoutTestController.setPageVisibility("hidden");
 31 }
 32}
 33
 34function onVisibilityChange() {
 35 shouldBeFalse("window.document.webkitIsVisible");
 36 shouldBeTrue("window2.document.webkitIsVisible");
 37 shouldBeTrue("iframe.contentDocument.webkitIsVisible");
 38
 39 window.document.adoptNode(iframe);
 40 window.document.body.appendChild(iframe);
 41 debug("Adopted iframe to Window 1");
 42
 43 shouldBeFalse("window.document.webkitIsVisible");
 44 shouldBeTrue("window2.document.webkitIsVisible");
 45 shouldBeFalse("iframe.contentDocument.webkitIsVisible");
 46
 47 window2.close();
 48
 49 finishTest();
 50}
 51
 52function startTest() {
 53 if (window.layoutTestController) {
 54 layoutTestController.waitUntilDone();
 55 layoutTestController.setCanOpenWindows();
 56 }
 57
 58 debug("Window 1 Loaded");
 59 document.addEventListener("webkitvisibilitystatechange",
 60 onVisibilityChange, false);
 61
 62 window2 = window.open("resources/page-visibility-iframe-move-new-page.html");
 63 window2.addEventListener("load", window2Loaded, false);
 64}
 65
 66function finishTest() {
 67 if (window.layoutTestController) {
 68 layoutTestController.resetPageVisibility();
 69 }
 70 finishJSTest();
 71}
 72
 73var successfullyParsed = true;
 74
 75</script>
 76
 77<script src="../js/resources/js-test-post.js"></script>
 78
 79</body>
 80</html>

LayoutTests/fast/events/page-visibility-iframe-propagation-test-expected.txt

 1This test checks that Page Visibility state events are propagated to child frames.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Main Page:
 7PASS document.webkitVisibilityState is "visible"
 8PASS document.webkitIsVisible is true
 9Child Frame:
 10PASS childFrame.contentDocument.webkitVisibilityState is "visible"
 11PASS childFrame.contentDocument.webkitIsVisible is true
 12Main Page:
 13PASS document.webkitVisibilityState is "hidden"
 14PASS document.webkitIsVisible is false
 15Child Frame:
 16PASS childFrame.contentDocument.webkitVisibilityState is "hidden"
 17PASS childFrame.contentDocument.webkitIsVisible is false
 18Main Page:
 19PASS document.webkitVisibilityState is "visible"
 20PASS document.webkitIsVisible is true
 21Child Frame:
 22PASS childFrame.contentDocument.webkitVisibilityState is "visible"
 23PASS childFrame.contentDocument.webkitIsVisible is true
 24PASS successfullyParsed is true
 25
 26TEST COMPLETE
 27

LayoutTests/fast/events/page-visibility-iframe-propagation-test.html

 1<html>
 2<body>
 3
 4<p id="description"></p>
 5<div id="console"></div>
 6
 7<script src="../js/resources/js-test-pre.js"></script>
 8
 9<script>
 10
 11description("This test checks that Page Visibility state events are propagated to child frames.");
 12
 13var jsTestIsAsync = true;
 14
 15function makePageVisible() {
 16 if (window.layoutTestController)
 17 layoutTestController.setPageVisibility("visible");
 18}
 19
 20function makePageHidden() {
 21 if (window.layoutTestController)
 22 layoutTestController.setPageVisibility("hidden");
 23}
 24
 25function checkIsPageVisible() {
 26 debug("Main Page:");
 27 shouldBeEqualToString("document.webkitVisibilityState", "visible");
 28 shouldBeTrue("document.webkitIsVisible");
 29}
 30
 31function checkIsPageHidden() {
 32 debug("Main Page:");
 33 shouldBeEqualToString("document.webkitVisibilityState", "hidden");
 34 shouldBeFalse("document.webkitIsVisible");
 35}
 36
 37function checkIsChildFrameVisible() {
 38 debug("Child Frame:");
 39 shouldBeEqualToString("childFrame.contentDocument.webkitVisibilityState",
 40 "visible");
 41 shouldBeTrue("childFrame.contentDocument.webkitIsVisible");
 42}
 43
 44function checkIsChildFrameHidden() {
 45 debug("Child Frame:");
 46 shouldBeEqualToString("childFrame.contentDocument.webkitVisibilityState",
 47 "hidden");
 48 shouldBeFalse("childFrame.contentDocument.webkitIsVisible");
 49}
 50
 51// We will try to change the visibility states as:
 52// 0 - visible. (Initial - i.e. on load).
 53// 1 - hidden
 54// 2 - visible
 55var numVisibilityChanges = 0;
 56
 57var childFrame;
 58
 59function startTest() {
 60 childFrame = document.getElementById("childFrame");
 61 childFrame.contentDocument.addEventListener(
 62 "webkitvisibilitystatechange", onChildFrameVisibilityChange, false);
 63 document.addEventListener("webkitvisibilitystatechange",
 64 onVisibilityChange, false);
 65
 66 checkIsPageVisible();
 67 checkIsChildFrameVisible();
 68
 69 numVisibilityChanges++;
 70 makePageHidden();
 71}
 72
 73var numFinishes = 0;
 74function finishTest() {
 75 numFinishes++;
 76 if (numFinishes < 2) {
 77 return;
 78 }
 79
 80 if (window.layoutTestController) {
 81 layoutTestController.resetPageVisibility();
 82 }
 83 finishJSTest();
 84}
 85
 86function onVisibilityChange() {
 87 if (numVisibilityChanges == 1) {
 88 checkIsPageHidden();
 89 return;
 90 } else if (numVisibilityChanges == 2) {
 91 checkIsPageVisible();
 92 finishTest();
 93 return;
 94 } else {
 95 testFailed("Too many visibility transitions");
 96 finishTest();
 97 return;
 98 }
 99}
 100
 101function onChildFrameVisibilityChange() {
 102 if (numVisibilityChanges == 1) {
 103 checkIsChildFrameHidden();
 104 numVisibilityChanges++;
 105 makePageVisible();
 106 return;
 107 } else if (numVisibilityChanges == 2) {
 108 checkIsChildFrameVisible();
 109 finishTest();
 110 return;
 111 } else {
 112 testFailed("Child Frame: Too many visibility transitions");
 113 finishTest();
 114 }
 115}
 116
 117var successfullyParsed = true;
 118
 119</script>
 120
 121<script src="../js/resources/js-test-post.js"></script>
 122
 123<iframe id="childFrame" onload="startTest()"></iframe>
 124</body>
 125</html>

LayoutTests/fast/events/page-visibility-transition-test-expected.txt

 1This test checks that Page Visibility state values are correct and the event changes are fired correctly.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6PASS document.webkitVisibilityState is "visible"
 7PASS document.webkitIsVisible is true
 8PASS document.webkitVisibilityState is "hidden"
 9PASS document.webkitIsVisible is false
 10PASS document.webkitVisibilityState is "hidden"
 11PASS document.webkitIsVisible is false
 12PASS document.webkitVisibilityState is "visible"
 13PASS document.webkitIsVisible is true
 14PASS successfullyParsed is true
 15
 16TEST COMPLETE
 17

LayoutTests/fast/events/page-visibility-transition-test.html

 1<html>
 2<body onload='startTest()'>
 3
 4<p id="description"></p>
 5<div id="console"></div>
 6
 7<script src="../js/resources/js-test-pre.js"></script>
 8
 9<script>
 10
 11description("This test checks that Page Visibility state values are correct and the event changes are fired correctly.");
 12
 13var jsTestIsAsync = true;
 14
 15function makePageVisible() {
 16 if (window.layoutTestController)
 17 layoutTestController.setPageVisibility("visible");
 18}
 19
 20function makePageHidden() {
 21 if (window.layoutTestController)
 22 layoutTestController.setPageVisibility("hidden");
 23}
 24
 25function checkIsPageVisible() {
 26 shouldBeEqualToString("document.webkitVisibilityState", "visible");
 27 shouldBeTrue("document.webkitIsVisible");
 28}
 29
 30function checkIsPageHidden() {
 31 shouldBeEqualToString("document.webkitVisibilityState", "hidden");
 32 shouldBeFalse("document.webkitIsVisible");
 33}
 34
 35// We will try to change the visibility states as:
 36// 0 - visible. (Initial - i.e. on load).
 37// 1 - hidden (should fire event).
 38// 2 - hidden (no event).
 39// 3 - visible (should fire event).
 40var numVisibilityChanges = 0;
 41
 42function startTest() {
 43 document.addEventListener(
 44 "webkitvisibilitystatechange", onVisibilityChange, false);
 45 checkIsPageVisible();
 46 numVisibilityChanges++;
 47 makePageHidden();
 48}
 49
 50function finishTest() {
 51 if (window.layoutTestController) {
 52 layoutTestController.resetPageVisibility();
 53 }
 54 finishJSTest();
 55}
 56
 57function onVisibilityChange() {
 58 if (numVisibilityChanges == 1) {
 59 checkIsPageHidden();
 60 numVisibilityChanges++;
 61 makePageHidden();
 62 checkIsPageHidden();
 63 numVisibilityChanges++;
 64 makePageVisible();
 65 return;
 66 } else if (numVisibilityChanges == 2) {
 67 testFailed("Invalid event fired on same state change.");
 68 finishTest();
 69 return;
 70 } else if (numVisibilityChanges == 3) {
 71 checkIsPageVisible();
 72 numVisibilityChanges++;
 73 finishTest();
 74 return;
 75 } else {
 76 testFailed("Too many visibility transitions");
 77 finishTest();
 78 return;
 79 }
 80}
 81
 82var successfullyParsed = true;
 83
 84</script>
 85
 86<script src="../js/resources/js-test-post.js"></script>
 87
 88</body>
 89</html>

LayoutTests/fast/events/resources/page-visibility-iframe-delete-test-frame.html

 1<html>
 2<body onload="parent.startTest()">
 3<iframe id="subIframe1" onload="parent.parent.startTest()"></iframe>
 4<iframe id="subIframe2" onload="parent.parent.startTest()"></iframe>
 5</body>
 6</html>

LayoutTests/fast/events/resources/page-visibility-iframe-move-new-page.html

 1<html>
 2<body>
 3<iframe id="iframe"></iframe>
 4</body>
 5</html>

LayoutTests/platform/chromium/test_expectations.txt

@@BUGWK60243 : fullscreen/full-screen-stacking-context.html = PASS TEXT
39903990
39913991BUGWK60252 MAC GPU : animations/3d/matrix-transform-type-animation.html = IMAGE
39923992BUGWK60252 MAC GPU : animations/3d/state-at-end-event-transform.html = IMAGE
 3993
 3994// Page visibility API not turned on.
 3995BUGWK54181 : fast/events/page-visibility-iframe-delete-test.html = TIMEOUT
 3996BUGWK54181 : fast/events/page-visibility-iframe-move-test.html = TIMEOUT
 3997BUGWK54181 : fast/events/page-visibility-iframe-propagation-test.html = TIMEOUT
 3998BUGWK54181 : fast/events/page-visibility-transition-test.html = TIMEOUT

LayoutTests/platform/gtk/Skipped

@@tables/mozilla_expected_failures/bugs/bug85016.html
14121412# HTTP 204 (No Content) should be ignored
14131413# https://bugs.webkit.org/show_bug.cgi?id=60206
14141414http/tests/navigation/response204.html
 1415
 1416# This platform does not support the Page Visibility API.
 1417fast/events/page-visibility-iframe-delete-test.html
 1418fast/events/page-visibility-iframe-move-test.html
 1419fast/events/page-visibility-iframe-propagation-test.html
 1420fast/events/page-visibility-transition-test.html

LayoutTests/platform/mac/Skipped

@@animations/animation-api-1.html
354354# HTTP 204 (No Content) should be ignored
355355# https://bugs.webkit.org/show_bug.cgi?id=60206
356356http/tests/navigation/response204.html
 357
 358# This platform does not support the Page Visibility API.
 359fast/events/page-visibility-iframe-delete-test.html
 360fast/events/page-visibility-iframe-move-test.html
 361fast/events/page-visibility-iframe-propagation-test.html
 362fast/events/page-visibility-transition-test.html

LayoutTests/platform/qt/Skipped

@@http/tests/security/contentSecurityPolicy/media-src-blocked.html
26962696
26972697# Animation API is disabled by default
26982698animations/animation-api-1.html
 2699
 2700# This platform does not support the Page Visibility API.
 2701fast/events/page-visibility-iframe-delete-test.html
 2702fast/events/page-visibility-iframe-move-test.html
 2703fast/events/page-visibility-iframe-propagation-test.html
 2704fast/events/page-visibility-transition-test.html

LayoutTests/platform/win/Skipped

@@animations/animation-api-1.html
12821282# HTTP 204 (No Content) should be ignored
12831283# https://bugs.webkit.org/show_bug.cgi?id=60206
12841284http/tests/navigation/response204.html
 1285
 1286# This platform does not support the Page Visibility API.
 1287fast/events/page-visibility-iframe-delete-test.html
 1288fast/events/page-visibility-iframe-move-test.html
 1289fast/events/page-visibility-iframe-propagation-test.html
 1290fast/events/page-visibility-transition-test.html

Source/WebCore/CMakeLists.txt

@@SET(WebCore_SOURCES
10111011 page/PageGroup.cpp
10121012 page/PageGroupLoadDeferrer.cpp
10131013 page/PageSerializer.cpp
 1014 page/PageVisibilityState.cpp
10141015 page/Performance.cpp
10151016 page/PerformanceNavigation.cpp
10161017 page/PerformanceTiming.cpp

Source/WebCore/ChangeLog

 12011-05-05 Shishir Agrawal <shishir@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Implement Page Visibility API.
 6 https://bugs.webkit.org/show_bug.cgi?id=54181
 7
 8 Tests: fast/events/page-visibility-iframe-delete-test.html
 9 fast/events/page-visibility-iframe-move-test.html
 10 fast/events/page-visibility-iframe-propagation-test.html
 11 fast/events/page-visibility-transition-test.html
 12
 13 * CMakeLists.txt:
 14 * GNUmakefile.list.am:
 15 * WebCore.gypi:
 16 * WebCore.pro:
 17 * WebCore.vcproj/WebCore.vcproj:
 18 * WebCore.xcodeproj/project.pbxproj:
 19 * dom/Document.cpp:
 20 (WebCore::Document::visibilityState):
 21 (WebCore::Document::webkitVisibilityState):
 22 (WebCore::Document::webkitIsVisible):
 23 (WebCore::Document::dispatchVisibilityStateChangeEvent):
 24 * dom/Document.h:
 25 * dom/Document.idl:
 26 * dom/EventNames.h:
 27 * page/Frame.cpp:
 28 (WebCore::Frame::dispatchVisibilityStateChangeEvent):
 29 * page/Frame.h:
 30 * page/Page.cpp:
 31 (WebCore::Page::Page):
 32 (WebCore::Page::setVisibilityState):
 33 (WebCore::Page::visibilityState):
 34 * page/Page.h:
 35 * page/PageVisibilityState.cpp: Added.
 36 (WebCore::GetPageVisibilityStateString):
 37 * page/PageVisibilityState.h: Added.
 38
1392011-05-05 Eric Carlson <eric.carlson@apple.com>
240
341 Reviewed by Adam Roben.

Source/WebCore/GNUmakefile.list.am

@@webcore_sources += \
22202220 Source/WebCore/page/PageGroupLoadDeferrer.h \
22212221 Source/WebCore/page/PageSerializer.cpp \
22222222 Source/WebCore/page/PageSerializer.h \
 2223 Source/WebCore/page/PageVisibilityState.cpp \
 2224 Source/WebCore/page/PageVisibilityState.h \
22232225 Source/WebCore/page/Performance.cpp \
22242226 Source/WebCore/page/Performance.h \
22252227 Source/WebCore/page/PerformanceNavigation.cpp \

Source/WebCore/WebCore.gypi

711711 'page/Page.h',
712712 'page/PageGroup.h',
713713 'page/PageSerializer.h',
 714 'page/PageVisibilityState.h',
714715 'page/PluginHalterClient.h',
715716 'page/PositionCallback.h',
716717 'page/PositionError.h',

34353436 'page/PageGroupLoadDeferrer.cpp',
34363437 'page/PageGroupLoadDeferrer.h',
34373438 'page/PageSerializer.cpp',
 3439 'page/PageVisibilityState.cpp',
34383440 'page/Performance.cpp',
34393441 'page/Performance.h',
34403442 'page/PerformanceNavigation.cpp',

Source/WebCore/WebCore.pro

@@SOURCES += \
921921 page/PageGroup.cpp \
922922 page/PageGroupLoadDeferrer.cpp \
923923 page/PageSerializer.cpp \
 924 page/PageVisibilityState.cpp \
924925 page/Performance.cpp \
925926 page/PerformanceNavigation.cpp \
926927 page/PerformanceTiming.cpp \

@@HEADERS += \
18621863 page/PageGroupLoadDeferrer.h \
18631864 page/Page.h \
18641865 page/PageSerializer.h \
 1866 page/PageVisibilityState.h \
18651867 page/PluginHalter.h \
18661868 page/PluginHalterClient.h \
18671869 page/PrintContext.h \

Source/WebCore/WebCore.vcproj/WebCore.vcproj

2475024750 >
2475124751 </File>
2475224752 <File
 24753 RelativePath="..\page\PageVisibilityState.cpp"
 24754 >
 24755 <File
 24756 RelativePath="..\page\PageVisibilityState.h"
 24757 >
 24758 <File
2475324759 RelativePath="..\page\Performance.cpp"
2475424760 >
2475524761 </File>

Source/WebCore/WebCore.xcodeproj/project.pbxproj

59265926 FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA620E9C4703000D6F75 /* JSGeoposition.h */; };
59275927 FE80DA710E9C472F000D6F75 /* JSPositionError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */; };
59285928 FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */; };
 5929 FFD5B97A135CC97800D5E92A /* PageVisibilityState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */; };
 5930 FFD5B97B135CC97800D5E92A /* PageVisibilityState.h in Headers */ = {isa = PBXBuildFile; fileRef = FFD5B978135CC97800D5E92A /* PageVisibilityState.h */; settings = {ATTRIBUTES = (Private, ); }; };
59295931/* End PBXBuildFile section */
59305932
59315933/* Begin PBXContainerItemProxy section */

1244712449 FE80DA620E9C4703000D6F75 /* JSGeoposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGeoposition.h; sourceTree = "<group>"; };
1244812450 FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionError.cpp; sourceTree = "<group>"; };
1244912451 FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionError.h; sourceTree = "<group>"; };
 12452 FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageVisibilityState.cpp; sourceTree = "<group>"; };
 12453 FFD5B978135CC97800D5E92A /* PageVisibilityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageVisibilityState.h; sourceTree = "<group>"; };
1245012454/* End PBXFileReference section */
1245112455
1245212456/* Begin PBXFrameworksBuildPhase section */

1417214176 7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */,
1417314177 371E65CD13661EED00BEEDB0 /* PageSerializer.cpp */,
1417414178 371E65CB13661EDC00BEEDB0 /* PageSerializer.h */,
 14179 FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */,
 14180 FFD5B978135CC97800D5E92A /* PageVisibilityState.h */,
1417514181 8A844D0111D3C18E0014065C /* Performance.cpp */,
1417614182 8A844D0211D3C18E0014065C /* Performance.h */,
1417714183 8A844D0311D3C18E0014065C /* Performance.idl */,

2187621882 F34742E51343633C00531BC2 /* PageScriptDebugServer.h in Headers */,
2187721883 371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */,
2187821884 E1284AE110447D4500EAEB52 /* PageTransitionEvent.h in Headers */,
 21885 FFD5B97B135CC97800D5E92A /* PageVisibilityState.h in Headers */,
2187921886 51E1ECC30C91C90400DC255B /* PageURLRecord.h in Headers */,
2188021887 0885067F11DA045B00182B98 /* PaintInfo.h in Headers */,
2188121888 0885068011DA045B00182B98 /* PaintPhase.h in Headers */,

2474324750 371E65CE13661EED00BEEDB0 /* PageSerializer.cpp in Sources */,
2474424751 E1284AEA10447DEE00EAEB52 /* PageTransitionEvent.cpp in Sources */,
2474524752 51E1ECC20C91C90400DC255B /* PageURLRecord.cpp in Sources */,
 24753 FFD5B97A135CC97800D5E92A /* PageVisibilityState.cpp in Sources */,
2474624754 FD3160A212B026F700C1A359 /* Panner.cpp in Sources */,
2474724755 F55B3DC91251F12D003EF269 /* PasswordInputType.cpp in Sources */,
2474824756 4B2709830AF2E5E00065127F /* PasteboardMac.mm in Sources */,

Source/WebCore/dom/Document.cpp

@@void Document::removeTitle(Element* titleElement)
13541354 updateTitle(StringWithDirection());
13551355}
13561356
 1357#if ENABLE(PAGE_VISIBILITY_API)
 1358PageVisibilityState Document::visibilityState() const
 1359{
 1360 // The visibility of the document is inherited from the visibility of the
 1361 // page. If there is no page associated with the document, we will assume
 1362 // that the page is visible i.e. invisibility has to be explicitly
 1363 // specified by the embedder.
 1364 if (!m_frame || !m_frame->page())
 1365 return PageVisibilityStateVisible;
 1366 return m_frame->page()->visibilityState();
 1367}
 1368
 1369String Document::webkitVisibilityState() const
 1370{
 1371 return GetPageVisibilityStateString(visibilityState());
 1372}
 1373
 1374bool Document::webkitIsVisible() const
 1375{
 1376 return visibilityState() == PageVisibilityStateVisible;
 1377}
 1378
 1379void Document::dispatchVisibilityStateChangeEvent()
 1380{
 1381 dispatchEvent(Event::create(eventNames().webkitvisibilitystatechangeEvent, false, false));
 1382}
 1383#endif
 1384
13571385String Document::nodeName() const
13581386{
13591387 return "#document";

Source/WebCore/dom/Document.h

3434#include "DOMTimeStamp.h"
3535#include "DocumentTiming.h"
3636#include "IconURL.h"
 37#include "PageVisibilityState.h"
3738#include "QualifiedName.h"
3839#include "ScriptExecutionContext.h"
3940#include "StringWithDirection.h"

@@public:
304305#if ENABLE(FULLSCREEN_API)
305306 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitfullscreenchange);
306307#endif
 308#if ENABLE(PAGE_VISIBILITY_API)
 309 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitvisibilitystatechange);
 310#endif
307311
308312 ViewportArguments viewportArguments() const { return m_viewportArguments; }
309313

@@public:
379383
380384 virtual KURL baseURI() const;
381385
 386#if ENABLE(PAGE_VISIBILITY_API)
 387 String webkitVisibilityState() const;
 388 bool webkitIsVisible() const;
 389 void dispatchVisibilityStateChangeEvent();
 390#endif
 391
382392 PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
383393
384394 PassRefPtr<HTMLCollection> images();

@@private:
11321142
11331143 void loadEventDelayTimerFired(Timer<Document>*);
11341144
 1145#if ENABLE(PAGE_VISIBILITY_API)
 1146 PageVisibilityState visibilityState() const;
 1147#endif
 1148
11351149 int m_guardRefCount;
11361150
11371151 OwnPtr<CSSStyleSelector> m_styleSelector;

Source/WebCore/dom/Document.idl

@@module core {
334334 boolean isHTMLDocument();
335335#endif
336336
 337 // Page visibility API.
 338 readonly attribute [Conditional=PAGE_VISIBILITY_API] DOMString webkitVisibilityState;
 339 readonly attribute [Conditional=PAGE_VISIBILITY_API] boolean webkitIsVisible;
 340
337341 };
338342
339343}

Source/WebCore/dom/EventNames.h

@@namespace WebCore {
106106 macro(unload) \
107107 macro(updateready) \
108108 macro(versionchange) \
 109 macro(webkitvisibilitystatechange) \
109110 macro(write) \
110111 macro(writeend) \
111112 macro(writestart) \

Source/WebCore/page/Frame.cpp

@@void Frame::setDOMWindow(DOMWindow* domWindow)
718718 m_domWindow = domWindow;
719719}
720720
 721#if ENABLE(PAGE_VISIBILITY_API)
 722void Frame::dispatchVisibilityStateChangeEvent()
 723{
 724 if (m_doc)
 725 m_doc->dispatchVisibilityStateChangeEvent();
 726 for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
 727 child->dispatchVisibilityStateChangeEvent();
 728}
 729#endif
 730
721731DOMWindow* Frame::domWindow() const
722732{
723733 if (!m_domWindow)

Source/WebCore/page/Frame.h

@@namespace WebCore {
119119
120120 void transferChildFrameToNewDocument();
121121
 122#if ENABLE(PAGE_VISIBILITY_API)
 123 void dispatchVisibilityStateChangeEvent();
 124#endif
 125
122126 // ======== All public functions below this point are candidates to move out of Frame into another class. ========
123127
124128 bool isDisconnected() const;

Source/WebCore/page/Page.cpp

@@Page::Page(const PageClients& pageClients)
163163 , m_viewMode(ViewModeWindowed)
164164 , m_minimumTimerInterval(Settings::defaultMinDOMTimerInterval())
165165 , m_isEditable(false)
 166#if ENABLE(PAGE_VISIBILITY_API)
 167 , m_visibilityState(PageVisibilityStateVisible)
 168#endif
166169{
167170 if (!allPages) {
168171 allPages = new HashSet<Page*>;

@@void Page::checkFrameCountConsistency() const
934937}
935938#endif
936939
 940#if ENABLE(PAGE_VISIBILITY_API)
 941void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitialState)
 942{
 943 if (m_visibilityState == visibilityState)
 944 return;
 945 m_visibilityState = visibilityState;
 946
 947 if (!isInitialState && m_mainFrame)
 948 m_mainFrame->dispatchVisibilityStateChangeEvent();
 949}
 950
 951PageVisibilityState Page::visibilityState() const
 952{
 953 return m_visibilityState;
 954}
 955#endif
 956
937957Page::PageClients::PageClients()
938958 : chromeClient(0)
939959 , contextMenuClient(0)

Source/WebCore/page/Page.h

2323
2424#include "FrameLoaderTypes.h"
2525#include "FindOptions.h"
 26#include "PageVisibilityState.h"
2627#include "PlatformString.h"
2728#include "ViewportArguments.h"
2829#include <wtf/Forward.h>

@@namespace WebCore {
300301 void setEditable(bool isEditable) { m_isEditable = isEditable; }
301302 bool isEditable() { return m_isEditable; }
302303
 304#if ENABLE(PAGE_VISIBILITY_API)
 305 PageVisibilityState visibilityState() const;
 306 void setVisibilityState(PageVisibilityState, bool);
 307#endif
 308
303309 private:
304310 void initGroup();
305311

@@namespace WebCore {
405411 OwnPtr<ScrollableAreaSet> m_scrollableAreaSet;
406412
407413 bool m_isEditable;
 414
 415#if ENABLE(PAGE_VISIBILITY_API)
 416 PageVisibilityState m_visibilityState;
 417#endif
408418 };
409419
410420} // namespace WebCore

Source/WebCore/page/PageVisibilityState.cpp

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions are
 6 * met:
 7 *
 8 * * Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * * Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer
 12 * in the documentation and/or other materials provided with the
 13 * distribution.
 14 * * Neither the name of Google Inc. nor the names of its
 15 * contributors may be used to endorse or promote products derived from
 16 * this software without specific prior written permission.
 17 *
 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 29 */
 30
 31#include "config.h"
 32#include "PageVisibilityState.h"
 33
 34#if ENABLE(PAGE_VISIBILITY_API)
 35
 36namespace WebCore {
 37
 38String GetPageVisibilityStateString(PageVisibilityState state)
 39{
 40 DEFINE_STATIC_LOCAL(const String, visible, ("visible"));
 41 DEFINE_STATIC_LOCAL(const String, hidden, ("hidden"));
 42
 43 switch (state) {
 44 case PageVisibilityStateVisible:
 45 return visible;
 46 case PageVisibilityStateHidden:
 47 return hidden;
 48 }
 49
 50 ASSERT_NOT_REACHED();
 51 return String();
 52}
 53
 54} // namespace WebCore
 55
 56#endif // if ENABLE(PAGE_VISIBILITY_API)

Source/WebCore/page/PageVisibilityState.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions are
 6 * met:
 7 *
 8 * * Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * * Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer
 12 * in the documentation and/or other materials provided with the
 13 * distribution.
 14 * * Neither the name of Google Inc. nor the names of its
 15 * contributors may be used to endorse or promote products derived from
 16 * this software without specific prior written permission.
 17 *
 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 29 */
 30
 31#ifndef PageVisibilityState_h
 32#define PageVisibilityState_h
 33
 34#include <wtf/text/WTFString.h>
 35
 36namespace WebCore {
 37
 38// The enum is not flag protected as it is used in the WebKit chromium API
 39// without flag protection.
 40enum PageVisibilityState {
 41 PageVisibilityStateVisible,
 42 PageVisibilityStateHidden
 43};
 44
 45#if ENABLE(PAGE_VISIBILITY_API)
 46String GetPageVisibilityStateString(PageVisibilityState);
 47#endif
 48
 49} // namespace WebCore
 50
 51#endif // ifndef PageVisibilityState_h

Source/WebKit/chromium/ChangeLog

 12011-05-05 Shishir Agrawal <shishir@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Implement Page Visibility API.
 6 https://bugs.webkit.org/show_bug.cgi?id=54181
 7
 8 * WebKit.gyp:
 9 * public/WebPageVisibilityState.h: Added.
 10 * public/WebView.h:
 11 (WebKit::WebView::setVisibilityState):
 12 * public/WebViewClient.h:
 13 (WebKit::WebViewClient::visibilityState):
 14 * src/WebViewImpl.cpp:
 15 (WebKit::WebViewImpl::WebViewImpl):
 16 (WebKit::WebViewImpl::setVisibilityState):
 17 * src/WebViewImpl.h:
 18
1192011-05-05 Adam Barth <abarth@webkit.org>
220
321 Roll Chromium DEPS.

Source/WebKit/chromium/WebKit.gyp

227227 'public/WebOptionElement.h',
228228 'public/WebPageSerializer.h',
229229 'public/WebPageSerializerClient.h',
 230 'public/WebPageVisibilityState.h',
230231 'public/WebPasswordAutocompleteListener.h',
231232 'public/WebPasswordFormData.h',
232233 'public/WebPerformance.h',

Source/WebKit/chromium/public/WebPageVisibilityState.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions are
 6 * met:
 7 *
 8 * * Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * * Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer
 12 * in the documentation and/or other materials provided with the
 13 * distribution.
 14 * * Neither the name of Google Inc. nor the names of its
 15 * contributors may be used to endorse or promote products derived from
 16 * this software without specific prior written permission.
 17 *
 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 29 */
 30
 31#ifndef WebPageVisibilityState_h
 32#define WebPageVisibilityState_h
 33
 34namespace WebKit {
 35
 36// The following enum should be consistent with the PageVisibilityState enum
 37// defined in WebCore.
 38enum WebPageVisibilityState {
 39 WebPageVisibilityStateVisible,
 40 WebPageVisibilityStateHidden
 41};
 42
 43} // namespace WebKit
 44
 45#endif

Source/WebKit/chromium/public/WebView.h

3232#define WebView_h
3333
3434#include "WebDragOperation.h"
 35#include "WebPageVisibilityState.h"
3536#include "WebString.h"
3637#include "WebVector.h"
3738#include "WebWidget.h"

@@public:
357358 // APIs.
358359 virtual WebGraphicsContext3D* graphicsContext3D() = 0;
359360
 361 // Visibility -----------------------------------------------------------
 362
 363 // Sets the visibility of the WebView.
 364 virtual void setVisibilityState(WebPageVisibilityState visibilityState,
 365 bool isInitialState) { }
 366
360367protected:
361368 ~WebView() {}
362369};

Source/WebKit/chromium/public/WebViewClient.h

3636#include "WebEditingAction.h"
3737#include "WebFileChooserCompletion.h"
3838#include "WebFileChooserParams.h"
 39#include "WebPageVisibilityState.h"
3940#include "WebPopupType.h"
4041#include "WebString.h"
4142#include "WebTextAffinity.h"

@@public:
315316 const WebString& url,
316317 const WebString& title) { }
317318
 319 // Visibility -----------------------------------------------------------
 320
 321 // Returns the current visibility of the WebView.
 322 virtual WebPageVisibilityState visibilityState() const
 323 {
 324 return WebPageVisibilityStateVisible;
 325 }
 326
318327protected:
319328 ~WebViewClient() { }
320329};

Source/WebKit/chromium/src/WebViewImpl.cpp

@@WebViewImpl::WebViewImpl(WebViewClient* client)
366366
367367 m_page->setGroupName(pageGroupName);
368368
 369#if ENABLE(PAGE_VISIBILITY_API)
 370 setVisibilityState(m_client->visibilityState(), true);
 371#endif
 372
369373 m_inspectorSettingsMap = adoptPtr(new SettingsMap);
370374}
371375

@@WebGraphicsContext3D* WebViewImpl::graphicsContext3D()
25592563 return 0;
25602564}
25612565
 2566
 2567void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
 2568 bool isInitialState) {
 2569#if ENABLE(PAGE_VISIBILITY_API)
 2570 if (!page())
 2571 return;
 2572
 2573 switch (visibilityState) {
 2574 case WebPageVisibilityStateVisible:
 2575 m_page->setVisibilityState(PageVisibilityStateVisible, isInitialState);
 2576 return;
 2577 case WebPageVisibilityStateHidden:
 2578 m_page->setVisibilityState(PageVisibilityStateHidden, isInitialState);
 2579 return;
 2580 default:
 2581 ASSERT_NOT_REACHED();
 2582 }
 2583#endif
 2584}
 2585
25622586} // namespace WebKit

Source/WebKit/chromium/src/WebViewImpl.h

@@public:
355355 // WebGL. Returns 0 if compositing support is not compiled in.
356356 virtual WebGraphicsContext3D* graphicsContext3D();
357357
 358 virtual void setVisibilityState(WebPageVisibilityState, bool);
 359
358360 WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); }
359361
360362 // Returns true if the event leads to scrolling.

Tools/ChangeLog

 12011-05-05 Shishir Agrawal <shishir@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Implement Page Visibility API.
 6 https://bugs.webkit.org/show_bug.cgi?id=54181
 7
 8 * DumpRenderTree/LayoutTestController.cpp:
 9 (setPageVisibilityCallback):
 10 (resetPageVisibilityCallback):
 11 (LayoutTestController::staticFunctions):
 12 * DumpRenderTree/LayoutTestController.h:
 13 (LayoutTestController::setPageVisibility):
 14 (LayoutTestController::resetPageVisibility):
 15 * DumpRenderTree/chromium/LayoutTestController.cpp:
 16 (LayoutTestController::LayoutTestController):
 17 (LayoutTestController::resetPageVisibility):
 18 (LayoutTestController::setPageVisibility):
 19 * DumpRenderTree/chromium/LayoutTestController.h:
 20
1212011-05-05 Joseph Pecoraro <joepeck@webkit.org>
222
323 Reviewed by David Kilzer.

Tools/DumpRenderTree/LayoutTestController.cpp

@@static JSValueRef setPluginsEnabledCallback(JSContextRef context, JSObjectRef fu
16701670 return JSValueMakeUndefined(context);
16711671}
16721672
 1673static JSValueRef setPageVisibilityCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 1674{
 1675 // Has mac & windows implementation
 1676 if (argumentCount < 1)
 1677 return JSValueMakeUndefined(context);
 1678
 1679 JSRetainPtr<JSStringRef> visibility(Adopt, JSValueToStringCopy(context, arguments[0], exception));
 1680 ASSERT(!*exception);
 1681
 1682 size_t maxLength = JSStringGetMaximumUTF8CStringSize(visibility.get());
 1683 char* visibilityBuffer = new char[maxLength + 1];
 1684 JSStringGetUTF8CString(visibility.get(), visibilityBuffer, maxLength + 1);
 1685
 1686 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
 1687 controller->setPageVisibility(visibilityBuffer);
 1688 delete[] visibilityBuffer;
 1689
 1690 return JSValueMakeUndefined(context);
 1691}
 1692
 1693static JSValueRef resetPageVisibilityCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 1694{
 1695 // Has mac & windows implementation
 1696 if (argumentCount < 1)
 1697 return JSValueMakeUndefined(context);
 1698
 1699 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
 1700 controller->resetPageVisibility();
 1701 return JSValueMakeUndefined(context);
 1702}
 1703
16731704static JSValueRef setSmartInsertDeleteEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
16741705{
16751706 if (argumentCount < 1)

@@JSStaticFunction* LayoutTestController::staticFunctions()
22562287 { "removeAllVisitedLinks", removeAllVisitedLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22572288 { "removeOriginAccessWhitelistEntry", removeOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22582289 { "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
 2290 { "resetPageVisibility", resetPageVisibilityCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22592291 { "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22602292 { "setAllowUniversalAccessFromFileURLs", setAllowUniversalAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22612293 { "setAllowFileAccessFromFileURLs", setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },

@@JSStaticFunction* LayoutTestController::staticFunctions()
22882320 { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22892321 { "addMockSpeechInputResult", addMockSpeechInputResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22902322 { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
 2323 { "setPageVisibility", setPageVisibilityCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22912324 { "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22922325 { "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
22932326 { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },

Tools/DumpRenderTree/LayoutTestController.h

@@public:
123123 void setScrollbarPolicy(JSStringRef orientation, JSStringRef policy);
124124 void setEditingBehavior(const char* editingBehavior);
125125
 126 void setPageVisibility(const char* visibility) { }
 127 void resetPageVisibility() { }
 128
126129 JSValueRef shadowRoot(JSContextRef, JSValueRef);
127130 JSValueRef ensureShadowRoot(JSContextRef, JSValueRef);
128131 void removeShadowRoot(JSContextRef, JSValueRef);

Tools/DumpRenderTree/chromium/LayoutTestController.cpp

@@LayoutTestController::LayoutTestController(TestShell* shell)
134134 bindMethod("removeOriginAccessWhitelistEntry", &LayoutTestController::removeOriginAccessWhitelistEntry);
135135 bindMethod("removeShadowRoot", &LayoutTestController::removeShadowRoot);
136136 bindMethod("repaintSweepHorizontally", &LayoutTestController::repaintSweepHorizontally);
 137 bindMethod("resetPageVisibility", &LayoutTestController::resetPageVisibility);
137138 bindMethod("resumeAnimations", &LayoutTestController::resumeAnimations);
138139 bindMethod("sampleSVGAnimationForElementAtTime", &LayoutTestController::sampleSVGAnimationForElementAtTime);
139140 bindMethod("setAcceptsEditing", &LayoutTestController::setAcceptsEditing);

@@LayoutTestController::LayoutTestController(TestShell* shell)
157158 bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
158159 bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
159160 bindMethod("addMockSpeechInputResult", &LayoutTestController::addMockSpeechInputResult);
 161 bindMethod("setPageVisibility", &LayoutTestController::setPageVisibility);
160162 bindMethod("setPluginsEnabled", &LayoutTestController::setPluginsEnabled);
161163 bindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingEnabled);
162164 bindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale);

@@void LayoutTestController::setPluginsEnabled(const CppArgumentList& arguments, C
17661768 }
17671769 result->setNull();
17681770}
 1771
 1772void LayoutTestController::resetPageVisibility(const CppArgumentList& arguments, CppVariant* result)
 1773{
 1774 m_shell->webView()->setVisibilityState(WebPageVisibilityStateVisible, true);
 1775}
 1776
 1777void LayoutTestController::setPageVisibility(const CppArgumentList& arguments, CppVariant* result)
 1778{
 1779 if (arguments.size() > 0 && arguments[0].isString()) {
 1780 string newVisibility = arguments[0].toString();
 1781 if (newVisibility == "visible")
 1782 m_shell->webView()->setVisibilityState(WebPageVisibilityStateVisible, false);
 1783 else if (newVisibility == "hidden")
 1784 m_shell->webView()->setVisibilityState(WebPageVisibilityStateHidden, false);
 1785 }
 1786}

Tools/DumpRenderTree/chromium/LayoutTestController.h

@@public:
365365 // Enable or disable plugins.
366366 void setPluginsEnabled(const CppArgumentList&, CppVariant*);
367367
 368 // Switch the visibility of the page.
 369 void setPageVisibility(const CppArgumentList&, CppVariant*);
 370 void resetPageVisibility(const CppArgumentList&, CppVariant*);
 371
368372public:
369373 // The following methods are not exposed to JavaScript.
370374 void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }