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

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

Issue 1565893004: Sets a transparent background for out-of-process subframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split cc changes Created 4 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 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "web/WebRemoteFrameImpl.h" 56 #include "web/WebRemoteFrameImpl.h"
57 #include "web/WebViewFrameWidget.h" 57 #include "web/WebViewFrameWidget.h"
58 58
59 namespace blink { 59 namespace blink {
60 60
61 // WebFrameWidget -------------------------------------------------------------- -- 61 // WebFrameWidget -------------------------------------------------------------- --
62 62
63 WebFrameWidget* WebFrameWidget::create(WebWidgetClient* client, WebLocalFrame* l ocalRoot) 63 WebFrameWidget* WebFrameWidget::create(WebWidgetClient* client, WebLocalFrame* l ocalRoot)
64 { 64 {
65 // Pass the WebFrameWidget's self-reference to the caller. 65 // Pass the WebFrameWidget's self-reference to the caller.
66 return WebFrameWidgetImpl::create(client, localRoot); 66 WebFrameWidgetImpl* widget = WebFrameWidgetImpl::create(client, localRoot);
67 if (localRoot->parent())
68 widget->setIsTransparent(true);
69 return widget;
67 } 70 }
68 71
69 WebFrameWidget* WebFrameWidget::create(WebWidgetClient* client, WebView* webView , WebLocalFrame* mainFrame) 72 WebFrameWidget* WebFrameWidget::create(WebWidgetClient* client, WebView* webView , WebLocalFrame* mainFrame)
70 { 73 {
71 return new WebViewFrameWidget(client, toWebViewImpl(*webView), toWebLocalFra meImpl(*mainFrame)); 74 return new WebViewFrameWidget(client, toWebViewImpl(*webView), toWebLocalFra meImpl(*mainFrame));
72 } 75 }
73 76
74 WebFrameWidgetImpl* WebFrameWidgetImpl::create(WebWidgetClient* client, WebLocal Frame* localRoot) 77 WebFrameWidgetImpl* WebFrameWidgetImpl::create(WebWidgetClient* client, WebLocal Frame* localRoot)
75 { 78 {
76 // Pass the WebFrameWidgetImpl's self-reference to the caller. 79 // Pass the WebFrameWidgetImpl's self-reference to the caller.
(...skipping 14 matching lines...) Expand all
91 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, WebLocalFrame* l ocalRoot) 94 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, WebLocalFrame* l ocalRoot)
92 : m_client(client) 95 : m_client(client)
93 , m_localRoot(toWebLocalFrameImpl(localRoot)) 96 , m_localRoot(toWebLocalFrameImpl(localRoot))
94 , m_layerTreeView(nullptr) 97 , m_layerTreeView(nullptr)
95 , m_rootLayer(nullptr) 98 , m_rootLayer(nullptr)
96 , m_rootGraphicsLayer(nullptr) 99 , m_rootGraphicsLayer(nullptr)
97 , m_isAcceleratedCompositingActive(false) 100 , m_isAcceleratedCompositingActive(false)
98 , m_layerTreeViewClosed(false) 101 , m_layerTreeViewClosed(false)
99 , m_suppressNextKeypressEvent(false) 102 , m_suppressNextKeypressEvent(false)
100 , m_ignoreInputEvents(false) 103 , m_ignoreInputEvents(false)
104 , m_isTransparent(false)
105 , m_backgroundColorOverride(Color::transparent)
101 #if ENABLE(OILPAN) 106 #if ENABLE(OILPAN)
102 , m_selfKeepAlive(this) 107 , m_selfKeepAlive(this)
103 #endif 108 #endif
104 { 109 {
105 ASSERT(m_localRoot->frame()->isLocalRoot()); 110 ASSERT(m_localRoot->frame()->isLocalRoot());
106 initializeLayerTreeView(); 111 initializeLayerTreeView();
107 m_localRoot->setFrameWidget(this); 112 m_localRoot->setFrameWidget(this);
108 allInstances().add(this); 113 allInstances().add(this);
109 } 114 }
110 115
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 276
272 // FIXME: We need access to page scale information from the WebView. 277 // FIXME: We need access to page scale information from the WebView.
273 m_layerTreeView->setPageScaleFactorAndLimits(1, 1, 1); 278 m_layerTreeView->setPageScaleFactorAndLimits(1, 1, 1);
274 } 279 }
275 280
276 void WebFrameWidgetImpl::updateLayerTreeBackgroundColor() 281 void WebFrameWidgetImpl::updateLayerTreeBackgroundColor()
277 { 282 {
278 if (!m_layerTreeView) 283 if (!m_layerTreeView)
279 return; 284 return;
280 285
281 m_layerTreeView->setBackgroundColor(alphaChannel(view()->backgroundColorOver ride()) ? view()->backgroundColorOverride() : view()->backgroundColor()); 286 m_layerTreeView->setBackgroundColor(alphaChannel(backgroundColorOverride()) ? backgroundColorOverride() : backgroundColor());
282 } 287 }
283 288
284 void WebFrameWidgetImpl::updateLayerTreeDeviceScaleFactor() 289 void WebFrameWidgetImpl::updateLayerTreeDeviceScaleFactor()
285 { 290 {
286 ASSERT(page()); 291 ASSERT(page());
287 ASSERT(m_layerTreeView); 292 ASSERT(m_layerTreeView);
288 293
289 float deviceScaleFactor = page()->deviceScaleFactor(); 294 float deviceScaleFactor = page()->deviceScaleFactor();
290 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 295 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
291 } 296 }
292 297
298 void WebFrameWidgetImpl::setIsTransparent(bool isTransparent)
299 {
300 m_isTransparent = isTransparent;
301
302 if (m_layerTreeView)
303 m_layerTreeView->setHasTransparentBackground(isTransparent);
304 }
305
293 bool WebFrameWidgetImpl::isTransparent() const 306 bool WebFrameWidgetImpl::isTransparent() const
294 { 307 {
295 // FIXME: This might need to proxy to the WebView's isTransparent(). 308 return m_isTransparent;
296 return false;
297 } 309 }
298 310
299 void WebFrameWidgetImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* cal lback) 311 void WebFrameWidgetImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* cal lback)
300 { 312 {
301 m_layerTreeView->layoutAndPaintAsync(callback); 313 m_layerTreeView->layoutAndPaintAsync(callback);
302 } 314 }
303 315
304 void WebFrameWidgetImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncC allback* callback) 316 void WebFrameWidgetImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncC allback* callback)
305 { 317 {
306 m_layerTreeView->compositeAndReadbackAsync(callback); 318 m_layerTreeView->compositeAndReadbackAsync(callback);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 { 386 {
375 page()->setIsCursorVisible(isVisible); 387 page()->setIsCursorVisible(isVisible);
376 } 388 }
377 389
378 bool WebFrameWidgetImpl::hasTouchEventHandlersAt(const WebPoint& point) 390 bool WebFrameWidgetImpl::hasTouchEventHandlersAt(const WebPoint& point)
379 { 391 {
380 // FIXME: Implement this. Note that the point must be divided by pageScaleFa ctor. 392 // FIXME: Implement this. Note that the point must be divided by pageScaleFa ctor.
381 return true; 393 return true;
382 } 394 }
383 395
396 void WebFrameWidgetImpl::setBaseBackgroundColor(WebColor color)
397 {
398 if (m_baseBackgroundColor == color)
399 return;
400
401 m_baseBackgroundColor = color;
402
403 m_localRoot->frameView()->setBaseBackgroundColor(color);
404
405 updateAllLifecyclePhases();
406 }
407
408 void WebFrameWidgetImpl::setBackgroundColorOverride(WebColor color)
409 {
410 m_backgroundColorOverride = color;
411 updateLayerTreeBackgroundColor();
412 }
413
384 void WebFrameWidgetImpl::scheduleAnimation() 414 void WebFrameWidgetImpl::scheduleAnimation()
385 { 415 {
386 if (m_layerTreeView) { 416 if (m_layerTreeView) {
387 m_layerTreeView->setNeedsBeginFrame(); 417 m_layerTreeView->setNeedsBeginFrame();
388 return; 418 return;
389 } 419 }
390 if (m_client) 420 if (m_client)
391 m_client->scheduleAnimation(); 421 m_client->scheduleAnimation();
392 } 422 }
393 423
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 WebTextInputType WebFrameWidgetImpl::textInputType() 506 WebTextInputType WebFrameWidgetImpl::textInputType()
477 { 507 {
478 return view()->textInputType(); 508 return view()->textInputType();
479 } 509 }
480 510
481 WebColor WebFrameWidgetImpl::backgroundColor() const 511 WebColor WebFrameWidgetImpl::backgroundColor() const
482 { 512 {
483 if (isTransparent()) 513 if (isTransparent())
484 return Color::transparent; 514 return Color::transparent;
485 if (!m_localRoot->frameView()) 515 if (!m_localRoot->frameView())
486 return view()->backgroundColor(); 516 return m_baseBackgroundColor;
487 FrameView* view = m_localRoot->frameView(); 517 FrameView* view = m_localRoot->frameView();
488 return view->documentBackgroundColor().rgb(); 518 return view->documentBackgroundColor().rgb();
489 } 519 }
490 520
491 bool WebFrameWidgetImpl::selectionBounds(WebRect& anchor, WebRect& focus) const 521 bool WebFrameWidgetImpl::selectionBounds(WebRect& anchor, WebRect& focus) const
492 { 522 {
493 const Frame* frame = focusedCoreFrame(); 523 const Frame* frame = focusedCoreFrame();
494 if (!frame || !frame->isLocalFrame()) 524 if (!frame || !frame->isLocalFrame())
495 return false; 525 return false;
496 526
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 1112
1083 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame) 1113 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame)
1084 { 1114 {
1085 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame)); 1115 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame));
1086 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); 1116 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active);
1087 result.setToShadowHostIfInUserAgentShadowRoot(); 1117 result.setToShadowHostIfInUserAgentShadowRoot();
1088 return result; 1118 return result;
1089 } 1119 }
1090 1120
1091 } // namespace blink 1121 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698