Title: [170638] trunk/Source/WebCore
- Revision
- 170638
- Author
- [email protected]
- Date
- 2014-07-01 08:16:24 -0700 (Tue, 01 Jul 2014)
Log Message
REGRESSION(160908): vube.com video won't play after going into and out of fullscreen
https://bugs.webkit.org/show_bug.cgi?id=134489
Reviewed by Zalan Bujtas.
Test: fullscreen/full-screen-plugin.html
It is difficult to restore the render tree correctly in all cases after removing a full screen
renderer from the tree. r160908 avoided dealing with this by simply always reconstructing the subtree.
Unfortunately plugin lifetime is currently tied to its renderer so this would cause the plugin to restart.
With this patch we avoid reconstruction in normal cases and only force it if the render tree is complicated.
* dom/Document.cpp:
(WebCore::unwrapFullScreenRenderer):
Force reconstruction conditionally.
(WebCore::Document::webkitWillEnterFullScreenForElement):
(WebCore::Document::webkitDidExitFullScreenForElement):
* rendering/RenderFullScreen.cpp:
(WebCore::RenderFullScreen::wrapRenderer):
(WebCore::RenderFullScreen::unwrapRenderer):
Deal with the simple case of single child, possibly in anonymous wrapper.
In other cases request reconstruction.
This is covered by the existing fullscreen tests.
* rendering/RenderFullScreen.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (170637 => 170638)
--- trunk/Source/WebCore/ChangeLog 2014-07-01 13:10:18 UTC (rev 170637)
+++ trunk/Source/WebCore/ChangeLog 2014-07-01 15:16:24 UTC (rev 170638)
@@ -1,3 +1,35 @@
+2014-07-01 Antti Koivisto <[email protected]>
+
+ REGRESSION(160908): vube.com video won't play after going into and out of fullscreen
+ https://bugs.webkit.org/show_bug.cgi?id=134489
+
+ Reviewed by Zalan Bujtas.
+
+ Test: fullscreen/full-screen-plugin.html
+
+ It is difficult to restore the render tree correctly in all cases after removing a full screen
+ renderer from the tree. r160908 avoided dealing with this by simply always reconstructing the subtree.
+ Unfortunately plugin lifetime is currently tied to its renderer so this would cause the plugin to restart.
+
+ With this patch we avoid reconstruction in normal cases and only force it if the render tree is complicated.
+
+ * dom/Document.cpp:
+ (WebCore::unwrapFullScreenRenderer):
+
+ Force reconstruction conditionally.
+
+ (WebCore::Document::webkitWillEnterFullScreenForElement):
+ (WebCore::Document::webkitDidExitFullScreenForElement):
+ * rendering/RenderFullScreen.cpp:
+ (WebCore::RenderFullScreen::wrapRenderer):
+ (WebCore::RenderFullScreen::unwrapRenderer):
+
+ Deal with the simple case of single child, possibly in anonymous wrapper.
+ In other cases request reconstruction.
+ This is covered by the existing fullscreen tests.
+
+ * rendering/RenderFullScreen.h:
+
2014-07-01 Zan Dobersek <[email protected]>
Remove remaining Vector<> copies in WebCore accessibility code
Modified: trunk/Source/WebCore/dom/Document.cpp (170637 => 170638)
--- trunk/Source/WebCore/dom/Document.cpp 2014-07-01 13:10:18 UTC (rev 170637)
+++ trunk/Source/WebCore/dom/Document.cpp 2014-07-01 15:16:24 UTC (rev 170638)
@@ -5311,6 +5311,17 @@
return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr, ownerElement());
}
+static void unwrapFullScreenRenderer(RenderFullScreen* fullScreenRenderer, Element* fullScreenElement)
+{
+ if (!fullScreenRenderer)
+ return;
+ bool requiresRenderTreeRebuild;
+ fullScreenRenderer->unwrapRenderer(requiresRenderTreeRebuild);
+
+ if (requiresRenderTreeRebuild && fullScreenElement && fullScreenElement->parentNode())
+ fullScreenElement->parentNode()->setNeedsStyleRecalc(ReconstructRenderTree);
+}
+
void Document::webkitWillEnterFullScreenForElement(Element* element)
{
if (!hasLivingRenderTree() || inPageCache())
@@ -5324,8 +5335,7 @@
ASSERT(page()->settings().fullScreenEnabled());
- if (m_fullScreenRenderer)
- m_fullScreenRenderer->unwrapRenderer();
+ unwrapFullScreenRenderer(m_fullScreenRenderer, m_fullScreenElement.get());
m_fullScreenElement = element;
@@ -5388,16 +5398,12 @@
m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
m_areKeysEnabledInFullScreen = false;
-
- if (m_fullScreenRenderer)
- m_fullScreenRenderer->unwrapRenderer();
- if (m_fullScreenElement->parentNode())
- m_fullScreenElement->parentNode()->setNeedsStyleRecalc(ReconstructRenderTree);
+ unwrapFullScreenRenderer(m_fullScreenRenderer, m_fullScreenElement.get());
m_fullScreenElement = nullptr;
scheduleForcedStyleRecalc();
-
+
// When webkitCancelFullScreen is called, we call webkitExitFullScreen on the topDocument(). That
// means that the events will be queued there. So if we have no events here, start the timer on
// the exiting document.
Modified: trunk/Source/WebCore/rendering/RenderFullScreen.cpp (170637 => 170638)
--- trunk/Source/WebCore/rendering/RenderFullScreen.cpp 2014-07-01 13:10:18 UTC (rev 170637)
+++ trunk/Source/WebCore/rendering/RenderFullScreen.cpp 2014-07-01 15:16:24 UTC (rev 170638)
@@ -138,11 +138,32 @@
return fullscreenRenderer;
}
-void RenderFullScreen::unwrapRenderer()
+void RenderFullScreen::unwrapRenderer(bool& requiresRenderTreeRebuild)
{
+ requiresRenderTreeRebuild = false;
if (parent()) {
- RenderObject* child;
+ auto* child = firstChild();
+ // Things can get very complicated with anonymous block generation.
+ // We can restore correctly without rebuild in simple cases only.
+ // FIXME: We should have a mechanism for removing a block without reconstructing the tree.
+ if (child != lastChild())
+ requiresRenderTreeRebuild = true;
+ else if (child && child->isAnonymousBlock()) {
+ auto& anonymousBlock = toRenderBlock(*child);
+ if (anonymousBlock.firstChild() != anonymousBlock.lastChild())
+ requiresRenderTreeRebuild = true;
+ }
+
while ((child = firstChild())) {
+ if (child->isAnonymousBlock() && !requiresRenderTreeRebuild) {
+ if (auto* nonAnonymousChild = toRenderBlock(*child).firstChild())
+ child = nonAnonymousChild;
+ else {
+ child->removeFromParent();
+ child->destroy();
+ continue;
+ }
+ }
// We have to clear the override size, because as a flexbox, we
// may have set one on the child, and we don't want to leave that
// lying around on the child.
Modified: trunk/Source/WebCore/rendering/RenderFullScreen.h (170637 => 170638)
--- trunk/Source/WebCore/rendering/RenderFullScreen.h 2014-07-01 13:10:18 UTC (rev 170637)
+++ trunk/Source/WebCore/rendering/RenderFullScreen.h 2014-07-01 15:16:24 UTC (rev 170638)
@@ -44,7 +44,7 @@
void createPlaceholder(PassRef<RenderStyle>, const LayoutRect& frameRect);
static RenderFullScreen* wrapRenderer(RenderObject*, RenderElement*, Document&);
- void unwrapRenderer();
+ void unwrapRenderer(bool& requiresRenderTreeRebuild);
private:
virtual void willBeDestroyed() override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes