Title: [143533] trunk
Revision
143533
Author
sch...@chromium.org
Date
2013-02-20 16:32:26 -0800 (Wed, 20 Feb 2013)

Log Message

Accept 'allowfullscreen' in addition to 'webkitallowfullscreen'.
https://bugs.webkit.org/show_bug.cgi?id=110374

Reviewed by Adam Barth.

Source/WebCore:

The fullscreen API also includes a new HTML attribute for iframes
which permits its use. That attribute, 'allowfullcreen' is now
included in the HTML specification [1] and is stable enough
to remove the webkit prefix.

[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-allowfullscreen

Tests: fullscreen/full-screen-enabled-prefixed.html
       fullscreen/full-screen-iframe-allowed-prefixed.html
       fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html

* dom/Document.cpp:
(WebCore::isAttributeOnAllOwners):
(WebCore::Document::fullScreenIsAllowedForElement):
(WebCore::Document::webkitFullscreenEnabled):
* html/HTMLAttributeNames.in:

LayoutTests:

Two previous tests duplicated to preserve testing webkitallowfullscreen
and then modified to test allowfullscreen.

A new test 'full-screen-iframe-with-mixed-allow-webkitallow-attribute.html'
added to test a mixed nesting of iframs with both allowfullscreen and
webkitallowfullscreen.

* fullscreen/full-screen-enabled-prefixed-expected.txt: Added.
* fullscreen/full-screen-enabled-prefixed.html: Copied from LayoutTests/fullscreen/full-screen-enabled.html.
* fullscreen/full-screen-enabled.html:
* fullscreen/full-screen-iframe-allowed-prefixed-expected.txt: Added.
* fullscreen/full-screen-iframe-allowed-prefixed.html: Copied from LayoutTests/fullscreen/full-screen-iframe-allowed.html.
* fullscreen/full-screen-iframe-allowed.html:
* fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute-expected.txt:
* fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html: Added.
* fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe1.html: Added.
* fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe2.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143532 => 143533)


--- trunk/LayoutTests/ChangeLog	2013-02-21 00:31:58 UTC (rev 143532)
+++ trunk/LayoutTests/ChangeLog	2013-02-21 00:32:26 UTC (rev 143533)
@@ -1,3 +1,28 @@
+2013-02-20  Vincent Scheib  <sch...@chromium.org>
+
+        Accept 'allowfullscreen' in addition to 'webkitallowfullscreen'.
+        https://bugs.webkit.org/show_bug.cgi?id=110374
+
+        Reviewed by Adam Barth.
+
+        Two previous tests duplicated to preserve testing webkitallowfullscreen
+        and then modified to test allowfullscreen.
+
+        A new test 'full-screen-iframe-with-mixed-allow-webkitallow-attribute.html'
+        added to test a mixed nesting of iframs with both allowfullscreen and
+        webkitallowfullscreen.
+
+        * fullscreen/full-screen-enabled-prefixed-expected.txt: Added.
+        * fullscreen/full-screen-enabled-prefixed.html: Copied from LayoutTests/fullscreen/full-screen-enabled.html.
+        * fullscreen/full-screen-enabled.html:
+        * fullscreen/full-screen-iframe-allowed-prefixed-expected.txt: Added.
+        * fullscreen/full-screen-iframe-allowed-prefixed.html: Copied from LayoutTests/fullscreen/full-screen-iframe-allowed.html.
+        * fullscreen/full-screen-iframe-allowed.html:
+        * fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute-expected.txt:
+        * fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html: Added.
+        * fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe1.html: Added.
+        * fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe2.html: Added.
+
 2013-02-20  Levi Weintraub  <le...@chromium.org>
 
         Line layout (but not pref widths) double-counts word spacing when between inlines

Added: trunk/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt (0 => 143533)


