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

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

Issue 788073004: Replace RenderFullscreen with top layer - Take II (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated after review comments. Created 6 years 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/Fullscreen.cpp
diff --git a/Source/core/dom/Fullscreen.cpp b/Source/core/dom/Fullscreen.cpp
index 07161b2523d4083a4500da08d7fa22bdc7b64615..f1cead012f53579daf3a1eb8e323403eec014c3c 100644
--- a/Source/core/dom/Fullscreen.cpp
+++ b/Source/core/dom/Fullscreen.cpp
@@ -28,8 +28,10 @@
#include "config.h"
#include "core/dom/Fullscreen.h"
+#include "bindings/core/v8/ExceptionMessages.h"
#include "core/HTMLNames.h"
#include "core/dom/Document.h"
+#include "core/dom/ElementTraversal.h"
#include "core/events/Event.h"
#include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h"
@@ -40,7 +42,9 @@
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
#include "core/page/EventHandler.h"
-#include "core/rendering/RenderFullScreen.h"
+#include "core/page/Page.h"
+#include "core/rendering/RenderObject.h"
+#include "core/rendering/style/RenderStyle.h"
#include "platform/UserGestureIndicator.h"
namespace blink {
@@ -161,7 +165,6 @@ bool Fullscreen::isFullScreen(Document& document)
Fullscreen::Fullscreen(Document& document)
: DocumentLifecycleObserver(&document)
- , m_fullScreenRenderer(nullptr)
, m_eventQueueTimer(this, &Fullscreen::eventQueueTimerFired)
{
document.setHasFullscreenSupplement();
@@ -180,9 +183,6 @@ void Fullscreen::documentWasDetached()
{
m_eventQueue.clear();
- if (m_fullScreenRenderer)
- m_fullScreenRenderer->destroy();
-
#if ENABLE(OILPAN)
m_fullScreenElement = nullptr;
m_fullScreenElementStack.clear();
@@ -419,25 +419,10 @@ void Fullscreen::didEnterFullScreenForElement(Element* element)
if (!document()->isActive())
return;
- 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
- // 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());
- }
-
- if (m_fullScreenElement != document()->documentElement())
- RenderFullScreen::wrapRenderer(renderer, renderer ? renderer->parent() : 0, document());
-
+ // FIXME: Why can we get here without calling pushFullscreenElementStack?
philipj_slow 2015/02/12 08:19:16 Not sure, but possibly it's when Chromium toggles
+ document()->addToTopLayer(m_fullScreenElement.get());
m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
// FIXME: This should not call updateStyleIfNeeded.
@@ -460,13 +445,11 @@ void Fullscreen::didExitFullScreenForElement(Element*)
if (!document()->isActive())
return;
+ document()->removeFromTopLayer(m_fullScreenElement.get());
m_fullScreenElement->willStopBeingFullscreenElement();
m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
- if (m_fullScreenRenderer)
- m_fullScreenRenderer->unwrapRenderer();
-
m_fullScreenElement = nullptr;
document()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::FullScreen));
@@ -483,30 +466,6 @@ void Fullscreen::didExitFullScreenForElement(Element*)
from(*exitingDocument).m_eventQueueTimer.startOneShot(0, FROM_HERE);
}
-void Fullscreen::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->unwrapRenderer();
- ASSERT(!m_fullScreenRenderer);
-
- m_fullScreenRenderer = renderer;
-}
-
-void Fullscreen::fullScreenRendererDestroyed()
-{
- m_fullScreenRenderer = nullptr;
-}
-
void Fullscreen::enqueueChangeEvent(Document& document, RequestType requestType)
{
RefPtrWillBeRawPtr<Event> event;
@@ -593,19 +552,20 @@ void Fullscreen::popFullscreenElementStack()
if (m_fullScreenElementStack.isEmpty())
return;
+ document()->removeFromTopLayer(m_fullScreenElementStack.last().first.get());
m_fullScreenElementStack.removeLast();
}
void Fullscreen::pushFullscreenElementStack(Element& element, RequestType requestType)
{
m_fullScreenElementStack.append(std::make_pair(&element, requestType));
+ document()->addToTopLayer(&element);
}
void Fullscreen::trace(Visitor* visitor)
{
visitor->trace(m_fullScreenElement);
visitor->trace(m_fullScreenElementStack);
- visitor->trace(m_fullScreenRenderer);
visitor->trace(m_eventQueue);
DocumentSupplement::trace(visitor);
}

Powered by Google App Engine
This is Rietveld 408576698