| Differences between
and this patch
- a/LayoutTests/ChangeLog +23 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-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
1
2011-05-05  Andrey Kosyakov  <caseq@chromium.org>
24
2011-05-05  Andrey Kosyakov  <caseq@chromium.org>
2
25
3
        Unreviewed. Skip inspector/console/console-shadow-dom-access.html (crashes in debug)
26
        Unreviewed. Skip inspector/console/console-shadow-dom-access.html (crashes in debug)
- a/LayoutTests/fast/events/page-visibility-iframe-delete-test-expected.txt +12 lines
Line 0 a/LayoutTests/fast/events/page-visibility-iframe-delete-test-expected.txt_sec1
1
This test checks that the page visibility event proagation does not crash the browser when frames are added / deleted.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
Loaded all frames.
7
Visibility of main document changed.
8
Visibility of sub frame 2 changed.
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
   
- a/LayoutTests/fast/events/page-visibility-iframe-delete-test.html +111 lines
Line 0 a/LayoutTests/fast/events/page-visibility-iframe-delete-test.html_sec1
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
11
description("This test checks that the page visibility event proagation does not crash the browser when frames are added / deleted.");
12
13
var jsTestIsAsync = true;
14
15
var numVisibilityChanges = 0;
16
var frame1, frame2, frame3, frame4, frame5, subframe1, subFrame2, subFrame3;
17
18
var docsLoaded = 0;
19
var mainPageVisibilityChangeDone = false;
20
var frame2VisiblityChangeDone = false;
21
22
function 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
48
function finishTest() {
49
    if (window.layoutTestController)
50
        layoutTestController.resetPageVisibility();
51
    finishJSTest();
52
}
53
54
function 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
83
function 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
    
100
var 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>
- a/LayoutTests/fast/events/page-visibility-iframe-move-test-expected.txt +21 lines
Line 0 a/LayoutTests/fast/events/page-visibility-iframe-move-test-expected.txt_sec1
1
This test checks that an iframe that moves between pages with different visibility will have the correct visibility value.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
Window 1 Loaded
7
Window 2 Loaded
8
PASS window.document.webkitIsVisible is true
9
PASS window2.document.webkitIsVisible is true
10
PASS iframe.contentDocument.webkitIsVisible is true
11
PASS window.document.webkitIsVisible is false
12
PASS window2.document.webkitIsVisible is true
13
PASS iframe.contentDocument.webkitIsVisible is true
14
Adopted iframe to Window 1
15
PASS window.document.webkitIsVisible is false
16
PASS window2.document.webkitIsVisible is true
17
PASS iframe.contentDocument.webkitIsVisible is false
18
PASS successfullyParsed is true
19
20
TEST COMPLETE
21
- a/LayoutTests/fast/events/page-visibility-iframe-move-test.html +80 lines
Line 0 a/LayoutTests/fast/events/page-visibility-iframe-move-test.html_sec1
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
11
description("This test checks that an iframe that moves between pages with different visibility will have the correct visibility value.");
12
13
var jsTestIsAsync = true;
14
15
var window2, iframe;
16
var numVisibilityChanges = 0;
17
18
function 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
34
function 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
52
function 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
66
function finishTest() {
67
    if (window.layoutTestController) {
68
        layoutTestController.resetPageVisibility();
69
    }
70
    finishJSTest();
71
}
72
73
var successfullyParsed = true;
74
75
</script>
76
77
<script src="../js/resources/js-test-post.js"></script>
78
79
</body>
80
</html>
- a/LayoutTests/fast/events/page-visibility-iframe-propagation-test-expected.txt +27 lines
Line 0 a/LayoutTests/fast/events/page-visibility-iframe-propagation-test-expected.txt_sec1
1
This test checks that Page Visibility state events are propagated to child frames.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
Main Page:
7
PASS document.webkitVisibilityState is "visible"
8
PASS document.webkitIsVisible is true
9
Child Frame:
10
PASS childFrame.contentDocument.webkitVisibilityState is "visible"
11
PASS childFrame.contentDocument.webkitIsVisible is true
12
Main Page:
13
PASS document.webkitVisibilityState is "hidden"
14
PASS document.webkitIsVisible is false
15
Child Frame:
16
PASS childFrame.contentDocument.webkitVisibilityState is "hidden"
17
PASS childFrame.contentDocument.webkitIsVisible is false
18
Main Page:
19
PASS document.webkitVisibilityState is "visible"
20
PASS document.webkitIsVisible is true
21
Child Frame:
22
PASS childFrame.contentDocument.webkitVisibilityState is "visible"
23
PASS childFrame.contentDocument.webkitIsVisible is true
24
PASS successfullyParsed is true
25
26
TEST COMPLETE
27
- a/LayoutTests/fast/events/page-visibility-iframe-propagation-test.html +125 lines
Line 0 a/LayoutTests/fast/events/page-visibility-iframe-propagation-test.html_sec1
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
11
description("This test checks that Page Visibility state events are propagated to child frames.");
12
13
var jsTestIsAsync = true;
14
15
function makePageVisible() {
16
    if (window.layoutTestController)
17
        layoutTestController.setPageVisibility("visible");
18
}
19
20
function makePageHidden() {
21
    if (window.layoutTestController)
22
        layoutTestController.setPageVisibility("hidden");
23
}
24
25
function checkIsPageVisible() {
26
    debug("Main Page:");
27
    shouldBeEqualToString("document.webkitVisibilityState", "visible");
28
    shouldBeTrue("document.webkitIsVisible");
29
}
30
31
function checkIsPageHidden() {
32
    debug("Main Page:");
33
    shouldBeEqualToString("document.webkitVisibilityState", "hidden");
34
    shouldBeFalse("document.webkitIsVisible");
35
}
36
37
function checkIsChildFrameVisible() {
38
    debug("Child Frame:");
39
    shouldBeEqualToString("childFrame.contentDocument.webkitVisibilityState",
40
                          "visible");
41
    shouldBeTrue("childFrame.contentDocument.webkitIsVisible");
42
}
43
44
function 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
55
var numVisibilityChanges = 0;
56
57
var childFrame;
58
59
function 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
73
var numFinishes = 0;
74
function finishTest() {
75
    numFinishes++;
76
    if (numFinishes < 2) {
77
      return;
78
    }
79
80
    if (window.layoutTestController) {
81
        layoutTestController.resetPageVisibility();
82
    }
83
    finishJSTest();
84
}
85
86
function 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
101
function 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
117
var 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>
- a/LayoutTests/fast/events/page-visibility-transition-test-expected.txt +17 lines
Line 0 a/LayoutTests/fast/events/page-visibility-transition-test-expected.txt_sec1
1
This test checks that Page Visibility state values are correct and the event changes are fired correctly.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS document.webkitVisibilityState is "visible"
7
PASS document.webkitIsVisible is true
8
PASS document.webkitVisibilityState is "hidden"
9
PASS document.webkitIsVisible is false
10
PASS document.webkitVisibilityState is "hidden"
11
PASS document.webkitIsVisible is false
12
PASS document.webkitVisibilityState is "visible"
13
PASS document.webkitIsVisible is true
14
PASS successfullyParsed is true
15
16
TEST COMPLETE
17
- a/LayoutTests/fast/events/page-visibility-transition-test.html +89 lines
Line 0 a/LayoutTests/fast/events/page-visibility-transition-test.html_sec1
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
11
description("This test checks that Page Visibility state values are correct and the event changes are fired correctly.");
12
13
var jsTestIsAsync = true;
14
15
function makePageVisible() {
16
    if (window.layoutTestController)
17
        layoutTestController.setPageVisibility("visible");
18
}
19
20
function makePageHidden() {
21
    if (window.layoutTestController)
22
        layoutTestController.setPageVisibility("hidden");
23
}
24
25
function checkIsPageVisible() {
26
    shouldBeEqualToString("document.webkitVisibilityState", "visible");
27
    shouldBeTrue("document.webkitIsVisible");
28
}
29
30
function 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).
40
var numVisibilityChanges = 0;
41
42
function startTest() {
43
    document.addEventListener(
44
        "webkitvisibilitystatechange", onVisibilityChange, false);
45
    checkIsPageVisible();
46
    numVisibilityChanges++;
47
    makePageHidden();
48
}
49
50
function finishTest() {
51
    if (window.layoutTestController) {
52
        layoutTestController.resetPageVisibility();
53
    }
54
    finishJSTest();
55
}
56
57
function 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
        
