Title: [105293] branches/safari-534.54-branch

Diff

Modified: branches/safari-534.54-branch/LayoutTests/ChangeLog (105292 => 105293)


--- branches/safari-534.54-branch/LayoutTests/ChangeLog	2012-01-18 18:20:40 UTC (rev 105292)
+++ branches/safari-534.54-branch/LayoutTests/ChangeLog	2012-01-18 18:41:13 UTC (rev 105293)
@@ -1,3 +1,19 @@
+2011-01-18  Lucas Forschler  <lforsch...@apple.com>
+
+    Merge 95371
+
+    2011-09-16  Jeremy Apthorp <jere...@chromium.org> and James Kozianski  <k...@chromium.org>
+
+            Don't detach elements from the render tree when entering fullscreen mode
+            https://bugs.webkit.org/show_bug.cgi?id=66531
+
+            Test that the plugin is not reloaded when entering fullscreen.
+
+            Reviewed by James Robinson.
+
+            * plugins/fullscreen-plugins-dont-reload-expected.txt: Added.
+            * plugins/fullscreen-plugins-dont-reload.html: Added.
+
 2011-1-17  Lucas Forschler  <lforsch...@apple.com>
 
     Merge 96973

Copied: branches/safari-534.54-branch/LayoutTests/plugins/fullscreen-plugins-dont-reload-expected.txt (from rev 95371, trunk/LayoutTests/plugins/fullscreen-plugins-dont-reload-expected.txt) (0 => 105293)


--- branches/safari-534.54-branch/LayoutTests/plugins/fullscreen-plugins-dont-reload-expected.txt	                        (rev 0)
+++ branches/safari-534.54-branch/LayoutTests/plugins/fullscreen-plugins-dont-reload-expected.txt	2012-01-18 18:41:13 UTC (rev 105293)
@@ -0,0 +1,5 @@
+ALERT: Plugin Loaded!
+go fullscreen
+There should only be one ALERT. If there were two, the plugin was reloaded during the transition to fullscreen.
+
+

Copied: branches/safari-534.54-branch/LayoutTests/plugins/fullscreen-plugins-dont-reload.html (from rev 95371, trunk/LayoutTests/plugins/fullscreen-plugins-dont-reload.html) (0 => 105293)


--- branches/safari-534.54-branch/LayoutTests/plugins/fullscreen-plugins-dont-reload.html	                        (rev 0)
+++ branches/safari-534.54-branch/LayoutTests/plugins/fullscreen-plugins-dont-reload.html	2012-01-18 18:41:13 UTC (rev 105293)
@@ -0,0 +1,25 @@
+<html>
+<a id='link' href=""
+fullscreen</a>
+<p>
+There should only be one ALERT. If there were two, the plugin was reloaded
+during the transition to fullscreen.
+</p>
+<embed id="plg" type="application/x-webkit-test-netscape" src=""
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+
+    var plugin = document.getElementById('plg');
+    plugin.addEventListener('webkitfullscreenchange', function () {
+        layoutTestController.notifyDone();
+    })
+    document.addEventListener('keydown', function () {
+        plugin.webkitRequestFullScreen();
+    })
+    eventSender.keyDown('a')
+}
+</script>
+</html>

Modified: branches/safari-534.54-branch/Source/WebCore/ChangeLog (105292 => 105293)


