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 3836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3847 blink::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompos
itingActive", active * 2 + m_isAcceleratedCompositingActive, 4); | 3847 blink::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompos
itingActive", active * 2 + m_isAcceleratedCompositingActive, 4); |
3848 | 3848 |
3849 if (m_isAcceleratedCompositingActive == active) | 3849 if (m_isAcceleratedCompositingActive == active) |
3850 return; | 3850 return; |
3851 | 3851 |
3852 if (!m_client) | 3852 if (!m_client) |
3853 return; | 3853 return; |
3854 | 3854 |
3855 if (!active) { | 3855 if (!active) { |
3856 m_isAcceleratedCompositingActive = false; | 3856 m_isAcceleratedCompositingActive = false; |
3857 m_client->didDeactivateCompositor(); | |
3858 if (!m_layerTreeViewCommitsDeferred | 3857 if (!m_layerTreeViewCommitsDeferred |
3859 && blink::Platform::current()->isThreadedCompositingEnabled()) { | 3858 && blink::Platform::current()->isThreadedCompositingEnabled()) { |
3860 ASSERT(m_layerTreeView); | 3859 ASSERT(m_layerTreeView); |
3861 // In threaded compositing mode, force compositing mode is always on
so setIsAcceleratedCompositingActive(false) | 3860 // In threaded compositing mode, force compositing mode is always on
so setIsAcceleratedCompositingActive(false) |
3862 // means that we're transitioning to a new page. Suppress commits un
til WebKit generates invalidations so | 3861 // means that we're transitioning to a new page. Suppress commits un
til WebKit generates invalidations so |
3863 // we don't attempt to paint too early in the next page load. | 3862 // we don't attempt to paint too early in the next page load. |
3864 m_layerTreeView->setDeferCommits(true); | 3863 m_layerTreeView->setDeferCommits(true); |
3865 m_layerTreeViewCommitsDeferred = true; | 3864 m_layerTreeViewCommitsDeferred = true; |
3866 } | 3865 } |
3867 } else if (m_layerTreeView) { | 3866 } else if (m_layerTreeView) { |
3868 m_isAcceleratedCompositingActive = true; | 3867 m_isAcceleratedCompositingActive = true; |
3869 updateLayerTreeViewport(); | 3868 updateLayerTreeViewport(); |
3870 if (m_pageOverlays) | 3869 if (m_pageOverlays) |
3871 m_pageOverlays->update(); | 3870 m_pageOverlays->update(); |
3872 | |
3873 m_client->didActivateCompositor(); | |
3874 } else { | 3871 } else { |
3875 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t
rue)"); | 3872 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t
rue)"); |
3876 | 3873 |
3877 m_client->initializeLayerTreeView(); | 3874 m_client->initializeLayerTreeView(); |
3878 m_layerTreeView = m_client->layerTreeView(); | 3875 m_layerTreeView = m_client->layerTreeView(); |
3879 if (m_layerTreeView) { | 3876 if (m_layerTreeView) { |
3880 m_layerTreeView->setRootLayer(*m_rootLayer); | 3877 m_layerTreeView->setRootLayer(*m_rootLayer); |
3881 | 3878 |
3882 bool visible = page()->visibilityState() == PageVisibilityStateVisib
le; | 3879 bool visible = page()->visibilityState() == PageVisibilityStateVisib
le; |
3883 m_layerTreeView->setVisible(visible); | 3880 m_layerTreeView->setVisible(visible); |
3884 updateLayerTreeDeviceScaleFactor(); | 3881 updateLayerTreeDeviceScaleFactor(); |
3885 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), mini
mumPageScaleFactor(), maximumPageScaleFactor()); | 3882 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), mini
mumPageScaleFactor(), maximumPageScaleFactor()); |
3886 updateLayerTreeBackgroundColor(); | 3883 updateLayerTreeBackgroundColor(); |
3887 m_layerTreeView->setHasTransparentBackground(isTransparent()); | 3884 m_layerTreeView->setHasTransparentBackground(isTransparent()); |
3888 #if USE(RUBBER_BANDING) | 3885 #if USE(RUBBER_BANDING) |
3889 RefPtr<Image> overhangImage = OverscrollTheme::theme()->getOverhangI
mage(); | 3886 RefPtr<Image> overhangImage = OverscrollTheme::theme()->getOverhangI
mage(); |
3890 if (overhangImage && overhangImage->nativeImageForCurrentFrame()) | 3887 if (overhangImage && overhangImage->nativeImageForCurrentFrame()) |
3891 m_layerTreeView->setOverhangBitmap(overhangImage->nativeImageFor
CurrentFrame()->bitmap()); | 3888 m_layerTreeView->setOverhangBitmap(overhangImage->nativeImageFor
CurrentFrame()->bitmap()); |
3892 #endif | 3889 #endif |
3893 updateLayerTreeViewport(); | 3890 updateLayerTreeViewport(); |
3894 m_client->didActivateCompositor(); | |
3895 m_isAcceleratedCompositingActive = true; | 3891 m_isAcceleratedCompositingActive = true; |
3896 if (m_pageOverlays) | 3892 if (m_pageOverlays) |
3897 m_pageOverlays->update(); | 3893 m_pageOverlays->update(); |
3898 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); | 3894 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); |
3899 m_layerTreeView->setShowPaintRects(m_showPaintRects); | 3895 m_layerTreeView->setShowPaintRects(m_showPaintRects); |
3900 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); | 3896 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); |
3901 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEn
abled); | 3897 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEn
abled); |
3902 m_layerTreeView->setShowScrollBottleneckRects(m_showScrollBottleneck
Rects); | 3898 m_layerTreeView->setShowScrollBottleneckRects(m_showScrollBottleneck
Rects); |
3903 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuri
sticsForGpuRasterization); | 3899 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuri
sticsForGpuRasterization); |
3904 } else { | 3900 } else { |
3905 // FIXME: It appears that only unittests, <webview> and android webv
iew | 3901 // FIXME: It appears that only unittests, <webview> and android webv
iew |
3906 // printing can hit this code. We should make them not hit this code
and | 3902 // printing can hit this code. We should make them not hit this code
and |
3907 // then delete this else clause and allowsBrokenNullLayerTreeView. | 3903 // then delete this else clause and allowsBrokenNullLayerTreeView. |
3908 // crbug.com/322276 and crbug.com/364716. | 3904 // crbug.com/322276 and crbug.com/364716. |
3909 ASSERT(m_client->allowsBrokenNullLayerTreeView()); | 3905 ASSERT(m_client->allowsBrokenNullLayerTreeView()); |
3910 m_isAcceleratedCompositingActive = false; | 3906 m_isAcceleratedCompositingActive = false; |
3911 m_client->didDeactivateCompositor(); | |
3912 m_page->settings().setAcceleratedCompositingEnabled(false); | 3907 m_page->settings().setAcceleratedCompositingEnabled(false); |
3913 m_page->updateAcceleratedCompositingSettings(); | 3908 m_page->updateAcceleratedCompositingSettings(); |
3914 } | 3909 } |
3915 } | 3910 } |
3916 if (page()) | 3911 if (page()) |
3917 page()->mainFrame()->view()->setClipsRepaints(!m_isAcceleratedCompositin
gActive); | 3912 page()->mainFrame()->view()->setClipsRepaints(!m_isAcceleratedCompositin
gActive); |
3918 } | 3913 } |
3919 | 3914 |
3920 void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition,
bool programmaticScroll) | 3915 void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition,
bool programmaticScroll) |
3921 { | 3916 { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4106 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4101 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4107 | 4102 |
4108 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4103 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4109 return false; | 4104 return false; |
4110 | 4105 |
4111 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4106 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4112 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4107 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4113 } | 4108 } |
4114 | 4109 |
4115 } // namespace blink | 4110 } // namespace blink |
OLD | NEW |