82
var successfullyParsed = true;
83
84
</script>
85
86
<script src="../js/resources/js-test-post.js"></script>
87
88
</body>
89
</html>
- a/LayoutTests/fast/events/resources/page-visibility-iframe-delete-test-frame.html +6 lines
Line 0 a/LayoutTests/fast/events/resources/page-visibility-iframe-delete-test-frame.html_sec1
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>
- a/LayoutTests/fast/events/resources/page-visibility-iframe-move-new-page.html +5 lines
Line 0 a/LayoutTests/fast/events/resources/page-visibility-iframe-move-new-page.html_sec1
1
<html>
2
<body>
3
<iframe id="iframe"></iframe>
4
</body>
5
</html>
- a/LayoutTests/platform/chromium/test_expectations.txt +6 lines
Lines 3990-3992 BUGWK60243 : fullscreen/full-screen-stacking-context.html = PASS TEXT a/LayoutTests/platform/chromium/test_expectations.txt_sec1
3990
3990
3991
BUGWK60252 MAC GPU : animations/3d/matrix-transform-type-animation.html = IMAGE
3991
BUGWK60252 MAC GPU : animations/3d/matrix-transform-type-animation.html = IMAGE
3992
BUGWK60252 MAC GPU : animations/3d/state-at-end-event-transform.html = IMAGE
3992
BUGWK60252 MAC GPU : animations/3d/state-at-end-event-transform.html = IMAGE
3993
3994
// Page visibility API not turned on.
3995
BUGWK54181 : fast/events/page-visibility-iframe-delete-test.html = TIMEOUT
3996
BUGWK54181 : fast/events/page-visibility-iframe-move-test.html = TIMEOUT
3997
BUGWK54181 : fast/events/page-visibility-iframe-propagation-test.html = TIMEOUT
3998
BUGWK54181 : fast/events/page-visibility-transition-test.html = TIMEOUT
- a/LayoutTests/platform/gtk/Skipped +6 lines
Lines 1412-1414 tables/mozilla_expected_failures/bugs/bug85016.html a/LayoutTests/platform/gtk/Skipped_sec1
1412
# HTTP 204 (No Content) should be ignored
1412
# HTTP 204 (No Content) should be ignored
1413
# https://bugs.webkit.org/show_bug.cgi?id=60206
1413
# https://bugs.webkit.org/show_bug.cgi?id=60206
1414
http/tests/navigation/response204.html
1414
http/tests/navigation/response204.html
1415
1416
# This platform does not support the Page Visibility API.
1417
fast/events/page-visibility-iframe-delete-test.html
1418
fast/events/page-visibility-iframe-move-test.html
1419
fast/events/page-visibility-iframe-propagation-test.html
1420
fast/events/page-visibility-transition-test.html
- a/LayoutTests/platform/mac/Skipped +6 lines
Lines 354-356 animations/animation-api-1.html a/LayoutTests/platform/mac/Skipped_sec1
354
# HTTP 204 (No Content) should be ignored
354
# HTTP 204 (No Content) should be ignored
355
# https://bugs.webkit.org/show_bug.cgi?id=60206
355
# https://bugs.webkit.org/show_bug.cgi?id=60206
356
http/tests/navigation/response204.html
356
http/tests/navigation/response204.html
357
358
# This platform does not support the Page Visibility API.
359
fast/events/page-visibility-iframe-delete-test.html
360
fast/events/page-visibility-iframe-move-test.html
361
fast/events/page-visibility-iframe-propagation-test.html
362
fast/events/page-visibility-transition-test.html
- a/LayoutTests/platform/qt/Skipped +6 lines
Lines 2696-2698 http/tests/security/contentSecurityPolicy/media-src-blocked.html a/LayoutTests/platform/qt/Skipped_sec1
2696
2696
2697
# Animation API is disabled by default
2697
# Animation API is disabled by default
2698
animations/animation-api-1.html
2698
animations/animation-api-1.html
2699
2700
# This platform does not support the Page Visibility API.
2701
fast/events/page-visibility-iframe-delete-test.html
2702
fast/events/page-visibility-iframe-move-test.html
2703
fast/events/page-visibility-iframe-propagation-test.html
2704
fast/events/page-visibility-transition-test.html
- a/LayoutTests/platform/win/Skipped +6 lines
Lines 1282-1284 animations/animation-api-1.html a/LayoutTests/platform/win/Skipped_sec1
1282
# HTTP 204 (No Content) should be ignored
1282
# HTTP 204 (No Content) should be ignored
1283
# https://bugs.webkit.org/show_bug.cgi?id=60206
1283
# https://bugs.webkit.org/show_bug.cgi?id=60206
1284
http/tests/navigation/response204.html
1284
http/tests/navigation/response204.html
1285
1286
# This platform does not support the Page Visibility API.
1287
fast/events/page-visibility-iframe-delete-test.html
1288
fast/events/page-visibility-iframe-move-test.html
1289
fast/events/page-visibility-iframe-propagation-test.html
1290
fast/events/page-visibility-transition-test.html
- a/Source/WebCore/CMakeLists.txt +1 lines
Lines 1011-1016 SET(WebCore_SOURCES a/Source/WebCore/CMakeLists.txt_sec1
1011
    page/PageGroup.cpp
1011
    page/PageGroup.cpp
1012
    page/PageGroupLoadDeferrer.cpp
1012
    page/PageGroupLoadDeferrer.cpp
1013
    page/PageSerializer.cpp
1013
    page/PageSerializer.cpp
1014
    page/PageVisibilityState.cpp
1014
    page/Performance.cpp
1015
    page/Performance.cpp
1015
    page/PerformanceNavigation.cpp
1016
    page/PerformanceNavigation.cpp
1016
    page/PerformanceTiming.cpp
1017
    page/PerformanceTiming.cpp
- a/Source/WebCore/ChangeLog +38 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-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
1
2011-05-05  Eric Carlson  <eric.carlson@apple.com>
39
2011-05-05  Eric Carlson  <eric.carlson@apple.com>
2
40
3
        Reviewed by Adam Roben.
41
        Reviewed by Adam Roben.
- a/Source/WebCore/GNUmakefile.list.am +2 lines
Lines 2220-2225 webcore_sources += \ a/Source/WebCore/GNUmakefile.list.am_sec1
2220
	Source/WebCore/page/PageGroupLoadDeferrer.h \
2220
	Source/WebCore/page/PageGroupLoadDeferrer.h \
2221
	Source/WebCore/page/PageSerializer.cpp \
2221
	Source/WebCore/page/PageSerializer.cpp \
2222
	Source/WebCore/page/PageSerializer.h \
2222
	Source/WebCore/page/PageSerializer.h \
2223
	Source/WebCore/page/PageVisibilityState.cpp \
2224
	Source/WebCore/page/PageVisibilityState.h \
2223
	Source/WebCore/page/Performance.cpp \
2225
	Source/WebCore/page/Performance.cpp \
2224
	Source/WebCore/page/Performance.h \
2226
	Source/WebCore/page/Performance.h \
2225
	Source/WebCore/page/PerformanceNavigation.cpp \
2227
	Source/WebCore/page/PerformanceNavigation.cpp \
- a/Source/WebCore/WebCore.gypi +2 lines
Lines 711-716 a/Source/WebCore/WebCore.gypi_sec1
711
            'page/Page.h',
711
            'page/Page.h',
712
            'page/PageGroup.h',
712
            'page/PageGroup.h',
713
            'page/PageSerializer.h',
713
            'page/PageSerializer.h',
714
            'page/PageVisibilityState.h',
714
            'page/PluginHalterClient.h',
715
            'page/PluginHalterClient.h',
715
            'page/PositionCallback.h',
716
            'page/PositionCallback.h',
716
            'page/PositionError.h',
717
            'page/PositionError.h',
Lines 3435-3440 a/Source/WebCore/WebCore.gypi_sec2
3435
            'page/PageGroupLoadDeferrer.cpp',
3436
            'page/PageGroupLoadDeferrer.cpp',
3436
            'page/PageGroupLoadDeferrer.h',
3437
            'page/PageGroupLoadDeferrer.h',
3437
            'page/PageSerializer.cpp',
3438
            'page/PageSerializer.cpp',
3439
            'page/PageVisibilityState.cpp',
3438
            'page/Performance.cpp',
3440
            'page/Performance.cpp',
3439
            'page/Performance.h',
3441
            'page/Performance.h',
3440
            'page/PerformanceNavigation.cpp',
3442
            'page/PerformanceNavigation.cpp',
- a/Source/WebCore/WebCore.pro +2 lines
Lines 921-926 SOURCES += \ a/Source/WebCore/WebCore.pro_sec1
921
    page/PageGroup.cpp \
921
    page/PageGroup.cpp \
922
    page/PageGroupLoadDeferrer.cpp \
922
    page/PageGroupLoadDeferrer.cpp \
923
    page/PageSerializer.cpp \
923
    page/PageSerializer.cpp \
924
    page/PageVisibilityState.cpp \
924
    page/Performance.cpp \
925
    page/Performance.cpp \
925
    page/PerformanceNavigation.cpp \
926
    page/PerformanceNavigation.cpp \
926
    page/PerformanceTiming.cpp \
927
    page/PerformanceTiming.cpp \
Lines 1862-1867 HEADERS += \ a/Source/WebCore/WebCore.pro_sec2
1862
    page/PageGroupLoadDeferrer.h \
1863
    page/PageGroupLoadDeferrer.h \
1863
    page/Page.h \
1864
    page/Page.h \
1864
    page/PageSerializer.h \
1865
    page/PageSerializer.h \
1866
    page/PageVisibilityState.h \
1865
    page/PluginHalter.h \
1867
    page/PluginHalter.h \
1866
    page/PluginHalterClient.h \
1868
    page/PluginHalterClient.h \
1867
    page/PrintContext.h \
1869
    page/PrintContext.h \
- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +6 lines
Lines 24750-24755 a/Source/WebCore/WebCore.vcproj/WebCore.vcproj_sec1
24750
				>
24750
				>
24751
			</File>
24751
			</File>
24752
			<File
24752
			<File
24753
				RelativePath="..\page\PageVisibilityState.cpp"
24754
				>
24755
			<File
24756
				RelativePath="..\page\PageVisibilityState.h"
24757
				>
24758
			<File
24753
				RelativePath="..\page\Performance.cpp"
24759
				RelativePath="..\page\Performance.cpp"
24754
				>
24760
				>
24755
			</File>
24761
			</File>
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +8 lines
Lines 5926-5931 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
5926
		FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA620E9C4703000D6F75 /* JSGeoposition.h */; };
