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

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: Address comments. 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 #include "core/platform/graphics/Extensions3D.h" 143 #include "core/platform/graphics/Extensions3D.h"
143 #include "core/platform/graphics/FontCache.h" 144 #include "core/platform/graphics/FontCache.h"
144 #include "core/platform/graphics/FontDescription.h" 145 #include "core/platform/graphics/FontDescription.h"
145 #include "core/platform/graphics/GraphicsContext.h" 146 #include "core/platform/graphics/GraphicsContext.h"
146 #include "core/platform/graphics/GraphicsContext3D.h" 147 #include "core/platform/graphics/GraphicsContext3D.h"
147 #include "core/platform/graphics/Image.h" 148 #include "core/platform/graphics/Image.h"
148 #include "core/platform/graphics/ImageBuffer.h" 149 #include "core/platform/graphics/ImageBuffer.h"
149 #include "core/platform/graphics/chromium/LayerPainterChromium.h" 150 #include "core/platform/graphics/chromium/LayerPainterChromium.h"
150 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h" 151 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h"
151 #include "core/platform/network/ResourceHandle.h" 152 #include "core/platform/network/ResourceHandle.h"
152 #include "core/rendering/RenderLayerCompositor.h"
153 #include "core/rendering/RenderView.h" 153 #include "core/rendering/RenderView.h"
154 #include "core/rendering/RenderWidget.h" 154 #include "core/rendering/RenderWidget.h"
155 #include "core/rendering/TextAutosizer.h" 155 #include "core/rendering/TextAutosizer.h"
156 #include "modules/geolocation/GeolocationController.h" 156 #include "modules/geolocation/GeolocationController.h"
157 #include "weborigin/SchemeRegistry.h" 157 #include "weborigin/SchemeRegistry.h"
158 #include "weborigin/SecurityOrigin.h" 158 #include "weborigin/SecurityOrigin.h"
159 #include "weborigin/SecurityPolicy.h" 159 #include "weborigin/SecurityPolicy.h"
160 #include "painting/ContinuousPainter.h" 160 #include "painting/ContinuousPainter.h"
161 161
162 #if ENABLE(DEFAULT_RENDER_THEME) 162 #if ENABLE(DEFAULT_RENDER_THEME)
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 } 1605 }
1606 1606
1607 // Set the fixed layout size from the viewport constraints before resizing. 1607 // Set the fixed layout size from the viewport constraints before resizing.
1608 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments()); 1608 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments());
1609 1609
1610 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); 1610 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
1611 if (agentPrivate) 1611 if (agentPrivate)
1612 agentPrivate->webViewResized(newSize); 1612 agentPrivate->webViewResized(newSize);
1613 if (!agentPrivate || !agentPrivate->metricsOverridden()) { 1613 if (!agentPrivate || !agentPrivate->metricsOverridden()) {
1614 WebFrameImpl* webFrame = mainFrameImpl(); 1614 WebFrameImpl* webFrame = mainFrameImpl();
1615 if (webFrame->frameView()) 1615 if (webFrame->frameView()) {
1616 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));
jamesr 2013/06/17 22:16:34 this appears to be the only caller to setViewportS
wjmaclean 2013/06/18 14:10:53 Thus far my observation is that we always seem to
1619 }
1617 } 1620 }
1618 1621
1619 if (settings()->viewportEnabled()) { 1622 if (settings()->viewportEnabled()) {
1620 // Relayout immediately to recalculate the minimum scale limit. 1623 // Relayout immediately to recalculate the minimum scale limit.
1621 if (view->needsLayout()) 1624 if (view->needsLayout())
1622 view->layout(); 1625 view->layout();
1623 1626
1624 if (shouldAnchorAndRescaleViewport) { 1627 if (shouldAnchorAndRescaleViewport) {
1625 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width; 1628 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width;
1626 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth; 1629 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth;
(...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after
3808 3811
3809 bool WebViewImpl::allowsAcceleratedCompositing() 3812 bool WebViewImpl::allowsAcceleratedCompositing()
3810 { 3813 {
3811 return !m_compositorCreationFailed; 3814 return !m_compositorCreationFailed;
3812 } 3815 }
3813 3816
3814 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) 3817 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
3815 { 3818 {
3816 suppressInvalidations(true); 3819 suppressInvalidations(true);
3817 3820
3818 m_rootGraphicsLayer = layer; 3821 if (page()->settings()->pinchVirtualViewportEnabled() && !m_pinchViewports)
3819 m_rootLayer = layer ? layer->platformLayer() : 0; 3822 m_pinchViewports = PinchViewports::create(this);
3823
3824 if (m_pinchViewports) {
3825 m_pinchViewports->setOverflowControlsHostLayer(layer);
3826 if (layer) {
3827 m_rootGraphicsLayer = m_pinchViewports->rootGraphicsLayer();
3828 m_rootLayer = m_pinchViewports->rootGraphicsLayer()->platformLayer() ;
3829 m_pinchViewports->registerViewportLayersWithTreeView(m_layerTreeView );
3830 } else {
3831 m_rootGraphicsLayer = 0;
3832 m_rootLayer = 0;
3833 m_pinchViewports->clearViewportLayersForTreeView(m_layerTreeView);
3834 }
3835 } else {
3836 m_rootGraphicsLayer = layer;
3837 m_rootLayer = layer ? layer->platformLayer() : 0;
3838 }
3839
3820 3840
3821 setIsAcceleratedCompositingActive(layer); 3841 setIsAcceleratedCompositingActive(layer);
3822 3842
3823 if (m_layerTreeView) { 3843 if (m_layerTreeView) {
3824 if (m_rootLayer) 3844 if (m_rootLayer)
3825 m_layerTreeView->setRootLayer(*m_rootLayer); 3845 m_layerTreeView->setRootLayer(*m_rootLayer);
3826 else 3846 else
3827 m_layerTreeView->clearRootLayer(); 3847 m_layerTreeView->clearRootLayer();
3828 } 3848 }
3829 3849
(...skipping 17 matching lines...) Expand all
3847 updateLayerTreeViewport(); 3867 updateLayerTreeViewport();
3848 } else if (m_client) 3868 } else if (m_client)
3849 m_client->didInvalidateRect(rect); 3869 m_client->didInvalidateRect(rect);
3850 } 3870 }
3851 3871
3852 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const 3872 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
3853 { 3873 {
3854 return m_graphicsLayerFactory.get(); 3874 return m_graphicsLayerFactory.get();
3855 } 3875 }
3856 3876
3877 WebCore::RenderLayerCompositor* WebViewImpl::compositor() const
3878 {
3879 if (!page()
3880 || !page()->mainFrame()
3881 || !page()->mainFrame()->document()
3882 || !page()->mainFrame()->document()->renderView())
3883 return 0;
3884 return page()->mainFrame()->document()->renderView()->compositor();
3885 }
3886
3857 void WebViewImpl::registerForAnimations(WebLayer* layer) 3887 void WebViewImpl::registerForAnimations(WebLayer* layer)
3858 { 3888 {
3859 if (m_layerTreeView) 3889 if (m_layerTreeView)
3860 m_layerTreeView->registerForAnimations(layer); 3890 m_layerTreeView->registerForAnimations(layer);
3861 } 3891 }
3862 3892
3863 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() 3893 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer()
3864 { 3894 {
3865 return m_rootGraphicsLayer; 3895 return m_rootGraphicsLayer;
3866 } 3896 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4096 } 4126 }
4097 4127
4098 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4128 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4099 { 4129 {
4100 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4130 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4101 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4131 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4102 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4132 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4103 } 4133 }
4104 4134
4105 } // namespace WebKit 4135 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698