<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203522] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203522">203522</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2016-07-21 14:06:51 -0700 (Thu, 21 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION: Plugin replaced YouTube Flash videos always have the same width
https://bugs.webkit.org/show_bug.cgi?id=159998
&lt;rdar://problem/27462285&gt;

Reviewed by Simon Fraser.

Source/WebCore:

Fixes an issue where the width of a plugin replaced YouTube video loaded via an HTML embed
element would always have the same width regardless of value of the width attribute.

For YouTube Flash videos the YouTube plugin replacement substitutes a shadow DOM subtree
for the default renderer of an HTML embed element. The root of this shadow DOM subtree
is an HTML div element. Currently we set inline styles on this &lt;div&gt; when it is instantiated.
In particular, we set inline display and position to &quot;inline-block&quot; and &quot;relative&quot;, respectively,
and set an invalid height and width (we specify a font weight value instead of a CSS length value
- this causes an ASSERT_NOT_REACHED() assertion failure in StyleBuilderConverter::convertLengthSizing()
in a debug build). These styles never worked as intended and we ultimately created an inline
renderer (ignoring display &quot;inline-block&quot;) that had auto width and height. Instead it is sufficient
to remove all these inline styles and create a RenderBlockFlow renderer for this &lt;div&gt; so that it
renders as a block, non-replaced element to achieve the intended illusion that the &lt;embed&gt; is a
single element.

* html/shadow/YouTubeEmbedShadowElement.cpp: Remove unused header HTMLEmbedElement.h and include
header RenderBlockFlow.h. Also update copyright in license block.
(WebCore::YouTubeEmbedShadowElement::YouTubeEmbedShadowElement): Remove inline styles as these
never worked as intended.
(WebCore::YouTubeEmbedShadowElement::createElementRenderer): Override; create a block-flow
renderer for us so that we layout as a block, non-replaced element.
* html/shadow/YouTubeEmbedShadowElement.h:

LayoutTests:

Unskip existing iOS layout tests, update tests and expected results.