5926
		FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA620E9C4703000D6F75 /* JSGeoposition.h */; };
5927
		FE80DA710E9C472F000D6F75 /* JSPositionError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */; };
5927
		FE80DA710E9C472F000D6F75 /* JSPositionError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */; };
5928
		FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */; };
5928
		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, ); }; };
5929
/* End PBXBuildFile section */
5931
/* End PBXBuildFile section */
5930
5932
5931
/* Begin PBXContainerItemProxy section */
5933
/* Begin PBXContainerItemProxy section */
Lines 12447-12452 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
12447
		FE80DA620E9C4703000D6F75 /* JSGeoposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGeoposition.h; sourceTree = "<group>"; };
12449
		FE80DA620E9C4703000D6F75 /* JSGeoposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGeoposition.h; sourceTree = "<group>"; };
12448
		FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionError.cpp; sourceTree = "<group>"; };
12450
		FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionError.cpp; sourceTree = "<group>"; };
12449
		FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionError.h; sourceTree = "<group>"; };
12451
		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>"; };
12450
/* End PBXFileReference section */
12454
/* End PBXFileReference section */
12451
12455
12452
/* Begin PBXFrameworksBuildPhase section */
12456
/* Begin PBXFrameworksBuildPhase section */
Lines 14172-14177 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
14172
				7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */,
