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

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: Skip creating WebScrollbarLayers, defer to creation in CC. 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 #include "core/platform/graphics/Extensions3D.h" 142 #include "core/platform/graphics/Extensions3D.h"
142 #include "core/platform/graphics/FontCache.h" 143 #include "core/platform/graphics/FontCache.h"
143 #include "core/platform/graphics/FontDescription.h" 144 #include "core/platform/graphics/FontDescription.h"
144 #include "core/platform/graphics/GraphicsContext.h" 145 #include "core/platform/graphics/GraphicsContext.h"
145 #include "core/platform/graphics/GraphicsContext3D.h" 146 #include "core/platform/graphics/GraphicsContext3D.h"
146 #include "core/platform/graphics/Image.h" 147 #include "core/platform/graphics/Image.h"
147 #include "core/platform/graphics/ImageBuffer.h" 148 #include "core/platform/graphics/ImageBuffer.h"
148 #include "core/platform/graphics/chromium/LayerPainterChromium.h" 149 #include "core/platform/graphics/chromium/LayerPainterChromium.h"
149 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h" 150 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h"
150 #include "core/platform/network/ResourceHandle.h" 151 #include "core/platform/network/ResourceHandle.h"
151 #include "core/rendering/RenderLayerCompositor.h"
152 #include "core/rendering/RenderView.h" 152 #include "core/rendering/RenderView.h"
153 #include "core/rendering/RenderWidget.h" 153 #include "core/rendering/RenderWidget.h"
154 #include "core/rendering/TextAutosizer.h" 154 #include "core/rendering/TextAutosizer.h"
155 #include "modules/geolocation/GeolocationController.h" 155 #include "modules/geolocation/GeolocationController.h"
156 #include "weborigin/SchemeRegistry.h" 156 #include "weborigin/SchemeRegistry.h"
157 #include "weborigin/SecurityOrigin.h" 157 #include "weborigin/SecurityOrigin.h"
158 #include "weborigin/SecurityPolicy.h" 158 #include "weborigin/SecurityPolicy.h"
159 #include "painting/ContinuousPainter.h" 159 #include "painting/ContinuousPainter.h"
160 160
161 #if ENABLE(DEFAULT_RENDER_THEME) 161 #if ENABLE(DEFAULT_RENDER_THEME)
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 } 1604 }
1605 1605
1606 // Set the fixed layout size from the viewport constraints before resizing. 1606 // Set the fixed layout size from the viewport constraints before resizing.
1607 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments()); 1607 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments());
1608 1608
1609 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); 1609 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
1610 if (agentPrivate) 1610 if (agentPrivate)
1611 agentPrivate->webViewResized(newSize); 1611 agentPrivate->webViewResized(newSize);
1612 if (!agentPrivate || !agentPrivate->metricsOverridden()) { 1612 if (!agentPrivate || !agentPrivate->metricsOverridden()) {
1613 WebFrameImpl* webFrame = mainFrameImpl(); 1613 WebFrameImpl* webFrame = mainFrameImpl();
1614 if (webFrame->frameView()) 1614 if (webFrame->frameView()) {
1615 webFrame->frameView()->resize(m_size); 1615 webFrame->frameView()->resize(m_size);
1616 if (m_pinchViewports)
1617 m_pinchViewports->setViewportSize(FloatSize(m_size.width, m_size .height));
1618 }
1616 } 1619 }
1617 1620
1618 if (settings()->viewportEnabled()) { 1621 if (settings()->viewportEnabled()) {
1619 // Relayout immediately to recalculate the minimum scale limit. 1622 // Relayout immediately to recalculate the minimum scale limit.
1620 if (view->needsLayout()) 1623 if (view->needsLayout())
1621 view->layout(); 1624 view->layout();
1622 1625
1623 if (shouldAnchorAndRescaleViewport) { 1626 if (shouldAnchorAndRescaleViewport) {
1624 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width; 1627 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width;
1625 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth; 1628 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth;
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3799 3802
3800 bool WebViewImpl::allowsAcceleratedCompositing() 3803 bool WebViewImpl::allowsAcceleratedCompositing()
3801 { 3804 {
3802 return !m_compositorCreationFailed; 3805 return !m_compositorCreationFailed;
3803 } 3806 }
3804 3807
3805 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) 3808 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
3806 { 3809 {
3807 suppressInvalidations(true); 3810 suppressInvalidations(true);
3808 3811
3809 m_rootGraphicsLayer = layer; 3812 if (page()->settings()->pinchVirtualViewportEnabled() && !m_pinchViewports)
3810 m_rootLayer = layer ? layer->platformLayer() : 0; 3813 m_pinchViewports = PinchViewports::create(this);
jamesr 2013/06/14 20:55:46 do you need to tear the pinch viewports down when
wjmaclean 2013/06/17 17:45:27 I don't *think* so, though I could be convinced ot
3814
3815 if (m_pinchViewports) {
3816 m_pinchViewports->setOverflowControlsHostLayer(layer);
3817 if (layer) {
3818 m_rootGraphicsLayer = m_pinchViewports->rootGraphicsLayer();
3819 m_rootLayer = m_pinchViewports->rootGraphicsLayer()->platformLayer() ;
3820 } else {
3821 m_rootGraphicsLayer = 0;
3822 m_rootLayer = 0;
3823 }
3824 } else {
3825 m_rootGraphicsLayer = layer;
3826 m_rootLayer = layer ? layer->platformLayer() : 0;
3827 }
3828
3811 3829
3812 setIsAcceleratedCompositingActive(layer); 3830 setIsAcceleratedCompositingActive(layer);
3813 3831
3832 // FIXME: We also need to tell the layer tree about the pinchViewport layers
3833 // in a follow-on CL.
3814 if (m_layerTreeView) { 3834 if (m_layerTreeView) {
3815 if (m_rootLayer) 3835 if (m_rootLayer)
3816 m_layerTreeView->setRootLayer(*m_rootLayer); 3836 m_layerTreeView->setRootLayer(*m_rootLayer);
3817 else 3837 else
3818 m_layerTreeView->clearRootLayer(); 3838 m_layerTreeView->clearRootLayer();
3819 } 3839 }
3820 3840
3821 suppressInvalidations(false); 3841 suppressInvalidations(false);
3822 } 3842 }
3823 3843
(...skipping 14 matching lines...) Expand all
3838 updateLayerTreeViewport(); 3858 updateLayerTreeViewport();
3839 } else if (m_client) 3859 } else if (m_client)
3840 m_client->didInvalidateRect(rect); 3860 m_client->didInvalidateRect(rect);
3841 } 3861 }
3842 3862
3843 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const 3863 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
3844 { 3864 {
3845 return m_graphicsLayerFactory.get(); 3865 return m_graphicsLayerFactory.get();
3846 } 3866 }
3847 3867
3868 WebCore::RenderLayerCompositor* WebViewImpl::compositor() const
3869 {
3870 if (!page()
3871 || !page()->mainFrame()
3872 || !page()->mainFrame()->document()
3873 || !page()->mainFrame()->document()->renderView())
3874 return 0;
3875 return page()->mainFrame()->document()->renderView()->compositor();
3876 }
3877
3848 void WebViewImpl::registerForAnimations(WebLayer* layer) 3878 void WebViewImpl::registerForAnimations(WebLayer* layer)
3849 { 3879 {
3850 if (m_layerTreeView) 3880 if (m_layerTreeView)
3851 m_layerTreeView->registerForAnimations(layer); 3881 m_layerTreeView->registerForAnimations(layer);
3852 } 3882 }
3853 3883
3854 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() 3884 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer()
3855 { 3885 {
3856 return m_rootGraphicsLayer; 3886 return m_rootGraphicsLayer;
3857 } 3887 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4087 } 4117 }
4088 4118
4089 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4119 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4090 { 4120 {
4091 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4121 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4092 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4122 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4093 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4123 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4094 } 4124 }
4095 4125
4096 } // namespace WebKit 4126 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698