Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: Source/core/dom/FullscreenController.cpp

Issue 18896003: [WIP] Migrate Fullscreen to use top layer instead of RenderFullScreen (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/FullscreenController.cpp
diff --git a/Source/core/dom/FullscreenController.cpp b/Source/core/dom/FullscreenController.cpp
index ed63fee0ebdbed7462772c83def1e8e0e6305aec..d3baf9f4e42fd40b61067c60a4d5add42461396e 100644
--- a/Source/core/dom/FullscreenController.cpp
+++ b/Source/core/dom/FullscreenController.cpp
@@ -39,7 +39,6 @@
#include "core/page/Frame.h"
#include "core/page/Page.h"
#include "core/page/Settings.h"
-#include "core/rendering/RenderFullScreen.h"
namespace WebCore {
@@ -101,7 +100,6 @@ bool FullscreenController::isFullScreen(Document* document)
FullscreenController::FullscreenController(Document* document)
: DocumentLifecycleObserver(document)
, m_areKeysEnabledInFullScreen(false)
- , m_fullScreenRenderer(0)
, m_fullScreenChangeDelayTimer(this, &FullscreenController::fullScreenChangeDelayTimerFired)
{
document->setHasFullscreenController();
@@ -120,9 +118,6 @@ void FullscreenController::documentWasDetached()
{
m_fullScreenChangeEventTargetQueue.clear();
m_fullScreenErrorEventTargetQueue.clear();
-
- if (m_fullScreenRenderer)
- setFullScreenRenderer(0);
}
void FullscreenController::documentWasDisposed()
@@ -361,34 +356,15 @@ void FullscreenController::webkitWillEnterFullScreenForElement(Element* element)
return;
ASSERT(document()->page()->settings()->fullScreenEnabled());
-
- if (m_fullScreenRenderer)
- m_fullScreenRenderer->unwrapRenderer();
-
m_fullScreenElement = element;
+ document()->addToTopLayer(element);
#if USE(NATIVE_FULLSCREEN_VIDEO)
if (element && element->isMediaElement())
return;
#endif
- // Create a placeholder block for a the full-screen element, to keep the page from reflowing
- // when the element is removed from the normal flow. Only do this for a RenderBox, as only
- // a box will have a frameRect. The placeholder will be created in setFullScreenRenderer()
- // during layout.
- RenderObject* renderer = m_fullScreenElement->renderer();
- bool shouldCreatePlaceholder = renderer && renderer->isBox();
- if (shouldCreatePlaceholder) {
- m_savedPlaceholderFrameRect = toRenderBox(renderer)->frameRect();
- m_savedPlaceholderRenderStyle = RenderStyle::clone(renderer->style());
- }
trchen 2013/07/18 22:26:29 I'm not sure how Document::addToTopLayer() works,
falken 2013/07/22 17:51:44 Yes, I think so. I thought we should remove it sin
-
- if (m_fullScreenElement != document()->documentElement())
- RenderFullScreen::wrapRenderer(renderer, renderer ? renderer->parent() : 0, document());
-
m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
-
- document()->recalcStyle(Node::Force);
falken 2013/07/09 12:50:22 I think this recalcStyle was a quirk needed for Re
}
void FullscreenController::webkitDidEnterFullScreenForElement(Element*)
@@ -412,6 +388,7 @@ void FullscreenController::webkitWillExitFullScreenForElement(Element*)
if (!document()->attached())
return;
+ document()->removeFromTopLayer(m_fullScreenElement.get());
m_fullScreenElement->willStopBeingFullscreenElement();
}
@@ -424,12 +401,8 @@ void FullscreenController::webkitDidExitFullScreenForElement(Element*)
return;
m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
-
m_areKeysEnabledInFullScreen = false;
- if (m_fullScreenRenderer)
- m_fullScreenRenderer->unwrapRenderer();
-
m_fullScreenElement = 0;
document()->scheduleForcedStyleRecalc();
@@ -442,30 +415,6 @@ void FullscreenController::webkitDidExitFullScreenForElement(Element*)
from(exitingDocument)->m_fullScreenChangeDelayTimer.startOneShot(0);
}
-void FullscreenController::setFullScreenRenderer(RenderFullScreen* renderer)
-{
- if (renderer == m_fullScreenRenderer)
- return;
-
- if (renderer && m_savedPlaceholderRenderStyle) {
- renderer->createPlaceholder(m_savedPlaceholderRenderStyle.release(), m_savedPlaceholderFrameRect);
- } else if (renderer && m_fullScreenRenderer && m_fullScreenRenderer->placeholder()) {
- RenderBlock* placeholder = m_fullScreenRenderer->placeholder();
- renderer->createPlaceholder(RenderStyle::clone(placeholder->style()), placeholder->frameRect());
- }
-
- if (m_fullScreenRenderer)
- m_fullScreenRenderer->destroy();
- ASSERT(!m_fullScreenRenderer);
-
- m_fullScreenRenderer = renderer;
-}
-
-void FullscreenController::fullScreenRendererDestroyed()
-{
- m_fullScreenRenderer = 0;
-}
-
void FullscreenController::fullScreenChangeDelayTimerFired(Timer<FullscreenController>*)
{
// Since we dispatch events in this function, it's possible that the
@@ -541,11 +490,13 @@ void FullscreenController::popFullscreenElementStack()
if (m_fullScreenElementStack.isEmpty())
return;
+ document()->removeFromTopLayer(m_fullScreenElementStack.last().get());
m_fullScreenElementStack.removeLast();
}
void FullscreenController::pushFullscreenElementStack(Element* element)
{
+ document()->addToTopLayer(element);
m_fullScreenElementStack.append(element);
}

Powered by Google App Engine
This is Rietveld 408576698