Unreviewed, rolling out r94510.
authorkoz@chromium.org <koz@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Sep 2011 06:43:32 +0000 (06:43 +0000)
committerkoz@chromium.org <koz@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Sep 2011 06:43:32 +0000 (06:43 +0000)
http://trac.webkit.org/changeset/94510
https://bugs.webkit.org/show_bug.cgi?id=66531

Causes layout test crashes.

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::webkitWillEnterFullScreenForElement):
(WebCore::Document::webkitDidExitFullScreenForElement):
* dom/NodeRenderingContext.cpp:
(WebCore::wrapWithRenderFullScreen):
(WebCore::NodeRendererFactory::createRendererIfNeeded):
* rendering/RenderFullScreen.cpp:
(RenderFullScreen::createFullScreenStyle):
* rendering/RenderFullScreen.h:

LayoutTests:

* plugins/fullscreen-plugins-dont-reload-expected.txt: Removed.
* plugins/fullscreen-plugins-dont-reload.html: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94513 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/plugins/fullscreen-plugins-dont-reload-expected.txt [deleted file]
LayoutTests/plugins/fullscreen-plugins-dont-reload.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/NodeRenderingContext.cpp
Source/WebCore/rendering/RenderFullScreen.cpp
Source/WebCore/rendering/RenderFullScreen.h

index ce224ad..a27ec7b 100644 (file)
@@ -1,3 +1,14 @@
+2011-09-04  James Kozianski  <koz@chromium.org>
+
+        Unreviewed, rolling out r94510.
+        http://trac.webkit.org/changeset/94510
+        https://bugs.webkit.org/show_bug.cgi?id=66531
+
+        Causes layout test crashes.
+
+        * plugins/fullscreen-plugins-dont-reload-expected.txt: Removed.
+        * plugins/fullscreen-plugins-dont-reload.html: Removed.
+
 2011-09-04  Abhishek Arya  <inferno@chromium.org>
 
         Crash in Range::processAncestorsAndTheirSiblings.
