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

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: compile Created 4 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, WebLocalFrame* l ocalRoot) 91 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, WebLocalFrame* l ocalRoot)
92 : m_client(client) 92 : m_client(client)
93 , m_localRoot(toWebLocalFrameImpl(localRoot)) 93 , m_localRoot(toWebLocalFrameImpl(localRoot))
94 , m_layerTreeView(nullptr) 94 , m_layerTreeView(nullptr)
95 , m_rootLayer(nullptr) 95 , m_rootLayer(nullptr)
96 , m_rootGraphicsLayer(nullptr) 96 , m_rootGraphicsLayer(nullptr)
97 , m_isAcceleratedCompositingActive(false) 97 , m_isAcceleratedCompositingActive(false)
98 , m_layerTreeViewClosed(false) 98 , m_layerTreeViewClosed(false)
99 , m_suppressNextKeypressEvent(false) 99 , m_suppressNextKeypressEvent(false)
100 , m_ignoreInputEvents(false) 100 , m_ignoreInputEvents(false)
101 , m_isTransparent(false)
101 #if ENABLE(OILPAN) 102 #if ENABLE(OILPAN)
102 , m_selfKeepAlive(this) 103 , m_selfKeepAlive(this)
103 #endif 104 #endif
104 { 105 {
105 ASSERT(m_localRoot->frame()->isLocalRoot()); 106 ASSERT(m_localRoot->frame()->isLocalRoot());
106 initializeLayerTreeView(); 107 initializeLayerTreeView();
107 m_localRoot->setFrameWidget(this); 108 m_localRoot->setFrameWidget(this);
108 allInstances().add(this); 109 allInstances().add(this);
110
111 if (localRoot->parent())
112 setIsTransparent(true);
109 } 113 }
110 114
111 WebFrameWidgetImpl::~WebFrameWidgetImpl() 115 WebFrameWidgetImpl::~WebFrameWidgetImpl()
112 { 116 {
113 } 117 }
114 118
115 DEFINE_TRACE(WebFrameWidgetImpl) 119 DEFINE_TRACE(WebFrameWidgetImpl)
116 { 120 {
117 visitor->trace(m_localRoot); 121 visitor->trace(m_localRoot);
118 visitor->trace(m_mouseCaptureNode); 122 visitor->trace(m_mouseCaptureNode);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 275
272 // FIXME: We need access to page scale information from the WebView. 276 // FIXME: We need access to page scale information from the WebView.
273 m_layerTreeView->setPageScaleFactorAndLimits(1, 1, 1); 277 m_layerTreeView->setPageScaleFactorAndLimits(1, 1, 1);
274 } 278 }
275 279
276 void WebFrameWidgetImpl::updateLayerTreeBackgroundColor() 280 void WebFrameWidgetImpl::updateLayerTreeBackgroundColor()
277 { 281 {
278 if (!m_layerTreeView) 282 if (!m_layerTreeView)
279 return; 283 return;
280 284
281 m_layerTreeView->setBackgroundColor(alphaChannel(view()->backgroundColorOver ride()) ? view()->backgroundColorOverride() : view()->backgroundColor()); 285 m_layerTreeView->setBackgroundColor(backgroundColor());
282 } 286 }
283 287
284 void WebFrameWidgetImpl::updateLayerTreeDeviceScaleFactor() 288 void WebFrameWidgetImpl::updateLayerTreeDeviceScaleFactor()
285 { 289 {
286 ASSERT(page()); 290 ASSERT(page());
287 ASSERT(m_layerTreeView); 291 ASSERT(m_layerTreeView);
288 292
289 float deviceScaleFactor = page()->deviceScaleFactor(); 293 float deviceScaleFactor = page()->deviceScaleFactor();
290 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 294 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
291 } 295 }
292 296
297 void WebFrameWidgetImpl::setIsTransparent(bool isTransparent)
298 {
299 m_isTransparent = isTransparent;
300
301 if (m_layerTreeView)
302 m_layerTreeView->setHasTransparentBackground(isTransparent);
303 }
304
293 bool WebFrameWidgetImpl::isTransparent() const 305 bool WebFrameWidgetImpl::isTransparent() const
294 { 306 {
295 // FIXME: This might need to proxy to the WebView's isTransparent(). 307 return m_isTransparent;
296 return false;
297 } 308 }
298 309
299 void WebFrameWidgetImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* cal lback) 310 void WebFrameWidgetImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* cal lback)
300 { 311 {
301 m_layerTreeView->layoutAndPaintAsync(callback); 312 m_layerTreeView->layoutAndPaintAsync(callback);
302 } 313 }
303 314
304 void WebFrameWidgetImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncC allback* callback) 315 void WebFrameWidgetImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncC allback* callback)
305 { 316 {
306 m_layerTreeView->compositeAndReadbackAsync(callback); 317 m_layerTreeView->compositeAndReadbackAsync(callback);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 { 385 {
375 page()->setIsCursorVisible(isVisible); 386 page()->setIsCursorVisible(isVisible);
376 } 387 }
377 388
378 bool WebFrameWidgetImpl::hasTouchEventHandlersAt(const WebPoint& point) 389 bool WebFrameWidgetImpl::hasTouchEventHandlersAt(const WebPoint& point)
379 { 390 {
380 // FIXME: Implement this. Note that the point must be divided by pageScaleFa ctor. 391 // FIXME: Implement this. Note that the point must be divided by pageScaleFa ctor.
381 return true; 392 return true;
382 } 393 }
383 394
395 void WebFrameWidgetImpl::setBaseBackgroundColor(WebColor color)
396 {
397 if (m_baseBackgroundColor == color)
398 return;
399
400 m_baseBackgroundColor = color;
401
402 m_localRoot->frameView()->setBaseBackgroundColor(color);
403
404 updateAllLifecyclePhases();
405 }
406
384 void WebFrameWidgetImpl::scheduleAnimation() 407 void WebFrameWidgetImpl::scheduleAnimation()
385 { 408 {
386 if (m_layerTreeView) { 409 if (m_layerTreeView) {
387 m_layerTreeView->setNeedsBeginFrame(); 410 m_layerTreeView->setNeedsBeginFrame();
388 return; 411 return;
389 } 412 }
390 if (m_client) 413 if (m_client)
391 m_client->scheduleAnimation(); 414 m_client->scheduleAnimation();
392 } 415 }
393 416
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 WebTextInputType WebFrameWidgetImpl::textInputType() 499 WebTextInputType WebFrameWidgetImpl::textInputType()
477 { 500 {
478 return view()->textInputType(); 501 return view()->textInputType();
479 } 502 }
480 503
481 WebColor WebFrameWidgetImpl::backgroundColor() const 504 WebColor WebFrameWidgetImpl::backgroundColor() const
482 { 505 {
483 if (isTransparent()) 506 if (isTransparent())
484 return Color::transparent; 507 return Color::transparent;
485 if (!m_localRoot->frameView()) 508 if (!m_localRoot->frameView())
486 return view()->backgroundColor(); 509 return m_baseBackgroundColor;
487 FrameView* view = m_localRoot->frameView(); 510 FrameView* view = m_localRoot->frameView();
488 return view->documentBackgroundColor().rgb(); 511 return view->documentBackgroundColor().rgb();
489 } 512 }
490 513
491 bool WebFrameWidgetImpl::selectionBounds(WebRect& anchor, WebRect& focus) const 514 bool WebFrameWidgetImpl::selectionBounds(WebRect& anchor, WebRect& focus) const
492 { 515 {
493 const Frame* frame = focusedCoreFrame(); 516 const Frame* frame = focusedCoreFrame();
494 if (!frame || !frame->isLocalFrame()) 517 if (!frame || !frame->isLocalFrame())
495 return false; 518 return false;
496 519
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 1105
1083 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame) 1106 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame)
1084 { 1107 {
1085 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame)); 1108 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame));
1086 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); 1109 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active);
1087 result.setToShadowHostIfInUserAgentShadowRoot(); 1110 result.setToShadowHostIfInUserAgentShadowRoot();
1088 return result; 1111 return result;
1089 } 1112 }
1090 1113
1091 } // namespace blink 1114 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.h ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698