14176
				7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */,
14173
				371E65CD13661EED00BEEDB0 /* PageSerializer.cpp */,
14177
				371E65CD13661EED00BEEDB0 /* PageSerializer.cpp */,
14174
				371E65CB13661EDC00BEEDB0 /* PageSerializer.h */,
14178
				371E65CB13661EDC00BEEDB0 /* PageSerializer.h */,
14179
				FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */,
14180
				FFD5B978135CC97800D5E92A /* PageVisibilityState.h */,
14175
				8A844D0111D3C18E0014065C /* Performance.cpp */,
14181
				8A844D0111D3C18E0014065C /* Performance.cpp */,
14176
				8A844D0211D3C18E0014065C /* Performance.h */,
14182
				8A844D0211D3C18E0014065C /* Performance.h */,
14177
				8A844D0311D3C18E0014065C /* Performance.idl */,
14183
				8A844D0311D3C18E0014065C /* Performance.idl */,
Lines 21876-21881 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
21876
				F34742E51343633C00531BC2 /* PageScriptDebugServer.h in Headers */,
21882
				F34742E51343633C00531BC2 /* PageScriptDebugServer.h in Headers */,
21877
				371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */,
21883
				371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */,
21878
				E1284AE110447D4500EAEB52 /* PageTransitionEvent.h in Headers */,
21884
				E1284AE110447D4500EAEB52 /* PageTransitionEvent.h in Headers */,
21885
				FFD5B97B135CC97800D5E92A /* PageVisibilityState.h in Headers */,
21879
				51E1ECC30C91C90400DC255B /* PageURLRecord.h in Headers */,
21886
				51E1ECC30C91C90400DC255B /* PageURLRecord.h in Headers */,
21880
				0885067F11DA045B00182B98 /* PaintInfo.h in Headers */,
21887
				0885067F11DA045B00182B98 /* PaintInfo.h in Headers */,
21881
				0885068011DA045B00182B98 /* PaintPhase.h in Headers */,
21888
				0885068011DA045B00182B98 /* PaintPhase.h in Headers */,
Lines 24743-24748 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
24743
				371E65CE13661EED00BEEDB0 /* PageSerializer.cpp in Sources */,
24750
				371E65CE13661EED00BEEDB0 /* PageSerializer.cpp in Sources */,
24744
				E1284AEA10447DEE00EAEB52 /* PageTransitionEvent.cpp in Sources */,
24751
				E1284AEA10447DEE00EAEB52 /* PageTransitionEvent.cpp in Sources */,
24745
				51E1ECC20C91C90400DC255B /* PageURLRecord.cpp in Sources */,
24752
				51E1ECC20C91C90400DC255B /* PageURLRecord.cpp in Sources */,
24753
				FFD5B97A135CC97800D5E92A /* PageVisibilityState.cpp in Sources */,
24746
				FD3160A212B026F700C1A359 /* Panner.cpp in Sources */,
24754
				FD3160A212B026F700C1A359 /* Panner.cpp in Sources */,
24747
				F55B3DC91251F12D003EF269 /* PasswordInputType.cpp in Sources */,
24755
				F55B3DC91251F12D003EF269 /* PasswordInputType.cpp in Sources */,
24748
				4B2709830AF2E5E00065127F /* PasteboardMac.mm in Sources */,
24756
				4B2709830AF2E5E00065127F /* PasteboardMac.mm in Sources */,
- a/Source/WebCore/dom/Document.cpp +28 lines
Lines 1354-1359 void Document::removeTitle(Element* titleElement) a/Source/WebCore/dom/Document.cpp_sec1
1354
        updateTitle(StringWithDirection());
1354
        updateTitle(StringWithDirection());