--- trunk/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt	2013-02-21 00:32:26 UTC (rev 143533)
@@ -0,0 +1,5 @@
+This tests the fullscreenEnabled property laid out in section 4 of the W3C Full Screen API
+EXPECTED (iframe.contentDocument.webkitFullscreenEnabled == 'true') OK
+EXPECTED (iframe2.contentDocument.webkitFullscreenEnabled == 'false') OK
+END OF TEST
+
Property changes on: trunk/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt
___________________________________________________________________

Added: svn:eol-style

Copied: trunk/LayoutTests/fullscreen/full-screen-enabled-prefixed.html (from rev 143529, trunk/LayoutTests/fullscreen/full-screen-enabled.html) (0 => 143533)


--- trunk/LayoutTests/fullscreen/full-screen-enabled-prefixed.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-enabled-prefixed.html	2013-02-21 00:32:26 UTC (rev 143533)
@@ -0,0 +1,12 @@
+<body>
+<div>This tests the <code>fullscreenEnabled</code> property laid out in section 4 of the W3C 
+<a href="" Screen API</a></div>
+<script src=""
+<script>
+    var iframe = document.documentElement.appendChild(document.createElement('iframe'));
+    iframe.setAttribute('webkitallowfullscreen', 'true');
+    var iframe2 = document.documentElement.appendChild(document.createElement('iframe'));
+    testExpected('iframe.contentDocument.webkitFullscreenEnabled', true);
+    testExpected('iframe2.contentDocument.webkitFullscreenEnabled', false);
+    endTest();
+</script>

Modified: trunk/LayoutTests/fullscreen/full-screen-enabled.html (143532 => 143533)


--- trunk/LayoutTests/fullscreen/full-screen-enabled.html	2013-02-21 00:31:58 UTC (rev 143532)
+++ trunk/LayoutTests/fullscreen/full-screen-enabled.html	2013-02-21 00:32:26 UTC (rev 143533)
@@ -4,7 +4,7 @@
 <script src=""
 <script>
     var iframe = document.documentElement.appendChild(document.createElement('iframe'));
-    iframe.setAttribute('webkitallowfullscreen', 'true');
+    iframe.setAttribute('allowfullscreen', 'true');
     var iframe2 = document.documentElement.appendChild(document.createElement('iframe'));
     testExpected('iframe.contentDocument.webkitFullscreenEnabled', true);
     testExpected('iframe2.contentDocument.webkitFullscreenEnabled', false);

Added: trunk/LayoutTests/fullscreen/full-screen-iframe-allowed-prefixed-expected.txt (0 => 143533)


--- trunk/LayoutTests/fullscreen/full-screen-iframe-allowed-prefixed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-iframe-allowed-prefixed-expected.txt	2013-02-21 00:32:26 UTC (rev 143533)
@@ -0,0 +1,8 @@
+Test for bug 56264: Handle entering full screen security restrictions
+
+To test manually, click the "Go full screen" button - the page should enter full screen mode.
+
+EVENT(webkitfullscreenchange)
+TEST(document.getElementById('frame').contentDocument.width==document.width) OK
+END OF TEST
+
Property changes on: trunk/LayoutTests/fullscreen/full-screen-iframe-allowed-prefixed-expected.txt
___________________________________________________________________

Added: svn:eol-style

Copied: trunk/LayoutTests/fullscreen/full-screen-iframe-allowed-prefixed.html (from rev 143529, trunk/LayoutTests/fullscreen/full-screen-iframe-allowed.html) (0 => 143533)