--- branches/safari-534.54-branch/Source/WebCore/ChangeLog	2012-01-18 18:20:40 UTC (rev 105292)
+++ branches/safari-534.54-branch/Source/WebCore/ChangeLog	2012-01-18 18:41:13 UTC (rev 105293)
@@ -1,3 +1,30 @@
+2011-01-18  Lucas Forschler  <lforsch...@apple.com>
+
+    Merge 95371
+
+    2011-09-16  Jeremy Apthorp <jere...@chromium.org> and James Kozianski  <k...@chromium.org>
+
+            Don't detach elements from the render tree when entering fullscreen mode
+            https://bugs.webkit.org/show_bug.cgi?id=66531
+
+            This prevents plugin instances from being destroyed and reinstantiated
+            when entering fullscreen mode.
+
+            Reviewed by James Robinson.
+
+            Test: plugins/fullscreen-plugins-dont-reload.html
+
+            * dom/Document.cpp:
+            (WebCore::Document::webkitWillEnterFullScreenForElement):
+            (WebCore::Document::webkitDidExitFullScreenForElement):
+            * dom/NodeRenderingContext.cpp:
+            (WebCore::NodeRendererFactory::createRendererIfNeeded):
+            * rendering/RenderFullScreen.cpp:
+            (createFullScreenStyle):
+            (RenderFullScreen::wrapRenderer):
+            (RenderFullScreen::unwrapRenderer):
+            * rendering/RenderFullScreen.h:
+
 2011-01-17  Lucas Forschler  <lforsch...@apple.com>
 
     Merge 103913 & 103915

Modified: branches/safari-534.54-branch/Source/WebCore/dom/Document.cpp (105292 => 105293)


--- branches/safari-534.54-branch/Source/WebCore/dom/Document.cpp	2012-01-18 18:20:40 UTC (rev 105292)
+++ branches/safari-534.54-branch/Source/WebCore/dom/Document.cpp	2012-01-18 18:41:13 UTC (rev 105293)
@@ -4902,6 +4902,9 @@
     ASSERT(element);
     ASSERT(page() && page()->settings()->fullScreenEnabled());
 
+    if (m_fullScreenRenderer)
+        m_fullScreenRenderer->unwrapRenderer();
+
     m_fullScreenElement = element;
 
     // Create a placeholder block for a the full-screen element, to keep the page from reflowing
@@ -4916,7 +4919,7 @@
     }
 
     if (m_fullScreenElement != documentElement())
-        m_fullScreenElement->detach();
+        RenderFullScreen::wrapRenderer(renderer, this);
 
     setContainsFullScreenElementRecursively(m_fullScreenElement->parentElement() ? m_fullScreenElement->parentElement() : ownerElement(), true);
     
@@ -4967,15 +4970,11 @@
 {
     m_areKeysEnabledInFullScreen = false;
     setAnimatingFullScreen(false);
-
-    if (m_fullScreenRenderer)
-        m_fullScreenRenderer->remove();
     
-    if (m_fullScreenElement != documentElement())
-        m_fullScreenElement->detach();
+    if (m_fullScreenRenderer)
+        m_fullScreenRenderer->unwrapRenderer();
 
     m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement.release());
-    setFullScreenRenderer(0);
 #if USE(ACCELERATED_COMPOSITING)
     page()->chrome()->client()->setRootFullScreenLayer(0);
 #endif

Modified: branches/safari-534.54-branch/Source/WebCore/dom/Node.cpp (105292 => 105293)


--- branches/safari-534.54-branch/Source/WebCore/dom/Node.cpp	2012-01-18 18:20:40 UTC (rev 105292)
+++ branches/safari-534.54-branch/Source/WebCore/dom/Node.cpp	2012-01-18 18:41:13 UTC (rev 105293)
@@ -1599,22 +1599,6 @@
     return 0;
 }
 
-#if ENABLE(FULLSCREEN_API)
-static RenderObject* wrapWithRenderFullScreen(RenderObject* object, Document* document)
-{
-    RenderFullScreen* fullscreenRenderer = new (document->renderArena()) RenderFullScreen(document);
-    fullscreenRenderer->setStyle(RenderFullScreen::createFullScreenStyle());
-    // It's possible that we failed to create the new render and end up wrapping nothing.
-    // We'll end up displaying a black screen, but Jer says this is expected.
-    if (object)
-        fullscreenRenderer->addChild(object);
-    document->setFullScreenRenderer(fullscreenRenderer);
-    if (fullscreenRenderer->placeholder())
-        return fullscreenRenderer->placeholder();
-    return fullscreenRenderer;
-}
-#endif
-
 void NodeRendererFactory::createRendererIfNeeded()
 {
     if (!document()->shouldCreateRenderers())
@@ -1626,7 +1610,7 @@
 
 #if ENABLE(FULLSCREEN_API)
     if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == m_node)