1355
}
1355
}
1356
1356
1357
#if ENABLE(PAGE_VISIBILITY_API)
1358
PageVisibilityState 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
1369
String Document::webkitVisibilityState() const
1370
{
1371
    return GetPageVisibilityStateString(visibilityState());
1372
}
1373
1374
bool Document::webkitIsVisible() const
1375
{
1376
    return visibilityState() == PageVisibilityStateVisible;
1377
}
1378
1379
void Document::dispatchVisibilityStateChangeEvent()
1380
{
1381
    dispatchEvent(Event::create(eventNames().webkitvisibilitystatechangeEvent, false, false));
1382
}
1383
#endif
1384
1357
String Document::nodeName() const
1385
String Document::nodeName() const
1358
{
1386
{
1359
    return "#document";
1387
    return "#document";
- a/Source/WebCore/dom/Document.h +14 lines
Lines 34-39 a/Source/WebCore/dom/Document.h_sec1
34
#include "DOMTimeStamp.h"
34
#include "DOMTimeStamp.h"
35
#include "DocumentTiming.h"
35
#include "DocumentTiming.h"
36
#include "IconURL.h"
36
#include "IconURL.h"
37
#include "PageVisibilityState.h"
37
#include "QualifiedName.h"
38
#include "QualifiedName.h"
38
#include "ScriptExecutionContext.h"
39
#include "ScriptExecutionContext.h"
39
#include "StringWithDirection.h"
40
#include "StringWithDirection.h"
Lines 304-309 public: a/Source/WebCore/dom/Document.h_sec2
304
#if ENABLE(FULLSCREEN_API)
305
#if ENABLE(FULLSCREEN_API)
305
    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitfullscreenchange);
306
    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitfullscreenchange);
306
#endif
307
#endif
308
#if ENABLE(PAGE_VISIBILITY_API)
309
    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitvisibilitystatechange);
310
#endif
307
311
308
    ViewportArguments viewportArguments() const { return m_viewportArguments; }
312
    ViewportArguments viewportArguments() const { return m_viewportArguments; }
309
313
Lines 379-384 public: a/Source/WebCore/dom/Document.h_sec3
379
383
380
    virtual KURL baseURI() const;
384
    virtual KURL baseURI() const;
381
385
386
#if ENABLE(PAGE_VISIBILITY_API)
387
    String webkitVisibilityState() const;
388
    bool webkitIsVisible() const;
389
    void dispatchVisibilityStateChangeEvent();
390
#endif
391
382
    PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
392
    PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
383
393
384
    PassRefPtr<HTMLCollection> images();
394
    PassRefPtr<HTMLCollection> images();
Lines 1132-1137 private: a/Source/WebCore/dom/Document.h_sec4
1132
1142
1133
    void loadEventDelayTimerFired(Timer<Document>*);
1143
    void loadEventDelayTimerFired(Timer<Document>*);
1134
1144
1145
#if ENABLE(PAGE_VISIBILITY_API)
1146
    PageVisibilityState visibilityState() const;
1147
#endif
1148
1135
    int m_guardRefCount;
1149
    int m_guardRefCount;
1136
1150
1137
    OwnPtr<CSSStyleSelector> m_styleSelector;
1151
    OwnPtr<CSSStyleSelector> m_styleSelector;
- a/Source/WebCore/dom/Document.idl +4 lines
Lines 334-339 module core { a/Source/WebCore/dom/Document.idl_sec1
334
        boolean isHTMLDocument();
334
        boolean isHTMLDocument();
335
#endif
335
#endif
336
336
337
        // Page visibility API.
338
        readonly attribute [Conditional=PAGE_VISIBILITY_API] DOMString webkitVisibilityState;
339
        readonly attribute [Conditional=PAGE_VISIBILITY_API] boolean webkitIsVisible;
340
337
    };
341
    };
