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

Unified Diff: third_party/WebKit/Source/web/ChromeClientImpl.cpp

Issue 2036403002: Always use the WebFrameWidget when attaching the root graphics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding comments Created 4 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: third_party/WebKit/Source/web/ChromeClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
index 6b3b603d7c53018d4218d65de9207089a6ba5ad0..c8c5da4eee22df989c4ebd21b59dab3fcc0a6f9e 100644
--- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -788,24 +788,15 @@ String ChromeClientImpl::acceptLanguages()
return m_webView->client()->acceptLanguages();
}
-void ChromeClientImpl::attachRootGraphicsLayer(GraphicsLayer* rootLayer, LocalFrame* localRoot)
+void ChromeClientImpl::attachRootGraphicsLayer(GraphicsLayer* rootLayer, LocalFrame* localFrame)
{
- // FIXME: For top-level frames we still use the WebView as a WebWidget. This
- // special case will be removed when top-level frames get WebFrameWidgets.
- if (localRoot->isMainFrame()) {
- m_webView->setRootGraphicsLayer(rootLayer);
- } else {
- WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
- // FIXME: The following conditional is only needed for staging until the
- // Chromium patch lands that instantiates a WebFrameWidget.
- if (!webFrame->frameWidget()) {
- m_webView->setRootGraphicsLayer(rootLayer);
- return;
- }
- DCHECK(webFrame);
- DCHECK(webFrame->frameWidget());
- toWebFrameWidgetImpl(webFrame->frameWidget())->setRootGraphicsLayer(rootLayer);
- }
+ WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localFrame)->localRoot();
+
+ // This method can be called while the frame is being detached. In that
+ // case, the rootLayer is null, and the widget is already destroyed.
+ DCHECK(webFrame->frameWidget() || !rootLayer);
+ if (webFrame->frameWidget())
+ webFrame->frameWidget()->setRootGraphicsLayer(rootLayer);
}
void ChromeClientImpl::didPaint(const PaintArtifact& paintArtifact)
@@ -815,44 +806,20 @@ void ChromeClientImpl::didPaint(const PaintArtifact& paintArtifact)
m_webView->getPaintArtifactCompositor().update(paintArtifact);
}
-void ChromeClientImpl::attachCompositorAnimationTimeline(CompositorAnimationTimeline* compositorTimeline, LocalFrame* localRoot)
+void ChromeClientImpl::attachCompositorAnimationTimeline(CompositorAnimationTimeline* compositorTimeline, LocalFrame* localFrame)
{
- // FIXME: For top-level frames we still use the WebView as a WebWidget. This
- // special case will be removed when top-level frames get WebFrameWidgets.
- if (localRoot->isMainFrame()) {
- m_webView->attachCompositorAnimationTimeline(compositorTimeline);
- } else {
- WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
- // FIXME: The following conditional is only needed for staging until the
- // Chromium patch lands that instantiates a WebFrameWidget.
- if (!webFrame->frameWidget()) {
- m_webView->attachCompositorAnimationTimeline(compositorTimeline);
- return;
- }
- DCHECK(webFrame);
- DCHECK(webFrame->frameWidget());
- toWebFrameWidgetImpl(webFrame->frameWidget())->attachCompositorAnimationTimeline(compositorTimeline);
- }
+ WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localFrame)->localRoot();
+ webFrame->frameWidget()->attachCompositorAnimationTimeline(compositorTimeline);
}
-void ChromeClientImpl::detachCompositorAnimationTimeline(CompositorAnimationTimeline* compositorTimeline, LocalFrame* localRoot)
+void ChromeClientImpl::detachCompositorAnimationTimeline(CompositorAnimationTimeline* compositorTimeline, LocalFrame* localFrame)
{
- // FIXME: For top-level frames we still use the WebView as a WebWidget. This
- // special case will be removed when top-level frames get WebFrameWidgets.
- if (localRoot->isMainFrame()) {
- m_webView->detachCompositorAnimationTimeline(compositorTimeline);
- } else {
- WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
- // FIXME: The following conditional is only needed for staging until the
- // Chromium patch lands that instantiates a WebFrameWidget.
- if (!webFrame->frameWidget()) {
- m_webView->detachCompositorAnimationTimeline(compositorTimeline);
- return;
- }
- DCHECK(webFrame);
- DCHECK(webFrame->frameWidget());
- toWebFrameWidgetImpl(webFrame->frameWidget())->detachCompositorAnimationTimeline(compositorTimeline);
- }
+ WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localFrame)->localRoot();
+
+ // This method can be called when the frame is being detached, after the
+ // widget is destroyed.
+ if (webFrame->frameWidget())
+ webFrame->frameWidget()->detachCompositorAnimationTimeline(compositorTimeline);
}
void ChromeClientImpl::enterFullScreenForElement(Element* element)

Powered by Google App Engine
This is Rietveld 408576698