Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: Source/WebKit/chromium/src/WebViewImpl.cpp

Issue 16799005: Insert pinch zoom virtual viewport layers to graphics layer tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "AutofillPopupMenuClient.h" 50 #include "AutofillPopupMenuClient.h"
51 #include "CSSValueKeywords.h" 51 #include "CSSValueKeywords.h"
52 #include "CompositionUnderlineVectorBuilder.h" 52 #include "CompositionUnderlineVectorBuilder.h"
53 #include "ContextFeaturesClientImpl.h" 53 #include "ContextFeaturesClientImpl.h"
54 #include "DeviceOrientationClientProxy.h" 54 #include "DeviceOrientationClientProxy.h"
55 #include "GeolocationClientProxy.h" 55 #include "GeolocationClientProxy.h"
56 #include "GraphicsLayerFactoryChromium.h" 56 #include "GraphicsLayerFactoryChromium.h"
57 #include "HTMLNames.h" 57 #include "HTMLNames.h"
58 #include "LinkHighlight.h" 58 #include "LinkHighlight.h"
59 #include "PageWidgetDelegate.h" 59 #include "PageWidgetDelegate.h"
60 #include "PinchViewports.h"
60 #include "PopupContainer.h" 61 #include "PopupContainer.h"
61 #include "PrerendererClientImpl.h" 62 #include "PrerendererClientImpl.h"
62 #include "SpeechInputClientImpl.h" 63 #include "SpeechInputClientImpl.h"
63 #include "SpeechRecognitionClientProxy.h" 64 #include "SpeechRecognitionClientProxy.h"
64 #include "TextFieldDecoratorImpl.h" 65 #include "TextFieldDecoratorImpl.h"
65 #include "ValidationMessageClientImpl.h" 66 #include "ValidationMessageClientImpl.h"
66 #include "ViewportAnchor.h" 67 #include "ViewportAnchor.h"
67 #include "WebAccessibilityObject.h" 68 #include "WebAccessibilityObject.h"
68 #include "WebActiveWheelFlingParameters.h" 69 #include "WebActiveWheelFlingParameters.h"
69 #include "WebAutofillClient.h" 70 #include "WebAutofillClient.h"
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 } 1605 }
1605 1606
1606 // Set the fixed layout size from the viewport constraints before resizing. 1607 // Set the fixed layout size from the viewport constraints before resizing.
1607 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments()); 1608 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments());
1608 1609
1609 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); 1610 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
1610 if (agentPrivate) 1611 if (agentPrivate)
1611 agentPrivate->webViewResized(newSize); 1612 agentPrivate->webViewResized(newSize);
1612 if (!agentPrivate || !agentPrivate->metricsOverridden()) { 1613 if (!agentPrivate || !agentPrivate->metricsOverridden()) {
1613 WebFrameImpl* webFrame = mainFrameImpl(); 1614 WebFrameImpl* webFrame = mainFrameImpl();
1614 if (webFrame->frameView()) 1615 if (webFrame->frameView()) {
1615 webFrame->frameView()->resize(m_size); 1616 webFrame->frameView()->resize(m_size);
1617 if (m_pinchViewports)
1618 m_pinchViewports->setViewportSizes();
1619 }
1616 } 1620 }
1617 1621
1618 if (settings()->viewportEnabled()) { 1622 if (settings()->viewportEnabled()) {
1619 // Relayout immediately to recalculate the minimum scale limit. 1623 // Relayout immediately to recalculate the minimum scale limit.
1620 if (view->needsLayout()) 1624 if (view->needsLayout())
1621 view->layout(); 1625 view->layout();
1622 1626
1623 if (shouldAnchorAndRescaleViewport) { 1627 if (shouldAnchorAndRescaleViewport) {
1624 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width; 1628 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width;
1625 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth; 1629 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth;
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
2974 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(m_size, c ontentsSize(), verticalScrollbarWidth); 2978 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(m_size, c ontentsSize(), verticalScrollbarWidth);
2975 } 2979 }
2976 2980
2977 float newPageScaleFactor = pageScaleFactor(); 2981 float newPageScaleFactor = pageScaleFactor();
2978 if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.fina lConstraints().initialScale != -1) { 2982 if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.fina lConstraints().initialScale != -1) {
2979 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().initia lScale; 2983 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().initia lScale;
2980 m_pageScaleConstraintsSet.setNeedsReset(false); 2984 m_pageScaleConstraintsSet.setNeedsReset(false);
2981 } 2985 }
2982 setPageScaleFactorPreservingScrollOffset(newPageScaleFactor); 2986 setPageScaleFactorPreservingScrollOffset(newPageScaleFactor);
2983 2987
2988 if (m_pinchViewports)
2989 m_pinchViewports->setViewportSizes();
2990
2984 updateLayerTreeViewport(); 2991 updateLayerTreeViewport();
2985 2992
2986 // Relayout immediately to avoid violating the rule that needsLayout() 2993 // Relayout immediately to avoid violating the rule that needsLayout()
2987 // isn't set at the end of a layout. 2994 // isn't set at the end of a layout.
2988 if (view->needsLayout()) 2995 if (view->needsLayout())
2989 view->layout(); 2996 view->layout();
2990 } 2997 }
2991 2998
2992 void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments& arguments) 2999 void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments& arguments)
2993 { 3000 {
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
3804 3811
3805 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) 3812 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
3806 { 3813 {
3807 suppressInvalidations(true); 3814 suppressInvalidations(true);
3808 3815
3809 m_rootGraphicsLayer = layer; 3816 m_rootGraphicsLayer = layer;
3810 m_rootLayer = layer ? layer->platformLayer() : 0; 3817 m_rootLayer = layer ? layer->platformLayer() : 0;
3811 3818
3812 setIsAcceleratedCompositingActive(layer); 3819 setIsAcceleratedCompositingActive(layer);
3813 3820
3821 if (page()->settings()->pinchVirtualViewportEnabled() && !m_pinchViewports)
3822 m_pinchViewports = PinchViewports::create(this);
3823
3824 if (m_pinchViewports) {
3825 if (m_rootLayer)
3826 m_pinchViewports->insertViewportLayers();
3827 else
3828 m_pinchViewports->detachViewportLayers();
3829 }
3830
3814 if (m_layerTreeView) { 3831 if (m_layerTreeView) {
3815 if (m_rootLayer) 3832 if (m_rootLayer)
3816 m_layerTreeView->setRootLayer(*m_rootLayer); 3833 m_layerTreeView->setRootLayer(*m_rootLayer);
3817 else 3834 else
3818 m_layerTreeView->clearRootLayer(); 3835 m_layerTreeView->clearRootLayer();
3819 } 3836 }
3820 3837
3821 suppressInvalidations(false); 3838 suppressInvalidations(false);
3822 } 3839 }
3823 3840
(...skipping 14 matching lines...) Expand all
3838 updateLayerTreeViewport(); 3855 updateLayerTreeViewport();
3839 } else if (m_client) 3856 } else if (m_client)
3840 m_client->didInvalidateRect(rect); 3857 m_client->didInvalidateRect(rect);
3841 } 3858 }
3842 3859
3843 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const 3860 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
3844 { 3861 {
3845 return m_graphicsLayerFactory.get(); 3862 return m_graphicsLayerFactory.get();
3846 } 3863 }
3847 3864
3865 WebCore::RenderLayerCompositor* WebViewImpl::compositor() const
3866 {
3867 Document* document = page()->mainFrame()->document();
3868 RenderView* renderView = document->renderView();
3869 return renderView->compositor();
3870 }
3871
3848 void WebViewImpl::registerForAnimations(WebLayer* layer) 3872 void WebViewImpl::registerForAnimations(WebLayer* layer)
3849 { 3873 {
3850 if (m_layerTreeView) 3874 if (m_layerTreeView)
3851 m_layerTreeView->registerForAnimations(layer); 3875 m_layerTreeView->registerForAnimations(layer);
3852 } 3876 }
3853 3877
3854 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() 3878 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer()
3855 { 3879 {
3856 return m_rootGraphicsLayer; 3880 return m_rootGraphicsLayer;
3857 } 3881 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4087 } 4111 }
4088 4112
4089 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4113 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4090 { 4114 {
4091 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4115 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4092 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4116 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4093 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4117 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4094 } 4118 }
4095 4119
4096 } // namespace WebKit 4120 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698