<!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>[45614] 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/45614">45614</a></dd>
<dt>Author</dt> <dd>pdherbemont@apple.com</dd>
<dt>Date</dt> <dd>2009-07-07 18:19:56 -0700 (Tue, 07 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebCore:

2009-07-07  Pierre d'Herbemont  &lt;pdherbemont@apple.com&gt;

        Reviewed by Simon Fraser.

        https://bugs.webkit.org/show_bug.cgi?id=27047

        We need to make sure that when we reattach, we also reattach
        the children in every MediaControlElement. Else we may end up
        having no remaining or elapsed time.

        We have to handle that, because we are using a special shadow
        tree in the DOM, and that we are ourselves handling
        attaching/detaching the renderer.

        The strategy here is to try to implement ::attach(), and try
        to reuse as much code as we can from the super class, including
        children attachement.

        Test: media/controls-after-reload.html

        * rendering/MediaControlElements.cpp:
        (WebCore::MediaControlElement::styleForElement): Code factoring.
        (WebCore::MediaControlElement::rendererIsNeeded): Code factoring.
        (WebCore::MediaControlElement::attach): Implement attach
        and call super class so that children are also attached.
        (WebCore::MediaControlElement::updateStyle): Use attach()
        (WebCore::MediaControlInputElement::styleForElement): Code
        factoring.
        (WebCore::MediaControlInputElement::rendererIsNeeded): Code
        factoring.
        (WebCore::MediaControlInputElement::attach): See above.
        (WebCore::MediaControlInputElement::updateStyle): Use attach()
        * rendering/MediaControlElements.h:
        * rendering/RenderMedia.cpp:
        (WebCore::RenderMedia::updateControls): Directly run attach() on
        the m_panel, which is a root node for our shadow tree.

LayoutTests:

2009-07-07  Pierre d'Herbemont  &lt;pdherbemont@apple.com&gt;

        Reviewed by Simon Fraser.

        https://bugs.webkit.org/show_bug.cgi?id=27047

        Make sure nothing changing the src and reloading doesn't
        change the look of the controller.

        * media/controls-after-reload.html: Added.
        * platform/mac-leopard/media/controls-after-reload-expected.txt: Added.
        * platform/mac/media/controls-after-reload-expected.txt: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorerenderingMediaControlElementscpp">trunk/WebCore/rendering/MediaControlElements.cpp</a></li>
<li><a href="#trunkWebCorerenderingMediaControlElementsh">trunk/WebCore/rendering/MediaControlElements.h</a></li>
<li><a href="#trunkWebCorerenderingRenderMediacpp">trunk/WebCore/rendering/RenderMedia.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmediacontrolsafterreloadhtml">trunk/LayoutTests/media/controls-after-reload.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacmediacontrolsafterreloadexpectedtxt">trunk/LayoutTests/platform/mac/media/controls-after-reload-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacleopardmediacontrolsafterreloadexpectedtxt">trunk/LayoutTests/platform/mac-leopard/media/controls-after-reload-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (45613 => 45614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2009-07-08 00:19:18 UTC (rev 45613)
+++ trunk/LayoutTests/ChangeLog        2009-07-08 01:19:56 UTC (rev 45614)
</span><span class="lines">@@ -44,6 +44,19 @@
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Simon Fraser.
</span><span class="cx"> 
</span><ins>+        https://bugs.webkit.org/show_bug.cgi?id=27047
+
+        Make sure nothing changing the src and reloading doesn't
+        change the look of the controller.
+
+        * media/controls-after-reload.html: Added.
+        * platform/mac-leopard/media/controls-after-reload-expected.txt: Added.
+        * platform/mac/media/controls-after-reload-expected.txt: Added.
+
+2009-07-07  Pierre d'Herbemont  &lt;pdherbemont@apple.com&gt;
+
+        Reviewed by Simon Fraser.
+
</ins><span class="cx">         Add a specific leopard result for controls-styling.html, given that it doesn't
</span><span class="cx">         use the new controller look.
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsmediacontrolsafterreloadhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/controls-after-reload.html (0 => 45614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls-after-reload.html                                (rev 0)
+++ trunk/LayoutTests/media/controls-after-reload.html        2009-07-08 01:19:56 UTC (rev 45614)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+    &lt;script&gt;
+    var video;
+    var loadedCount = 0;
+
+    if (window.layoutTestController)
+        layoutTestController.waitUntilDone();
+
+    function canplaythrough()
+    {
+        loadedCount++;
+        if (loadedCount == 2) {
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+            return;
+        }
+        
+        video.src = &quot;content/test.mp4&quot;;
+        video.load();
+    }
+
+    function test()
+    {
+        video = document.getElementsByTagName('video')[0];
+        video.addEventListener(&quot;canplaythrough&quot;, canplaythrough);
+        
+        video.src = &quot;content/scaled-matrix.mov&quot;;
+        video.load();
+    }
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;Making sure the controller looks ok after a second load().&lt;/p&gt;
+&lt;video controls&gt;&lt;/video&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacmediacontrolsafterreloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/media/controls-after-reload-expected.txt (0 => 45614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/media/controls-after-reload-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/media/controls-after-reload-expected.txt        2009-07-08 01:19:56 UTC (rev 45614)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 360x18
+          text run at (0,0) width 360: &quot;Making sure the controller looks ok after a second load().&quot;
+      RenderBlock (anonymous) at (0,34) size 784x240
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+layer at (8,42) size 320x240
+  RenderVideo {VIDEO} at (0,0) size 320x240
+layer at (8,42) size 320x240
+  RenderBlock (relative positioned) {DIV} at (0,0) size 320x240
+layer at (8,257) size 320x25
+  RenderFlexibleBox (positioned) {DIV} at (0,215) size 320x25
+    RenderButton {INPUT} at (7,4) size 16x16
+    RenderButton {INPUT} at (297,4) size 16x16
+    RenderButton {INPUT} at (37,4) size 16x16
+    RenderFlexibleBox {DIV} at (60,6) size 230x13
+      RenderSlider {INPUT} at (45,0) size 140x13
+        RenderBlock {DIV} at (0,2) size 11x9
+layer at (68,263) size 45x13
+  RenderFlexibleBox {DIV} at (0,0) size 45x13
+    RenderBlock (anonymous) at (9,1) size 26x11
+      RenderText {#text} at (0,0) size 26x11
+        text run at (0,0) width 26: &quot;00:00&quot;
+layer at (253,263) size 45x13
+  RenderFlexibleBox {DIV} at (185,0) size 45x13
+    RenderBlock (anonymous) at (6,1) size 32x11
+      RenderText {#text} at (0,0) size 32x11
+        text run at (0,0) width 32: &quot;-00:06&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacleopardmediacontrolsafterreloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-leopard/media/controls-after-reload-expected.txt (0 => 45614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-leopard/media/controls-after-reload-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-leopard/media/controls-after-reload-expected.txt        2009-07-08 01:19:56 UTC (rev 45614)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 360x18
+          text run at (0,0) width 360: &quot;Making sure the controller looks ok after a second load().&quot;
+      RenderBlock (anonymous) at (0,34) size 784x240
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+layer at (8,42) size 320x240
+  RenderVideo {VIDEO} at (0,0) size 320x240
+layer at (8,42) size 320x240
+  RenderBlock (relative positioned) {DIV} at (0,0) size 320x240
+layer at (8,266) size 320x16
+  RenderFlexibleBox (positioned) {DIV} at (0,224) size 320x16
+    RenderButton {INPUT} at (0,0) size 16x16
+    RenderButton {INPUT} at (16,0) size 16x16
+    RenderFlexibleBox {DIV} at (32,0) size 256x16
+      RenderSlider {INPUT} at (0,0) size 256x16
+        RenderBlock {DIV} at (2,1) size 13x14
+    RenderButton {INPUT} at (288,0) size 16x16
+    RenderButton {INPUT} at (304,0) size 16x16
+    
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (45613 => 45614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-07-08 00:19:18 UTC (rev 45613)
+++ trunk/WebCore/ChangeLog        2009-07-08 01:19:56 UTC (rev 45614)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2009-07-07  Pierre d'Herbemont  &lt;pdherbemont@apple.com&gt;
+
+        Reviewed by Simon Fraser.
+
+        https://bugs.webkit.org/show_bug.cgi?id=27047
+
+        We need to make sure that when we reattach, we also reattach
+        the children in every MediaControlElement. Else we may end up
+        having no remaining or elapsed time.
+
+        We have to handle that, because we are using a special shadow
+        tree in the DOM, and that we are ourselves handling
+        attaching/detaching the renderer.
+
+        The strategy here is to try to implement ::attach(), and try
+        to reuse as much code as we can from the super class, including
+        children attachement.
+
+        Test: media/controls-after-reload.html
+
+        * rendering/MediaControlElements.cpp:
+        (WebCore::MediaControlElement::styleForElement): Code factoring.
+        (WebCore::MediaControlElement::rendererIsNeeded): Code factoring.
+        (WebCore::MediaControlElement::attach): Implement attach
+        and call super class so that children are also attached.
+        (WebCore::MediaControlElement::updateStyle): Use attach()
+        (WebCore::MediaControlInputElement::styleForElement): Code factoring.
+        (WebCore::MediaControlInputElement::rendererIsNeeded): Code factoring.
+        (WebCore::MediaControlInputElement::attach): See above.
+        (WebCore::MediaControlInputElement::updateStyle): Use attach()
+        * rendering/MediaControlElements.h:
+        * rendering/RenderMedia.cpp:
+        (WebCore::RenderMedia::updateControls): Directly run attach() on
+        the m_panel, which is a root node for our shadow tree.
+
</ins><span class="cx"> 2009-07-07  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Dan Bernstein.
</span></span></pre></div>
<a id="trunkWebCorerenderingMediaControlElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/rendering/MediaControlElements.cpp (45613 => 45614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/rendering/MediaControlElements.cpp        2009-07-08 00:19:18 UTC (rev 45613)
+++ trunk/WebCore/rendering/MediaControlElements.cpp        2009-07-08 01:19:56 UTC (rev 45614)
</span><span class="lines">@@ -75,7 +75,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> // ----------------------------
</span><span class="cx">     
</span><span class="cx"> 
</span><span class="lines">@@ -99,38 +98,63 @@
</span><span class="cx">     updateStyle();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+RenderStyle* MediaControlElement::styleForElement()
+{
+    RenderStyle* style = m_mediaElement-&gt;renderer()-&gt;getCachedPseudoStyle(m_pseudoStyleId);
+    if (!style)
+        return 0;
+    
+    // text-decoration can't be overrided from CSS. So we do it here.
+    // See https://bugs.webkit.org/show_bug.cgi?id=27015
+    style-&gt;setTextDecoration(TDNONE);
+    style-&gt;setTextDecorationsInEffect(TDNONE);
+
+    return style;
+}
+
+bool MediaControlElement::rendererIsNeeded(RenderStyle* style)
+{
+    return HTMLDivElement::rendererIsNeeded(style) &amp;&amp; parent() &amp;&amp; parent()-&gt;renderer();
+}
+    
+void MediaControlElement::attach()
+{
+    RenderStyle* style = styleForElement();
+    if (!style)
+        return;
+    bool needsRenderer = rendererIsNeeded(style);
+    if (!needsRenderer)
+        return;
+    RenderObject* renderer = createRenderer(m_mediaElement-&gt;renderer()-&gt;renderArena(), style);
+    if (!renderer)
+        return;
+    renderer-&gt;setStyle(style);
+    setRenderer(renderer);
+    if (parent() &amp;&amp; parent()-&gt;renderer()) {
+        // Find next sibling with a renderer to determine where to insert.
+        Node* sibling = nextSibling();
+        while (sibling &amp;&amp; !sibling-&gt;renderer())
+            sibling = sibling-&gt;nextSibling();
+        parent()-&gt;renderer()-&gt;addChild(renderer, sibling ? sibling-&gt;renderer() : 0);
+    }
+    ContainerNode::attach();
+}
+
</ins><span class="cx"> void MediaControlElement::updateStyle()
</span><span class="cx"> {
</span><span class="cx">     if (!m_mediaElement || !m_mediaElement-&gt;renderer())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    RenderStyle* style = m_mediaElement-&gt;renderer()-&gt;getCachedPseudoStyle(m_pseudoStyleId);
</del><ins>+    RenderStyle* style = styleForElement();
</ins><span class="cx">     if (!style)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // text-decoration can't be overrided from CSS. So we do it here.
-    // See https://bugs.webkit.org/show_bug.cgi?id=27015
-    style-&gt;setTextDecoration(TDNONE);
-    style-&gt;setTextDecorationsInEffect(TDNONE);
-
</del><span class="cx">     bool needsRenderer = rendererIsNeeded(style) &amp;&amp; parent() &amp;&amp; parent()-&gt;renderer();
</span><span class="cx">     if (renderer() &amp;&amp; !needsRenderer)
</span><span class="cx">         detach();
</span><del>-    else if (!renderer() &amp;&amp; needsRenderer) {
-        RenderObject* renderer = createRenderer(m_mediaElement-&gt;renderer()-&gt;renderArena(), style);
-        if (!renderer)
-            return;
-        renderer-&gt;setStyle(style);
-        setRenderer(renderer);
-        setAttached();
-        if (parent() &amp;&amp; parent()-&gt;renderer()) {
-            // Find next sibling with a renderer to determine where to insert.
-            Node* sibling = nextSibling();
-            while (sibling &amp;&amp; !sibling-&gt;renderer())
-                sibling = sibling-&gt;nextSibling();
-            parent()-&gt;renderer()-&gt;addChild(renderer, sibling ? sibling-&gt;renderer() : 0);
-        }
-    } else if (renderer()) {
</del><ins>+    else if (!renderer() &amp;&amp; needsRenderer)
+        attach();
+    else if (renderer()) {
</ins><span class="cx">         renderer()-&gt;setStyle(style);
</span><span class="cx"> 
</span><span class="cx">         // Make sure that if there is any innerText renderer, it is updated as well.
</span><span class="lines">@@ -233,36 +257,58 @@
</span><span class="cx">     updateStyle();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+RenderStyle* MediaControlInputElement::styleForElement()
+{
+    return m_mediaElement-&gt;renderer()-&gt;getCachedPseudoStyle(m_pseudoStyleId);
+}
+
+bool MediaControlInputElement::rendererIsNeeded(RenderStyle* style)
+{
+    return HTMLInputElement::rendererIsNeeded(style) &amp;&amp; parent() &amp;&amp; parent()-&gt;renderer();
+}
+
+void MediaControlInputElement::attach()
+{
+    RenderStyle* style = styleForElement();
+    if (!style)
+        return;
+    
+    bool needsRenderer = rendererIsNeeded(style);
+    if (!needsRenderer)
+        return;
+    RenderObject* renderer = createRenderer(m_mediaElement-&gt;renderer()-&gt;renderArena(), style);
+    if (!renderer)
+        return;
+    renderer-&gt;setStyle(style);
+    setRenderer(renderer);
+    if (parent() &amp;&amp; parent()-&gt;renderer()) {
+        // Find next sibling with a renderer to determine where to insert.
+        Node* sibling = nextSibling();
+        while (sibling &amp;&amp; !sibling-&gt;renderer())
+            sibling = sibling-&gt;nextSibling();
+        parent()-&gt;renderer()-&gt;addChild(renderer, sibling ? sibling-&gt;renderer() : 0);
+    }  
+    ContainerNode::attach();
+}
+
</ins><span class="cx"> void MediaControlInputElement::updateStyle()
</span><span class="cx"> {
</span><span class="cx">     if (!m_mediaElement || !m_mediaElement-&gt;renderer())
</span><span class="cx">         return;
</span><del>-
-    RenderStyle* style = m_mediaElement-&gt;renderer()-&gt;getCachedPseudoStyle(m_pseudoStyleId);
</del><ins>+    
+    RenderStyle* style = styleForElement();
</ins><span class="cx">     if (!style)
</span><span class="cx">         return;
</span><del>-
</del><ins>+    
</ins><span class="cx">     bool needsRenderer = rendererIsNeeded(style) &amp;&amp; parent() &amp;&amp; parent()-&gt;renderer();
</span><span class="cx">     if (renderer() &amp;&amp; !needsRenderer)
</span><span class="cx">         detach();
</span><del>-    else if (!renderer() &amp;&amp; needsRenderer) {
-        RenderObject* renderer = createRenderer(m_mediaElement-&gt;renderer()-&gt;renderArena(), style);
-        if (!renderer)
-            return;
-        renderer-&gt;setStyle(style);
-        setRenderer(renderer);
-        setAttached();
-        if (parent() &amp;&amp; parent()-&gt;renderer()) {
-            // Find next sibling with a renderer to determine where to insert.
-            Node* sibling = nextSibling();
-            while (sibling &amp;&amp; !sibling-&gt;renderer())
-                sibling = sibling-&gt;nextSibling();
-            parent()-&gt;renderer()-&gt;addChild(renderer, sibling ? sibling-&gt;renderer() : 0);
-        }
-    } else if (renderer())
</del><ins>+    else if (!renderer() &amp;&amp; needsRenderer)
+        attach();
+    else if (renderer())
</ins><span class="cx">         renderer()-&gt;setStyle(style);
</span><span class="cx"> }
</span><del>-
</del><ins>+    
</ins><span class="cx"> bool MediaControlInputElement::hitTest(const IntPoint&amp; absPoint)
</span><span class="cx"> {
</span><span class="cx">     if (renderer() &amp;&amp; renderer()-&gt;style()-&gt;hasAppearance())
</span></span></pre></div>
<a id="trunkWebCorerenderingMediaControlElementsh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/rendering/MediaControlElements.h (45613 => 45614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/rendering/MediaControlElements.h        2009-07-08 00:19:18 UTC (rev 45613)
+++ trunk/WebCore/rendering/MediaControlElements.h        2009-07-08 01:19:56 UTC (rev 45614)
</span><span class="lines">@@ -82,9 +82,14 @@
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx">     MediaControlElement(Document*, PseudoId, HTMLMediaElement*);
</span><ins>+    virtual void attach();
+    virtual bool rendererIsNeeded(RenderStyle*);
+
+    RenderStyle* styleForElement();
</ins><span class="cx">     void attachToParent(Element*);
</span><span class="cx">     void update();
</span><del>-    void updateStyle();
</del><ins>+    virtual void updateStyle();
+
</ins><span class="cx"> protected:
</span><span class="cx">     HTMLMediaElement* m_mediaElement;   
</span><span class="cx">     PseudoId m_pseudoStyleId;
</span><span class="lines">@@ -95,7 +100,7 @@
</span><span class="cx"> class MediaControlTimelineContainerElement : public MediaControlElement {
</span><span class="cx"> public:
</span><span class="cx">     MediaControlTimelineContainerElement(Document*, HTMLMediaElement*);
</span><del>-    virtual bool rendererIsNeeded(RenderStyle* style);
</del><ins>+    virtual bool rendererIsNeeded(RenderStyle*);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="lines">@@ -104,7 +109,7 @@
</span><span class="cx"> public:
</span><span class="cx">     MediaControlStatusDisplayElement(Document*, HTMLMediaElement*);
</span><span class="cx">     virtual void update();
</span><del>-    virtual bool rendererIsNeeded(RenderStyle* style);
</del><ins>+    virtual bool rendererIsNeeded(RenderStyle*);
</ins><span class="cx"> private:
</span><span class="cx">     enum StateBeingDisplayed { Nothing, Loading, LiveBroadcast };
</span><span class="cx">     StateBeingDisplayed m_stateBeingDisplayed;
</span><span class="lines">@@ -115,9 +120,14 @@
</span><span class="cx"> class MediaControlInputElement : public HTMLInputElement {
</span><span class="cx"> public:
</span><span class="cx">     MediaControlInputElement(Document*, PseudoId, const String&amp; type, HTMLMediaElement*, MediaControlElementType);
</span><ins>+    virtual void attach();
+    virtual bool rendererIsNeeded(RenderStyle*);
+
+    RenderStyle* styleForElement();
</ins><span class="cx">     void attachToParent(Element*);
</span><span class="cx">     void update();
</span><del>-    virtual void updateStyle();
</del><ins>+    void updateStyle();
+
</ins><span class="cx">     bool hitTest(const IntPoint&amp; absPoint);
</span><span class="cx">     MediaControlElementType displayType() const { return m_displayType; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorerenderingRenderMediacpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/rendering/RenderMedia.cpp (45613 => 45614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/rendering/RenderMedia.cpp        2009-07-08 00:19:18 UTC (rev 45613)
+++ trunk/WebCore/rendering/RenderMedia.cpp        2009-07-08 01:19:56 UTC (rev 45614)
</span><span class="lines">@@ -292,12 +292,13 @@
</span><span class="cx">             createSeekBackButton();
</span><span class="cx">             createSeekForwardButton();
</span><span class="cx">             createFullscreenButton();
</span><ins>+            if (m_timelineContainer) {
+                createCurrentTimeDisplay();
+                createTimeline();
+                createTimeRemainingDisplay();
+            }
+            m_panel-&gt;attach();
</ins><span class="cx">         }
</span><del>-        if (m_timelineContainer) {
-            createCurrentTimeDisplay();
-            createTimeline();
-            createTimeRemainingDisplay();
-        }
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (media-&gt;canPlay()) {
</span></span></pre>
</div>
</div>

</body>
</html>