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