-        newRenderer = wrapWithRenderFullScreen(newRenderer, document());
+        newRenderer = RenderFullScreen::wrapRenderer(newRenderer, document());
 #endif
 
     // FIXME: This side effect should be visible from attach() code.

Modified: branches/safari-534.54-branch/Source/WebCore/rendering/RenderFullScreen.cpp (105292 => 105293)


--- branches/safari-534.54-branch/Source/WebCore/rendering/RenderFullScreen.cpp	2012-01-18 18:20:40 UTC (rev 105292)
+++ branches/safari-534.54-branch/Source/WebCore/rendering/RenderFullScreen.cpp	2012-01-18 18:41:13 UTC (rev 105293)
@@ -79,7 +79,7 @@
     RenderFlexibleBox::destroy();
 }
 
-PassRefPtr<RenderStyle> RenderFullScreen::createFullScreenStyle()
+static PassRefPtr<RenderStyle> createFullScreenStyle()
 {
     RefPtr<RenderStyle> fullscreenStyle = RenderStyle::createDefaultStyle();
 
@@ -97,14 +97,45 @@
     fullscreenStyle->setPosition(FixedPosition);
     fullscreenStyle->setWidth(Length(100.0, Percent));
     fullscreenStyle->setHeight(Length(100.0, Percent));
-    fullscreenStyle->setLeft(Length(0, Fixed));
-    fullscreenStyle->setTop(Length(0, Fixed));
+    fullscreenStyle->setLeft(Length(0, WebCore::Fixed));
+    fullscreenStyle->setTop(Length(0, WebCore::Fixed));
     
     fullscreenStyle->setBackgroundColor(Color::black);
     
     return fullscreenStyle.release();
 }
 
+RenderObject* RenderFullScreen::wrapRenderer(RenderObject* object, Document* document)
+{
+    RenderFullScreen* fullscreenRenderer = new (document->renderArena()) RenderFullScreen(document);
+    fullscreenRenderer->setStyle(createFullScreenStyle());
+    if (object) {
+        if (RenderObject* parent = object->parent()) {
+            parent->addChild(fullscreenRenderer, object);
+            object->remove();
+        }
+        fullscreenRenderer->addChild(object);
+    }
+    document->setFullScreenRenderer(fullscreenRenderer);
+    if (fullscreenRenderer->placeholder())
+        return fullscreenRenderer->placeholder();
+    return fullscreenRenderer;
+}
+
+void RenderFullScreen::unwrapRenderer()
+{
+    RenderObject* wrappedRenderer = firstChild();
+    if (wrappedRenderer) {
+        wrappedRenderer->remove();
+        RenderObject* holder = placeholder() ? placeholder() : this;
+        RenderObject* parent = holder->parent();
+        if (parent)
+            parent->addChild(wrappedRenderer, holder);
+    }
+    remove();
+    document()->setFullScreenRenderer(0);
+}
+
 void RenderFullScreen::setPlaceholder(RenderBlock* placeholder)
 {
     m_placeholder = placeholder;

Modified: branches/safari-534.54-branch/Source/WebCore/rendering/RenderFullScreen.h (105292 => 105293)


--- branches/safari-534.54-branch/Source/WebCore/rendering/RenderFullScreen.h	2012-01-18 18:20:40 UTC (rev 105292)
+++ branches/safari-534.54-branch/Source/WebCore/rendering/RenderFullScreen.h	2012-01-18 18:41:13 UTC (rev 105293)
@@ -42,7 +42,8 @@
     RenderBlock* placeholder() { return m_placeholder; }
     void createPlaceholder(PassRefPtr<RenderStyle>, const IntRect& frameRect);
 
-    static PassRefPtr<RenderStyle> createFullScreenStyle();
+    static RenderObject* wrapRenderer(RenderObject* renderer, Document*); 
+    void unwrapRenderer();
     
 protected:
     RenderBlock* m_placeholder;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to