Chromium Code Reviews| 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()) |