| OLD | NEW |
| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 , m_suppressNextKeypressEvent(false) | 422 , m_suppressNextKeypressEvent(false) |
| 423 , m_imeAcceptEvents(true) | 423 , m_imeAcceptEvents(true) |
| 424 , m_operationsAllowed(WebDragOperationNone) | 424 , m_operationsAllowed(WebDragOperationNone) |
| 425 , m_dragOperation(WebDragOperationNone) | 425 , m_dragOperation(WebDragOperationNone) |
| 426 , m_devToolsEmulator(nullptr) | 426 , m_devToolsEmulator(nullptr) |
| 427 , m_isTransparent(false) | 427 , m_isTransparent(false) |
| 428 , m_tabsToLinks(false) | 428 , m_tabsToLinks(false) |
| 429 , m_layerTreeView(nullptr) | 429 , m_layerTreeView(nullptr) |
| 430 , m_rootLayer(nullptr) | 430 , m_rootLayer(nullptr) |
| 431 , m_rootGraphicsLayer(nullptr) | 431 , m_rootGraphicsLayer(nullptr) |
| 432 , m_containerLayer(nullptr) |
| 432 , m_matchesHeuristicsForGpuRasterization(false) | 433 , m_matchesHeuristicsForGpuRasterization(false) |
| 433 , m_flingModifier(0) | 434 , m_flingModifier(0) |
| 434 , m_flingSourceDevice(WebGestureDeviceUninitialized) | 435 , m_flingSourceDevice(WebGestureDeviceUninitialized) |
| 435 , m_fullscreenController(FullscreenController::create(this)) | 436 , m_fullscreenController(FullscreenController::create(this)) |
| 436 , m_showFPSCounter(false) | |
| 437 , m_baseBackgroundColor(Color::white) | 437 , m_baseBackgroundColor(Color::white) |
| 438 , m_backgroundColorOverride(Color::transparent) | 438 , m_backgroundColorOverride(Color::transparent) |
| 439 , m_zoomFactorOverride(0) | 439 , m_zoomFactorOverride(0) |
| 440 , m_userGestureObserved(false) | 440 , m_userGestureObserved(false) |
| 441 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) | 441 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) |
| 442 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) | 442 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) |
| 443 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) | 443 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) |
| 444 , m_displayMode(WebDisplayModeBrowser) | 444 , m_displayMode(WebDisplayModeBrowser) |
| 445 , m_elasticOverscroll(FloatSize()) | 445 , m_elasticOverscroll(FloatSize()) |
| 446 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr
eateWebViewScheduler(this).release())) | 446 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr
eateWebViewScheduler(this).release())) |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 | 1010 |
| 1011 void WebViewImpl::enableFakePageScaleAnimationForTesting(bool enable) | 1011 void WebViewImpl::enableFakePageScaleAnimationForTesting(bool enable) |
| 1012 { | 1012 { |
| 1013 m_enableFakePageScaleAnimationForTesting = enable; | 1013 m_enableFakePageScaleAnimationForTesting = enable; |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void WebViewImpl::setShowFPSCounter(bool show) | 1016 void WebViewImpl::setShowFPSCounter(bool show) |
| 1017 { | 1017 { |
| 1018 if (m_layerTreeView) { | 1018 if (m_layerTreeView) { |
| 1019 TRACE_EVENT0("blink", "WebViewImpl::setShowFPSCounter"); | 1019 TRACE_EVENT0("blink", "WebViewImpl::setShowFPSCounter"); |
| 1020 m_layerTreeView->setShowFPSCounter(show && !m_devToolsEmulator->deviceEm
ulationEnabled()); | 1020 m_layerTreeView->setShowFPSCounter(show); |
| 1021 } | 1021 } |
| 1022 m_showFPSCounter = show; | |
| 1023 } | 1022 } |
| 1024 | 1023 |
| 1025 void WebViewImpl::setShowPaintRects(bool show) | 1024 void WebViewImpl::setShowPaintRects(bool show) |
| 1026 { | 1025 { |
| 1027 if (m_layerTreeView) { | 1026 if (m_layerTreeView) { |
| 1028 TRACE_EVENT0("blink", "WebViewImpl::setShowPaintRects"); | 1027 TRACE_EVENT0("blink", "WebViewImpl::setShowPaintRects"); |
| 1029 m_layerTreeView->setShowPaintRects(show); | 1028 m_layerTreeView->setShowPaintRects(show); |
| 1030 } | 1029 } |
| 1031 setFirstPaintInvalidationTrackingEnabledForShowPaintRects(show); | 1030 setFirstPaintInvalidationTrackingEnabledForShowPaintRects(show); |
| 1032 } | 1031 } |
| 1033 | 1032 |
| 1034 void WebViewImpl::setShowDebugBorders(bool show) | 1033 void WebViewImpl::setShowDebugBorders(bool show) |
| 1035 { | 1034 { |
| 1036 if (m_layerTreeView) | 1035 if (m_layerTreeView) |
| 1037 m_layerTreeView->setShowDebugBorders(show); | 1036 m_layerTreeView->setShowDebugBorders(show); |
| 1038 } | 1037 } |
| 1039 | 1038 |
| 1040 void WebViewImpl::updateShowFPSCounter() | |
| 1041 { | |
| 1042 if (m_layerTreeView) | |
| 1043 m_layerTreeView->setShowFPSCounter(m_showFPSCounter && !m_devToolsEmulat
or->deviceEmulationEnabled()); | |
| 1044 } | |
| 1045 | |
| 1046 void WebViewImpl::setShowScrollBottleneckRects(bool show) | 1039 void WebViewImpl::setShowScrollBottleneckRects(bool show) |
| 1047 { | 1040 { |
| 1048 if (m_layerTreeView) | 1041 if (m_layerTreeView) |
| 1049 m_layerTreeView->setShowScrollBottleneckRects(show); | 1042 m_layerTreeView->setShowScrollBottleneckRects(show); |
| 1050 } | 1043 } |
| 1051 | 1044 |
| 1052 void WebViewImpl::acceptLanguagesChanged() | 1045 void WebViewImpl::acceptLanguagesChanged() |
| 1053 { | 1046 { |
| 1054 if (m_client) | 1047 if (m_client) |
| 1055 FontCache::acceptLanguagesChanged(m_client->acceptLanguages()); | 1048 FontCache::acceptLanguagesChanged(m_client->acceptLanguages()); |
| (...skipping 3182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4238 return; | 4231 return; |
| 4239 | 4232 |
| 4240 // In SPv2, we attach layers via PaintArtifactCompositor, rather than | 4233 // In SPv2, we attach layers via PaintArtifactCompositor, rather than |
| 4241 // supplying a root GraphicsLayer from PaintLayerCompositor. | 4234 // supplying a root GraphicsLayer from PaintLayerCompositor. |
| 4242 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 4235 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 4243 | 4236 |
| 4244 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 4237 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
| 4245 visualViewport.attachToLayerTree(layer); | 4238 visualViewport.attachToLayerTree(layer); |
| 4246 if (layer) { | 4239 if (layer) { |
| 4247 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); | 4240 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); |
| 4241 m_containerLayer = visualViewport.containerLayer(); |
| 4248 m_rootLayer = m_rootGraphicsLayer->platformLayer(); | 4242 m_rootLayer = m_rootGraphicsLayer->platformLayer(); |
| 4249 updateRootLayerTransform(); | 4243 updateRootLayerTransform(); |
| 4250 m_layerTreeView->setRootLayer(*m_rootLayer); | 4244 m_layerTreeView->setRootLayer(*m_rootLayer); |
| 4251 // We register viewport layers here since there may not be a layer | 4245 // We register viewport layers here since there may not be a layer |
| 4252 // tree view prior to this point. | 4246 // tree view prior to this point. |
| 4253 visualViewport.registerLayersWithTreeView(m_layerTreeView); | 4247 visualViewport.registerLayersWithTreeView(m_layerTreeView); |
| 4254 updatePageOverlays(); | 4248 updatePageOverlays(); |
| 4255 // TODO(enne): Work around page visibility changes not being | 4249 // TODO(enne): Work around page visibility changes not being |
| 4256 // propagated to the WebView in some circumstances. This needs to | 4250 // propagated to the WebView in some circumstances. This needs to |
| 4257 // be refreshed here when setting a new root layer to avoid being | 4251 // be refreshed here when setting a new root layer to avoid being |
| 4258 // stuck in a presumed incorrectly invisible state. | 4252 // stuck in a presumed incorrectly invisible state. |
| 4259 m_layerTreeView->setVisible(page()->isPageVisible()); | 4253 m_layerTreeView->setVisible(page()->isPageVisible()); |
| 4260 } else { | 4254 } else { |
| 4261 m_rootGraphicsLayer = nullptr; | 4255 m_rootGraphicsLayer = nullptr; |
| 4256 m_containerLayer = nullptr; |
| 4262 m_rootLayer = nullptr; | 4257 m_rootLayer = nullptr; |
| 4263 // This means that we're transitioning to a new page. Suppress | 4258 // This means that we're transitioning to a new page. Suppress |
| 4264 // commits until Blink generates invalidations so we don't | 4259 // commits until Blink generates invalidations so we don't |
| 4265 // attempt to paint too early in the next page load. | 4260 // attempt to paint too early in the next page load. |
| 4266 m_layerTreeView->setDeferCommits(true); | 4261 m_layerTreeView->setDeferCommits(true); |
| 4267 m_layerTreeView->clearRootLayer(); | 4262 m_layerTreeView->clearRootLayer(); |
| 4268 visualViewport.clearLayersForTreeView(m_layerTreeView); | 4263 visualViewport.clearLayersForTreeView(m_layerTreeView); |
| 4269 } | 4264 } |
| 4270 } | 4265 } |
| 4271 | 4266 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4403 { | 4398 { |
| 4404 DCHECK(page()); | 4399 DCHECK(page()); |
| 4405 DCHECK(m_layerTreeView); | 4400 DCHECK(m_layerTreeView); |
| 4406 | 4401 |
| 4407 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit
orDeviceScaleFactorOverride : page()->deviceScaleFactor(); | 4402 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit
orDeviceScaleFactorOverride : page()->deviceScaleFactor(); |
| 4408 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); | 4403 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); |
| 4409 } | 4404 } |
| 4410 | 4405 |
| 4411 void WebViewImpl::updateRootLayerTransform() | 4406 void WebViewImpl::updateRootLayerTransform() |
| 4412 { | 4407 { |
| 4413 if (m_rootGraphicsLayer) { | 4408 if (m_containerLayer) { |
| 4414 TransformationMatrix transform; | 4409 TransformationMatrix transform; |
| 4415 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); | 4410 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); |
| 4416 transform = transform.scale(m_rootLayerScale); | 4411 transform = transform.scale(m_rootLayerScale); |
| 4417 m_rootGraphicsLayer->setTransform(transform); | 4412 m_containerLayer->setTransform(transform); |
| 4418 } | 4413 } |
| 4419 } | 4414 } |
| 4420 | 4415 |
| 4421 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar
getedEvent) | 4416 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar
getedEvent) |
| 4422 { | 4417 { |
| 4423 if (!m_page->mainFrame()->isLocalFrame()) | 4418 if (!m_page->mainFrame()->isLocalFrame()) |
| 4424 return false; | 4419 return false; |
| 4425 | 4420 |
| 4426 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo
ot() will modify it. | 4421 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo
ot() will modify it. |
| 4427 HitTestResult touchHit = targetedEvent.hitTestResult(); | 4422 HitTestResult touchHit = targetedEvent.hitTestResult(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4570 { | 4565 { |
| 4571 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4566 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
| 4572 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4567 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
| 4573 if (!page()) | 4568 if (!page()) |
| 4574 return 1; | 4569 return 1; |
| 4575 | 4570 |
| 4576 return page()->deviceScaleFactor(); | 4571 return page()->deviceScaleFactor(); |
| 4577 } | 4572 } |
| 4578 | 4573 |
| 4579 } // namespace blink | 4574 } // namespace blink |
| OLD | NEW |