OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | |
14 * its contributors may be used to endorse or promote products derived | |
15 * from this software without specific prior written permission. | |
16 * | |
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 */ | |
28 | |
29 #ifndef InspectorOverlay_h | |
30 #define InspectorOverlay_h | |
31 | |
32 #include <v8-inspector.h> | |
33 #include <memory> | |
34 #include "core/inspector/InspectorDOMAgent.h" | |
35 #include "core/inspector/InspectorOverlayHost.h" | |
36 #include "core/inspector/protocol/Forward.h" | |
37 #include "platform/Timer.h" | |
38 #include "platform/geometry/FloatQuad.h" | |
39 #include "platform/geometry/LayoutRect.h" | |
40 #include "platform/graphics/Color.h" | |
41 #include "platform/heap/Handle.h" | |
42 #include "platform/wtf/RefPtr.h" | |
43 #include "platform/wtf/text/WTFString.h" | |
44 #include "public/platform/WebInputEvent.h" | |
45 | |
46 namespace blink { | |
47 | |
48 class Color; | |
49 class LocalFrame; | |
50 class Node; | |
51 class Page; | |
52 class PageOverlay; | |
53 class WebGestureEvent; | |
54 class WebMouseEvent; | |
55 class WebLocalFrameImpl; | |
56 class WebTouchEvent; | |
57 | |
58 namespace protocol { | |
59 class Value; | |
60 } | |
61 | |
62 class InspectorOverlay final | |
63 : public GarbageCollectedFinalized<InspectorOverlay>, | |
64 public InspectorDOMAgent::Client, | |
65 public InspectorOverlayHost::Listener { | |
66 USING_GARBAGE_COLLECTED_MIXIN(InspectorOverlay); | |
67 | |
68 public: | |
69 explicit InspectorOverlay(WebLocalFrameImpl*); | |
70 ~InspectorOverlay() override; | |
71 DECLARE_TRACE(); | |
72 | |
73 void Init(v8_inspector::V8InspectorSession*, InspectorDOMAgent*); | |
74 | |
75 void Clear(); | |
76 void Suspend(); | |
77 void Resume(); | |
78 bool HandleInputEvent(const WebInputEvent&); | |
79 void PageLayoutInvalidated(bool resized); | |
80 void SetShowViewportSizeOnResize(bool); | |
81 void ShowReloadingBlanket(); | |
82 void HideReloadingBlanket(); | |
83 void SetPausedInDebuggerMessage(const String&); | |
84 | |
85 // Does not yet include paint. | |
86 void UpdateAllLifecyclePhases(); | |
87 | |
88 PageOverlay* GetPageOverlay() { return page_overlay_.get(); }; | |
89 String EvaluateInOverlayForTest(const String&); | |
90 | |
91 private: | |
92 class InspectorOverlayChromeClient; | |
93 class InspectorPageOverlayDelegate; | |
94 | |
95 // InspectorOverlayHost::Listener implementation. | |
96 void OverlayResumed() override; | |
97 void OverlaySteppedOver() override; | |
98 | |
99 // InspectorDOMAgent::Client implementation. | |
100 void HideHighlight() override; | |
101 void HighlightNode(Node*, | |
102 const InspectorHighlightConfig&, | |
103 bool omit_tooltip) override; | |
104 void HighlightQuad(std::unique_ptr<FloatQuad>, | |
105 const InspectorHighlightConfig&) override; | |
106 void SetInspectMode(InspectorDOMAgent::SearchMode, | |
107 std::unique_ptr<InspectorHighlightConfig>) override; | |
108 | |
109 void HighlightNode(Node*, | |
110 Node* event_target, | |
111 const InspectorHighlightConfig&, | |
112 bool omit_tooltip); | |
113 bool IsEmpty(); | |
114 void DrawNodeHighlight(); | |
115 void DrawQuadHighlight(); | |
116 void DrawPausedInDebuggerMessage(); | |
117 void DrawViewSize(); | |
118 | |
119 float WindowToViewportScale() const; | |
120 | |
121 Page* OverlayPage(); | |
122 LocalFrame* OverlayMainFrame(); | |
123 void Reset(const IntSize& viewport_size, | |
124 const IntPoint& document_scroll_offset); | |
125 void EvaluateInOverlay(const String& method, const String& argument); | |
126 void EvaluateInOverlay(const String& method, | |
127 std::unique_ptr<protocol::Value> argument); | |
128 void OnTimer(TimerBase*); | |
129 void RebuildOverlayPage(); | |
130 void Invalidate(); | |
131 void ScheduleUpdate(); | |
132 void ClearInternal(); | |
133 | |
134 bool HandleMouseDown(); | |
135 bool HandleMouseUp(); | |
136 bool HandleGestureEvent(const WebGestureEvent&); | |
137 bool HandleTouchEvent(const WebTouchEvent&); | |
138 bool HandleMouseMove(const WebMouseEvent&); | |
139 bool ShouldSearchForNode(); | |
140 void Inspect(Node*); | |
141 | |
142 Member<WebLocalFrameImpl> frame_impl_; | |
143 String paused_in_debugger_message_; | |
144 Member<Node> highlight_node_; | |
145 Member<Node> event_target_node_; | |
146 InspectorHighlightConfig node_highlight_config_; | |
147 std::unique_ptr<FloatQuad> highlight_quad_; | |
148 Member<Page> overlay_page_; | |
149 Member<InspectorOverlayChromeClient> overlay_chrome_client_; | |
150 Member<InspectorOverlayHost> overlay_host_; | |
151 InspectorHighlightConfig quad_highlight_config_; | |
152 bool draw_view_size_; | |
153 bool resize_timer_active_; | |
154 bool omit_tooltip_; | |
155 TaskRunnerTimer<InspectorOverlay> timer_; | |
156 bool suspended_; | |
157 bool show_reloading_blanket_; | |
158 bool in_layout_; | |
159 bool needs_update_; | |
160 v8_inspector::V8InspectorSession* v8_session_; | |
161 Member<InspectorDOMAgent> dom_agent_; | |
162 std::unique_ptr<PageOverlay> page_overlay_; | |
163 Member<Node> hovered_node_for_inspect_mode_; | |
164 bool swallow_next_mouse_up_; | |
165 InspectorDOMAgent::SearchMode inspect_mode_; | |
166 std::unique_ptr<InspectorHighlightConfig> inspect_mode_highlight_config_; | |
167 }; | |
168 | |
169 } // namespace blink | |
170 | |
171 #endif // InspectorOverlay_h | |
OLD | NEW |