--- trunk/LayoutTests/fullscreen/full-screen-iframe-allowed-prefixed.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-iframe-allowed-prefixed.html	2013-02-21 00:32:26 UTC (rev 143533)
@@ -0,0 +1,26 @@
+<p>Test for <a href="" 56264</a>: 
+Handle entering full screen security restrictions</p>
+<p>To test manually, click the "Go full screen" button - the page should enter full screen mode.</p>
+<script src=""
+<script>
+function runTest() {
+    var frame = document.getElementById('frame');
+
+    waitForEvent(frame.contentDocument, 'webkitfullscreenchange', function() { 
+            test("document.getElementById('frame').contentDocument.width==document.width")
+            endTest();
+    });
+
+    runWithKeyDown(function() {
+
+        setTimeout(function() { 
+            consoleWrite("FAIL - did not enter full screen!"); 
+            endTest(); 
+        }, 50);
+
+        frame.contentDocument.documentElement.webkitRequestFullScreen();
+    });
+}
+</script>
+<iframe id="frame" src="" width="300" height="100" _onload_="runTest()" webkitallowfullscreen>
+</iframe>

Modified: trunk/LayoutTests/fullscreen/full-screen-iframe-allowed.html (143532 => 143533)


--- trunk/LayoutTests/fullscreen/full-screen-iframe-allowed.html	2013-02-21 00:31:58 UTC (rev 143532)
+++ trunk/LayoutTests/fullscreen/full-screen-iframe-allowed.html	2013-02-21 00:32:26 UTC (rev 143533)
@@ -22,5 +22,5 @@
     });
 }
 </script>
-<iframe id="frame" src="" width="300" height="100" _onload_="runTest()" webkitallowfullscreen>
+<iframe id="frame" src="" width="300" height="100" _onload_="runTest()" allowfullscreen>
 </iframe>

Added: trunk/LayoutTests/fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute-expected.txt (0 => 143533)


--- trunk/LayoutTests/fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute-expected.txt	2013-02-21 00:32:26 UTC (rev 143533)
@@ -0,0 +1,7 @@
+Test entering full screen for a nested iframe works with a mixture of both allowfullscreen and webkitallowfullscreen.
+
+To test manually, click into inner frame, the page should enter full screen mode.
+
+SUCCEED - entered full screen!
+END OF TEST
+
Property changes on: trunk/LayoutTests/fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html (0 => 143533)


--- trunk/LayoutTests/fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html	2013-02-21 00:32:26 UTC (rev 143533)
@@ -0,0 +1,25 @@
+<p>Test entering full screen for a nested iframe works with a mixture of both
+allowfullscreen and webkitallowfullscreen.</p>
+<p>To test manually, click into inner frame, the page should enter full screen mode.</p>
+<script src=""
+<iframe webkitallowfullscreen src=""
+</iframe>
+<script>
+window._onmessage_ = function () { // iframes have been loaded and messaged us.
+  // Send click to center of iframe.
+  iframe = document.getElementsByTagName("iframe")[0];
+  x = iframe.offsetLeft + iframe.offsetWidth / 2;
+  y = iframe.offsetTop + iframe.offsetHeight / 2;
+  if (window.eventSender) {
+      eventSender.mouseMoveTo(x, y);
+      eventSender.mouseDown();
+      eventSender.mouseUp();
+  }
+
+  window._onmessage_ = function (messageEvent) {
+      consoleWrite(messageEvent.data);
+      endTest();
+  }
+}
+</script>
+
Property changes on: trunk/LayoutTests/fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:eol-style

Added: trunk/LayoutTests/fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe1.html (0 => 143533)


--- trunk/LayoutTests/fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe1.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe1.html	2013-02-21 00:32:26 UTC (rev 143533)
@@ -0,0 +1,9 @@
+iframe1
+<iframe allowfullscreen src=""
+</iframe>
+<script>
+window._onmessage_ = function (messageEvent) {
+    parent.postMessage(messageEvent.data, "*");
+}
+</script>
+
Property changes on: trunk/LayoutTests/fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe1.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:eol-style

Added: trunk/LayoutTests/fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe2.html (0 => 143533)


