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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) | 389 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) |
390 , m_savedPageScaleFactor(0) | 390 , m_savedPageScaleFactor(0) |
391 , m_doubleTapZoomPageScaleFactor(0) | 391 , m_doubleTapZoomPageScaleFactor(0) |
392 , m_doubleTapZoomPending(false) | 392 , m_doubleTapZoomPending(false) |
393 , m_enableFakePageScaleAnimationForTesting(false) | 393 , m_enableFakePageScaleAnimationForTesting(false) |
394 , m_fakePageScaleAnimationPageScaleFactor(0) | 394 , m_fakePageScaleAnimationPageScaleFactor(0) |
395 , m_fakePageScaleAnimationUseAnchor(false) | 395 , m_fakePageScaleAnimationUseAnchor(false) |
396 , m_contextMenuAllowed(false) | 396 , m_contextMenuAllowed(false) |
397 , m_doingDragAndDrop(false) | 397 , m_doingDragAndDrop(false) |
398 , m_ignoreInputEvents(false) | 398 , m_ignoreInputEvents(false) |
399 , m_emulatingDeviceScales(false) | |
pfeldman
2013/09/19 12:46:05
Initialize floats too.
dgozman
2013/09/19 13:59:38
Done.
| |
399 , m_suppressNextKeypressEvent(false) | 400 , m_suppressNextKeypressEvent(false) |
400 , m_imeAcceptEvents(true) | 401 , m_imeAcceptEvents(true) |
401 , m_operationsAllowed(WebDragOperationNone) | 402 , m_operationsAllowed(WebDragOperationNone) |
402 , m_dragOperation(WebDragOperationNone) | 403 , m_dragOperation(WebDragOperationNone) |
403 , m_featureSwitchClient(adoptPtr(new ContextFeaturesClientImpl())) | 404 , m_featureSwitchClient(adoptPtr(new ContextFeaturesClientImpl())) |
404 , m_autofillPopupShowing(false) | 405 , m_autofillPopupShowing(false) |
405 , m_autofillPopup(0) | 406 , m_autofillPopup(0) |
406 , m_isTransparent(false) | 407 , m_isTransparent(false) |
407 , m_tabsToLinks(false) | 408 , m_tabsToLinks(false) |
408 , m_layerTreeView(0) | 409 , m_layerTreeView(0) |
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2857 return page()->deviceScaleFactor(); | 2858 return page()->deviceScaleFactor(); |
2858 } | 2859 } |
2859 | 2860 |
2860 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) | 2861 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) |
2861 { | 2862 { |
2862 if (!page()) | 2863 if (!page()) |
2863 return; | 2864 return; |
2864 | 2865 |
2865 page()->setDeviceScaleFactor(scaleFactor); | 2866 page()->setDeviceScaleFactor(scaleFactor); |
2866 | 2867 |
2867 if (m_layerTreeView) | 2868 updateLayerTreeDeviceScaleFactor(); |
2868 m_layerTreeView->setDeviceScaleFactor(scaleFactor); | |
2869 } | 2869 } |
2870 | 2870 |
2871 bool WebViewImpl::isFixedLayoutModeEnabled() const | 2871 bool WebViewImpl::isFixedLayoutModeEnabled() const |
2872 { | 2872 { |
2873 if (!page()) | 2873 if (!page()) |
2874 return false; | 2874 return false; |
2875 | 2875 |
2876 Frame* frame = page()->mainFrame(); | 2876 Frame* frame = page()->mainFrame(); |
2877 if (!frame || !frame->view()) | 2877 if (!frame || !frame->view()) |
2878 return false; | 2878 return false; |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3696 m_newNavigationLoader = m_page->mainFrame()->loader()->documentLoader(); | 3696 m_newNavigationLoader = m_page->mainFrame()->loader()->documentLoader(); |
3697 #endif | 3697 #endif |
3698 } | 3698 } |
3699 | 3699 |
3700 void WebViewImpl::setIgnoreInputEvents(bool newValue) | 3700 void WebViewImpl::setIgnoreInputEvents(bool newValue) |
3701 { | 3701 { |
3702 ASSERT(m_ignoreInputEvents != newValue); | 3702 ASSERT(m_ignoreInputEvents != newValue); |
3703 m_ignoreInputEvents = newValue; | 3703 m_ignoreInputEvents = newValue; |
3704 } | 3704 } |
3705 | 3705 |
3706 void WebViewImpl::setDeviceEmulationScales(bool enabled, float deviceScaleFactor , float rootLayerScale) | |
3707 { | |
3708 m_emulatingDeviceScales = enabled; | |
3709 m_emulatedDeviceScaleFactor = deviceScaleFactor; | |
3710 m_rootLayerScale = rootLayerScale; | |
3711 updateLayerTreeDeviceScaleFactor(); | |
3712 updateRootLayerTransform(); | |
3713 } | |
3714 | |
3706 void WebViewImpl::addPageOverlay(WebPageOverlay* overlay, int zOrder) | 3715 void WebViewImpl::addPageOverlay(WebPageOverlay* overlay, int zOrder) |
3707 { | 3716 { |
3708 if (!m_pageOverlays) | 3717 if (!m_pageOverlays) |
3709 m_pageOverlays = PageOverlayList::create(this); | 3718 m_pageOverlays = PageOverlayList::create(this); |
3710 | 3719 |
3711 m_pageOverlays->add(overlay, zOrder); | 3720 m_pageOverlays->add(overlay, zOrder); |
3712 } | 3721 } |
3713 | 3722 |
3714 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) | 3723 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) |
3715 { | 3724 { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3810 m_rootLayer = 0; | 3819 m_rootLayer = 0; |
3811 m_pinchViewports->clearViewportLayersForTreeView(m_layerTreeView); | 3820 m_pinchViewports->clearViewportLayersForTreeView(m_layerTreeView); |
3812 } | 3821 } |
3813 } else { | 3822 } else { |
3814 m_rootGraphicsLayer = layer; | 3823 m_rootGraphicsLayer = layer; |
3815 m_rootLayer = layer ? layer->platformLayer() : 0; | 3824 m_rootLayer = layer ? layer->platformLayer() : 0; |
3816 } | 3825 } |
3817 | 3826 |
3818 setIsAcceleratedCompositingActive(layer); | 3827 setIsAcceleratedCompositingActive(layer); |
3819 | 3828 |
3829 updateRootLayerTransform(); | |
pfeldman
2013/09/19 12:46:05
Will this work?:
if (m_emulatingDeviceScales)
dgozman
2013/09/19 13:59:38
What if root layer has transform left from previou
| |
3830 | |
3820 if (m_layerTreeView) { | 3831 if (m_layerTreeView) { |
3821 if (m_rootLayer) | 3832 if (m_rootLayer) |
3822 m_layerTreeView->setRootLayer(*m_rootLayer); | 3833 m_layerTreeView->setRootLayer(*m_rootLayer); |
3823 else | 3834 else |
3824 m_layerTreeView->clearRootLayer(); | 3835 m_layerTreeView->clearRootLayer(); |
3825 } | 3836 } |
3826 | 3837 |
3827 suppressInvalidations(false); | 3838 suppressInvalidations(false); |
3828 } | 3839 } |
3829 | 3840 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3917 } else { | 3928 } else { |
3918 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t rue)"); | 3929 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t rue)"); |
3919 | 3930 |
3920 m_client->initializeLayerTreeView(); | 3931 m_client->initializeLayerTreeView(); |
3921 m_layerTreeView = m_client->layerTreeView(); | 3932 m_layerTreeView = m_client->layerTreeView(); |
3922 if (m_layerTreeView) { | 3933 if (m_layerTreeView) { |
3923 m_layerTreeView->setRootLayer(*m_rootLayer); | 3934 m_layerTreeView->setRootLayer(*m_rootLayer); |
3924 | 3935 |
3925 bool visible = page()->visibilityState() == PageVisibilityStateVisib le; | 3936 bool visible = page()->visibilityState() == PageVisibilityStateVisib le; |
3926 m_layerTreeView->setVisible(visible); | 3937 m_layerTreeView->setVisible(visible); |
3927 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor()); | 3938 updateLayerTreeDeviceScaleFactor(); |
3928 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), mini mumPageScaleFactor(), maximumPageScaleFactor()); | 3939 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), mini mumPageScaleFactor(), maximumPageScaleFactor()); |
3929 m_layerTreeView->setBackgroundColor(backgroundColor()); | 3940 m_layerTreeView->setBackgroundColor(backgroundColor()); |
3930 m_layerTreeView->setHasTransparentBackground(isTransparent()); | 3941 m_layerTreeView->setHasTransparentBackground(isTransparent()); |
3931 updateLayerTreeViewport(); | 3942 updateLayerTreeViewport(); |
3932 m_client->didActivateCompositor(0); | 3943 m_client->didActivateCompositor(0); |
3933 m_isAcceleratedCompositingActive = true; | 3944 m_isAcceleratedCompositingActive = true; |
3934 m_compositorCreationFailed = false; | 3945 m_compositorCreationFailed = false; |
3935 if (m_pageOverlays) | 3946 if (m_pageOverlays) |
3936 m_pageOverlays->update(); | 3947 m_pageOverlays->update(); |
3937 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); | 3948 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4002 } | 4013 } |
4003 | 4014 |
4004 void WebViewImpl::updateLayerTreeViewport() | 4015 void WebViewImpl::updateLayerTreeViewport() |
4005 { | 4016 { |
4006 if (!page() || !m_layerTreeView) | 4017 if (!page() || !m_layerTreeView) |
4007 return; | 4018 return; |
4008 | 4019 |
4009 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor()); | 4020 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor()); |
4010 } | 4021 } |
4011 | 4022 |
4023 void WebViewImpl::updateLayerTreeDeviceScaleFactor() | |
4024 { | |
4025 if (!page() || !m_layerTreeView) | |
pfeldman
2013/09/19 12:46:05
Assert these exist instead.
dgozman
2013/09/19 13:59:38
Done.
| |
4026 return; | |
4027 | |
4028 float deviceScaleFactor = page()->deviceScaleFactor(); | |
4029 if (m_emulatingDeviceScales) | |
apavlov
2013/09/19 12:47:57
float deviceScaleFactor = m_emulatingDeviceScales
dgozman
2013/09/19 13:59:38
Done.
| |
4030 deviceScaleFactor = m_emulatedDeviceScaleFactor; | |
4031 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); | |
4032 } | |
4033 | |
4034 void WebViewImpl::updateRootLayerTransform() | |
4035 { | |
4036 if (m_rootGraphicsLayer) { | |
4037 WebCore::TransformationMatrix transform; | |
4038 if (m_emulatingDeviceScales) | |
4039 transform = transform.scale(m_rootLayerScale); | |
4040 m_rootGraphicsLayer->setTransform(transform); | |
4041 } | |
4042 } | |
4043 | |
4012 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) | 4044 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) |
4013 { | 4045 { |
4014 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio nsCount()) | 4046 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio nsCount()) |
4015 m_autofillPopupClient->valueChanged(listIndex); | 4047 m_autofillPopupClient->valueChanged(listIndex); |
4016 } | 4048 } |
4017 | 4049 |
4018 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) | 4050 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) |
4019 { | 4051 { |
4020 HitTestResult touchHit = hitTestResultForWindowPos(position); | 4052 HitTestResult touchHit = hitTestResultForWindowPos(position); |
4021 | 4053 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4114 // the initial viewport width. | 4146 // the initial viewport width. |
4115 // 2. The author has disabled viewport zoom. | 4147 // 2. The author has disabled viewport zoom. |
4116 | 4148 |
4117 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 4149 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
4118 | 4150 |
4119 return fixedLayoutSize().width == m_size.width | 4151 return fixedLayoutSize().width == m_size.width |
4120 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4152 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
4121 } | 4153 } |
4122 | 4154 |
4123 } // namespace WebKit | 4155 } // namespace WebKit |
OLD | NEW |