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

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: sync. 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"
13 #include "web/WebExport.h"
12 #include "wtf/Forward.h" 14 #include "wtf/Forward.h"
15 #include "wtf/Optional.h"
13 #include <memory> 16 #include <memory>
14 17
15 namespace blink { 18 namespace blink {
16 19
17 class InspectorEmulationAgent; 20 class InspectorEmulationAgent;
18 class IntPoint; 21 class IntPoint;
22 class TransformationMatrix;
23 struct WebFloatRect;
19 class WebInputEvent; 24 class WebInputEvent;
20 class WebViewImpl; 25 class WebViewImpl;
21 26
22 class DevToolsEmulator final : public GarbageCollectedFinalized<DevToolsEmulator > { 27 class WEB_EXPORT DevToolsEmulator final : public GarbageCollectedFinalized<DevTo olsEmulator> {
23 public: 28 public:
24 ~DevToolsEmulator(); 29 ~DevToolsEmulator();
25 static DevToolsEmulator* create(WebViewImpl*); 30 static DevToolsEmulator* create(WebViewImpl*);
26 DECLARE_TRACE(); 31 DECLARE_TRACE();
27 32
28 // Settings overrides. 33 // Settings overrides.
29 void setTextAutosizingEnabled(bool); 34 void setTextAutosizingEnabled(bool);
30 void setDeviceScaleAdjustment(float); 35 void setDeviceScaleAdjustment(float);
31 void setPreferCompositingToLCDTextEnabled(bool); 36 void setPreferCompositingToLCDTextEnabled(bool);
32 void setViewportStyle(WebViewportStyle); 37 void setViewportStyle(WebViewportStyle);
33 void setPluginsEnabled(bool); 38 void setPluginsEnabled(bool);
34 void setScriptEnabled(bool); 39 void setScriptEnabled(bool);
35 void setDoubleTapToZoomEnabled(bool); 40 void setDoubleTapToZoomEnabled(bool);
36 bool doubleTapToZoomEnabled() const; 41 bool doubleTapToZoomEnabled() const;
37 void setAvailablePointerTypes(int); 42 void setAvailablePointerTypes(int);
38 void setPrimaryPointerType(PointerType); 43 void setPrimaryPointerType(PointerType);
39 void setAvailableHoverTypes(int); 44 void setAvailableHoverTypes(int);
40 void setPrimaryHoverType(HoverType); 45 void setPrimaryHoverType(HoverType);
41 void setMainFrameResizesAreOrientationChanges(bool); 46 void setMainFrameResizesAreOrientationChanges(bool);
42 bool mainFrameResizesAreOrientationChanges() const; 47 bool mainFrameResizesAreOrientationChanges() const;
43 48
44 // Emulation. 49 // Emulation.
45 void enableDeviceEmulation(const WebDeviceEmulationParams&); 50 void enableDeviceEmulation(const WebDeviceEmulationParams&);
46 void disableDeviceEmulation(); 51 void disableDeviceEmulation();
52 void setVisualTransformOverride(const WebFloatRect& area, float scale);
53 void clearVisualTransformOverride();
47 bool resizeIsDeviceSizeChange(); 54 bool resizeIsDeviceSizeChange();
48 void setTouchEventEmulationEnabled(bool); 55 void setTouchEventEmulationEnabled(bool);
49 bool handleInputEvent(const WebInputEvent&); 56 bool handleInputEvent(const WebInputEvent&);
50 void setScriptExecutionDisabled(bool); 57 void setScriptExecutionDisabled(bool);
51 58
59 // Notify the DevToolsEmulator about a scroll or scale change of the main
60 // frame. Updates the transform for an visual transform override.
61 void mainFrameScrollOrScaleChanged();
62
52 private: 63 private:
53 explicit DevToolsEmulator(WebViewImpl*); 64 explicit DevToolsEmulator(WebViewImpl*);
54 65
55 void enableMobileEmulation(); 66 void enableMobileEmulation();
56 void disableMobileEmulation(); 67 void disableMobileEmulation();
57 68
69 void applyDeviceEmulationTransform(TransformationMatrix*);
70 void applyVisualTransformOverride(TransformationMatrix*);
71 void updateRootLayerTransform();
72
58 WebViewImpl* m_webViewImpl; 73 WebViewImpl* m_webViewImpl;
59 74
60 bool m_deviceMetricsEnabled; 75 bool m_deviceMetricsEnabled;
61 bool m_emulateMobileEnabled; 76 bool m_emulateMobileEnabled;
62 WebDeviceEmulationParams m_emulationParams; 77 WebDeviceEmulationParams m_emulationParams;
63 78
79 struct VisualTransformOverride {
80 WebFloatRect area;
81 double scale;
82 bool originalVisualViewportMasking;
83 };
84 WTF::Optional<VisualTransformOverride> m_visualTransformOverride;
85
64 bool m_isOverlayScrollbarsEnabled; 86 bool m_isOverlayScrollbarsEnabled;
65 bool m_isOrientationEventEnabled; 87 bool m_isOrientationEventEnabled;
66 bool m_isMobileLayoutThemeEnabled; 88 bool m_isMobileLayoutThemeEnabled;
67 float m_originalDefaultMinimumPageScaleFactor; 89 float m_originalDefaultMinimumPageScaleFactor;
68 float m_originalDefaultMaximumPageScaleFactor; 90 float m_originalDefaultMaximumPageScaleFactor;
69 bool m_embedderTextAutosizingEnabled; 91 bool m_embedderTextAutosizingEnabled;
70 float m_embedderDeviceScaleAdjustment; 92 float m_embedderDeviceScaleAdjustment;
71 bool m_embedderPreferCompositingToLCDTextEnabled; 93 bool m_embedderPreferCompositingToLCDTextEnabled;
72 WebViewportStyle m_embedderViewportStyle; 94 WebViewportStyle m_embedderViewportStyle;
73 bool m_embedderPluginsEnabled; 95 bool m_embedderPluginsEnabled;
(...skipping 12 matching lines...) Expand all
86 std::unique_ptr<IntPoint> m_lastPinchAnchorCss; 108 std::unique_ptr<IntPoint> m_lastPinchAnchorCss;
87 std::unique_ptr<IntPoint> m_lastPinchAnchorDip; 109 std::unique_ptr<IntPoint> m_lastPinchAnchorDip;
88 110
89 bool m_embedderScriptEnabled; 111 bool m_embedderScriptEnabled;
90 bool m_scriptExecutionDisabled; 112 bool m_scriptExecutionDisabled;
91 }; 113 };
92 114
93 } // namespace blink 115 } // namespace blink
94 116
95 #endif 117 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698