| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 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 | 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 | 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. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #ifndef InspectorOverlayImpl_h | 29 #ifndef InspectorOverlayImpl_h |
| 30 #define InspectorOverlayImpl_h | 30 #define InspectorOverlayImpl_h |
| 31 | 31 |
| 32 #include "core/InspectorTypeBuilder.h" | 32 #include "core/InspectorTypeBuilder.h" |
| 33 #include "core/inspector/InspectorOverlay.h" | 33 #include "core/inspector/InspectorDOMAgent.h" |
| 34 #include "core/inspector/InspectorHighlight.h" |
| 34 #include "core/inspector/InspectorOverlayHost.h" | 35 #include "core/inspector/InspectorOverlayHost.h" |
| 36 #include "core/inspector/InspectorPageAgent.h" |
| 37 #include "core/inspector/InspectorProfilerAgent.h" |
| 35 #include "platform/Timer.h" | 38 #include "platform/Timer.h" |
| 36 #include "platform/geometry/FloatQuad.h" | 39 #include "platform/geometry/FloatQuad.h" |
| 37 #include "platform/geometry/LayoutRect.h" | 40 #include "platform/geometry/LayoutRect.h" |
| 38 #include "platform/graphics/Color.h" | 41 #include "platform/graphics/Color.h" |
| 39 #include "platform/heap/Handle.h" | 42 #include "platform/heap/Handle.h" |
| 40 #include "public/web/WebInputEvent.h" | 43 #include "public/web/WebInputEvent.h" |
| 41 #include "wtf/OwnPtr.h" | 44 #include "wtf/OwnPtr.h" |
| 42 #include "wtf/PassOwnPtr.h" | 45 #include "wtf/PassOwnPtr.h" |
| 43 #include "wtf/RefPtr.h" | 46 #include "wtf/RefPtr.h" |
| 44 #include "wtf/text/WTFString.h" | 47 #include "wtf/text/WTFString.h" |
| 45 | 48 |
| 46 namespace blink { | 49 namespace blink { |
| 47 | 50 |
| 48 class Color; | 51 class Color; |
| 49 class EmptyChromeClient; | 52 class EmptyChromeClient; |
| 50 class LocalFrame; | 53 class LocalFrame; |
| 51 class GraphicsContext; | 54 class GraphicsContext; |
| 52 class GraphicsLayer; | 55 class GraphicsLayer; |
| 56 class InspectorCSSAgent; |
| 57 class InspectorDebuggerAgent; |
| 53 class JSONValue; | 58 class JSONValue; |
| 54 class LayoutEditor; | 59 class LayoutEditor; |
| 55 class Node; | 60 class Node; |
| 56 class Page; | 61 class Page; |
| 57 class PageOverlay; | 62 class PageOverlay; |
| 58 class WebViewImpl; | 63 class WebViewImpl; |
| 59 | 64 |
| 60 class InspectorOverlayImpl final : public NoBaseWillBeGarbageCollectedFinalized<
InspectorOverlayImpl>, public InspectorOverlay, public InspectorOverlayHost::Deb
uggerListener { | 65 class InspectorOverlayImpl final |
| 66 : public NoBaseWillBeGarbageCollectedFinalized<InspectorOverlayImpl> |
| 67 , public InspectorDOMAgent::Client |
| 68 , public InspectorPageAgent::Client |
| 69 , public InspectorProfilerAgent::Client |
| 70 , public InspectorOverlayHost::DebuggerListener { |
| 61 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InspectorOverlayImpl); | 71 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InspectorOverlayImpl); |
| 62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(InspectorOverlayImpl); | 72 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(InspectorOverlayImpl); |
| 63 public: | 73 public: |
| 64 // FIXME: remove this once overlay works for non-main frame. | |
| 65 static PassOwnPtrWillBeRawPtr<InspectorOverlay> createEmpty(); | |
| 66 | |
| 67 static PassOwnPtrWillBeRawPtr<InspectorOverlayImpl> create(WebViewImpl* webV
iewImpl) | 74 static PassOwnPtrWillBeRawPtr<InspectorOverlayImpl> create(WebViewImpl* webV
iewImpl) |
| 68 { | 75 { |
| 69 return adoptPtrWillBeNoop(new InspectorOverlayImpl(webViewImpl)); | 76 return adoptPtrWillBeNoop(new InspectorOverlayImpl(webViewImpl)); |
| 70 } | 77 } |
| 71 | 78 |
| 72 ~InspectorOverlayImpl() override; | 79 ~InspectorOverlayImpl() override; |
| 73 DECLARE_TRACE(); | 80 DECLARE_TRACE(); |
| 74 | 81 |
| 75 // InspectorOverlay implementation. | 82 void init(InspectorCSSAgent*, InspectorDebuggerAgent*); |
| 76 void update() override; | 83 |
| 84 void update(); |
| 85 void clear(); |
| 86 bool handleInputEvent(const WebInputEvent&); |
| 87 void layout(); |
| 88 PageOverlay* pageOverlay() { return m_pageOverlay.get(); }; |
| 89 |
| 90 private: |
| 91 explicit InspectorOverlayImpl(WebViewImpl*); |
| 92 class InspectorOverlayChromeClient; |
| 93 class InspectorPageOverlayDelegate; |
| 94 |
| 95 // InspectorOverlayHost::DebuggerListener implementation. |
| 96 void overlayResumed() override; |
| 97 void overlaySteppedOver() override; |
| 98 |
| 99 // InspectorProfilerAgent::Client implementation. |
| 100 void profilingStarted() override; |
| 101 void profilingStopped() override; |
| 102 |
| 103 // InspectorPageAgent::Client implementation. |
| 104 void pageLayoutInvalidated(bool resized) override; |
| 105 void setShowViewportSizeOnResize(bool show, bool showGrid) override; |
| 77 void setPausedInDebuggerMessage(const String*) override; | 106 void setPausedInDebuggerMessage(const String*) override; |
| 107 |
| 108 // InspectorDOMAgent::Client implementation. |
| 78 void setInspectModeEnabled(bool) override; | 109 void setInspectModeEnabled(bool) override; |
| 79 void hideHighlight() override; | 110 void hideHighlight() override; |
| 80 void highlightNode(Node*, Node* eventTarget, const InspectorHighlightConfig&
, bool omitTooltip) override; | 111 void highlightNode(Node*, Node* eventTarget, const InspectorHighlightConfig&
, bool omitTooltip) override; |
| 81 void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlightConfig&) o
verride; | 112 void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlightConfig&) o
verride; |
| 82 void showAndHideViewSize(bool showGrid) override; | |
| 83 void setListener(InspectorOverlay::Listener* listener) override { m_listener
= listener; } | |
| 84 void suspendUpdates() override; | |
| 85 void resumeUpdates() override; | |
| 86 void clear() override; | |
| 87 void setLayoutEditor(PassOwnPtrWillBeRawPtr<LayoutEditor>) override; | |
| 88 | |
| 89 bool handleInputEvent(const WebInputEvent&); | |
| 90 void layout(); | |
| 91 PageOverlay* pageOverlay() { return m_pageOverlay.get(); }; | |
| 92 private: | |
| 93 explicit InspectorOverlayImpl(WebViewImpl*); | |
| 94 class InspectorOverlayChromeClient; | |
| 95 class InspectorPageOverlayDelegate; | |
| 96 // InspectorOverlayHost::DebuggerListener implementation. | |
| 97 void overlayResumed() override; | |
| 98 void overlaySteppedOver() override; | |
| 99 | 113 |
| 100 bool isEmpty(); | 114 bool isEmpty(); |
| 101 void drawNodeHighlight(); | 115 void drawNodeHighlight(); |
| 102 void drawQuadHighlight(); | 116 void drawQuadHighlight(); |
| 103 void drawPausedInDebuggerMessage(); | 117 void drawPausedInDebuggerMessage(); |
| 104 void drawViewSize(); | 118 void drawViewSize(); |
| 105 | 119 |
| 106 Page* overlayPage(); | 120 Page* overlayPage(); |
| 107 LocalFrame* overlayMainFrame(); | 121 LocalFrame* overlayMainFrame(); |
| 108 void reset(const IntSize& viewportSize, const IntPoint& documentScrollOffset
); | 122 void reset(const IntSize& viewportSize, const IntPoint& documentScrollOffset
); |
| 109 void evaluateInOverlay(const String& method, const String& argument); | 123 void evaluateInOverlay(const String& method, const String& argument); |
| 110 void evaluateInOverlay(const String& method, PassRefPtr<JSONValue> argument)
; | 124 void evaluateInOverlay(const String& method, PassRefPtr<JSONValue> argument)
; |
| 111 void onTimer(Timer<InspectorOverlayImpl>*); | 125 void onTimer(Timer<InspectorOverlayImpl>*); |
| 112 void rebuildOverlayPage(); | 126 void rebuildOverlayPage(); |
| 113 void invalidate(); | 127 void invalidate(); |
| 114 | 128 |
| 115 WebViewImpl* m_webViewImpl; | 129 WebViewImpl* m_webViewImpl; |
| 116 String m_pausedInDebuggerMessage; | 130 String m_pausedInDebuggerMessage; |
| 117 bool m_inspectModeEnabled; | 131 bool m_inspectModeEnabled; |
| 118 RefPtrWillBeMember<Node> m_highlightNode; | 132 RefPtrWillBeMember<Node> m_highlightNode; |
| 119 RefPtrWillBeMember<Node> m_eventTargetNode; | 133 RefPtrWillBeMember<Node> m_eventTargetNode; |
| 120 InspectorHighlightConfig m_nodeHighlightConfig; | 134 InspectorHighlightConfig m_nodeHighlightConfig; |
| 121 OwnPtr<FloatQuad> m_highlightQuad; | 135 OwnPtr<FloatQuad> m_highlightQuad; |
| 122 OwnPtrWillBeMember<Page> m_overlayPage; | 136 OwnPtrWillBeMember<Page> m_overlayPage; |
| 123 OwnPtrWillBeMember<InspectorOverlayChromeClient> m_overlayChromeClient; | 137 OwnPtrWillBeMember<InspectorOverlayChromeClient> m_overlayChromeClient; |
| 124 RefPtrWillBeMember<InspectorOverlayHost> m_overlayHost; | 138 RefPtrWillBeMember<InspectorOverlayHost> m_overlayHost; |
| 125 InspectorHighlightConfig m_quadHighlightConfig; | 139 InspectorHighlightConfig m_quadHighlightConfig; |
| 126 bool m_drawViewSize; | 140 bool m_drawViewSize; |
| 127 bool m_drawViewSizeWithGrid; | 141 bool m_drawViewSizeWithGrid; |
| 142 bool m_resizeTimerActive; |
| 128 bool m_omitTooltip; | 143 bool m_omitTooltip; |
| 129 Timer<InspectorOverlayImpl> m_timer; | 144 Timer<InspectorOverlayImpl> m_timer; |
| 130 int m_suspendCount; | 145 int m_suspendCount; |
| 131 bool m_inLayout; | 146 bool m_inLayout; |
| 132 bool m_needsUpdate; | 147 bool m_needsUpdate; |
| 133 RawPtrWillBeMember<InspectorOverlay::Listener> m_listener; | 148 RawPtrWillBeMember<InspectorDebuggerAgent> m_debuggerAgent; |
| 134 OwnPtrWillBeMember<LayoutEditor> m_layoutEditor; | 149 OwnPtrWillBeMember<LayoutEditor> m_layoutEditor; |
| 135 OwnPtr<PageOverlay> m_pageOverlay; | 150 OwnPtr<PageOverlay> m_pageOverlay; |
| 136 }; | 151 }; |
| 137 | 152 |
| 138 } // namespace blink | 153 } // namespace blink |
| 139 | 154 |
| 140 | 155 |
| 141 #endif // InspectorOverlayImpl_h | 156 #endif // InspectorOverlayImpl_h |
| OLD | NEW |