Title: [209750] trunk
Revision
209750
Author
[email protected]
Date
2016-12-12 18:05:42 -0800 (Mon, 12 Dec 2016)

Log Message

Add Document.onvisibilitychange event handler attribute
https://bugs.webkit.org/show_bug.cgi?id=165784

Reviewed by Daniel Bates.

Source/WebCore:

Add Document.onvisibilitychange event handler attribute as per Page
Visibility Level 2 API:
- http://w3c.github.io/page-visibility/#onvisiblitychange-event-handler

Test: fast/events/page-visibility-onvisibilitychange.html

* dom/Document.idl:

LayoutTests:

Add layout test coverage.

* fast/events/page-visibility-onvisibilitychange-expected.txt: Added.
* fast/events/page-visibility-onvisibilitychange.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209749 => 209750)


--- trunk/LayoutTests/ChangeLog	2016-12-13 01:32:56 UTC (rev 209749)
+++ trunk/LayoutTests/ChangeLog	2016-12-13 02:05:42 UTC (rev 209750)
@@ -1,3 +1,15 @@
+2016-12-12  Chris Dumez  <[email protected]>
+
+        Add Document.onvisibilitychange event handler attribute
+        https://bugs.webkit.org/show_bug.cgi?id=165784
+
+        Reviewed by Daniel Bates.
+
+        Add layout test coverage.
+
+        * fast/events/page-visibility-onvisibilitychange-expected.txt: Added.
+        * fast/events/page-visibility-onvisibilitychange.html: Added.
+
 2016-12-07  Jiewen Tan  <[email protected]>
 
         [WebCrypto] Migrate some tests from webkitSubtle to subtle

Added: trunk/LayoutTests/fast/events/page-visibility-onvisibilitychange-expected.txt (0 => 209750)


--- trunk/LayoutTests/fast/events/page-visibility-onvisibilitychange-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/page-visibility-onvisibilitychange-expected.txt	2016-12-13 02:05:42 UTC (rev 209750)
@@ -0,0 +1,13 @@
+This test checks the onvisibilitychange event handler attribute on Document.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.visibilityState is "visible"
+PASS document.hidden is false
+PASS document.visibilityState is "hidden"
+PASS document.hidden is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/page-visibility-onvisibilitychange.html (0 => 209750)


--- trunk/LayoutTests/fast/events/page-visibility-onvisibilitychange.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/page-visibility-onvisibilitychange.html	2016-12-13 02:05:42 UTC (rev 209750)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("This test checks the onvisibilitychange event handler attribute on Document.");
+
+var jsTestIsAsync = true;
+
+function makePageHidden() {
+    if (window.testRunner)
+        testRunner.setPageVisibility("hidden");
+}
+
+function checkIsPageVisible() {
+    shouldBeEqualToString("document.visibilityState", "visible");
+    shouldBeFalse("document.hidden");
+}
+
+function checkIsPageHidden() {
+    shouldBeEqualToString("document.visibilityState", "hidden");
+    shouldBeTrue("document.hidden");
+}
+
+function startTest() {
+    document._onvisibilitychange_ = function() {
+        checkIsPageHidden();
+        document._onvisibilitychange_ = null;
+        if (window.testRunner)
+            testRunner.resetPageVisibility();
+        finishJSTest();
+    };
+    checkIsPageVisible();
+    makePageHidden();
+}
+
+startTest();
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (209749 => 209750)


--- trunk/Source/WebCore/ChangeLog	2016-12-13 01:32:56 UTC (rev 209749)
+++ trunk/Source/WebCore/ChangeLog	2016-12-13 02:05:42 UTC (rev 209750)
@@ -1,3 +1,18 @@
+2016-12-12  Chris Dumez  <[email protected]>
+
+        Add Document.onvisibilitychange event handler attribute
+        https://bugs.webkit.org/show_bug.cgi?id=165784
+
+        Reviewed by Daniel Bates.
+
+        Add Document.onvisibilitychange event handler attribute as per Page
+        Visibility Level 2 API:
+        - http://w3c.github.io/page-visibility/#onvisiblitychange-event-handler
+
+        Test: fast/events/page-visibility-onvisibilitychange.html
+
+        * dom/Document.idl:
+
 2016-12-12  Dean Jackson  <[email protected]>
 
         [iOS] MediaDocument "Done" button should navigate the page back

Modified: trunk/Source/WebCore/dom/Document.idl (209749 => 209750)


--- trunk/Source/WebCore/dom/Document.idl	2016-12-13 01:32:56 UTC (rev 209749)
+++ trunk/Source/WebCore/dom/Document.idl	2016-12-13 02:05:42 UTC (rev 209750)
@@ -172,8 +172,7 @@
     // Page visibility API.
     readonly attribute VisibilityState visibilityState;
     readonly attribute boolean hidden;
-    // FIXME: We should implement this.
-    // attribute EventHandler onvisibilitychange;
+    attribute EventHandler onvisibilitychange;
 
     // currentscript API: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-currentscript
     readonly attribute HTMLScriptElement? currentScript;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to