--- trunk/LayoutTests/fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe2.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe2.html	2013-02-21 00:32:26 UTC (rev 143533)
@@ -0,0 +1,16 @@
+<body _onload_='parent.postMessage("onload", "*");'>
+    iframe2<br>
+    Manual test: click here.
+    <script src=""
+    <script>
+        document.body._onclick_ = function() {
+            document.body.webkitRequestFullScreen();
+            setTimeout(function() {
+                parent.postMessage("FAIL - did not enter full screen!", "*");
+            }, 50);
+        };
+        waitForEvent(document, 'webkitfullscreenchange', function() {
+            parent.postMessage("SUCCEED - entered full screen!", "*");
+        });
+    </script>
+</body>
Property changes on: trunk/LayoutTests/fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe2.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (143532 => 143533)


--- trunk/Source/WebCore/ChangeLog	2013-02-21 00:31:58 UTC (rev 143532)
+++ trunk/Source/WebCore/ChangeLog	2013-02-21 00:32:26 UTC (rev 143533)
@@ -1,3 +1,27 @@
+2013-02-20  Vincent Scheib  <sch...@chromium.org>
+
+        Accept 'allowfullscreen' in addition to 'webkitallowfullscreen'.
+        https://bugs.webkit.org/show_bug.cgi?id=110374
+
+        Reviewed by Adam Barth.
+
+        The fullscreen API also includes a new HTML attribute for iframes
+        which permits its use. That attribute, 'allowfullcreen' is now
+        included in the HTML specification [1] and is stable enough
+        to remove the webkit prefix.
+
+        [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-allowfullscreen
+
+        Tests: fullscreen/full-screen-enabled-prefixed.html
+               fullscreen/full-screen-iframe-allowed-prefixed.html
+               fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html
+
+        * dom/Document.cpp:
+        (WebCore::isAttributeOnAllOwners):
+        (WebCore::Document::fullScreenIsAllowedForElement):
+        (WebCore::Document::webkitFullscreenEnabled):
+        * html/HTMLAttributeNames.in:
+
 2013-02-20  Roger Fong  <roger_f...@apple.com>
 
         Get VS2010 Solution B&I ready.

Modified: trunk/Source/WebCore/dom/Document.cpp (143532 => 143533)


--- trunk/Source/WebCore/dom/Document.cpp	2013-02-21 00:31:58 UTC (rev 143532)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-02-21 00:32:26 UTC (rev 143533)
@@ -562,12 +562,12 @@
 }
 
 #if ENABLE(FULLSCREEN_API)
-static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, const HTMLFrameOwnerElement* owner)
+static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, const WebCore::QualifiedName& prefixedAttribute, const HTMLFrameOwnerElement* owner)
 {
     if (!owner)
         return true;
     do {
-        if (!owner->hasAttribute(attribute))
+        if (!(owner->hasAttribute(attribute) || owner->hasAttribute(prefixedAttribute)))
             return false;
     } while ((owner = owner->document()->ownerElement()));
     return true;
@@ -4952,7 +4952,7 @@
 bool Document::fullScreenIsAllowedForElement(Element* element) const
 {
     ASSERT(element);
-    return isAttributeOnAllOwners(webkitallowfullscreenAttr, element->document()->ownerElement());
+    return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr, element->document()->ownerElement());
 }
 
 void Document::requestFullScreenForElement(Element* element, unsigned short flags, FullScreenCheckType checkType)
@@ -5171,7 +5171,7 @@
     // browsing context's documents have their fullscreen enabled flag set, or false otherwise.
 
     // Top-level browsing contexts are implied to have their allowFullScreen attribute set.
-    return isAttributeOnAllOwners(webkitallowfullscreenAttr, ownerElement());
+    return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr, ownerElement());
 }
 
 void Document::webkitWillEnterFullScreenForElement(Element* element)

Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (143532 => 143533)


--- trunk/Source/WebCore/html/HTMLAttributeNames.in	2013-02-21 00:31:58 UTC (rev 143532)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in	2013-02-21 00:32:26 UTC (rev 143533)
@@ -10,6 +10,7 @@
 action
 align
 alink
+allowfullscreen
 alt
 archive
 aria-activedescendant
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to