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

Side by Side Diff: third_party/WebKit/Source/web/DevToolsEmulator.h

Issue 2237433004: Adds DevTools commands for forced viewport override. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unique_ptr -> Optional. Created 4 years, 4 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DevToolsEmulator_h 5 #ifndef DevToolsEmulator_h
6 #define DevToolsEmulator_h 6 #define DevToolsEmulator_h
7 7
8 #include "platform/heap/Handle.h" 8 #include "platform/heap/Handle.h"
9 #include "public/platform/PointerProperties.h" 9 #include "public/platform/PointerProperties.h"
10 #include "public/platform/WebFloatRect.h"
10 #include "public/platform/WebViewportStyle.h" 11 #include "public/platform/WebViewportStyle.h"
11 #include "public/web/WebDeviceEmulationParams.h" 12 #include "public/web/WebDeviceEmulationParams.h"
12 #include "wtf/Forward.h" 13 #include "wtf/Forward.h"
14 #include "wtf/Optional.h"
13 #include <memory> 15 #include <memory>
14 16
15 namespace blink { 17 namespace blink {
16 18
17 class InspectorEmulationAgent; 19 class InspectorEmulationAgent;
18 class IntPoint; 20 class IntPoint;
21 class TransformationMatrix;
22 struct WebFloatRect;
19 class WebInputEvent; 23 class WebInputEvent;
20 class WebViewImpl; 24 class WebViewImpl;
21 25
22 class DevToolsEmulator final : public GarbageCollectedFinalized<DevToolsEmulator > { 26 class DevToolsEmulator final : public GarbageCollectedFinalized<DevToolsEmulator > {
23 public: 27 public:
24 ~DevToolsEmulator(); 28 ~DevToolsEmulator();
25 static DevToolsEmulator* create(WebViewImpl*); 29 static DevToolsEmulator* create(WebViewImpl*);
26 DECLARE_TRACE(); 30 DECLARE_TRACE();
27 31
28 // Settings overrides. 32 // Settings overrides.
29 void setTextAutosizingEnabled(bool); 33 void setTextAutosizingEnabled(bool);
30 void setDeviceScaleAdjustment(float); 34 void setDeviceScaleAdjustment(float);
31 void setPreferCompositingToLCDTextEnabled(bool); 35 void setPreferCompositingToLCDTextEnabled(bool);
32 void setViewportStyle(WebViewportStyle); 36 void setViewportStyle(WebViewportStyle);
33 void setPluginsEnabled(bool); 37 void setPluginsEnabled(bool);
34 void setScriptEnabled(bool); 38 void setScriptEnabled(bool);
35 void setDoubleTapToZoomEnabled(bool); 39 void setDoubleTapToZoomEnabled(bool);
36 bool doubleTapToZoomEnabled() const; 40 bool doubleTapToZoomEnabled() const;
37 void setAvailablePointerTypes(int); 41 void setAvailablePointerTypes(int);
38 void setPrimaryPointerType(PointerType); 42 void setPrimaryPointerType(PointerType);
39 void setAvailableHoverTypes(int); 43 void setAvailableHoverTypes(int);
40 void setPrimaryHoverType(HoverType); 44 void setPrimaryHoverType(HoverType);
41 void setMainFrameResizesAreOrientationChanges(bool); 45 void setMainFrameResizesAreOrientationChanges(bool);
42 bool mainFrameResizesAreOrientationChanges() const; 46 bool mainFrameResizesAreOrientationChanges() const;
43 47
44 // Emulation. 48 // Emulation.
45 void enableDeviceEmulation(const WebDeviceEmulationParams&); 49 void enableDeviceEmulation(const WebDeviceEmulationParams&);
46 void disableDeviceEmulation(); 50 void disableDeviceEmulation();
51 void setVisualTransformOverride(const WebFloatRect& area, float scale);
52 void clearVisualTransformOverride();
47 bool resizeIsDeviceSizeChange(); 53 bool resizeIsDeviceSizeChange();
48 void setTouchEventEmulationEnabled(bool); 54 void setTouchEventEmulationEnabled(bool);
49 bool handleInputEvent(const WebInputEvent&); 55 bool handleInputEvent(const WebInputEvent&);
50 void setScriptExecutionDisabled(bool); 56 void setScriptExecutionDisabled(bool);
51 57
58 // Notify the DevToolsEmulator about a scroll or scale change of the main
59 // frame. Updates the transform for an visual transform override.
60 void mainFrameScrollOrScaleChanged();
61
52 private: 62 private:
53 explicit DevToolsEmulator(WebViewImpl*); 63 explicit DevToolsEmulator(WebViewImpl*);
54 64
55 void enableMobileEmulation(); 65 void enableMobileEmulation();
56 void disableMobileEmulation(); 66 void disableMobileEmulation();
57 67
68 void applyDeviceEmulationTransform(TransformationMatrix*);
69 void applyVisualTransformOverride(TransformationMatrix*);
70 void updateRootLayerTransform();
71
58 WebViewImpl* m_webViewImpl; 72 WebViewImpl* m_webViewImpl;
59 73
60 bool m_deviceMetricsEnabled; 74 bool m_deviceMetricsEnabled;
61 bool m_emulateMobileEnabled; 75 bool m_emulateMobileEnabled;
62 WebDeviceEmulationParams m_emulationParams; 76 WebDeviceEmulationParams m_emulationParams;
63 77
78 struct VisualTransformOverride {
79 WebFloatRect area;
80 double scale;
81 bool originalVisualViewportMasking;
82 };
83 WTF::Optional<VisualTransformOverride> m_visualTransformOverride;
84
64 bool m_isOverlayScrollbarsEnabled; 85 bool m_isOverlayScrollbarsEnabled;
65 bool m_isOrientationEventEnabled; 86 bool m_isOrientationEventEnabled;
66 bool m_isMobileLayoutThemeEnabled; 87 bool m_isMobileLayoutThemeEnabled;
67 float m_originalDefaultMinimumPageScaleFactor; 88 float m_originalDefaultMinimumPageScaleFactor;
68 float m_originalDefaultMaximumPageScaleFactor; 89 float m_originalDefaultMaximumPageScaleFactor;
69 bool m_embedderTextAutosizingEnabled; 90 bool m_embedderTextAutosizingEnabled;
70 float m_embedderDeviceScaleAdjustment; 91 float m_embedderDeviceScaleAdjustment;
71 bool m_embedderPreferCompositingToLCDTextEnabled; 92 bool m_embedderPreferCompositingToLCDTextEnabled;
72 WebViewportStyle m_embedderViewportStyle; 93 WebViewportStyle m_embedderViewportStyle;
73 bool m_embedderPluginsEnabled; 94 bool m_embedderPluginsEnabled;
(...skipping 12 matching lines...) Expand all
86 std::unique_ptr<IntPoint> m_lastPinchAnchorCss; 107 std::unique_ptr<IntPoint> m_lastPinchAnchorCss;
87 std::unique_ptr<IntPoint> m_lastPinchAnchorDip; 108 std::unique_ptr<IntPoint> m_lastPinchAnchorDip;
88 109
89 bool m_embedderScriptEnabled; 110 bool m_embedderScriptEnabled;
90 bool m_scriptExecutionDisabled; 111 bool m_scriptExecutionDisabled;
91 }; 112 };
92 113
93 } // namespace blink 114 } // namespace blink
94 115
95 #endif 116 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698