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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2237433004: Adds DevTools commands for forced viewport override. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove offset/scale params, rename commands, clip by backing size. Created 4 years, 3 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
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 #include "platform/Histogram.h" 103 #include "platform/Histogram.h"
104 #include "platform/KeyboardCodes.h" 104 #include "platform/KeyboardCodes.h"
105 #include "platform/PlatformGestureEvent.h" 105 #include "platform/PlatformGestureEvent.h"
106 #include "platform/PlatformKeyboardEvent.h" 106 #include "platform/PlatformKeyboardEvent.h"
107 #include "platform/PlatformMouseEvent.h" 107 #include "platform/PlatformMouseEvent.h"
108 #include "platform/RuntimeEnabledFeatures.h" 108 #include "platform/RuntimeEnabledFeatures.h"
109 #include "platform/TraceEvent.h" 109 #include "platform/TraceEvent.h"
110 #include "platform/UserGestureIndicator.h" 110 #include "platform/UserGestureIndicator.h"
111 #include "platform/exported/WebActiveGestureAnimation.h" 111 #include "platform/exported/WebActiveGestureAnimation.h"
112 #include "platform/fonts/FontCache.h" 112 #include "platform/fonts/FontCache.h"
113 #include "platform/geometry/FloatRect.h"
113 #include "platform/graphics/Color.h" 114 #include "platform/graphics/Color.h"
114 #include "platform/graphics/CompositorMutatorClient.h" 115 #include "platform/graphics/CompositorMutatorClient.h"
115 #include "platform/graphics/FirstPaintInvalidationTracking.h" 116 #include "platform/graphics/FirstPaintInvalidationTracking.h"
116 #include "platform/graphics/GraphicsContext.h" 117 #include "platform/graphics/GraphicsContext.h"
117 #include "platform/graphics/Image.h" 118 #include "platform/graphics/Image.h"
118 #include "platform/graphics/ImageBuffer.h" 119 #include "platform/graphics/ImageBuffer.h"
119 #include "platform/graphics/gpu/DrawingBuffer.h" 120 #include "platform/graphics/gpu/DrawingBuffer.h"
120 #include "platform/graphics/paint/DrawingRecorder.h" 121 #include "platform/graphics/paint/DrawingRecorder.h"
121 #include "platform/image-decoders/ImageDecoder.h" 122 #include "platform/image-decoders/ImageDecoder.h"
122 #include "platform/scroll/ScrollbarTheme.h" 123 #include "platform/scroll/ScrollbarTheme.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 , m_zoomFactorForDeviceScaleFactor(0.f) 414 , m_zoomFactorForDeviceScaleFactor(0.f)
414 , m_maximumLegibleScale(1) 415 , m_maximumLegibleScale(1)
415 , m_doubleTapZoomPageScaleFactor(0) 416 , m_doubleTapZoomPageScaleFactor(0)
416 , m_doubleTapZoomPending(false) 417 , m_doubleTapZoomPending(false)
417 , m_enableFakePageScaleAnimationForTesting(false) 418 , m_enableFakePageScaleAnimationForTesting(false)
418 , m_fakePageScaleAnimationPageScaleFactor(0) 419 , m_fakePageScaleAnimationPageScaleFactor(0)
419 , m_fakePageScaleAnimationUseAnchor(false) 420 , m_fakePageScaleAnimationUseAnchor(false)
420 , m_doingDragAndDrop(false) 421 , m_doingDragAndDrop(false)
421 , m_ignoreInputEvents(false) 422 , m_ignoreInputEvents(false)
422 , m_compositorDeviceScaleFactorOverride(0) 423 , m_compositorDeviceScaleFactorOverride(0)
423 , m_rootLayerScale(1)
424 , m_suppressNextKeypressEvent(false) 424 , m_suppressNextKeypressEvent(false)
425 , m_imeAcceptEvents(true) 425 , m_imeAcceptEvents(true)
426 , m_operationsAllowed(WebDragOperationNone) 426 , m_operationsAllowed(WebDragOperationNone)
427 , m_dragOperation(WebDragOperationNone) 427 , m_dragOperation(WebDragOperationNone)
428 , m_devToolsEmulator(nullptr) 428 , m_devToolsEmulator(nullptr)
429 , m_isTransparent(false) 429 , m_isTransparent(false)
430 , m_tabsToLinks(false) 430 , m_tabsToLinks(false)
431 , m_layerTreeView(nullptr) 431 , m_layerTreeView(nullptr)
432 , m_rootLayer(nullptr) 432 , m_rootLayer(nullptr)
433 , m_rootGraphicsLayer(nullptr) 433 , m_rootGraphicsLayer(nullptr)
(...skipping 3403 matching lines...) Expand 10 before | Expand all | Expand 10 after
3837 return; 3837 return;
3838 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; 3838 m_compositorDeviceScaleFactorOverride = deviceScaleFactor;
3839 if (m_zoomFactorForDeviceScaleFactor) { 3839 if (m_zoomFactorForDeviceScaleFactor) {
3840 setZoomLevel(zoomLevel()); 3840 setZoomLevel(zoomLevel());
3841 return; 3841 return;
3842 } 3842 }
3843 if (page() && m_layerTreeView) 3843 if (page() && m_layerTreeView)
3844 updateLayerTreeDeviceScaleFactor(); 3844 updateLayerTreeDeviceScaleFactor();
3845 } 3845 }
3846 3846
3847 void WebViewImpl::setRootLayerTransform(const WebSize& rootLayerOffset, float ro otLayerScale) 3847 void WebViewImpl::setRootLayerTransform(const TransformationMatrix& transform)
3848 { 3848 {
3849 if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffs et) 3849 if (transform == m_rootLayerTransform)
3850 return; 3850 return;
3851 m_rootLayerScale = rootLayerScale; 3851 m_rootLayerTransform = transform;
3852 m_rootLayerOffset = rootLayerOffset;
3853 if (mainFrameImpl())
3854 mainFrameImpl()->setInputEventsTransformForEmulation(m_rootLayerOffset, m_rootLayerScale);
3855 updateRootLayerTransform(); 3852 updateRootLayerTransform();
3856 } 3853 }
3857 3854
3855 TransformationMatrix WebViewImpl::getRootLayerTransformForTesting() const
3856 {
3857 return m_rootLayerTransform;
3858 }
3859
3858 void WebViewImpl::enableDeviceEmulation(const WebDeviceEmulationParams& params) 3860 void WebViewImpl::enableDeviceEmulation(const WebDeviceEmulationParams& params)
3859 { 3861 {
3860 m_devToolsEmulator->enableDeviceEmulation(params); 3862 m_devToolsEmulator->enableDeviceEmulation(params);
3861 } 3863 }
3862 3864
3863 void WebViewImpl::disableDeviceEmulation() 3865 void WebViewImpl::disableDeviceEmulation()
3864 { 3866 {
3865 m_devToolsEmulator->disableDeviceEmulation(); 3867 m_devToolsEmulator->disableDeviceEmulation();
3866 } 3868 }
3867 3869
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
4083 void WebViewImpl::didChangeContentsSize() 4085 void WebViewImpl::didChangeContentsSize()
4084 { 4086 {
4085 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), pageScaleFac tor()); 4087 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), pageScaleFac tor());
4086 } 4088 }
4087 4089
4088 void WebViewImpl::pageScaleFactorChanged() 4090 void WebViewImpl::pageScaleFactorChanged()
4089 { 4091 {
4090 pageScaleConstraintsSet().setNeedsReset(false); 4092 pageScaleConstraintsSet().setNeedsReset(false);
4091 updateLayerTreeViewport(); 4093 updateLayerTreeViewport();
4092 m_client->pageScaleFactorChanged(); 4094 m_client->pageScaleFactorChanged();
4095 m_devToolsEmulator->mainFrameScrollOrScaleChanged();
chrishtr 2016/08/22 22:00:42 This seems new. Why was it not needed before?
Eric Seckler 2016/08/23 09:32:19 Should have been there in the previous version of
4096 }
4097
4098 void WebViewImpl::mainFrameScrollOffsetChanged()
4099 {
4100 m_devToolsEmulator->mainFrameScrollOrScaleChanged();
4093 } 4101 }
4094 4102
4095 bool WebViewImpl::useExternalPopupMenus() 4103 bool WebViewImpl::useExternalPopupMenus()
4096 { 4104 {
4097 return shouldUseExternalPopupMenus; 4105 return shouldUseExternalPopupMenus;
4098 } 4106 }
4099 4107
4100 void WebViewImpl::startDragging(LocalFrame* frame, 4108 void WebViewImpl::startDragging(LocalFrame* frame,
4101 const WebDragData& dragData, 4109 const WebDragData& dragData,
4102 WebDragOperationsMask mask, 4110 WebDragOperationsMask mask,
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
4413 { 4421 {
4414 DCHECK(page()); 4422 DCHECK(page());
4415 DCHECK(m_layerTreeView); 4423 DCHECK(m_layerTreeView);
4416 4424
4417 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit orDeviceScaleFactorOverride : page()->deviceScaleFactor(); 4425 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit orDeviceScaleFactorOverride : page()->deviceScaleFactor();
4418 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 4426 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
4419 } 4427 }
4420 4428
4421 void WebViewImpl::updateRootLayerTransform() 4429 void WebViewImpl::updateRootLayerTransform()
4422 { 4430 {
4423 if (m_visualViewportContainerLayer) { 4431 if (m_visualViewportContainerLayer)
4424 TransformationMatrix transform; 4432 m_visualViewportContainerLayer->setTransform(m_rootLayerTransform);
4425 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height);
4426 transform = transform.scale(m_rootLayerScale);
4427 m_visualViewportContainerLayer->setTransform(transform);
4428 }
4429 } 4433 }
4430 4434
4431 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar getedEvent) 4435 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar getedEvent)
4432 { 4436 {
4433 if (!m_page->mainFrame()->isLocalFrame()) 4437 if (!m_page->mainFrame()->isLocalFrame())
4434 return false; 4438 return false;
4435 4439
4436 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo ot() will modify it. 4440 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo ot() will modify it.
4437 HitTestResult touchHit = targetedEvent.hitTestResult(); 4441 HitTestResult touchHit = targetedEvent.hitTestResult();
4438 touchHit.setToShadowHostIfInUserAgentShadowRoot(); 4442 touchHit.setToShadowHostIfInUserAgentShadowRoot();
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
4600 return nullptr; 4604 return nullptr;
4601 return focusedFrame; 4605 return focusedFrame;
4602 } 4606 }
4603 4607
4604 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const 4608 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const
4605 { 4609 {
4606 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4610 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4607 } 4611 }
4608 4612
4609 } // namespace blink 4613 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698