diff --git a/LayoutTests/plugins/fullscreen-plugins-dont-reload-expected.txt b/LayoutTests/plugins/fullscreen-plugins-dont-reload-expected.txt
deleted file mode 100644 (file)
index 78208f1..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-ALERT: Plugin Loaded!
-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
-      RenderInline {A} at (0,0) size 81x18 [color=#0000EE]
-        RenderText {#text} at (0,136) size 81x18
-          text run at (0,136) width 81: "go fullscreen"
-      RenderText {#text} at (81,136) size 4x18
-        text run at (81,136) width 4: " "
-      RenderBlock (generated) at (85,0) size 300x150
-      RenderText {#text} at (0,0) size 0x0
-      RenderText {#text} at (0,0) size 0x0
-layer at (0,0) size 800x600
-  RenderFullScreen zI: 2147483647 at (0,0) size 800x600 [bgcolor=#000000]
-    RenderBlock (anonymous) at (250,225) size 300x150
-      RenderEmbeddedObject {EMBED} at (0,0) size 300x150 [bgcolor=#FFFFFF]
diff --git a/LayoutTests/plugins/fullscreen-plugins-dont-reload.html b/LayoutTests/plugins/fullscreen-plugins-dont-reload.html
deleted file mode 100644 (file)
index 0182438..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<html>
-<a id='link' href="javascript:document.getElementById('plg').webkitRequestFullScreen()">go
-fullscreen</a>
-<embed id="plg" type="application/x-webkit-test-netscape" src="data:application/x-webkit-test-netscape,alertwhenloaded"></iframe>
-
-<script>
-if (window.layoutTestController) {
-    layoutTestController.waitUntilDone();
-
-    setTimeout(function () {
-        var link = document.getElementById('link');
-        var x = link.offsetLeft + 5;
-        var y = link.offsetTop + 5;
-        eventSender.mouseMoveTo(x, y);
-        eventSender.mouseDown();
-        eventSender.mouseUp();
-
-        setTimeout(function () {
-            layoutTestController.notifyDone();
-        }, 0);
-    }, 100);
-}
-
-
-</script>
-</html>
index 70c3300..ae20254 100644 (file)
@@ -1,3 +1,21 @@
+2011-09-04  James Kozianski  <koz@chromium.org>
+
+        Unreviewed, rolling out r94510.
+        http://trac.webkit.org/changeset/94510
+        https://bugs.webkit.org/show_bug.cgi?id=66531
+
+        Causes layout test crashes.
+
+        * dom/Document.cpp:
+        (WebCore::Document::webkitWillEnterFullScreenForElement):
+        (WebCore::Document::webkitDidExitFullScreenForElement):
+        * dom/NodeRenderingContext.cpp:
+        (WebCore::wrapWithRenderFullScreen):
+        (WebCore::NodeRendererFactory::createRendererIfNeeded):
+        * rendering/RenderFullScreen.cpp:
+        (RenderFullScreen::createFullScreenStyle):
+        * rendering/RenderFullScreen.h:
+
 2011-09-04  Abhishek Arya  <inferno@chromium.org>
 
         Unreviewed. Compile fix for r94511.
index 96548b1..12f445b 100644 (file)
@@ -4887,7 +4887,7 @@ void Document::webkitWillEnterFullScreenForElement(Element* element)
     }
 
     if (m_fullScreenElement != documentElement())
-        RenderFullScreen::wrapRenderer(renderer, this);
+        m_fullScreenElement->detach();
 
     m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
     
@@ -4938,11 +4938,15 @@ void Document::webkitDidExitFullScreenForElement(Element*)
 {
     m_areKeysEnabledInFullScreen = false;
     setAnimatingFullScreen(false);
-    
+
     if (m_fullScreenRenderer)
-        m_fullScreenRenderer->unwrapRenderer();
+        m_fullScreenRenderer->remove();
+    
+    if (m_fullScreenElement != documentElement())
+        m_fullScreenElement->detach();
 
     m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement.release());
+    setFullScreenRenderer(0);
 #if USE(ACCELERATED_COMPOSITING)
     page()->chrome()->client()->setRootFullScreenLayer(0);
 #endif
index 5bd23b8..015e294 100644 (file)
@@ -320,6 +320,22 @@ RenderObject* NodeRendererFactory::createRendererAndStyle()
     return newRenderer;
 }
 
+#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()
 {
     Node* node = m_context.node();
@@ -340,7 +356,7 @@ void NodeRendererFactory::createRendererIfNeeded()
 
 #if ENABLE(FULLSCREEN_API)
     if (document->webkitIsFullScreen() && document->webkitCurrentFullScreenElement() == node)
-        newRenderer = RenderFullScreen::wrapRenderer(newRenderer, document);
+        newRenderer = wrapWithRenderFullScreen(newRenderer, document);
 #endif
 
     // FIXME: This side effect should be visible from attach() code.
index 9bc13c7..18dbc9f 100644 (file)
@@ -79,7 +79,7 @@ void RenderFullScreen::willBeDestroyed()
     RenderDeprecatedFlexibleBox::willBeDestroyed();
 }
 
-static PassRefPtr<RenderStyle> createFullScreenStyle()
+PassRefPtr<RenderStyle> RenderFullScreen::createFullScreenStyle()
 {
     RefPtr<RenderStyle> fullscreenStyle = RenderStyle::createDefaultStyle();
 
@@ -97,45 +97,14 @@ static PassRefPtr<RenderStyle> createFullScreenStyle()
     fullscreenStyle->setPosition(FixedPosition);
     fullscreenStyle->setWidth(Length(100.0, Percent));
     fullscreenStyle->setHeight(Length(100.0, Percent));
-    fullscreenStyle->setLeft(Length(0, WebCore::Fixed));
-    fullscreenStyle->setTop(Length(0, WebCore::Fixed));
+    fullscreenStyle->setLeft(Length(0, Fixed));
+    fullscreenStyle->setTop(Length(0, 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;
index 7968792..6f4c783 100644 (file)
@@ -41,9 +41,7 @@ public:
     RenderBlock* placeholder() { return m_placeholder; }
     void createPlaceholder(PassRefPtr<RenderStyle>, const IntRect& frameRect);
 
-
-    static RenderObject* wrapRenderer(RenderObject* renderer, Document*);
-    void unwrapRenderer();
+    static PassRefPtr<RenderStyle> createFullScreenStyle();
 
 private:
     virtual void willBeDestroyed();