338
342
339
}
343
}
- a/Source/WebCore/dom/EventNames.h +1 lines
Lines 106-111 namespace WebCore { a/Source/WebCore/dom/EventNames.h_sec1
106
    macro(unload) \
106
    macro(unload) \
107
    macro(updateready) \
107
    macro(updateready) \
108
    macro(versionchange) \
108
    macro(versionchange) \
109
    macro(webkitvisibilitystatechange) \
109
    macro(write) \
110
    macro(write) \
110
    macro(writeend) \
111
    macro(writeend) \
111
    macro(writestart) \
112
    macro(writestart) \
- a/Source/WebCore/page/Frame.cpp +10 lines
Lines 718-723 void Frame::setDOMWindow(DOMWindow* domWindow) a/Source/WebCore/page/Frame.cpp_sec1
718
    m_domWindow = domWindow;
718
    m_domWindow = domWindow;
719
}
719
}
720
720
721
#if ENABLE(PAGE_VISIBILITY_API)
722
void 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
721
DOMWindow* Frame::domWindow() const
731
DOMWindow* Frame::domWindow() const
722
{
732
{
723
    if (!m_domWindow)
733
    if (!m_domWindow)
- a/Source/WebCore/page/Frame.h +4 lines
Lines 119-124 namespace WebCore { a/Source/WebCore/page/Frame.h_sec1
119
119
120
        void transferChildFrameToNewDocument();
120
        void transferChildFrameToNewDocument();
121
121
122
#if ENABLE(PAGE_VISIBILITY_API)
123
        void dispatchVisibilityStateChangeEvent();
124
#endif
125
122
    // ======== All public functions below this point are candidates to move out of Frame into another class. ========
126
    // ======== All public functions below this point are candidates to move out of Frame into another class. ========
123
127
124
        bool isDisconnected() const;
128
        bool isDisconnected() const;
- a/Source/WebCore/page/Page.cpp +20 lines
Lines 163-168 Page::Page(const PageClients& pageClients) a/Source/WebCore/page/Page.cpp_sec1
163
    , m_viewMode(ViewModeWindowed)
163
    , m_viewMode(ViewModeWindowed)
164
    , m_minimumTimerInterval(Settings::defaultMinDOMTimerInterval())
164
    , m_minimumTimerInterval(Settings::defaultMinDOMTimerInterval())
165
    , m_isEditable(false)
165
    , m_isEditable(false)
166
#if ENABLE(PAGE_VISIBILITY_API)
167
    , m_visibilityState(PageVisibilityStateVisible)
168
#endif
166
{
169
{
167
    if (!allPages) {
170
    if (!allPages) {
168
        allPages = new HashSet<Page*>;
171
        allPages = new HashSet<Page*>;
Lines 934-939 void Page::checkFrameCountConsistency() const a/Source/WebCore/page/Page.cpp_sec2
934
}
937
}
935
#endif
938
#endif
936
939
940
#if ENABLE(PAGE_VISIBILITY_API)
941
void 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
951
PageVisibilityState Page::visibilityState() const
952
{
953
    return m_visibilityState;
954
}
955
#endif
956
937
Page::PageClients::PageClients()
957
Page::PageClients::PageClients()
938
    : chromeClient(0)
958
    : chromeClient(0)
939
    , contextMenuClient(0)
959
    , contextMenuClient(0)
- a/Source/WebCore/page/Page.h +10 lines
Lines 23-28 a/Source/WebCore/page/Page.h_sec1
23
23
24
#include "FrameLoaderTypes.h"
24
#include "FrameLoaderTypes.h"
25
#include "FindOptions.h"
25
#include "FindOptions.h"
26
#include "PageVisibilityState.h"
26
#include "PlatformString.h"
27
#include "PlatformString.h"
27
#include "ViewportArguments.h"
28
#include "ViewportArguments.h"
28
#include <wtf/Forward.h>
29
#include <wtf/Forward.h>
Lines 300-305 namespace WebCore { a/Source/WebCore/page/Page.h_sec2
300
        void setEditable(bool isEditable) { m_isEditable = isEditable; }
301
        void setEditable(bool isEditable) { m_isEditable = isEditable; }
301
        bool isEditable() { return m_isEditable; }
302
        bool isEditable() { return m_isEditable; }
302
303
304
#if ENABLE(PAGE_VISIBILITY_API)
305
        PageVisibilityState visibilityState() const;
306
        void setVisibilityState(PageVisibilityState, bool);
307
#endif
308
303
    private:
309
    private:
304
        void initGroup();
310
        void initGroup();
305
311
Lines 405-410 namespace WebCore { a/Source/WebCore/page/Page.h_sec3
405
        OwnPtr<ScrollableAreaSet> m_scrollableAreaSet;
411
        OwnPtr<ScrollableAreaSet> m_scrollableAreaSet;
406
412
407
        bool m_isEditable;
413
        bool m_isEditable;
414
415
#if ENABLE(PAGE_VISIBILITY_API)
416
        PageVisibilityState m_visibilityState;
417
#endif
408
    };
418
    };
409
419
410
} // namespace WebCore
420
} // namespace WebCore
- a/Source/WebCore/page/PageVisibilityState.cpp +56 lines
Line 0 a/Source/WebCore/page/PageVisibilityState.cpp_sec1
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
36
namespace WebCore {
37
38
String 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)
- a/Source/WebCore/page/PageVisibilityState.h +51 lines
Line 0 a/Source/WebCore/page/PageVisibilityState.h_sec1
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
36
namespace WebCore {
37
38
// The enum is not flag protected as it is used in the WebKit chromium API
39
// without flag protection.
40
enum PageVisibilityState {
41
    PageVisibilityStateVisible,
42
    PageVisibilityStateHidden
43
};
44
45
#if ENABLE(PAGE_VISIBILITY_API)
46
String GetPageVisibilityStateString(PageVisibilityState);
47
#endif
48
49
} // namespace WebCore
50
51
#endif // ifndef PageVisibilityState_h
- a/Source/WebKit/chromium/ChangeLog +19 lines
Lines 1-3 a/Source/WebKit/chromium/ChangeLog_sec1
1
2011-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/AssertMatchingEnums.cpp:
15
        * src/WebViewImpl.cpp:
16
        (WebKit::WebViewImpl::WebViewImpl):
17
        (WebKit::WebViewImpl::setVisibilityState):
18
        * src/WebViewImpl.h:
19
1
2011-05-05  Adam Barth  <abarth@webkit.org>
20
2011-05-05  Adam Barth  <abarth@webkit.org>
2
21
3
        Roll Chromium DEPS.
22
        Roll Chromium DEPS.
- a/Source/WebKit/chromium/WebKit.gyp +1 lines
Lines 227-232 a/Source/WebKit/chromium/WebKit.gyp_sec1
227
                'public/WebOptionElement.h',
227
                'public/WebOptionElement.h',
228
                'public/WebPageSerializer.h',
228
                'public/WebPageSerializer.h',
229
                'public/WebPageSerializerClient.h',
229
                'public/WebPageSerializerClient.h',
230
                'public/WebPageVisibilityState.h',
230
                'public/WebPasswordAutocompleteListener.h',
231
                'public/WebPasswordAutocompleteListener.h',
231
                'public/WebPasswordFormData.h',
232
                'public/WebPasswordFormData.h',
232
                'public/WebPerformance.h',
233
                'public/WebPerformance.h',
- a/Source/WebKit/chromium/public/WebPageVisibilityState.h +45 lines
Line 0 a/Source/WebKit/chromium/public/WebPageVisibilityState.h_sec1
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
34
namespace WebKit {
35
36
// The following enum should be consistent with the PageVisibilityState enum
37
// defined in WebCore.
38
enum WebPageVisibilityState {
39
    WebPageVisibilityStateVisible,
40
    WebPageVisibilityStateHidden
41
};
42
43
} // namespace WebKit
44
45
#endif
- a/Source/WebKit/chromium/public/WebView.h +7 lines
Lines 32-37 a/Source/WebKit/chromium/public/WebView.h_sec1
32
#define WebView_h
32
#define WebView_h
33
33
34
#include "WebDragOperation.h"
34
#include "WebDragOperation.h"
35
#include "WebPageVisibilityState.h"
35
#include "WebString.h"
36
#include "WebString.h"
36
#include "WebVector.h"
37
#include "WebVector.h"
37
#include "WebWidget.h"
38
#include "WebWidget.h"
Lines 357-362 public: a/Source/WebKit/chromium/public/WebView.h_sec2
357
    // APIs.
358
    // APIs.
358
    virtual WebGraphicsContext3D* graphicsContext3D() = 0;
359
    virtual WebGraphicsContext3D* graphicsContext3D() = 0;
359
360
361
    // Visibility -----------------------------------------------------------
362
363
    // Sets the visibility of the WebView.
364
    virtual void setVisibilityState(WebPageVisibilityState visibilityState,
365
                                    bool isInitialState) { }
366
360
protected:
367
protected:
361
    ~WebView() {}
368
    ~WebView() {}
362
};
369
};
- a/Source/WebKit/chromium/public/WebViewClient.h +9 lines
Lines 36-41 a/Source/WebKit/chromium/public/WebViewClient.h_sec1
36
#include "WebEditingAction.h"
36
#include "WebEditingAction.h"
37
#include "WebFileChooserCompletion.h"
37
#include "WebFileChooserCompletion.h"
38
#include "WebFileChooserParams.h"
38
#include "WebFileChooserParams.h"
39
#include "WebPageVisibilityState.h"
39
#include "WebPopupType.h"
40
#include "WebPopupType.h"
40
#include "WebString.h"
41
#include "WebString.h"
41
#include "WebTextAffinity.h"
42
#include "WebTextAffinity.h"
Lines 315-320 public: a/Source/WebKit/chromium/public/WebViewClient.h_sec2
315
                                         const WebString& url,
316
                                         const WebString& url,
316
                                         const WebString& title) { }
