Chromium Code Reviews| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 #if ENABLE(OILPAN) | 333 #if ENABLE(OILPAN) |
| 334 deferrer->dispose(); | 334 deferrer->dispose(); |
| 335 #else | 335 #else |
| 336 delete deferrer; | 336 delete deferrer; |
| 337 #endif | 337 #endif |
| 338 pageLoadDeferrerStack().removeLast(); | 338 pageLoadDeferrerStack().removeLast(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void WebViewImpl::setMainFrame(WebFrame* frame) | 341 void WebViewImpl::setMainFrame(WebFrame* frame) |
| 342 { | 342 { |
| 343 if (frame->isWebLocalFrame()) | 343 if (frame->isWebLocalFrame()) { |
| 344 toWebLocalFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0, nullAtom, nullAtom); | 344 WebLocalFrameImpl* localFrame = toWebLocalFrameImpl(frame); |
| 345 else | 345 localFrame->initializeCoreFrame(&page()->frameHost(), 0, nullAtom, nullA tom); |
| 346 // Composited WebViews want repaints outside the frame visible rect. | |
| 347 localFrame->frame()->view()->setClipsRepaints(!m_layerTreeView); | |
| 348 } else { | |
| 346 toWebRemoteFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0 , nullAtom); | 349 toWebRemoteFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0 , nullAtom); |
| 350 } | |
| 347 } | 351 } |
| 348 | 352 |
| 349 void WebViewImpl::setCredentialManagerClient(WebCredentialManagerClient* webCred entialManagerClient) | 353 void WebViewImpl::setCredentialManagerClient(WebCredentialManagerClient* webCred entialManagerClient) |
| 350 { | 354 { |
| 351 ASSERT(m_page); | 355 ASSERT(m_page); |
| 352 provideCredentialManagerClientTo(*m_page, new CredentialManagerClient(webCre dentialManagerClient)); | 356 provideCredentialManagerClientTo(*m_page, new CredentialManagerClient(webCre dentialManagerClient)); |
| 353 } | 357 } |
| 354 | 358 |
| 355 void WebViewImpl::setPrerendererClient(WebPrerendererClient* prerendererClient) | 359 void WebViewImpl::setPrerendererClient(WebPrerendererClient* prerendererClient) |
| 356 { | 360 { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 , m_operationsAllowed(WebDragOperationNone) | 403 , m_operationsAllowed(WebDragOperationNone) |
| 400 , m_dragOperation(WebDragOperationNone) | 404 , m_dragOperation(WebDragOperationNone) |
| 401 , m_devToolsEmulator(nullptr) | 405 , m_devToolsEmulator(nullptr) |
| 402 , m_isTransparent(false) | 406 , m_isTransparent(false) |
| 403 , m_tabsToLinks(false) | 407 , m_tabsToLinks(false) |
| 404 , m_layerTreeView(0) | 408 , m_layerTreeView(0) |
| 405 , m_rootLayer(0) | 409 , m_rootLayer(0) |
| 406 , m_rootGraphicsLayer(0) | 410 , m_rootGraphicsLayer(0) |
| 407 , m_rootTransformLayer(0) | 411 , m_rootTransformLayer(0) |
| 408 , m_graphicsLayerFactory(adoptPtr(new GraphicsLayerFactoryChromium(this))) | 412 , m_graphicsLayerFactory(adoptPtr(new GraphicsLayerFactoryChromium(this))) |
| 409 , m_isAcceleratedCompositingActive(false) | |
| 410 , m_layerTreeViewCommitsDeferred(false) | |
| 411 , m_layerTreeViewClosed(false) | |
| 412 , m_matchesHeuristicsForGpuRasterization(false) | 413 , m_matchesHeuristicsForGpuRasterization(false) |
| 413 , m_recreatingGraphicsContext(false) | 414 , m_recreatingGraphicsContext(false) |
| 414 , m_flingModifier(0) | 415 , m_flingModifier(0) |
| 415 , m_flingSourceDevice(false) | 416 , m_flingSourceDevice(false) |
| 416 , m_fullscreenController(FullscreenController::create(this)) | 417 , m_fullscreenController(FullscreenController::create(this)) |
| 417 , m_showFPSCounter(false) | 418 , m_showFPSCounter(false) |
| 418 , m_showPaintRects(false) | |
| 419 , m_showDebugBorders(false) | |
| 420 , m_continuousPaintingEnabled(false) | 419 , m_continuousPaintingEnabled(false) |
| 421 , m_showScrollBottleneckRects(false) | |
| 422 , m_baseBackgroundColor(Color::white) | 420 , m_baseBackgroundColor(Color::white) |
| 423 , m_backgroundColorOverride(Color::transparent) | 421 , m_backgroundColorOverride(Color::transparent) |
| 424 , m_zoomFactorOverride(0) | 422 , m_zoomFactorOverride(0) |
| 425 , m_userGestureObserved(false) | 423 , m_userGestureObserved(false) |
| 426 , m_displayMode(WebDisplayModeBrowser) | 424 , m_displayMode(WebDisplayModeBrowser) |
| 427 { | 425 { |
| 428 Page::PageClients pageClients; | 426 Page::PageClients pageClients; |
| 429 pageClients.chromeClient = &m_chromeClientImpl; | 427 pageClients.chromeClient = &m_chromeClientImpl; |
| 430 pageClients.contextMenuClient = &m_contextMenuClientImpl; | 428 pageClients.contextMenuClient = &m_contextMenuClientImpl; |
| 431 pageClients.editorClient = &m_editorClientImpl; | 429 pageClients.editorClient = &m_editorClientImpl; |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 954 } | 952 } |
| 955 m_showFPSCounter = show; | 953 m_showFPSCounter = show; |
| 956 } | 954 } |
| 957 | 955 |
| 958 void WebViewImpl::setShowPaintRects(bool show) | 956 void WebViewImpl::setShowPaintRects(bool show) |
| 959 { | 957 { |
| 960 if (m_layerTreeView) { | 958 if (m_layerTreeView) { |
| 961 TRACE_EVENT0("blink", "WebViewImpl::setShowPaintRects"); | 959 TRACE_EVENT0("blink", "WebViewImpl::setShowPaintRects"); |
| 962 m_layerTreeView->setShowPaintRects(show); | 960 m_layerTreeView->setShowPaintRects(show); |
| 963 } | 961 } |
| 964 m_showPaintRects = show; | |
| 965 setFirstPaintInvalidationTrackingEnabledForShowPaintRects(show); | 962 setFirstPaintInvalidationTrackingEnabledForShowPaintRects(show); |
| 966 } | 963 } |
| 967 | 964 |
| 968 void WebViewImpl::setShowDebugBorders(bool show) | 965 void WebViewImpl::setShowDebugBorders(bool show) |
| 969 { | 966 { |
| 970 if (m_layerTreeView) | 967 if (m_layerTreeView) |
| 971 m_layerTreeView->setShowDebugBorders(show); | 968 m_layerTreeView->setShowDebugBorders(show); |
| 972 m_showDebugBorders = show; | |
| 973 } | 969 } |
| 974 | 970 |
| 975 void WebViewImpl::setContinuousPaintingEnabled(bool enabled) | 971 void WebViewImpl::setContinuousPaintingEnabled(bool enabled) |
| 976 { | 972 { |
| 977 if (m_layerTreeView) { | 973 if (m_layerTreeView) { |
| 978 TRACE_EVENT0("blink", "WebViewImpl::setContinuousPaintingEnabled"); | 974 TRACE_EVENT0("blink", "WebViewImpl::setContinuousPaintingEnabled"); |
| 979 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837. | 975 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837. |
| 980 m_layerTreeView->setContinuousPaintingEnabled(enabled && !m_devToolsEmul ator->deviceEmulationEnabled()); | 976 m_layerTreeView->setContinuousPaintingEnabled(enabled && !m_devToolsEmul ator->deviceEmulationEnabled()); |
| 981 } | 977 } |
| 982 m_continuousPaintingEnabled = enabled; | 978 m_continuousPaintingEnabled = enabled; |
| 983 if (m_client) | 979 if (m_client) |
| 984 m_client->scheduleAnimation(); | 980 m_client->scheduleAnimation(); |
| 985 } | 981 } |
| 986 | 982 |
| 987 void WebViewImpl::updateShowFPSCounterAndContinuousPainting() | 983 void WebViewImpl::updateShowFPSCounterAndContinuousPainting() |
| 988 { | 984 { |
| 989 if (m_layerTreeView) { | 985 if (m_layerTreeView) { |
| 990 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837. | 986 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837. |
| 991 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnable d && !m_devToolsEmulator->deviceEmulationEnabled()); | 987 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnable d && !m_devToolsEmulator->deviceEmulationEnabled()); |
| 992 m_layerTreeView->setShowFPSCounter(m_showFPSCounter && !m_devToolsEmulat or->deviceEmulationEnabled()); | 988 m_layerTreeView->setShowFPSCounter(m_showFPSCounter && !m_devToolsEmulat or->deviceEmulationEnabled()); |
| 993 } | 989 } |
| 994 } | 990 } |
| 995 | 991 |
| 996 void WebViewImpl::setShowScrollBottleneckRects(bool show) | 992 void WebViewImpl::setShowScrollBottleneckRects(bool show) |
| 997 { | 993 { |
| 998 if (m_layerTreeView) | 994 if (m_layerTreeView) |
| 999 m_layerTreeView->setShowScrollBottleneckRects(show); | 995 m_layerTreeView->setShowScrollBottleneckRects(show); |
| 1000 m_showScrollBottleneckRects = show; | |
| 1001 } | 996 } |
| 1002 | 997 |
| 1003 void WebViewImpl::acceptLanguagesChanged() | 998 void WebViewImpl::acceptLanguagesChanged() |
| 1004 { | 999 { |
| 1005 if (!page()) | 1000 if (!page()) |
| 1006 return; | 1001 return; |
| 1007 | 1002 |
| 1008 page()->acceptLanguagesChanged(); | 1003 page()->acceptLanguagesChanged(); |
| 1009 } | 1004 } |
| 1010 | 1005 |
| (...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2727 break; | 2722 break; |
| 2728 | 2723 |
| 2729 default: | 2724 default: |
| 2730 notImplemented(); | 2725 notImplemented(); |
| 2731 break; | 2726 break; |
| 2732 } | 2727 } |
| 2733 } | 2728 } |
| 2734 | 2729 |
| 2735 bool WebViewImpl::isAcceleratedCompositingActive() const | 2730 bool WebViewImpl::isAcceleratedCompositingActive() const |
| 2736 { | 2731 { |
| 2737 return m_isAcceleratedCompositingActive; | 2732 return m_rootLayer; |
| 2738 } | 2733 } |
| 2739 | 2734 |
| 2740 void WebViewImpl::willCloseLayerTreeView() | 2735 void WebViewImpl::willCloseLayerTreeView() |
| 2741 { | 2736 { |
| 2742 setIsAcceleratedCompositingActive(false); | 2737 setRootGraphicsLayer(nullptr); |
|
enne (OOO)
2015/04/23 22:48:17
This is the crash fix from https://codereview.chro
| |
| 2743 m_layerTreeView = 0; | 2738 m_layerTreeView = 0; |
| 2744 m_layerTreeViewClosed = true; | |
| 2745 } | 2739 } |
| 2746 | 2740 |
| 2747 void WebViewImpl::didAcquirePointerLock() | 2741 void WebViewImpl::didAcquirePointerLock() |
| 2748 { | 2742 { |
| 2749 if (page()) | 2743 if (page()) |
| 2750 page()->pointerLockController().didAcquirePointerLock(); | 2744 page()->pointerLockController().didAcquirePointerLock(); |
| 2751 } | 2745 } |
| 2752 | 2746 |
| 2753 void WebViewImpl::didNotAcquirePointerLock() | 2747 void WebViewImpl::didNotAcquirePointerLock() |
| 2754 { | 2748 { |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3699 { | 3693 { |
| 3700 // FIXME: This is wrong. The FrameView is responsible sending a resizeEvent | 3694 // FIXME: This is wrong. The FrameView is responsible sending a resizeEvent |
| 3701 // as part of layout. Layout is also responsible for sending invalidations | 3695 // as part of layout. Layout is also responsible for sending invalidations |
| 3702 // to the embedder. This method and all callers may be wrong. -- eseidel. | 3696 // to the embedder. This method and all callers may be wrong. -- eseidel. |
| 3703 if (mainFrameImpl()->frameView()) { | 3697 if (mainFrameImpl()->frameView()) { |
| 3704 // Enqueues the resize event. | 3698 // Enqueues the resize event. |
| 3705 mainFrameImpl()->frame()->document()->enqueueResizeEvent(); | 3699 mainFrameImpl()->frame()->document()->enqueueResizeEvent(); |
| 3706 } | 3700 } |
| 3707 | 3701 |
| 3708 if (m_client) { | 3702 if (m_client) { |
| 3709 if (isAcceleratedCompositingActive()) { | 3703 if (m_layerTreeView) { |
| 3710 updateLayerTreeViewport(); | 3704 updateLayerTreeViewport(); |
| 3711 } else { | 3705 } else { |
| 3712 WebRect damagedRect(0, 0, m_size.width, m_size.height); | 3706 WebRect damagedRect(0, 0, m_size.width, m_size.height); |
| 3713 m_client->didInvalidateRect(damagedRect); | 3707 m_client->didInvalidateRect(damagedRect); |
| 3714 } | 3708 } |
| 3715 } | 3709 } |
| 3716 if (m_pageOverlays) | 3710 if (m_pageOverlays) |
| 3717 m_pageOverlays->update(); | 3711 m_pageOverlays->update(); |
| 3718 m_devToolsEmulator->viewportChanged(); | 3712 m_devToolsEmulator->viewportChanged(); |
| 3719 } | 3713 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3841 // Set any existing frames to be transparent. | 3835 // Set any existing frames to be transparent. |
| 3842 Frame* frame = m_page->mainFrame(); | 3836 Frame* frame = m_page->mainFrame(); |
| 3843 while (frame) { | 3837 while (frame) { |
| 3844 if (frame->isLocalFrame()) | 3838 if (frame->isLocalFrame()) |
| 3845 toLocalFrame(frame)->view()->setTransparent(isTransparent); | 3839 toLocalFrame(frame)->view()->setTransparent(isTransparent); |
| 3846 frame = frame->tree().traverseNext(); | 3840 frame = frame->tree().traverseNext(); |
| 3847 } | 3841 } |
| 3848 | 3842 |
| 3849 // Future frames check this to know whether to be transparent. | 3843 // Future frames check this to know whether to be transparent. |
| 3850 m_isTransparent = isTransparent; | 3844 m_isTransparent = isTransparent; |
| 3845 | |
| 3846 if (m_layerTreeView) | |
| 3847 m_layerTreeView->setHasTransparentBackground(this->isTransparent()); | |
| 3851 } | 3848 } |
| 3852 | 3849 |
| 3853 bool WebViewImpl::isTransparent() const | 3850 bool WebViewImpl::isTransparent() const |
| 3854 { | 3851 { |
| 3855 return m_isTransparent; | 3852 return m_isTransparent; |
| 3856 } | 3853 } |
| 3857 | 3854 |
| 3858 void WebViewImpl::setBaseBackgroundColor(WebColor color) | 3855 void WebViewImpl::setBaseBackgroundColor(WebColor color) |
| 3859 { | 3856 { |
| 3860 layout(); | 3857 layout(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3941 return; | 3938 return; |
| 3942 | 3939 |
| 3943 // If we have no more stylesheets to load and we're past the body tag, | 3940 // If we have no more stylesheets to load and we're past the body tag, |
| 3944 // we should have something to paint and should start as soon as possible. | 3941 // we should have something to paint and should start as soon as possible. |
| 3945 if (m_page->deprecatedLocalMainFrame()->document()->body()) | 3942 if (m_page->deprecatedLocalMainFrame()->document()->body()) |
| 3946 resumeTreeViewCommits(); | 3943 resumeTreeViewCommits(); |
| 3947 } | 3944 } |
| 3948 | 3945 |
| 3949 void WebViewImpl::resumeTreeViewCommits() | 3946 void WebViewImpl::resumeTreeViewCommits() |
| 3950 { | 3947 { |
| 3951 if (m_layerTreeViewCommitsDeferred) { | 3948 if (m_layerTreeView) |
| 3952 if (m_layerTreeView) | 3949 m_layerTreeView->setDeferCommits(false); |
| 3953 m_layerTreeView->setDeferCommits(false); | |
| 3954 m_layerTreeViewCommitsDeferred = false; | |
| 3955 } | |
| 3956 } | 3950 } |
| 3957 | 3951 |
| 3958 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) | 3952 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) |
| 3959 { | 3953 { |
| 3960 FrameView* view = webframe->frame()->view(); | 3954 FrameView* view = webframe->frame()->view(); |
| 3961 if (webframe == mainFrame()) | 3955 if (webframe == mainFrame()) |
| 3962 view->resize(mainFrameSize()); | 3956 view->resize(mainFrameSize()); |
| 3963 else | 3957 else |
| 3964 view->resize(webframe->frameView()->layoutSize()); | 3958 view->resize(webframe->frameView()->layoutSize()); |
| 3965 } | 3959 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4141 } | 4135 } |
| 4142 | 4136 |
| 4143 void WebViewImpl::suppressInvalidations(bool enable) | 4137 void WebViewImpl::suppressInvalidations(bool enable) |
| 4144 { | 4138 { |
| 4145 if (m_client) | 4139 if (m_client) |
| 4146 m_client->suppressCompositorScheduling(enable); | 4140 m_client->suppressCompositorScheduling(enable); |
| 4147 } | 4141 } |
| 4148 | 4142 |
| 4149 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) | 4143 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) |
| 4150 { | 4144 { |
| 4145 if (!m_layerTreeView) | |
| 4146 return; | |
| 4147 | |
| 4151 suppressInvalidations(true); | 4148 suppressInvalidations(true); |
| 4152 | 4149 |
| 4153 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); | 4150 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); |
| 4154 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory()); | 4151 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory()); |
| 4155 if (layer) { | 4152 if (layer) { |
| 4156 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer(); | 4153 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer(); |
| 4157 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer(); | 4154 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer(); |
| 4158 m_rootTransformLayer = pinchViewport.rootGraphicsLayer(); | 4155 m_rootTransformLayer = pinchViewport.rootGraphicsLayer(); |
| 4156 updateRootLayerTransform(); | |
|
enne (OOO)
2015/04/23 22:48:17
I rolled https://codereview.chromium.org/109718300
| |
| 4157 m_layerTreeView->setRootLayer(*m_rootLayer); | |
| 4158 // We register viewport layers here since there may not be a layer | |
| 4159 // tree view prior to this point. | |
| 4160 page()->frameHost().pinchViewport().registerLayersWithTreeView(m_layerTr eeView); | |
| 4161 if (m_pageOverlays) | |
| 4162 m_pageOverlays->update(); | |
| 4163 | |
| 4164 // TODO(enne): Work around page visibility changes not being | |
| 4165 // propogated to the WebView in some circumstances. This needs to | |
| 4166 // be refreshed here when setting a new root layer to avoid being | |
| 4167 // stuck in a presumed incorrectly invisible state. | |
| 4168 bool visible = page()->visibilityState() == PageVisibilityStateVisible; | |
|
enne (OOO)
2015/04/23 22:48:17
This is the fix that made me revert the original p
| |
| 4169 m_layerTreeView->setVisible(visible); | |
| 4159 } else { | 4170 } else { |
| 4160 m_rootGraphicsLayer = nullptr; | 4171 m_rootGraphicsLayer = nullptr; |
| 4161 m_rootLayer = nullptr; | 4172 m_rootLayer = nullptr; |
| 4162 m_rootTransformLayer = nullptr; | 4173 m_rootTransformLayer = nullptr; |
| 4163 } | 4174 // This means that we're transitioning to a new page. Suppress |
| 4164 | 4175 // commits until Blink generates invalidations so we don't |
| 4165 setIsAcceleratedCompositingActive(layer != 0); | 4176 // attempt to paint too early in the next page load. |
| 4166 | 4177 m_layerTreeView->setDeferCommits(true); |
| 4167 updateRootLayerTransform(); | 4178 m_layerTreeView->clearRootLayer(); |
| 4168 | 4179 page()->frameHost().pinchViewport().clearLayersForTreeView(m_layerTreeVi ew); |
| 4169 if (m_layerTreeView) { | |
| 4170 if (m_rootLayer) { | |
| 4171 m_layerTreeView->setRootLayer(*m_rootLayer); | |
| 4172 // We register viewport layers here since there may not be a layer | |
| 4173 // tree view prior to this point. | |
| 4174 page()->frameHost().pinchViewport().registerLayersWithTreeView(m_lay erTreeView); | |
| 4175 } else { | |
| 4176 m_layerTreeView->clearRootLayer(); | |
| 4177 page()->frameHost().pinchViewport().clearLayersForTreeView(m_layerTr eeView); | |
| 4178 } | |
| 4179 } | 4180 } |
| 4180 | 4181 |
| 4181 suppressInvalidations(false); | 4182 suppressInvalidations(false); |
| 4182 } | 4183 } |
| 4183 | 4184 |
| 4184 void WebViewImpl::scheduleCompositingLayerSync() | 4185 void WebViewImpl::scheduleCompositingLayerSync() |
| 4185 { | 4186 { |
| 4186 m_layerTreeView->setNeedsAnimate(); | 4187 m_layerTreeView->setNeedsAnimate(); |
| 4187 } | 4188 } |
| 4188 | 4189 |
| 4189 void WebViewImpl::invalidateRect(const IntRect& rect) | 4190 void WebViewImpl::invalidateRect(const IntRect& rect) |
| 4190 { | 4191 { |
| 4191 if (m_isAcceleratedCompositingActive) { | 4192 if (m_layerTreeView) |
| 4192 ASSERT(m_layerTreeView); | |
| 4193 updateLayerTreeViewport(); | 4193 updateLayerTreeViewport(); |
| 4194 } else if (m_client) | 4194 else if (m_client) |
| 4195 m_client->didInvalidateRect(rect); | 4195 m_client->didInvalidateRect(rect); |
| 4196 } | 4196 } |
| 4197 | 4197 |
| 4198 GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const | 4198 GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const |
| 4199 { | 4199 { |
| 4200 return m_graphicsLayerFactory.get(); | 4200 return m_graphicsLayerFactory.get(); |
| 4201 } | 4201 } |
| 4202 | 4202 |
| 4203 DeprecatedPaintLayerCompositor* WebViewImpl::compositor() const | 4203 DeprecatedPaintLayerCompositor* WebViewImpl::compositor() const |
| 4204 { | 4204 { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4251 m_layerTreeView = m_client->layerTreeView(); | 4251 m_layerTreeView = m_client->layerTreeView(); |
| 4252 } | 4252 } |
| 4253 | 4253 |
| 4254 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView != 0); | 4254 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView != 0); |
| 4255 | 4255 |
| 4256 // FIXME: only unittests, click to play, Android priting, and printing (for headers and footers) | 4256 // FIXME: only unittests, click to play, Android priting, and printing (for headers and footers) |
| 4257 // make this assert necessary. We should make them not hit this code and the n delete allowsBrokenNullLayerTreeView. | 4257 // make this assert necessary. We should make them not hit this code and the n delete allowsBrokenNullLayerTreeView. |
| 4258 ASSERT(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeVi ew()); | 4258 ASSERT(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeVi ew()); |
| 4259 } | 4259 } |
| 4260 | 4260 |
| 4261 void WebViewImpl::setIsAcceleratedCompositingActive(bool active) | |
| 4262 { | |
| 4263 // In the middle of shutting down; don't try to spin back up a compositor. | |
| 4264 // FIXME: compositing startup/shutdown should be refactored so that it | |
| 4265 // turns on explicitly rather than lazily, which causes this awkwardness. | |
| 4266 if (m_layerTreeViewClosed) | |
| 4267 return; | |
| 4268 | |
| 4269 ASSERT(!active || m_layerTreeView); | |
| 4270 Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompositingAc tive", active * 2 + m_isAcceleratedCompositingActive, 4); | |
| 4271 | |
| 4272 if (m_isAcceleratedCompositingActive == active) | |
| 4273 return; | |
| 4274 | |
| 4275 if (!m_client) | |
| 4276 return; | |
| 4277 | |
| 4278 if (!active) { | |
| 4279 m_isAcceleratedCompositingActive = false; | |
| 4280 if (!m_layerTreeViewCommitsDeferred) { | |
| 4281 ASSERT(m_layerTreeView); | |
| 4282 // This means that we're transitioning to a new page. Suppress commi ts until WebKit generates invalidations so | |
| 4283 // we don't attempt to paint too early in the next page load. | |
| 4284 m_layerTreeView->setDeferCommits(true); | |
| 4285 m_layerTreeViewCommitsDeferred = true; | |
| 4286 } | |
| 4287 } else { | |
| 4288 TRACE_EVENT0("blink", "WebViewImpl::setIsAcceleratedCompositingActive(tr ue)"); | |
| 4289 m_layerTreeView->setRootLayer(*m_rootLayer); | |
| 4290 | |
| 4291 bool visible = page()->visibilityState() == PageVisibilityStateVisible; | |
| 4292 m_layerTreeView->setVisible(visible); | |
| 4293 updateLayerTreeDeviceScaleFactor(); | |
| 4294 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumP ageScaleFactor(), maximumPageScaleFactor()); | |
| 4295 updateLayerTreeBackgroundColor(); | |
| 4296 m_layerTreeView->setHasTransparentBackground(isTransparent()); | |
| 4297 updateLayerTreeViewport(); | |
| 4298 m_isAcceleratedCompositingActive = true; | |
| 4299 if (m_pageOverlays) | |
| 4300 m_pageOverlays->update(); | |
| 4301 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837. | |
| 4302 m_layerTreeView->setShowFPSCounter(m_showFPSCounter && !m_devToolsEmulat or->deviceEmulationEnabled()); | |
| 4303 m_layerTreeView->setShowPaintRects(m_showPaintRects); | |
| 4304 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); | |
| 4305 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnable d && !m_devToolsEmulator->deviceEmulationEnabled()); | |
| 4306 m_layerTreeView->setShowScrollBottleneckRects(m_showScrollBottleneckRect s); | |
| 4307 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic sForGpuRasterization); | |
| 4308 } | |
| 4309 if (page() && page()->mainFrame()->isLocalFrame()) | |
| 4310 page()->deprecatedLocalMainFrame()->view()->setClipsRepaints(!m_isAccele ratedCompositingActive); | |
| 4311 } | |
| 4312 | |
| 4313 void WebViewImpl::updateMainFrameScrollPosition(const DoublePoint& scrollPositio n, bool programmaticScroll) | 4261 void WebViewImpl::updateMainFrameScrollPosition(const DoublePoint& scrollPositio n, bool programmaticScroll) |
| 4314 { | 4262 { |
| 4315 if (!page()->mainFrame()->isLocalFrame()) | 4263 if (!page()->mainFrame()->isLocalFrame()) |
| 4316 return; | 4264 return; |
| 4317 | 4265 |
| 4318 // FIXME(305811): Refactor for OOPI. | 4266 // FIXME(305811): Refactor for OOPI. |
| 4319 FrameView* frameView = page()->deprecatedLocalMainFrame()->view(); | 4267 FrameView* frameView = page()->deprecatedLocalMainFrame()->view(); |
| 4320 if (!frameView) | 4268 if (!frameView) |
| 4321 return; | 4269 return; |
| 4322 | 4270 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4424 WebContentDetectionResult content = m_client->detectContentAround(touchHit); | 4372 WebContentDetectionResult content = m_client->detectContentAround(touchHit); |
| 4425 if (!content.isValid()) | 4373 if (!content.isValid()) |
| 4426 return false; | 4374 return false; |
| 4427 | 4375 |
| 4428 m_client->scheduleContentIntent(content.intent()); | 4376 m_client->scheduleContentIntent(content.intent()); |
| 4429 return true; | 4377 return true; |
| 4430 } | 4378 } |
| 4431 | 4379 |
| 4432 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, | 4380 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, |
| 4433 bool isInitialState) { | 4381 bool isInitialState) { |
| 4434 if (!page()) | 4382 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden || visibilityState == WebPageVisibilityStatePrere nder); |
| 4435 return; | |
| 4436 | 4383 |
| 4437 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden || visibilityState == WebPageVisibilityStatePrere nder); | 4384 if (page()) |
| 4438 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int> (visibilityState)), isInitialState); | 4385 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState); |
| 4439 | 4386 |
| 4440 if (m_layerTreeView) { | 4387 if (m_layerTreeView) { |
| 4441 bool visible = visibilityState == WebPageVisibilityStateVisible; | 4388 bool visible = visibilityState == WebPageVisibilityStateVisible; |
| 4442 m_layerTreeView->setVisible(visible); | 4389 m_layerTreeView->setVisible(visible); |
| 4443 } | 4390 } |
| 4444 } | 4391 } |
| 4445 | 4392 |
| 4446 bool WebViewImpl::requestPointerLock() | 4393 bool WebViewImpl::requestPointerLock() |
| 4447 { | 4394 { |
| 4448 return m_client && m_client->requestPointerLock(); | 4395 return m_client && m_client->requestPointerLock(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4506 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4453 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4507 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4454 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 4508 } | 4455 } |
| 4509 | 4456 |
| 4510 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4457 void WebViewImpl::forceNextWebGLContextCreationToFail() |
| 4511 { | 4458 { |
| 4512 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4459 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
| 4513 } | 4460 } |
| 4514 | 4461 |
| 4515 } // namespace blink | 4462 } // namespace blink |
| OLD | NEW |