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

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

Issue 2643723008: [devtools] Add a command to emulate the default background color. (Closed)
Patch Set: Force lifecycle update to CompositingCleanPlusScrolling. Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 19a2df0f5202b81cd8bbd87c047e4abb23069f1b..f579413fc6860c5f91b921dbb78a0cdfa61330c8 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -372,6 +372,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client,
m_flingSourceDevice(WebGestureDeviceUninitialized),
m_fullscreenController(FullscreenController::create(this)),
m_baseBackgroundColor(Color::white),
+ m_baseBackgroundColorOverride(Color::transparent),
m_backgroundColorOverride(Color::transparent),
m_zoomFactorOverride(0),
m_userGestureObserved(false),
@@ -3577,12 +3578,35 @@ WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController()
return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget());
}
+Color WebViewImpl::baseBackgroundColor() const {
+ return alphaChannel(m_baseBackgroundColorOverride)
+ ? m_baseBackgroundColorOverride
+ : m_baseBackgroundColor;
+}
+
void WebViewImpl::setBaseBackgroundColor(WebColor color) {
if (m_baseBackgroundColor == color)
return;
m_baseBackgroundColor = color;
+ updateBaseBackgroundColor();
+}
+
+void WebViewImpl::setBaseBackgroundColorOverride(WebColor color) {
+ m_baseBackgroundColorOverride = color;
+ if (mainFrameImpl()) {
+ // Force lifecycle update to ensure we're good to call
+ // FrameView::setBaseBackgroundColor().
+ mainFrameImpl()
+ ->frame()
+ ->view()
+ ->updateLifecycleToCompositingCleanPlusScrolling();
+ }
+ updateBaseBackgroundColor();
+}
+void WebViewImpl::updateBaseBackgroundColor() {
+ Color color = baseBackgroundColor();
if (m_page->mainFrame() && m_page->mainFrame()->isLocalFrame())
m_page->deprecatedLocalMainFrame()->view()->setBaseBackgroundColor(color);
}
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698