317
                                         const WebString& title) { }
317
318
319
    // Visibility -----------------------------------------------------------
320
321
    // Returns the current visibility of the WebView.
322
    virtual WebPageVisibilityState visibilityState() const
323
    {
324
        return WebPageVisibilityStateVisible;
325
    }
326
318
protected:
327
protected:
319
    ~WebViewClient() { }
328
    ~WebViewClient() { }
320
};
329
};
- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +5 lines
Lines 50-55 a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp_sec1
50
#include "IDBKey.h"
50
#include "IDBKey.h"
51
#include "MediaPlayer.h"
51
#include "MediaPlayer.h"
52
#include "NotificationPresenter.h"
52
#include "NotificationPresenter.h"
53
#include "PageVisibilityState.h"
53
#include "PasteboardPrivate.h"
54
#include "PasteboardPrivate.h"
54
#include "PlatformCursor.h"
55
#include "PlatformCursor.h"
55
#include "Settings.h"
56
#include "Settings.h"
Lines 75-80 a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp_sec2
75
#include "WebInputElement.h"
76
#include "WebInputElement.h"
76
#include "WebMediaPlayer.h"
77
#include "WebMediaPlayer.h"
77
#include "WebNotificationPresenter.h"
78
#include "WebNotificationPresenter.h"
79
#include "WebPageVisibilityState.h"
78
#include "WebScrollbar.h"
80
#include "WebScrollbar.h"
79
#include "WebSettings.h"
81
#include "WebSettings.h"
80
#include "WebStorageQuotaError.h"
82
#include "WebStorageQuotaError.h"
Lines 445-447 COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationVertical, Platf a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp_sec3
445
COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentScrollView, PlatformBridge::ScrollbarParentScrollView);
447
COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentScrollView, PlatformBridge::ScrollbarParentScrollView);
446
COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentRenderLayer, PlatformBridge::ScrollbarParentRenderLayer);
448
COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentRenderLayer, PlatformBridge::ScrollbarParentRenderLayer);
447
#endif
449
#endif
450
451
COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateVisible, PageVisibilityStateVisible);
452
COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateHidden, PageVisibilityStateHidden);
- a/Source/WebKit/chromium/src/WebViewImpl.cpp +16 lines
Lines 366-371 WebViewImpl::WebViewImpl(WebViewClient* client) a/Source/WebKit/chromium/src/WebViewImpl.cpp_sec1
366
366
367
    m_page->setGroupName(pageGroupName);
367
    m_page->setGroupName(pageGroupName);
368
368
369
#if ENABLE(PAGE_VISIBILITY_API)
370
    setVisibilityState(m_client->visibilityState(), true);
371
#endif
372
369
    m_inspectorSettingsMap = adoptPtr(new SettingsMap);
373
    m_inspectorSettingsMap = adoptPtr(new SettingsMap);
370
}
374
}
371
375
Lines 2559-2562 WebGraphicsContext3D* WebViewImpl::graphicsContext3D() a/Source/WebKit/chromium/src/WebViewImpl.cpp_sec2
2559
    return 0;
2563
    return 0;
2560
}
2564
}
2561
2565
2566
2567
void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
2568
                                     bool isInitialState) {
2569
#if ENABLE(PAGE_VISIBILITY_API)
2570
    if (!page())
2571
        return;
2572
2573
    ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState == WebPageVisibilityStateHidden);
2574
    m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int>(visibilityState)), isInitialState);
2575
#endif
2576
}
2577
2562
} // namespace WebKit
2578
} // namespace WebKit
- a/Source/WebKit/chromium/src/WebViewImpl.h +2 lines
Lines 355-360 public: a/Source/WebKit/chromium/src/WebViewImpl.h_sec1
355
    // WebGL. Returns 0 if compositing support is not compiled in.
355
    // WebGL. Returns 0 if compositing support is not compiled in.
356
    virtual WebGraphicsContext3D* graphicsContext3D();
356
    virtual WebGraphicsContext3D* graphicsContext3D();
357
357
358
    virtual void setVisibilityState(WebPageVisibilityState, bool);
359
358
    WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); }
360
    WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); }
359
361
360
    // Returns true if the event leads to scrolling.
362
    // Returns true if the event leads to scrolling.
- a/Tools/ChangeLog +20 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2011-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
1
2011-05-05  Joseph Pecoraro  <joepeck@webkit.org>
21
2011-05-05  Joseph Pecoraro  <joepeck@webkit.org>
2
22
3
        Reviewed by David Kilzer.
23
        Reviewed by David Kilzer.
