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

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

Issue 2704213002: [devtools] Allow transparent base background color overrides. (Closed)
Patch Set: 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 155c10e439a954a7004474faceb8a605a7758138..b5464c6bcc437e28aaeae37c407e2d2713413327 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_baseBackgroundColorOverrideEnabled(false),
m_baseBackgroundColorOverride(Color::transparent),
m_backgroundColorOverride(Color::transparent),
m_zoomFactorOverride(0),
@@ -2446,11 +2447,11 @@ WebColor WebViewImpl::backgroundColor() const {
if (isTransparent())
return Color::transparent;
if (!m_page)
- return m_baseBackgroundColor;
+ return baseBackgroundColor().rgb();
dgozman 2017/02/21 19:41:44 Nice one!
Eric Seckler 2017/02/22 09:19:30 yeah ... I should have seen that in the first plac
if (!m_page->mainFrame())
- return m_baseBackgroundColor;
+ return baseBackgroundColor().rgb();
if (!m_page->mainFrame()->isLocalFrame())
- return m_baseBackgroundColor;
+ return baseBackgroundColor().rgb();
FrameView* view = m_page->deprecatedLocalMainFrame()->view();
return view->documentBackgroundColor().rgb();
}
@@ -3530,9 +3531,8 @@ WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController()
}
Color WebViewImpl::baseBackgroundColor() const {
- return alphaChannel(m_baseBackgroundColorOverride)
- ? m_baseBackgroundColorOverride
- : m_baseBackgroundColor;
+ return m_baseBackgroundColorOverrideEnabled ? m_baseBackgroundColorOverride
+ : m_baseBackgroundColor;
}
void WebViewImpl::setBaseBackgroundColor(WebColor color) {
@@ -3544,6 +3544,7 @@ void WebViewImpl::setBaseBackgroundColor(WebColor color) {
}
void WebViewImpl::setBaseBackgroundColorOverride(WebColor color) {
+ m_baseBackgroundColorOverrideEnabled = true;
m_baseBackgroundColorOverride = color;
if (mainFrameImpl()) {
// Force lifecycle update to ensure we're good to call
@@ -3556,6 +3557,19 @@ void WebViewImpl::setBaseBackgroundColorOverride(WebColor color) {
updateBaseBackgroundColor();
}
+void WebViewImpl::clearBaseBackgroundColorOverride() {
+ m_baseBackgroundColorOverrideEnabled = false;
+ 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())
« 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