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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Pass the limits even though this is for subframes, as the limits will be 260 // Pass the limits even though this is for subframes, as the limits will be
261 // needed in setting the raster scale. 261 // needed in setting the raster scale.
262 m_layerTreeView->setPageScaleFactorAndLimits( 262 m_layerTreeView->setPageScaleFactorAndLimits(
263 1, view()->minimumPageScaleFactor(), view()->maximumPageScaleFactor()); 263 1, view()->minimumPageScaleFactor(), view()->maximumPageScaleFactor());
264 } 264 }
265 265
266 void WebFrameWidgetImpl::updateLayerTreeBackgroundColor() { 266 void WebFrameWidgetImpl::updateLayerTreeBackgroundColor() {
267 if (!m_layerTreeView) 267 if (!m_layerTreeView)
268 return; 268 return;
269 269
270 m_layerTreeView->setBackgroundColor(backgroundColor()); 270 WebColor color = backgroundColor();
271 m_layerTreeView->setBackgroundColor(color);
272 m_layerTreeView->setHasTransparentBackground(alphaChannel(color) <
273 SK_AlphaOPAQUE);
271 } 274 }
272 275
273 void WebFrameWidgetImpl::updateLayerTreeDeviceScaleFactor() { 276 void WebFrameWidgetImpl::updateLayerTreeDeviceScaleFactor() {
274 DCHECK(page()); 277 DCHECK(page());
275 DCHECK(m_layerTreeView); 278 DCHECK(m_layerTreeView);
276 279
277 float deviceScaleFactor = page()->deviceScaleFactorDeprecated(); 280 float deviceScaleFactor = page()->deviceScaleFactorDeprecated();
278 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 281 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
279 } 282 }
280 283
281 void WebFrameWidgetImpl::setIsTransparent(bool isTransparent) { 284 void WebFrameWidgetImpl::setIsTransparent(bool isTransparent) {
282 m_isTransparent = isTransparent; 285 m_isTransparent = isTransparent;
chrishtr 2017/03/01 16:16:53 It seems it is not guaranteed that m_isTransparent
Eric Seckler 2017/03/07 18:00:47 FWIW, I think this would have been sort-of guarant
283 286 updateLayerTreeBackgroundColor();
284 if (m_layerTreeView)
285 m_layerTreeView->setHasTransparentBackground(isTransparent);
286 } 287 }
287 288
288 bool WebFrameWidgetImpl::isTransparent() const { 289 bool WebFrameWidgetImpl::isTransparent() const {
289 return m_isTransparent; 290 return m_isTransparent;
290 } 291 }
291 292
292 void WebFrameWidgetImpl::layoutAndPaintAsync( 293 void WebFrameWidgetImpl::layoutAndPaintAsync(
293 WebLayoutAndPaintAsyncCallback* callback) { 294 WebLayoutAndPaintAsyncCallback* callback) {
294 m_layerTreeView->layoutAndPaintAsync(callback); 295 m_layerTreeView->layoutAndPaintAsync(callback);
295 } 296 }
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 return nullptr; 1143 return nullptr;
1143 } 1144 }
1144 1145
1145 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { 1146 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const {
1146 if (!m_imeAcceptEvents) 1147 if (!m_imeAcceptEvents)
1147 return nullptr; 1148 return nullptr;
1148 return focusedLocalFrameInWidget(); 1149 return focusedLocalFrameInWidget();
1149 } 1150 }
1150 1151
1151 } // namespace blink 1152 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698