- a/Tools/DumpRenderTree/LayoutTestController.cpp +33 lines
Lines 1670-1675 static JSValueRef setPluginsEnabledCallback(JSContextRef context, JSObjectRef fu a/Tools/DumpRenderTree/LayoutTestController.cpp_sec1
1670
    return JSValueMakeUndefined(context);
1670
    return JSValueMakeUndefined(context);
1671
}    
1671
}    
1672
1672
1673
static 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
1693
static 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
1673
static JSValueRef setSmartInsertDeleteEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1704
static JSValueRef setSmartInsertDeleteEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1674
{
1705
{
1675
    if (argumentCount < 1)
1706
    if (argumentCount < 1)
Lines 2256-2261 JSStaticFunction* LayoutTestController::staticFunctions() a/Tools/DumpRenderTree/LayoutTestController.cpp_sec2
2256
        { "removeAllVisitedLinks", removeAllVisitedLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2287
        { "removeAllVisitedLinks", removeAllVisitedLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2257
        { "removeOriginAccessWhitelistEntry", removeOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2288
        { "removeOriginAccessWhitelistEntry", removeOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2258
        { "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2289
        { "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2290
        { "resetPageVisibility", resetPageVisibilityCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2259
        { "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2291
        { "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2260
        { "setAllowUniversalAccessFromFileURLs", setAllowUniversalAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2292
        { "setAllowUniversalAccessFromFileURLs", setAllowUniversalAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2261
        { "setAllowFileAccessFromFileURLs", setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2293
        { "setAllowFileAccessFromFileURLs", setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
Lines 2288-2293 JSStaticFunction* LayoutTestController::staticFunctions() a/Tools/DumpRenderTree/LayoutTestController.cpp_sec3
2288
        { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2320
        { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2289
        { "addMockSpeechInputResult", addMockSpeechInputResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2321
        { "addMockSpeechInputResult", addMockSpeechInputResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2290
        { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2322
        { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2323
        { "setPageVisibility", setPageVisibilityCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2291
        { "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2324
        { "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2292
        { "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2325
        { "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2293
        { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2326
        { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- a/Tools/DumpRenderTree/LayoutTestController.h +3 lines
Lines 123-128 public: a/Tools/DumpRenderTree/LayoutTestController.h_sec1
123
    void setScrollbarPolicy(JSStringRef orientation, JSStringRef policy);
123
    void setScrollbarPolicy(JSStringRef orientation, JSStringRef policy);
124
    void setEditingBehavior(const char* editingBehavior);
124
    void setEditingBehavior(const char* editingBehavior);
125
125
126
    void setPageVisibility(const char* visibility) { }
127
    void resetPageVisibility() { }
128
126
    JSValueRef shadowRoot(JSContextRef, JSValueRef);
129
    JSValueRef shadowRoot(JSContextRef, JSValueRef);
127
    JSValueRef ensureShadowRoot(JSContextRef, JSValueRef);
130
    JSValueRef ensureShadowRoot(JSContextRef, JSValueRef);
128
    void removeShadowRoot(JSContextRef, JSValueRef);
131
    void removeShadowRoot(JSContextRef, JSValueRef);
- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp +18 lines
Lines 134-139 LayoutTestController::LayoutTestController(TestShell* shell) a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp_sec1
134
    bindMethod("removeOriginAccessWhitelistEntry", &LayoutTestController::removeOriginAccessWhitelistEntry);
134
    bindMethod("removeOriginAccessWhitelistEntry", &LayoutTestController::removeOriginAccessWhitelistEntry);
135
    bindMethod("removeShadowRoot", &LayoutTestController::removeShadowRoot);
135
    bindMethod("removeShadowRoot", &LayoutTestController::removeShadowRoot);
136
    bindMethod("repaintSweepHorizontally", &LayoutTestController::repaintSweepHorizontally);
136
    bindMethod("repaintSweepHorizontally", &LayoutTestController::repaintSweepHorizontally);
137
    bindMethod("resetPageVisibility", &LayoutTestController::resetPageVisibility);
137
    bindMethod("resumeAnimations", &LayoutTestController::resumeAnimations);
138
    bindMethod("resumeAnimations", &LayoutTestController::resumeAnimations);
138
    bindMethod("sampleSVGAnimationForElementAtTime", &LayoutTestController::sampleSVGAnimationForElementAtTime);
139
    bindMethod("sampleSVGAnimationForElementAtTime", &LayoutTestController::sampleSVGAnimationForElementAtTime);
139
    bindMethod("setAcceptsEditing", &LayoutTestController::setAcceptsEditing);
140
    bindMethod("setAcceptsEditing", &LayoutTestController::setAcceptsEditing);
Lines 157-162 LayoutTestController::LayoutTestController(TestShell* shell) a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp_sec2
157
    bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
158
    bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
158
    bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
159
    bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
159
    bindMethod("addMockSpeechInputResult", &LayoutTestController::addMockSpeechInputResult);
160
    bindMethod("addMockSpeechInputResult", &LayoutTestController::addMockSpeechInputResult);
161
    bindMethod("setPageVisibility", &LayoutTestController::setPageVisibility);
160
    bindMethod("setPluginsEnabled", &LayoutTestController::setPluginsEnabled);
162
    bindMethod("setPluginsEnabled", &LayoutTestController::setPluginsEnabled);
161
    bindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingEnabled);
163
    bindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingEnabled);
162
    bindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale);
164
    bindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale);
Lines 1766-1768 void LayoutTestController::setPluginsEnabled(const CppArgumentList& arguments, C a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp_sec3
1766
    }
1768
    }
1767
    result->setNull();
1769
    result->setNull();
1768
}
1770
}
1771
1772
void LayoutTestController::resetPageVisibility(const CppArgumentList& arguments, CppVariant* result)
1773
{
1774
    m_shell->webView()->setVisibilityState(WebPageVisibilityStateVisible, true);
1775
}
1776
1777
void 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
}
- a/Tools/DumpRenderTree/chromium/LayoutTestController.h +4 lines
Lines 365-370 public: a/Tools/DumpRenderTree/chromium/LayoutTestController.h_sec1
365
    // Enable or disable plugins.
365
    // Enable or disable plugins.
366
    void setPluginsEnabled(const CppArgumentList&, CppVariant*);
366
    void setPluginsEnabled(const CppArgumentList&, CppVariant*);
367
367
368
    // Switch the visibility of the page.
369
    void setPageVisibility(const CppArgumentList&, CppVariant*);
370
    void resetPageVisibility(const CppArgumentList&, CppVariant*);
371
368
public:
372
public:
369
    // The following methods are not exposed to JavaScript.
373
    // The following methods are not exposed to JavaScript.
370
    void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
374
    void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }

Return to Bug 54181