| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) | 406 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) |
| 407 , m_savedPageScaleFactor(0) | 407 , m_savedPageScaleFactor(0) |
| 408 , m_doubleTapZoomPageScaleFactor(0) | 408 , m_doubleTapZoomPageScaleFactor(0) |
| 409 , m_doubleTapZoomPending(false) | 409 , m_doubleTapZoomPending(false) |
| 410 , m_enableFakePageScaleAnimationForTesting(false) | 410 , m_enableFakePageScaleAnimationForTesting(false) |
| 411 , m_fakePageScaleAnimationPageScaleFactor(0) | 411 , m_fakePageScaleAnimationPageScaleFactor(0) |
| 412 , m_fakePageScaleAnimationUseAnchor(false) | 412 , m_fakePageScaleAnimationUseAnchor(false) |
| 413 , m_contextMenuAllowed(false) | 413 , m_contextMenuAllowed(false) |
| 414 , m_doingDragAndDrop(false) | 414 , m_doingDragAndDrop(false) |
| 415 , m_ignoreInputEvents(false) | 415 , m_ignoreInputEvents(false) |
| 416 , m_compositorDeviceScaleFactorOverride(0) |
| 417 , m_rootLayerScale(1) |
| 416 , m_suppressNextKeypressEvent(false) | 418 , m_suppressNextKeypressEvent(false) |
| 417 , m_imeAcceptEvents(true) | 419 , m_imeAcceptEvents(true) |
| 418 , m_operationsAllowed(WebDragOperationNone) | 420 , m_operationsAllowed(WebDragOperationNone) |
| 419 , m_dragOperation(WebDragOperationNone) | 421 , m_dragOperation(WebDragOperationNone) |
| 420 , m_featureSwitchClient(adoptPtr(new ContextFeaturesClientImpl())) | 422 , m_featureSwitchClient(adoptPtr(new ContextFeaturesClientImpl())) |
| 421 , m_autofillPopupShowing(false) | 423 , m_autofillPopupShowing(false) |
| 422 , m_autofillPopup(0) | 424 , m_autofillPopup(0) |
| 423 , m_isTransparent(false) | 425 , m_isTransparent(false) |
| 424 , m_tabsToLinks(false) | 426 , m_tabsToLinks(false) |
| 425 , m_layerTreeView(0) | 427 , m_layerTreeView(0) |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1716 viewportAnchor.setAnchor(view->visibleContentRect(), | 1718 viewportAnchor.setAnchor(view->visibleContentRect(), |
| 1717 FloatSize(viewportAnchorXCoord, viewportAnchorY
Coord)); | 1719 FloatSize(viewportAnchorXCoord, viewportAnchorY
Coord)); |
| 1718 } | 1720 } |
| 1719 | 1721 |
| 1720 // Set the fixed layout size from the viewport constraints before resizing. | 1722 // Set the fixed layout size from the viewport constraints before resizing. |
| 1721 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->
viewportDescription()); | 1723 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->
viewportDescription()); |
| 1722 | 1724 |
| 1723 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); | 1725 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); |
| 1724 if (agentPrivate) | 1726 if (agentPrivate) |
| 1725 agentPrivate->webViewResized(newSize); | 1727 agentPrivate->webViewResized(newSize); |
| 1726 if (!agentPrivate || !agentPrivate->metricsOverridden()) { | 1728 WebFrameImpl* webFrame = mainFrameImpl(); |
| 1727 WebFrameImpl* webFrame = mainFrameImpl(); | 1729 if (webFrame->frameView()) { |
| 1728 if (webFrame->frameView()) { | 1730 webFrame->frameView()->resize(m_size); |
| 1729 webFrame->frameView()->resize(m_size); | 1731 if (m_pinchViewports) |
| 1730 if (m_pinchViewports) | 1732 m_pinchViewports->setViewportSize(m_size); |
| 1731 m_pinchViewports->setViewportSize(m_size); | |
| 1732 } | |
| 1733 } | 1733 } |
| 1734 | 1734 |
| 1735 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { | 1735 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { |
| 1736 // Relayout immediately to recalculate the minimum scale limit. | 1736 // Relayout immediately to recalculate the minimum scale limit. |
| 1737 if (view->needsLayout()) | 1737 if (view->needsLayout()) |
| 1738 view->layout(); | 1738 view->layout(); |
| 1739 | 1739 |
| 1740 if (shouldAnchorAndRescaleViewport) { | 1740 if (shouldAnchorAndRescaleViewport) { |
| 1741 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi
ze.width; | 1741 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi
ze.width; |
| 1742 float contentsWidthRatio = static_cast<float>(contentsSize().width()
) / oldContentsWidth; | 1742 float contentsWidthRatio = static_cast<float>(contentsSize().width()
) / oldContentsWidth; |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2916 } | 2916 } |
| 2917 | 2917 |
| 2918 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) | 2918 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) |
| 2919 { | 2919 { |
| 2920 if (!page()) | 2920 if (!page()) |
| 2921 return; | 2921 return; |
| 2922 | 2922 |
| 2923 page()->setDeviceScaleFactor(scaleFactor); | 2923 page()->setDeviceScaleFactor(scaleFactor); |
| 2924 | 2924 |
| 2925 if (m_layerTreeView) | 2925 if (m_layerTreeView) |
| 2926 m_layerTreeView->setDeviceScaleFactor(scaleFactor); | 2926 updateLayerTreeDeviceScaleFactor(); |
| 2927 } | 2927 } |
| 2928 | 2928 |
| 2929 bool WebViewImpl::isFixedLayoutModeEnabled() const | 2929 bool WebViewImpl::isFixedLayoutModeEnabled() const |
| 2930 { | 2930 { |
| 2931 if (!page()) | 2931 if (!page()) |
| 2932 return false; | 2932 return false; |
| 2933 | 2933 |
| 2934 Frame* frame = page()->mainFrame(); | 2934 Frame* frame = page()->mainFrame(); |
| 2935 if (!frame || !frame->view()) | 2935 if (!frame || !frame->view()) |
| 2936 return false; | 2936 return false; |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3475 | 3475 |
| 3476 void WebViewImpl::setInspectorSetting(const WebString& key, | 3476 void WebViewImpl::setInspectorSetting(const WebString& key, |
| 3477 const WebString& value) | 3477 const WebString& value) |
| 3478 { | 3478 { |
| 3479 m_inspectorSettingsMap->set(key, value); | 3479 m_inspectorSettingsMap->set(key, value); |
| 3480 client()->didUpdateInspectorSetting(key, value); | 3480 client()->didUpdateInspectorSetting(key, value); |
| 3481 } | 3481 } |
| 3482 | 3482 |
| 3483 void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor
) | 3483 void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor
) |
| 3484 { | 3484 { |
| 3485 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; |
| 3486 if (page() && m_layerTreeView) |
| 3487 updateLayerTreeDeviceScaleFactor(); |
| 3485 } | 3488 } |
| 3486 | 3489 |
| 3487 void WebViewImpl::setRootLayerScaleTransform(float rootLayerScale) | 3490 void WebViewImpl::setRootLayerScaleTransform(float rootLayerScale) |
| 3488 { | 3491 { |
| 3492 m_rootLayerScale = rootLayerScale; |
| 3493 if (mainFrameImpl()) |
| 3494 mainFrameImpl()->setInputEventsScaleFactorForEmulation(m_rootLayerScale)
; |
| 3495 updateRootLayerTransform(); |
| 3489 } | 3496 } |
| 3490 | 3497 |
| 3491 WebDevToolsAgent* WebViewImpl::devToolsAgent() | 3498 WebDevToolsAgent* WebViewImpl::devToolsAgent() |
| 3492 { | 3499 { |
| 3493 return m_devToolsAgent.get(); | 3500 return m_devToolsAgent.get(); |
| 3494 } | 3501 } |
| 3495 | 3502 |
| 3496 WebAXObject WebViewImpl::accessibilityObject() | 3503 WebAXObject WebViewImpl::accessibilityObject() |
| 3497 { | 3504 { |
| 3498 if (!mainFrameImpl()) | 3505 if (!mainFrameImpl()) |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3883 m_rootGraphicsLayer = 0; | 3890 m_rootGraphicsLayer = 0; |
| 3884 m_rootLayer = 0; | 3891 m_rootLayer = 0; |
| 3885 } | 3892 } |
| 3886 } else { | 3893 } else { |
| 3887 m_rootGraphicsLayer = layer; | 3894 m_rootGraphicsLayer = layer; |
| 3888 m_rootLayer = layer ? layer->platformLayer() : 0; | 3895 m_rootLayer = layer ? layer->platformLayer() : 0; |
| 3889 } | 3896 } |
| 3890 | 3897 |
| 3891 setIsAcceleratedCompositingActive(layer); | 3898 setIsAcceleratedCompositingActive(layer); |
| 3892 | 3899 |
| 3900 updateRootLayerTransform(); |
| 3901 |
| 3893 if (m_layerTreeView) { | 3902 if (m_layerTreeView) { |
| 3894 if (m_rootLayer) { | 3903 if (m_rootLayer) { |
| 3895 m_layerTreeView->setRootLayer(*m_rootLayer); | 3904 m_layerTreeView->setRootLayer(*m_rootLayer); |
| 3896 // We register viewport layers here since there may not be a layer | 3905 // We register viewport layers here since there may not be a layer |
| 3897 // tree view prior to this point. | 3906 // tree view prior to this point. |
| 3898 if (m_pinchViewports) { | 3907 if (m_pinchViewports) { |
| 3899 m_pinchViewports->registerViewportLayersWithTreeView(m_layerTree
View); | 3908 m_pinchViewports->registerViewportLayersWithTreeView(m_layerTree
View); |
| 3900 } else { | 3909 } else { |
| 3901 GraphicsLayer* rootScrollLayer = compositor()->scrollLayer(); | 3910 GraphicsLayer* rootScrollLayer = compositor()->scrollLayer(); |
| 3902 ASSERT(rootScrollLayer); | 3911 ASSERT(rootScrollLayer); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4005 } else { | 4014 } else { |
| 4006 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t
rue)"); | 4015 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t
rue)"); |
| 4007 | 4016 |
| 4008 m_client->initializeLayerTreeView(); | 4017 m_client->initializeLayerTreeView(); |
| 4009 m_layerTreeView = m_client->layerTreeView(); | 4018 m_layerTreeView = m_client->layerTreeView(); |
| 4010 if (m_layerTreeView) { | 4019 if (m_layerTreeView) { |
| 4011 m_layerTreeView->setRootLayer(*m_rootLayer); | 4020 m_layerTreeView->setRootLayer(*m_rootLayer); |
| 4012 | 4021 |
| 4013 bool visible = page()->visibilityState() == PageVisibilityStateVisib
le; | 4022 bool visible = page()->visibilityState() == PageVisibilityStateVisib
le; |
| 4014 m_layerTreeView->setVisible(visible); | 4023 m_layerTreeView->setVisible(visible); |
| 4015 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor()); | 4024 updateLayerTreeDeviceScaleFactor(); |
| 4016 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), mini
mumPageScaleFactor(), maximumPageScaleFactor()); | 4025 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), mini
mumPageScaleFactor(), maximumPageScaleFactor()); |
| 4017 m_layerTreeView->setBackgroundColor(backgroundColor()); | 4026 m_layerTreeView->setBackgroundColor(backgroundColor()); |
| 4018 m_layerTreeView->setHasTransparentBackground(isTransparent()); | 4027 m_layerTreeView->setHasTransparentBackground(isTransparent()); |
| 4019 updateLayerTreeViewport(); | 4028 updateLayerTreeViewport(); |
| 4020 m_client->didActivateCompositor(0); | 4029 m_client->didActivateCompositor(0); |
| 4021 m_isAcceleratedCompositingActive = true; | 4030 m_isAcceleratedCompositingActive = true; |
| 4022 m_compositorCreationFailed = false; | 4031 m_compositorCreationFailed = false; |
| 4023 if (m_pageOverlays) | 4032 if (m_pageOverlays) |
| 4024 m_pageOverlays->update(); | 4033 m_pageOverlays->update(); |
| 4025 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); | 4034 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4090 } | 4099 } |
| 4091 | 4100 |
| 4092 void WebViewImpl::updateLayerTreeViewport() | 4101 void WebViewImpl::updateLayerTreeViewport() |
| 4093 { | 4102 { |
| 4094 if (!page() || !m_layerTreeView) | 4103 if (!page() || !m_layerTreeView) |
| 4095 return; | 4104 return; |
| 4096 | 4105 |
| 4097 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS
caleFactor(), maximumPageScaleFactor()); | 4106 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS
caleFactor(), maximumPageScaleFactor()); |
| 4098 } | 4107 } |
| 4099 | 4108 |
| 4109 void WebViewImpl::updateLayerTreeDeviceScaleFactor() |
| 4110 { |
| 4111 ASSERT(page()); |
| 4112 ASSERT(m_layerTreeView); |
| 4113 |
| 4114 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit
orDeviceScaleFactorOverride : page()->deviceScaleFactor(); |
| 4115 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); |
| 4116 } |
| 4117 |
| 4118 void WebViewImpl::updateRootLayerTransform() |
| 4119 { |
| 4120 if (m_rootGraphicsLayer) { |
| 4121 WebCore::TransformationMatrix transform; |
| 4122 transform = transform.scale(m_rootLayerScale); |
| 4123 m_rootGraphicsLayer->setChildrenTransform(transform); |
| 4124 } |
| 4125 } |
| 4126 |
| 4100 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) | 4127 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) |
| 4101 { | 4128 { |
| 4102 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio
nsCount()) | 4129 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio
nsCount()) |
| 4103 m_autofillPopupClient->valueChanged(listIndex); | 4130 m_autofillPopupClient->valueChanged(listIndex); |
| 4104 } | 4131 } |
| 4105 | 4132 |
| 4106 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) | 4133 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) |
| 4107 { | 4134 { |
| 4108 HitTestResult touchHit = hitTestResultForWindowPos(position); | 4135 HitTestResult touchHit = hitTestResultForWindowPos(position); |
| 4109 | 4136 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4202 // the initial viewport width. | 4229 // the initial viewport width. |
| 4203 // 2. The author has disabled viewport zoom. | 4230 // 2. The author has disabled viewport zoom. |
| 4204 | 4231 |
| 4205 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4232 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
| 4206 | 4233 |
| 4207 return fixedLayoutSize().width == m_size.width | 4234 return fixedLayoutSize().width == m_size.width |
| 4208 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4235 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4209 } | 4236 } |
| 4210 | 4237 |
| 4211 } // namespace WebKit | 4238 } // namespace WebKit |
| OLD | NEW |