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 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 void WebViewImpl::layout() | 1719 void WebViewImpl::layout() |
1720 { | 1720 { |
1721 TRACE_EVENT0("webkit", "WebViewImpl::layout"); | 1721 TRACE_EVENT0("webkit", "WebViewImpl::layout"); |
1722 PageWidgetDelegate::layout(m_page.get()); | 1722 PageWidgetDelegate::layout(m_page.get()); |
1723 updateLayerTreeBackgroundColor(); | 1723 updateLayerTreeBackgroundColor(); |
1724 | 1724 |
1725 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1725 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
1726 m_linkHighlights[i]->updateGeometry(); | 1726 m_linkHighlights[i]->updateGeometry(); |
1727 } | 1727 } |
1728 | 1728 |
1729 void WebViewImpl::enterForceCompositingMode(bool enter) | |
1730 { | |
1731 if (page()->settings().forceCompositingMode() == enter) | |
1732 return; | |
1733 | |
1734 TRACE_EVENT1("webkit", "WebViewImpl::enterForceCompositingMode", "enter", en
ter); | |
1735 settingsImpl()->setForceCompositingMode(enter); | |
1736 if (enter) { | |
1737 if (!m_page) | |
1738 return; | |
1739 LocalFrame* mainFrame = m_page->mainFrame(); | |
1740 if (!mainFrame) | |
1741 return; | |
1742 mainFrame->view()->updateCompositingLayersAfterStyleChange(); | |
1743 } | |
1744 } | |
1745 | |
1746 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 1729 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
1747 { | 1730 { |
1748 // This should only be used when compositing is not being used for this | 1731 // This should only be used when compositing is not being used for this |
1749 // WebView, and it is painting into the recording of its parent. | 1732 // WebView, and it is painting into the recording of its parent. |
1750 ASSERT(!isAcceleratedCompositingActive()); | 1733 ASSERT(!isAcceleratedCompositingActive()); |
1751 | 1734 |
1752 double paintStart = currentTime(); | 1735 double paintStart = currentTime(); |
1753 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran
sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); | 1736 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran
sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); |
1754 double paintEnd = currentTime(); | 1737 double paintEnd = currentTime(); |
1755 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); | 1738 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); |
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3588 m_client->didUpdateLayout(); | 3571 m_client->didUpdateLayout(); |
3589 } | 3572 } |
3590 | 3573 |
3591 void WebViewImpl::didChangeContentsSize() | 3574 void WebViewImpl::didChangeContentsSize() |
3592 { | 3575 { |
3593 m_pageScaleConstraintsSet.didChangeContentsSize(contentsSize(), pageScaleFac
tor()); | 3576 m_pageScaleConstraintsSet.didChangeContentsSize(contentsSize(), pageScaleFac
tor()); |
3594 } | 3577 } |
3595 | 3578 |
3596 void WebViewImpl::deviceOrPageScaleFactorChanged() | 3579 void WebViewImpl::deviceOrPageScaleFactorChanged() |
3597 { | 3580 { |
3598 if (pageScaleFactor() && pageScaleFactor() != 1) | |
3599 enterForceCompositingMode(true); | |
3600 m_pageScaleConstraintsSet.setNeedsReset(false); | 3581 m_pageScaleConstraintsSet.setNeedsReset(false); |
3601 updateLayerTreeViewport(); | 3582 updateLayerTreeViewport(); |
3602 } | 3583 } |
3603 | 3584 |
3604 bool WebViewImpl::useExternalPopupMenus() | 3585 bool WebViewImpl::useExternalPopupMenus() |
3605 { | 3586 { |
3606 return shouldUseExternalPopupMenus; | 3587 return shouldUseExternalPopupMenus; |
3607 } | 3588 } |
3608 | 3589 |
3609 void WebViewImpl::startDragging(LocalFrame* frame, | 3590 void WebViewImpl::startDragging(LocalFrame* frame, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3812 blink::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompos
itingActive", active * 2 + m_isAcceleratedCompositingActive, 4); | 3793 blink::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompos
itingActive", active * 2 + m_isAcceleratedCompositingActive, 4); |
3813 | 3794 |
3814 if (m_isAcceleratedCompositingActive == active) | 3795 if (m_isAcceleratedCompositingActive == active) |
3815 return; | 3796 return; |
3816 | 3797 |
3817 if (!m_client) | 3798 if (!m_client) |
3818 return; | 3799 return; |
3819 | 3800 |
3820 if (!active) { | 3801 if (!active) { |
3821 m_isAcceleratedCompositingActive = false; | 3802 m_isAcceleratedCompositingActive = false; |
3822 // We need to finish all GL rendering before sending didDeactivateCompos
itor() to prevent | |
3823 // flickering when compositing turns off. This is only necessary if we'r
e not in | |
3824 // force-compositing-mode. | |
3825 if (m_layerTreeView && !page()->settings().forceCompositingMode()) | |
3826 m_layerTreeView->finishAllRendering(); | |
3827 m_client->didDeactivateCompositor(); | 3803 m_client->didDeactivateCompositor(); |
3828 if (!m_layerTreeViewCommitsDeferred | 3804 if (!m_layerTreeViewCommitsDeferred |
3829 && blink::Platform::current()->isThreadedCompositingEnabled()) { | 3805 && blink::Platform::current()->isThreadedCompositingEnabled()) { |
3830 ASSERT(m_layerTreeView); | 3806 ASSERT(m_layerTreeView); |
3831 // In threaded compositing mode, force compositing mode is always on
so setIsAcceleratedCompositingActive(false) | 3807 // In threaded compositing mode, force compositing mode is always on
so setIsAcceleratedCompositingActive(false) |
3832 // means that we're transitioning to a new page. Suppress commits un
til WebKit generates invalidations so | 3808 // means that we're transitioning to a new page. Suppress commits un
til WebKit generates invalidations so |
3833 // we don't attempt to paint too early in the next page load. | 3809 // we don't attempt to paint too early in the next page load. |
3834 m_layerTreeView->setDeferCommits(true); | 3810 m_layerTreeView->setDeferCommits(true); |
3835 m_layerTreeViewCommitsDeferred = true; | 3811 m_layerTreeViewCommitsDeferred = true; |
3836 } | 3812 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4074 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4050 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4075 | 4051 |
4076 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4052 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4077 return false; | 4053 return false; |
4078 | 4054 |
4079 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4055 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4080 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4056 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4081 } | 4057 } |
4082 | 4058 |
4083 } // namespace blink | 4059 } // namespace blink |
OLD | NEW |