Title: [160734] trunk
Revision
160734
Author
[email protected]
Date
2013-12-17 16:16:31 -0800 (Tue, 17 Dec 2013)

Log Message

Video element's width and height content attributes should not influence intrinsic width and height
https://bugs.webkit.org/show_bug.cgi?id=125822

Reviewed by Darin Adler.

Source/WebCore: 

Merge https://chromium.googlesource.com/chromium/blink/+/022ce34efb5b70cb964c3ca29f23c8980ffaef05

The width/height content attributes already influence specified style via
HTMLVideoElement::collectStyleForPresentationAttribute, to also influence the intrinsic size has never
been part of the spec: http://www.w3.org/TR/2013/WD-html51-20130528/embedded-content-0.html#dom-dim-width

The test case passes in Firefox Nightly and IE11 Release Preview, but fails in Opera Presto, which has
no default intrinsic size.

Test: media/video-intrinsic-width-height.html

* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::calculateIntrinsicSize):

LayoutTests: 

* media/video-intrinsic-width-height-expected.txt: Added.
* media/video-intrinsic-width-height.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160733 => 160734)


--- trunk/LayoutTests/ChangeLog	2013-12-18 00:15:02 UTC (rev 160733)
+++ trunk/LayoutTests/ChangeLog	2013-12-18 00:16:31 UTC (rev 160734)
@@ -1,3 +1,13 @@
+2013-12-17  Ryosuke Niwa  <[email protected]>
+
+        Video element's width and height content attributes should not influence intrinsic width and height
+        https://bugs.webkit.org/show_bug.cgi?id=125822
+
+        Reviewed by Darin Adler.
+
+        * media/video-intrinsic-width-height-expected.txt: Added.
+        * media/video-intrinsic-width-height.html: Added.
+
 2013-12-17  Gavin Barraclough  <[email protected]>
 
         Remove PageVisibilityStateUnloaded

Added: trunk/LayoutTests/media/video-intrinsic-width-height-expected.txt (0 => 160734)


--- trunk/LayoutTests/media/video-intrinsic-width-height-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-intrinsic-width-height-expected.txt	2013-12-18 00:16:31 UTC (rev 160734)
@@ -0,0 +1,8 @@
+       
+
+PASS no width/height attributes 
+PASS only width attribute 
+PASS only height attribute 
+PASS both width/height attributes 
+PASS both width/height attributes and style 
+

Added: trunk/LayoutTests/media/video-intrinsic-width-height.html (0 => 160734)


--- trunk/LayoutTests/media/video-intrinsic-width-height.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-intrinsic-width-height.html	2013-12-18 00:16:31 UTC (rev 160734)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>video element intrinsic width/height</title>
+        <script src=""
+        <script src=""
+    </head>
+    <body>
+        <div id="log"></div>
+        <video title="no width/height attributes"
+               data-expected-width="300" data-expected-height="150"></video>
+        <video title="only width attribute"
+               data-expected-width="100" data-expected-height="50"
+               width="100"></video>
+        <video title="only height attribute"
+               data-expected-width="200" data-expected-height="100"
+               height="100"></video>
+        <video title="both width/height attributes"
+               data-expected-width="100" data-expected-height="100"
+               width="100" height="100"></video>
+        <!-- A width:height ratio other than 2:1 and overriding the specified style must be used to
+             verify that width/height does not influence intrinsic ratio -->
+        <video title="both width/height attributes and style"
+               data-expected-width="300" data-expected-height="150"
+               width="100" height="100" style="width: auto; height: auto"></video>
+        <script>
+            Array.prototype.forEach.call(document.querySelectorAll('video'), function(video)
+            {
+                test(function()
+                {
+                    assert_equals(video.clientWidth, parseInt(video.dataset.expectedWidth), "width");
+                    assert_equals(video.clientHeight, parseInt(video.dataset.expectedHeight), "height");
+                }, video.title);
+            });
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (160733 => 160734)


--- trunk/Source/WebCore/ChangeLog	2013-12-18 00:15:02 UTC (rev 160733)
+++ trunk/Source/WebCore/ChangeLog	2013-12-18 00:16:31 UTC (rev 160734)
@@ -1,3 +1,24 @@
+2013-12-17  Ryosuke Niwa  <[email protected]>
+
+        Video element's width and height content attributes should not influence intrinsic width and height
+        https://bugs.webkit.org/show_bug.cgi?id=125822
+
+        Reviewed by Darin Adler.
+
+        Merge https://chromium.googlesource.com/chromium/blink/+/022ce34efb5b70cb964c3ca29f23c8980ffaef05
+
+        The width/height content attributes already influence specified style via
+        HTMLVideoElement::collectStyleForPresentationAttribute, to also influence the intrinsic size has never
+        been part of the spec: http://www.w3.org/TR/2013/WD-html51-20130528/embedded-content-0.html#dom-dim-width
+
+        The test case passes in Firefox Nightly and IE11 Release Preview, but fails in Opera Presto, which has
+        no default intrinsic size.
+
+        Test: media/video-intrinsic-width-height.html
+
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::calculateIntrinsicSize):
+
 2013-12-16  Daniel Bates  <[email protected]>
 
         [iOS] Upstream WebCore/html changes

Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (160733 => 160734)


--- trunk/Source/WebCore/rendering/RenderVideo.cpp	2013-12-18 00:15:02 UTC (rev 160733)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp	2013-12-18 00:16:31 UTC (rev 160734)
@@ -116,14 +116,6 @@
     if (videoElement().shouldDisplayPosterImage() && !m_cachedImageSize.isEmpty() && !imageResource()->errorOccurred())
         return m_cachedImageSize;
 
-#if !PLATFORM(IOS)
-    // When the natural size of the video is unavailable, we use the provided
-    // width and height attributes of the video element as the intrinsic size until
-    // better values become available.
-    if (videoElement().hasAttribute(widthAttr) && videoElement().hasAttribute(heightAttr))
-        return LayoutSize(videoElement().width(), videoElement().height());
-#endif
-
     // <video> in standalone media documents should not use the default 300x150
     // size since they also have audio-only files. By setting the intrinsic
     // size to 300x1 the video will resize itself in these cases, and audio will
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to