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

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: 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 // 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/WebFloatPoint.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 IntRect;
23 class TransformationMatrix;
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 forceViewport(const WebFloatPoint& position, float scale);
chrishtr 2016/08/22 22:00:42 Scale after position, or before? Units for positio
Eric Seckler 2016/08/23 09:32:19 Units are documented in the corresponding protocol
53 void resetViewport();
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 a viewport override.
61 void mainFrameScrollOrScaleChanged();
62
63 // Returns a custom visible content rect if a viewport override is active.
64 // This ensures that all content inside the forced viewport is painted.
65 WTF::Optional<IntRect> visibleContentRectForPainting() const;
66
52 private: 67 private:
53 explicit DevToolsEmulator(WebViewImpl*); 68 explicit DevToolsEmulator(WebViewImpl*);
54 69
55 void enableMobileEmulation(); 70 void enableMobileEmulation();
56 void disableMobileEmulation(); 71 void disableMobileEmulation();
57 72
73 void applyDeviceEmulationTransform(TransformationMatrix*);
74 void applyViewportOverride(TransformationMatrix*);
75 void updateRootLayerTransform();
76
58 WebViewImpl* m_webViewImpl; 77 WebViewImpl* m_webViewImpl;
59 78
60 bool m_deviceMetricsEnabled; 79 bool m_deviceMetricsEnabled;
61 bool m_emulateMobileEnabled; 80 bool m_emulateMobileEnabled;
62 WebDeviceEmulationParams m_emulationParams; 81 WebDeviceEmulationParams m_emulationParams;
63 82
83 struct ViewportOverride {
84 WebFloatPoint position;
85 double scale;
86 bool originalVisualViewportMasking;
87 };
88 WTF::Optional<ViewportOverride> m_viewportOverride;
89
64 bool m_isOverlayScrollbarsEnabled; 90 bool m_isOverlayScrollbarsEnabled;
65 bool m_isOrientationEventEnabled; 91 bool m_isOrientationEventEnabled;
66 bool m_isMobileLayoutThemeEnabled; 92 bool m_isMobileLayoutThemeEnabled;
67 float m_originalDefaultMinimumPageScaleFactor; 93 float m_originalDefaultMinimumPageScaleFactor;
68 float m_originalDefaultMaximumPageScaleFactor; 94 float m_originalDefaultMaximumPageScaleFactor;
69 bool m_embedderTextAutosizingEnabled; 95 bool m_embedderTextAutosizingEnabled;
70 float m_embedderDeviceScaleAdjustment; 96 float m_embedderDeviceScaleAdjustment;
71 bool m_embedderPreferCompositingToLCDTextEnabled; 97 bool m_embedderPreferCompositingToLCDTextEnabled;
72 WebViewportStyle m_embedderViewportStyle; 98 WebViewportStyle m_embedderViewportStyle;
73 bool m_embedderPluginsEnabled; 99 bool m_embedderPluginsEnabled;
(...skipping 12 matching lines...) Expand all
86 std::unique_ptr<IntPoint> m_lastPinchAnchorCss; 112 std::unique_ptr<IntPoint> m_lastPinchAnchorCss;
87 std::unique_ptr<IntPoint> m_lastPinchAnchorDip; 113 std::unique_ptr<IntPoint> m_lastPinchAnchorDip;
88 114
89 bool m_embedderScriptEnabled; 115 bool m_embedderScriptEnabled;
90 bool m_scriptExecutionDisabled; 116 bool m_scriptExecutionDisabled;
91 }; 117 };
92 118
93 } // namespace blink 119 } // namespace blink
94 120
95 #endif 121 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698