* platform/ios-simulator/TestExpectations:
* platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-expected.txt: Updated expected result based on the
changes to test youtube-flash-plugin-iframe.html.
* platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width-expected.txt: Updated expected result
based on the changes to test youtube-flash-plugin-iframe-no-height-or-width.html.
* platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width.html: Modified to check the
width of each embedded YouTube video to ensure that we respect it (if specified).
* platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe.html: Substitute pseudo id -webkit-plugin-replacement
for -apple-youtube-shadow-iframe as the later was renamed to the former in &lt;https://trac.webkit.org/changeset/168442&gt;.
Fix misspelling of the word &quot;embed&quot; in a comment.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatoriospluginyoutubeflashpluginiframeexpectedtxt">trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatoriospluginyoutubeflashpluginiframenoheightorwidthexpectedtxt">trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatoriospluginyoutubeflashpluginiframenoheightorwidthhtml">trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width.html</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatoriospluginyoutubeflashpluginiframehtml">trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowYouTubeEmbedShadowElementcpp">trunk/Source/WebCore/html/shadow/YouTubeEmbedShadowElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowYouTubeEmbedShadowElementh">trunk/Source/WebCore/html/shadow/YouTubeEmbedShadowElement.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (203521 => 203522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-07-21 21:05:29 UTC (rev 203521)
+++ trunk/LayoutTests/ChangeLog        2016-07-21 21:06:51 UTC (rev 203522)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-07-21  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        REGRESSION: Plugin replaced YouTube Flash videos always have the same width
+        https://bugs.webkit.org/show_bug.cgi?id=159998
+        &lt;rdar://problem/27462285&gt;
+
+        Reviewed by Simon Fraser.
+
+        Unskip existing iOS layout tests, update tests and expected results.
+
+        * platform/ios-simulator/TestExpectations:
+        * platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-expected.txt: Updated expected result based on the
+        changes to test youtube-flash-plugin-iframe.html.
+        * platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width-expected.txt: Updated expected result
+        based on the changes to test youtube-flash-plugin-iframe-no-height-or-width.html.
+        * platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width.html: Modified to check the
+        width of each embedded YouTube video to ensure that we respect it (if specified).
+        * platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe.html: Substitute pseudo id -webkit-plugin-replacement
+        for -apple-youtube-shadow-iframe as the later was renamed to the former in &lt;https://trac.webkit.org/changeset/168442&gt;.
+        Fix misspelling of the word &quot;embed&quot; in a comment.
+
</ins><span class="cx"> 2016-07-21  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Marking inspector/codemirror/prettyprinting-javascript.html as a flaky timeout on mac debug.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (203521 => 203522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-07-21 21:05:29 UTC (rev 203521)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-07-21 21:06:51 UTC (rev 203522)
</span><span class="lines">@@ -2556,8 +2556,6 @@
</span><span class="cx"> 
</span><span class="cx"> # iOS tests that assert:
</span><span class="cx"> platform/ios-simulator/ios/fast/text/combining-enclosing-keycap.html
</span><del>-platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width.html
-platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe.html
</del><span class="cx"> 
</span><span class="cx"> # Kerning, Ligatures, and Printer Fonts caused these tests to fail.
</span><span class="cx"> # The following tests are reftests (and also fail on Mac):
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatoriospluginyoutubeflashpluginiframeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-expected.txt (203521 => 203522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-expected.txt        2016-07-21 21:05:29 UTC (rev 203521)
+++ trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-expected.txt        2016-07-21 21:06:51 UTC (rev 203522)
</span><span class="lines">@@ -16,11 +16,11 @@
</span><span class="cx"> PASS objectEmbed.tagName is &quot;EMBED&quot;
</span><span class="cx"> PASS objectNoEmbed.tagName is &quot;OBJECT&quot;
</span><span class="cx"> PASS document.querySelectorAll(&quot;iframe&quot;).length is 1
</span><del>-PASS internals.shadowPseudoId(normalEmbedShadowRoot.firstChild) is &quot;-apple-youtube-shadow-iframe&quot;
</del><ins>+PASS internals.shadowPseudoId(normalEmbedShadowRoot.firstChild) is &quot;-webkit-plugin-replacement&quot;
</ins><span class="cx"> PASS normalEmbedShadowRoot.firstChild.firstChild.tagName is &quot;IFRAME&quot;
</span><del>-PASS internals.shadowPseudoId(objectEmbedShadowRoot.firstChild) is &quot;-apple-youtube-shadow-iframe&quot;
</del><ins>+PASS internals.shadowPseudoId(objectEmbedShadowRoot.firstChild) is &quot;-webkit-plugin-replacement&quot;
</ins><span class="cx"> PASS objectEmbedShadowRoot.firstChild.firstChild.tagName is &quot;IFRAME&quot;
</span><del>-PASS internals.shadowPseudoId(objectNoEmbedShadowRoot.firstChild) is &quot;-apple-youtube-shadow-iframe&quot;
</del><ins>+PASS internals.shadowPseudoId(objectNoEmbedShadowRoot.firstChild) is &quot;-webkit-plugin-replacement&quot;
</ins><span class="cx"> PASS objectNoEmbedShadowRoot.firstChild.firstChild.tagName is &quot;IFRAME&quot;
</span><span class="cx"> Normal Embed:
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatoriospluginyoutubeflashpluginiframenoheightorwidthexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width-expected.txt (203521 => 203522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width-expected.txt        2016-07-21 21:05:29 UTC (rev 203521)
+++ trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width-expected.txt        2016-07-21 21:06:51 UTC (rev 203522)
</span><span class="lines">@@ -12,12 +12,16 @@
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span><ins>+PASS getComputedStyle(embedNoHeight).width is &quot;425px&quot;
</ins><span class="cx"> PASS getComputedStyle(embedNoHeight).height is &quot;150px&quot;
</span><span class="cx"> PASS getComputedStyle(embedNoWidth).width is &quot;300px&quot;
</span><ins>+PASS getComputedStyle(embedNoWidth).height is &quot;350px&quot;
</ins><span class="cx"> PASS getComputedStyle(embedNoWidthHeight).width is &quot;300px&quot;
</span><span class="cx"> PASS getComputedStyle(embedNoWidthHeight).height is &quot;150px&quot;
</span><ins>+PASS getComputedStyle(objectNoHeight).width is &quot;425px&quot;
</ins><span class="cx"> PASS getComputedStyle(objectNoHeight).height is &quot;150px&quot;
</span><span class="cx"> PASS getComputedStyle(objectNoWidth).width is &quot;300px&quot;
</span><ins>+PASS getComputedStyle(objectNoWidth).height is &quot;350px&quot;
</ins><span class="cx"> PASS getComputedStyle(objectNoWidthHeight).width is &quot;300px&quot;
</span><span class="cx"> PASS getComputedStyle(objectNoWidthHeight).height is &quot;150px&quot;
</span><span class="cx"> Embed without height:
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatoriospluginyoutubeflashpluginiframenoheightorwidthhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width.html (203521 => 203522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width.html        2016-07-21 21:05:29 UTC (rev 203521)
+++ trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width.html        2016-07-21 21:06:51 UTC (rev 203522)
</span><span class="lines">@@ -16,10 +16,12 @@
</span><span class="cx"> {
</span><span class="cx">     setTimeout(function() {
</span><span class="cx">         embedNoHeight = document.getElementById('embed-no-height');
</span><del>-        shouldBe('getComputedStyle(embedNoHeight).height', '&quot;150px&quot;')
</del><ins>+        shouldBe('getComputedStyle(embedNoHeight).width', '&quot;425px&quot;');
+        shouldBe('getComputedStyle(embedNoHeight).height', '&quot;150px&quot;');
</ins><span class="cx"> 
</span><span class="cx">         embedNoWidth = document.getElementById('embed-no-width');
</span><del>-        shouldBe('getComputedStyle(embedNoWidth).width', '&quot;300px&quot;')
</del><ins>+        shouldBe('getComputedStyle(embedNoWidth).width', '&quot;300px&quot;');
+        shouldBe('getComputedStyle(embedNoWidth).height', '&quot;350px&quot;');
</ins><span class="cx"> 
</span><span class="cx">         embedNoWidthHeight = document.getElementById('embed-no-width-or-height');
</span><span class="cx">         shouldBe('getComputedStyle(embedNoWidthHeight).width', '&quot;300px&quot;');
</span><span class="lines">@@ -26,10 +28,12 @@
</span><span class="cx">         shouldBe('getComputedStyle(embedNoWidthHeight).height', '&quot;150px&quot;');
</span><span class="cx"> 
</span><span class="cx">         objectNoHeight = document.getElementById('object-no-height');
</span><del>-        shouldBe('getComputedStyle(objectNoHeight).height', '&quot;150px&quot;')
</del><ins>+        shouldBe('getComputedStyle(objectNoHeight).width', '&quot;425px&quot;');
+        shouldBe('getComputedStyle(objectNoHeight).height', '&quot;150px&quot;');
</ins><span class="cx"> 
</span><span class="cx">         objectNoWidth = document.getElementById('object-no-width');
</span><del>-        shouldBe('getComputedStyle(objectNoWidth).width', '&quot;300px&quot;')
</del><ins>+        shouldBe('getComputedStyle(objectNoWidth).width', '&quot;300px&quot;');
+        shouldBe('getComputedStyle(objectNoWidth).height', '&quot;350px&quot;');
</ins><span class="cx"> 
</span><span class="cx">         objectNoWidthHeight = document.getElementById('object-no-width-or-height');
</span><span class="cx">         shouldBe('getComputedStyle(objectNoWidthHeight).width', '&quot;300px&quot;');
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatoriospluginyoutubeflashpluginiframehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe.html (203521 => 203522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe.html        2016-07-21 21:05:29 UTC (rev 203521)
+++ trunk/LayoutTests/platform/ios-simulator/ios/plugin/youtube-flash-plugin-iframe.html        2016-07-21 21:06:51 UTC (rev 203522)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx">         objectEmbed = document.getElementById('object-embed');
</span><span class="cx">         objectNoEmbed = document.getElementById('object-no-embed');
</span><span class="cx"> 
</span><del>-        // Test we don't change any embe/object tag to iframe.
</del><ins>+        // Test we don't change any embed/object tag to iframe.
</ins><span class="cx">         shouldBe('normalEmbed.tagName', '&quot;EMBED&quot;');
</span><span class="cx">         shouldBe('elinkEmbed.tagName', '&quot;EMBED&quot;');
</span><span class="cx">         shouldBe('objectEmbed.tagName', '&quot;EMBED&quot;');
</span><span class="lines">@@ -31,15 +31,15 @@
</span><span class="cx"> 
</span><span class="cx">         // Test we have the shadow root and the iframe player.
</span><span class="cx">         normalEmbedShadowRoot = internals.shadowRoot(normalEmbed);
</span><del>-        shouldBe('internals.shadowPseudoId(normalEmbedShadowRoot.firstChild)', '&quot;-apple-youtube-shadow-iframe&quot;');
</del><ins>+        shouldBe('internals.shadowPseudoId(normalEmbedShadowRoot.firstChild)', '&quot;-webkit-plugin-replacement&quot;');
</ins><span class="cx">         shouldBe('normalEmbedShadowRoot.firstChild.firstChild.tagName', '&quot;IFRAME&quot;');
</span><span class="cx"> 
</span><span class="cx">         objectEmbedShadowRoot = internals.shadowRoot(objectEmbed);
</span><del>-        shouldBe('internals.shadowPseudoId(objectEmbedShadowRoot.firstChild)', '&quot;-apple-youtube-shadow-iframe&quot;');
</del><ins>+        shouldBe('internals.shadowPseudoId(objectEmbedShadowRoot.firstChild)', '&quot;-webkit-plugin-replacement&quot;');
</ins><span class="cx">         shouldBe('objectEmbedShadowRoot.firstChild.firstChild.tagName', '&quot;IFRAME&quot;');
</span><span class="cx"> 
</span><span class="cx">         objectNoEmbedShadowRoot = internals.shadowRoot(objectNoEmbed);
</span><del>-        shouldBe('internals.shadowPseudoId(objectNoEmbedShadowRoot.firstChild)', '&quot;-apple-youtube-shadow-iframe&quot;');
</del><ins>+        shouldBe('internals.shadowPseudoId(objectNoEmbedShadowRoot.firstChild)', '&quot;-webkit-plugin-replacement&quot;');
</ins><span class="cx">         shouldBe('objectNoEmbedShadowRoot.firstChild.firstChild.tagName', '&quot;IFRAME&quot;');
</span><span class="cx"> 
</span><span class="cx">         var successfullyParsed = true;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203521 => 203522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-21 21:05:29 UTC (rev 203521)
+++ trunk/Source/WebCore/ChangeLog        2016-07-21 21:06:51 UTC (rev 203522)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-07-21  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        REGRESSION: Plugin replaced YouTube Flash videos always have the same width
+        https://bugs.webkit.org/show_bug.cgi?id=159998
+        &lt;rdar://problem/27462285&gt;
+
+        Reviewed by Simon Fraser.
+
+        Fixes an issue where the width of a plugin replaced YouTube video loaded via an HTML embed
+        element would always have the same width regardless of value of the width attribute.
+
+        For YouTube Flash videos the YouTube plugin replacement substitutes a shadow DOM subtree
+        for the default renderer of an HTML embed element. The root of this shadow DOM subtree
+        is an HTML div element. Currently we set inline styles on this &lt;div&gt; when it is instantiated.
+        In particular, we set inline display and position to &quot;inline-block&quot; and &quot;relative&quot;, respectively,
+        and set an invalid height and width (we specify a font weight value instead of a CSS length value
+        - this causes an ASSERT_NOT_REACHED() assertion failure in StyleBuilderConverter::convertLengthSizing()
+        in a debug build). These styles never worked as intended and we ultimately created an inline
+        renderer (ignoring display &quot;inline-block&quot;) that had auto width and height. Instead it is sufficient
+        to remove all these inline styles and create a RenderBlockFlow renderer for this &lt;div&gt; so that it
+        renders as a block, non-replaced element to achieve the intended illusion that the &lt;embed&gt; is a
+        single element.
+
+        * html/shadow/YouTubeEmbedShadowElement.cpp: Remove unused header HTMLEmbedElement.h and include
+        header RenderBlockFlow.h. Also update copyright in license block.
+        (WebCore::YouTubeEmbedShadowElement::YouTubeEmbedShadowElement): Remove inline styles as these
+        never worked as intended.
+        (WebCore::YouTubeEmbedShadowElement::createElementRenderer): Override; create a block-flow
+        renderer for us so that we layout as a block, non-replaced element.
+        * html/shadow/YouTubeEmbedShadowElement.h:
+
</ins><span class="cx"> 2016-07-21  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iPhone] Playing a video on tudou.com plays only sound, no video
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowYouTubeEmbedShadowElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/YouTubeEmbedShadowElement.cpp (203521 => 203522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/YouTubeEmbedShadowElement.cpp        2016-07-21 21:05:29 UTC (rev 203521)
+++ trunk/Source/WebCore/html/shadow/YouTubeEmbedShadowElement.cpp        2016-07-21 21:06:51 UTC (rev 203522)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;YouTubeEmbedShadowElement.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;HTMLEmbedElement.h&quot;
</del><ins>+#include &quot;RenderBlockFlow.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -39,11 +39,11 @@
</span><span class="cx">     : HTMLDivElement(HTMLNames::divTag, document)
</span><span class="cx"> {
</span><span class="cx">     setPseudo(AtomicString(&quot;-webkit-plugin-replacement&quot;, AtomicString::ConstructFromLiteral));
</span><ins>+}
</ins><span class="cx"> 
</span><del>-    setInlineStyleProperty(CSSPropertyDisplay, CSSValueInlineBlock);
-    setInlineStyleProperty(CSSPropertyPosition, CSSValueRelative);
-    setInlineStyleProperty(CSSPropertyWidth, CSSValue100);
-    setInlineStyleProperty(CSSPropertyHeight, CSSValue100);
</del><ins>+RenderPtr&lt;RenderElement&gt; YouTubeEmbedShadowElement::createElementRenderer(RenderStyle&amp;&amp; style, const RenderTreePosition&amp;)
+{
+    return createRenderer&lt;RenderBlockFlow&gt;(*this, WTFMove(style));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowYouTubeEmbedShadowElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/YouTubeEmbedShadowElement.h (203521 => 203522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/YouTubeEmbedShadowElement.h        2016-07-21 21:05:29 UTC (rev 203521)
+++ trunk/Source/WebCore/html/shadow/YouTubeEmbedShadowElement.h        2016-07-21 21:06:51 UTC (rev 203522)
</span><span class="lines">@@ -35,6 +35,8 @@
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;YouTubeEmbedShadowElement&gt; create(Document&amp;);
</span><span class="cx"> 
</span><ins>+    RenderPtr&lt;RenderElement&gt; createElementRenderer(RenderStyle&amp;&amp;, const RenderTreePosition&amp;) final;
+
</ins><span class="cx"> private:
</span><span class="cx">     YouTubeEmbedShadowElement(Document&amp;);
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>