| 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 InspectorOverlayImpl_h | |
| 30 #define InspectorOverlayImpl_h | |
| 31 | |
| 32 #include "core/InspectorTypeBuilder.h" | |
| 33 #include "core/inspector/InspectorDOMAgent.h" | |
| 34 #include "core/inspector/InspectorOverlayHost.h" | |
| 35 #include "core/inspector/InspectorPageAgent.h" | |
| 36 #include "core/inspector/InspectorProfilerAgent.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 "public/web/WebInputEvent.h" | |
| 43 #include "wtf/OwnPtr.h" | |
| 44 #include "wtf/PassOwnPtr.h" | |
| 45 #include "wtf/RefPtr.h" | |
| 46 #include "wtf/text/WTFString.h" | |
| 47 | |
| 48 namespace blink { | |
| 49 | |
| 50 class Color; | |
| 51 class EmptyChromeClient; | |
| 52 class LocalFrame; | |
| 53 class GraphicsContext; | |
| 54 class GraphicsLayer; | |
| 55 class InspectorCSSAgent; | |
| 56 class InspectorDebuggerAgent; | |
| 57 class JSONValue; | |
| 58 class LayoutEditor; | |
| 59 class Node; | |
| 60 class Page; | |
| 61 class PageOverlay; | |
| 62 class WebViewImpl; | |
| 63 | |
| 64 class InspectorOverlayImpl final | |
| 65 : public NoBaseWillBeGarbageCollectedFinalized<InspectorOverlayImpl> | |
| 66 , public InspectorDOMAgent::Client | |
| 67 , public InspectorPageAgent::Client | |
| 68 , public InspectorProfilerAgent::Client | |
| 69 , public InspectorOverlayHost::Listener { | |
| 70 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InspectorOverlayImpl); | |
| 71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(InspectorOverlayImpl); | |
| 72 public: | |
| 73 static PassOwnPtrWillBeRawPtr<InspectorOverlayImpl> create(WebViewImpl* webV
iewImpl) | |
| 74 { | |
| 75 return adoptPtrWillBeNoop(new InspectorOverlayImpl(webViewImpl)); | |
| 76 } | |
| 77 | |
| 78 ~InspectorOverlayImpl() override; | |
| 79 DECLARE_TRACE(); | |
| 80 | |
| 81 void init(InspectorCSSAgent*, InspectorDebuggerAgent*, InspectorDOMAgent*); | |
| 82 | |
| 83 void clear(); | |
| 84 bool handleInputEvent(const WebInputEvent&); | |
| 85 void layout(); | |
| 86 PageOverlay* pageOverlay() { return m_pageOverlay.get(); }; | |
| 87 | |
| 88 private: | |
| 89 explicit InspectorOverlayImpl(WebViewImpl*); | |
| 90 class InspectorOverlayChromeClient; | |
| 91 class InspectorPageOverlayDelegate; | |
| 92 | |
| 93 // InspectorOverlayHost::Listener implementation. | |
| 94 void overlayResumed() override; | |
| 95 void overlaySteppedOver() override; | |
| 96 void overlayStartedPropertyChange(const String&) override; | |
| 97 void overlayPropertyChanged(float) override; | |
| 98 void overlayEndedPropertyChange() override; | |
| 99 void overlayClearSelection(bool) override; | |
| 100 void overlayNextSelector() override; | |
| 101 void overlayPreviousSelector() override; | |
| 102 String overlayCurrentSelectorInfo() override; | |
| 103 | |
| 104 // InspectorProfilerAgent::Client implementation. | |
| 105 void profilingStarted() override; | |
| 106 void profilingStopped() override; | |
| 107 | |
| 108 // InspectorPageAgent::Client implementation. | |
| 109 void pageLayoutInvalidated(bool resized) override; | |
| 110 void setShowViewportSizeOnResize(bool show, bool showGrid) override; | |
| 111 void setPausedInDebuggerMessage(const String*) override; | |
| 112 | |
| 113 // InspectorDOMAgent::Client implementation. | |
| 114 void hideHighlight() override; | |
| 115 void highlightNode(Node*, const InspectorHighlightConfig&, bool omitTooltip)
override; | |
| 116 void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlightConfig&) o
verride; | |
| 117 void setInspectMode(InspectorDOMAgent::SearchMode, PassOwnPtr<InspectorHighl
ightConfig>) override; | |
| 118 | |
| 119 void highlightNode(Node*, Node* eventTarget, const InspectorHighlightConfig&
, bool omitTooltip); | |
| 120 bool isEmpty(); | |
| 121 void drawNodeHighlight(); | |
| 122 void drawQuadHighlight(); | |
| 123 void drawPausedInDebuggerMessage(); | |
| 124 void drawViewSize(); | |
| 125 | |
| 126 Page* overlayPage(); | |
| 127 LocalFrame* overlayMainFrame(); | |
| 128 void reset(const IntSize& viewportSize, const IntPoint& documentScrollOffset
); | |
| 129 void evaluateInOverlay(const String& method, const String& argument); | |
| 130 void evaluateInOverlay(const String& method, PassRefPtr<JSONValue> argument)
; | |
| 131 void onTimer(Timer<InspectorOverlayImpl>*); | |
| 132 void rebuildOverlayPage(); | |
| 133 void invalidate(); | |
| 134 void scheduleUpdate(); | |
| 135 | |
| 136 bool handleMousePress(); | |
| 137 bool handleGestureEvent(const PlatformGestureEvent&); | |
| 138 bool handleTouchEvent(const PlatformTouchEvent&); | |
| 139 bool handleMouseMove(const PlatformMouseEvent&); | |
| 140 bool shouldSearchForNode(); | |
| 141 void inspect(Node*); | |
| 142 | |
| 143 WebViewImpl* m_webViewImpl; | |
| 144 String m_pausedInDebuggerMessage; | |
| 145 RefPtrWillBeMember<Node> m_highlightNode; | |
| 146 RefPtrWillBeMember<Node> m_eventTargetNode; | |
| 147 InspectorHighlightConfig m_nodeHighlightConfig; | |
| 148 OwnPtr<FloatQuad> m_highlightQuad; | |
| 149 OwnPtrWillBeMember<Page> m_overlayPage; | |
| 150 OwnPtrWillBeMember<InspectorOverlayChromeClient> m_overlayChromeClient; | |
| 151 RefPtrWillBeMember<InspectorOverlayHost> m_overlayHost; | |
| 152 InspectorHighlightConfig m_quadHighlightConfig; | |
| 153 bool m_drawViewSize; | |
| 154 bool m_drawViewSizeWithGrid; | |
| 155 bool m_resizeTimerActive; | |
| 156 bool m_omitTooltip; | |
| 157 Timer<InspectorOverlayImpl> m_timer; | |
| 158 int m_suspendCount; | |
| 159 bool m_inLayout; | |
| 160 bool m_needsUpdate; | |
| 161 RawPtrWillBeMember<InspectorDebuggerAgent> m_debuggerAgent; | |
| 162 RawPtrWillBeMember<InspectorDOMAgent> m_domAgent; | |
| 163 RawPtrWillBeMember<InspectorCSSAgent> m_cssAgent; | |
| 164 OwnPtrWillBeMember<LayoutEditor> m_layoutEditor; | |
| 165 OwnPtr<PageOverlay> m_pageOverlay; | |
| 166 RefPtrWillBeMember<Node> m_hoveredNodeForInspectMode; | |
| 167 InspectorDOMAgent::SearchMode m_inspectMode; | |
| 168 OwnPtr<InspectorHighlightConfig> m_inspectModeHighlightConfig; | |
| 169 }; | |
| 170 | |
| 171 } // namespace blink | |
| 172 | |
| 173 | |
| 174 #endif // InspectorOverlayImpl_h | |
| OLD | NEW |