OLD | NEW |
---|---|
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 Loading... | |
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()) | |
dcheng
2016/02/11 22:40:26
Do you think it'd make sense to have this in the c
lfg
2016/02/11 23:48:02
Done.
| |
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 Loading... | |
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) | |
101 #if ENABLE(OILPAN) | 105 #if ENABLE(OILPAN) |
102 , m_selfKeepAlive(this) | 106 , m_selfKeepAlive(this) |
103 #endif | 107 #endif |
104 { | 108 { |
105 ASSERT(m_localRoot->frame()->isLocalRoot()); | 109 ASSERT(m_localRoot->frame()->isLocalRoot()); |
106 initializeLayerTreeView(); | 110 initializeLayerTreeView(); |
107 m_localRoot->setFrameWidget(this); | 111 m_localRoot->setFrameWidget(this); |
108 allInstances().add(this); | 112 allInstances().add(this); |
109 } | 113 } |
110 | 114 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | |
dcheng
2016/02/11 22:40:26
The WebView version also marks the FrameViews as t
lfg
2016/02/11 23:48:02
I believe this is correct. isTransparent() on Fram
dcheng
2016/02/12 22:46:23
Hm... I guess I am thinking that it would make it
| |
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 Loading... | |
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |