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

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: Add new viewport layers above overflowControlsHost. 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->setViewportSize(FloatSize(m_size.width, m_size .height));
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 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3799 3803
3800 bool WebViewImpl::allowsAcceleratedCompositing() 3804 bool WebViewImpl::allowsAcceleratedCompositing()
3801 { 3805 {
3802 return !m_compositorCreationFailed; 3806 return !m_compositorCreationFailed;
3803 } 3807 }
3804 3808
3805 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) 3809 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
3806 { 3810 {
3807 suppressInvalidations(true); 3811 suppressInvalidations(true);
3808 3812
3809 m_rootGraphicsLayer = layer; 3813 if (page()->settings()->pinchVirtualViewportEnabled() && !m_pinchViewports)
3810 m_rootLayer = layer ? layer->platformLayer() : 0; 3814 m_pinchViewports = PinchViewports::create(this);
3815
3816 if (m_pinchViewports) {
3817 m_pinchViewports->setOverflowControlsHostLayer(layer);
3818 if (layer) {
3819 m_rootGraphicsLayer = m_pinchViewports->rootGraphicsLayer();
3820 m_rootLayer = m_pinchViewports->rootGraphicsLayer()->platformLayer() ;
3821 } else {
3822 m_rootGraphicsLayer = 0;
3823 m_rootLayer = 0;
3824 }
3825 } else {
3826 m_rootGraphicsLayer = layer;
3827 m_rootLayer = layer ? layer->platformLayer() : 0;
3828 }
3829
3811 3830
3812 setIsAcceleratedCompositingActive(layer); 3831 setIsAcceleratedCompositingActive(layer);
3813 3832
3833 // FIXME: We also need to tell the layer tree about the pinchViewport layers
3834 // in a follow-on CL.
3814 if (m_layerTreeView) { 3835 if (m_layerTreeView) {
3815 if (m_rootLayer) 3836 if (m_rootLayer)
3816 m_layerTreeView->setRootLayer(*m_rootLayer); 3837 m_layerTreeView->setRootLayer(*m_rootLayer);
3817 else 3838 else
3818 m_layerTreeView->clearRootLayer(); 3839 m_layerTreeView->clearRootLayer();
3819 } 3840 }
3820 3841
3821 suppressInvalidations(false); 3842 suppressInvalidations(false);
3822 } 3843 }
3823 3844
(...skipping 14 matching lines...) Expand all
3838 updateLayerTreeViewport(); 3859 updateLayerTreeViewport();
3839 } else if (m_client) 3860 } else if (m_client)
3840 m_client->didInvalidateRect(rect); 3861 m_client->didInvalidateRect(rect);
3841 } 3862 }
3842 3863
3843 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const 3864 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
3844 { 3865 {
3845 return m_graphicsLayerFactory.get(); 3866 return m_graphicsLayerFactory.get();
3846 } 3867 }
3847 3868
3869 WebCore::RenderLayerCompositor* WebViewImpl::compositor() const
3870 {
3871 Document* document = page()->mainFrame()->document();
enne (OOO) 2013/06/13 22:45:07 Can any of these things be NULL?
wjmaclean 2013/06/14 15:54:16 Yes, we should put in checks. I'm not sure what th
3872 RenderView* renderView = document->renderView();
3873 return renderView->compositor();
3874 }
3875
3848 void WebViewImpl::registerForAnimations(WebLayer* layer) 3876 void WebViewImpl::registerForAnimations(WebLayer* layer)
3849 { 3877 {
3850 if (m_layerTreeView) 3878 if (m_layerTreeView)
3851 m_layerTreeView->registerForAnimations(layer); 3879 m_layerTreeView->registerForAnimations(layer);
3852 } 3880 }
3853 3881
3854 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() 3882 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer()
3855 { 3883 {
3856 return m_rootGraphicsLayer; 3884 return m_rootGraphicsLayer;
3857 } 3885 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4087 } 4115 }
4088 4116
4089 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4117 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4090 { 4118 {
4091 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4119 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4092 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4120 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4093 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4121 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4094 } 4122 }
4095 4123
4096 } // namespace WebKit 4124 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698