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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2715243004: [blink] Support (semi-)transparent background colors in WebView/Frame. (Closed)
Patch Set: Set WebViewImpl transparency for fullscreen. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 3505 matching lines...) Expand 10 before | Expand all | Expand 10 after
3516 // Set any existing frames to be transparent. 3516 // Set any existing frames to be transparent.
3517 Frame* frame = m_page->mainFrame(); 3517 Frame* frame = m_page->mainFrame();
3518 while (frame) { 3518 while (frame) {
3519 if (frame->isLocalFrame()) 3519 if (frame->isLocalFrame())
3520 toLocalFrame(frame)->view()->setTransparent(isTransparent); 3520 toLocalFrame(frame)->view()->setTransparent(isTransparent);
3521 frame = frame->tree().traverseNext(); 3521 frame = frame->tree().traverseNext();
3522 } 3522 }
3523 3523
3524 // Future frames check this to know whether to be transparent. 3524 // Future frames check this to know whether to be transparent.
3525 m_isTransparent = isTransparent; 3525 m_isTransparent = isTransparent;
3526 3526 updateLayerTreeBackgroundColor();
3527 if (m_layerTreeView)
3528 m_layerTreeView->setHasTransparentBackground(this->isTransparent());
3529 } 3527 }
3530 3528
3531 bool WebViewImpl::isTransparent() const { 3529 bool WebViewImpl::isTransparent() const {
3532 return m_isTransparent; 3530 return m_isTransparent;
3533 } 3531 }
3534 3532
3535 WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController() 3533 WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController()
3536 const { 3534 const {
3537 return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget()); 3535 return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget());
3538 } 3536 }
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
4007 return; 4005 return;
4008 4006
4009 m_layerTreeView->setPageScaleFactorAndLimits( 4007 m_layerTreeView->setPageScaleFactorAndLimits(
4010 pageScaleFactor(), minimumPageScaleFactor(), maximumPageScaleFactor()); 4008 pageScaleFactor(), minimumPageScaleFactor(), maximumPageScaleFactor());
4011 } 4009 }
4012 4010
4013 void WebViewImpl::updateLayerTreeBackgroundColor() { 4011 void WebViewImpl::updateLayerTreeBackgroundColor() {
4014 if (!m_layerTreeView) 4012 if (!m_layerTreeView)
4015 return; 4013 return;
4016 4014
4017 m_layerTreeView->setBackgroundColor(alphaChannel(m_backgroundColorOverride) 4015 WebColor color = alphaChannel(m_backgroundColorOverride)
4018 ? m_backgroundColorOverride 4016 ? m_backgroundColorOverride
4019 : backgroundColor()); 4017 : backgroundColor();
4018 m_layerTreeView->setBackgroundColor(color);
4019 m_layerTreeView->setHasTransparentBackground(alphaChannel(color) <
dgozman 2017/03/01 19:11:52 Similarly to Chris' question, do we actually need
Eric Seckler 2017/03/07 18:00:47 Implemented as suggested.
4020 SK_AlphaOPAQUE);
4020 } 4021 }
4021 4022
4022 void WebViewImpl::updateLayerTreeDeviceScaleFactor() { 4023 void WebViewImpl::updateLayerTreeDeviceScaleFactor() {
4023 DCHECK(page()); 4024 DCHECK(page());
4024 DCHECK(m_layerTreeView); 4025 DCHECK(m_layerTreeView);
4025 4026
4026 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride 4027 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride
4027 ? m_compositorDeviceScaleFactorOverride 4028 ? m_compositorDeviceScaleFactorOverride
4028 : page()->deviceScaleFactorDeprecated(); 4029 : page()->deviceScaleFactorDeprecated();
4029 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 4030 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
4163 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4164 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4164 return nullptr; 4165 return nullptr;
4165 return focusedFrame; 4166 return focusedFrame;
4166 } 4167 }
4167 4168
4168 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4169 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4169 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4170 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4170 } 4171 }
4171 4172
4172 } // namespace blink 4173 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698