| 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 |
| 11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | 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 | 14 * its contributors may be used to endorse or promote products derived |
| 15 * from this software without specific prior written permission. | 15 * from this software without specific prior written permission. |
| 16 * | 16 * |
| 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 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 | 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 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 | 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 #include "config.h" | 29 #include "config.h" |
| 30 #include "web/InspectorOverlayImpl.h" | 30 #include "web/InspectorOverlay.h" |
| 31 | 31 |
| 32 #include "bindings/core/v8/ScriptController.h" | 32 #include "bindings/core/v8/ScriptController.h" |
| 33 #include "bindings/core/v8/V8InspectorOverlayHost.h" | 33 #include "bindings/core/v8/V8InspectorOverlayHost.h" |
| 34 #include "core/dom/Node.h" | 34 #include "core/dom/Node.h" |
| 35 #include "core/frame/FrameHost.h" | 35 #include "core/frame/FrameHost.h" |
| 36 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
| 37 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 38 #include "core/frame/Settings.h" | 38 #include "core/frame/Settings.h" |
| 39 #include "core/input/EventHandler.h" | 39 #include "core/input/EventHandler.h" |
| 40 #include "core/inspector/InspectorCSSAgent.h" | 40 #include "core/inspector/InspectorCSSAgent.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 Node* hoveredNodeForEvent(LocalFrame* frame, const PlatformTouchEvent& event, bo
ol ignorePointerEventsNone) | 89 Node* hoveredNodeForEvent(LocalFrame* frame, const PlatformTouchEvent& event, bo
ol ignorePointerEventsNone) |
| 90 { | 90 { |
| 91 const Vector<PlatformTouchPoint>& points = event.touchPoints(); | 91 const Vector<PlatformTouchPoint>& points = event.touchPoints(); |
| 92 if (!points.size()) | 92 if (!points.size()) |
| 93 return nullptr; | 93 return nullptr; |
| 94 return hoveredNodeForPoint(frame, roundedIntPoint(points[0].pos()), ignorePo
interEventsNone); | 94 return hoveredNodeForPoint(frame, roundedIntPoint(points[0].pos()), ignorePo
interEventsNone); |
| 95 } | 95 } |
| 96 } // namespace | 96 } // namespace |
| 97 | 97 |
| 98 class InspectorOverlayImpl::InspectorPageOverlayDelegate final : public PageOver
lay::Delegate { | 98 class InspectorOverlay::InspectorPageOverlayDelegate final : public PageOverlay:
:Delegate { |
| 99 public: | 99 public: |
| 100 explicit InspectorPageOverlayDelegate(InspectorOverlayImpl& overlay) | 100 explicit InspectorPageOverlayDelegate(InspectorOverlay& overlay) |
| 101 : m_overlay(&overlay) | 101 : m_overlay(&overlay) |
| 102 { } | 102 { } |
| 103 | 103 |
| 104 DEFINE_INLINE_VIRTUAL_TRACE() | 104 DEFINE_INLINE_VIRTUAL_TRACE() |
| 105 { | 105 { |
| 106 visitor->trace(m_overlay); | 106 visitor->trace(m_overlay); |
| 107 PageOverlay::Delegate::trace(visitor); | 107 PageOverlay::Delegate::trace(visitor); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void paintPageOverlay(WebGraphicsContext* context, const WebSize& webViewSiz
e) | 110 void paintPageOverlay(WebGraphicsContext* context, const WebSize& webViewSiz
e) |
| 111 { | 111 { |
| 112 if (m_overlay->isEmpty()) | 112 if (m_overlay->isEmpty()) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 GraphicsContext& graphicsContext = toWebGraphicsContextImpl(context)->gr
aphicsContext(); | 115 GraphicsContext& graphicsContext = toWebGraphicsContextImpl(context)->gr
aphicsContext(); |
| 116 FrameView* view = m_overlay->overlayMainFrame()->view(); | 116 FrameView* view = m_overlay->overlayMainFrame()->view(); |
| 117 ASSERT(!view->needsLayout()); | 117 ASSERT(!view->needsLayout()); |
| 118 view->paint(&graphicsContext, IntRect(0, 0, view->width(), view->height(
))); | 118 view->paint(&graphicsContext, IntRect(0, 0, view->width(), view->height(
))); |
| 119 } | 119 } |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 RawPtrWillBeMember<InspectorOverlayImpl> m_overlay; | 122 RawPtrWillBeMember<InspectorOverlay> m_overlay; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 | 125 |
| 126 class InspectorOverlayImpl::InspectorOverlayChromeClient final : public EmptyChr
omeClient { | 126 class InspectorOverlay::InspectorOverlayChromeClient final : public EmptyChromeC
lient { |
| 127 public: | 127 public: |
| 128 static PassOwnPtrWillBeRawPtr<InspectorOverlayChromeClient> create(ChromeCli
ent& client, InspectorOverlayImpl& overlay) | 128 static PassOwnPtrWillBeRawPtr<InspectorOverlayChromeClient> create(ChromeCli
ent& client, InspectorOverlay& overlay) |
| 129 { | 129 { |
| 130 return adoptPtrWillBeNoop(new InspectorOverlayChromeClient(client, overl
ay)); | 130 return adoptPtrWillBeNoop(new InspectorOverlayChromeClient(client, overl
ay)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 DEFINE_INLINE_VIRTUAL_TRACE() | 133 DEFINE_INLINE_VIRTUAL_TRACE() |
| 134 { | 134 { |
| 135 visitor->trace(m_client); | 135 visitor->trace(m_client); |
| 136 visitor->trace(m_overlay); | 136 visitor->trace(m_overlay); |
| 137 EmptyChromeClient::trace(visitor); | 137 EmptyChromeClient::trace(visitor); |
| 138 } | 138 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 157 | 157 |
| 158 void scheduleAnimation() override | 158 void scheduleAnimation() override |
| 159 { | 159 { |
| 160 if (m_overlay->m_inLayout) | 160 if (m_overlay->m_inLayout) |
| 161 return; | 161 return; |
| 162 | 162 |
| 163 m_client->scheduleAnimation(); | 163 m_client->scheduleAnimation(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 private: | 166 private: |
| 167 InspectorOverlayChromeClient(ChromeClient& client, InspectorOverlayImpl& ove
rlay) | 167 InspectorOverlayChromeClient(ChromeClient& client, InspectorOverlay& overlay
) |
| 168 : m_client(&client) | 168 : m_client(&client) |
| 169 , m_overlay(&overlay) | 169 , m_overlay(&overlay) |
| 170 { } | 170 { } |
| 171 | 171 |
| 172 RawPtrWillBeMember<ChromeClient> m_client; | 172 RawPtrWillBeMember<ChromeClient> m_client; |
| 173 RawPtrWillBeMember<InspectorOverlayImpl> m_overlay; | 173 RawPtrWillBeMember<InspectorOverlay> m_overlay; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 | 176 |
| 177 InspectorOverlayImpl::InspectorOverlayImpl(WebViewImpl* webViewImpl) | 177 InspectorOverlay::InspectorOverlay(WebViewImpl* webViewImpl) |
| 178 : m_webViewImpl(webViewImpl) | 178 : m_webViewImpl(webViewImpl) |
| 179 , m_overlayHost(InspectorOverlayHost::create()) | 179 , m_overlayHost(InspectorOverlayHost::create()) |
| 180 , m_drawViewSize(false) | 180 , m_drawViewSize(false) |
| 181 , m_drawViewSizeWithGrid(false) | 181 , m_drawViewSizeWithGrid(false) |
| 182 , m_resizeTimerActive(false) | 182 , m_resizeTimerActive(false) |
| 183 , m_omitTooltip(false) | 183 , m_omitTooltip(false) |
| 184 , m_timer(this, &InspectorOverlayImpl::onTimer) | 184 , m_timer(this, &InspectorOverlay::onTimer) |
| 185 , m_suspendCount(0) | 185 , m_suspendCount(0) |
| 186 , m_inLayout(false) | 186 , m_inLayout(false) |
| 187 , m_needsUpdate(false) | 187 , m_needsUpdate(false) |
| 188 , m_inspectMode(InspectorDOMAgent::NotSearching) | 188 , m_inspectMode(InspectorDOMAgent::NotSearching) |
| 189 { | 189 { |
| 190 } | 190 } |
| 191 | 191 |
| 192 InspectorOverlayImpl::~InspectorOverlayImpl() | 192 InspectorOverlay::~InspectorOverlay() |
| 193 { | 193 { |
| 194 ASSERT(!m_overlayPage); | 194 ASSERT(!m_overlayPage); |
| 195 } | 195 } |
| 196 | 196 |
| 197 DEFINE_TRACE(InspectorOverlayImpl) | 197 DEFINE_TRACE(InspectorOverlay) |
| 198 { | 198 { |
| 199 visitor->trace(m_highlightNode); | 199 visitor->trace(m_highlightNode); |
| 200 visitor->trace(m_eventTargetNode); | 200 visitor->trace(m_eventTargetNode); |
| 201 visitor->trace(m_overlayPage); | 201 visitor->trace(m_overlayPage); |
| 202 visitor->trace(m_overlayChromeClient); | 202 visitor->trace(m_overlayChromeClient); |
| 203 visitor->trace(m_overlayHost); | 203 visitor->trace(m_overlayHost); |
| 204 visitor->trace(m_debuggerAgent); | 204 visitor->trace(m_debuggerAgent); |
| 205 visitor->trace(m_domAgent); | 205 visitor->trace(m_domAgent); |
| 206 visitor->trace(m_cssAgent); | 206 visitor->trace(m_cssAgent); |
| 207 visitor->trace(m_layoutEditor); | 207 visitor->trace(m_layoutEditor); |
| 208 visitor->trace(m_hoveredNodeForInspectMode); | 208 visitor->trace(m_hoveredNodeForInspectMode); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void InspectorOverlayImpl::init(InspectorCSSAgent* cssAgent, InspectorDebuggerAg
ent* debuggerAgent, InspectorDOMAgent* domAgent) | 211 void InspectorOverlay::init(InspectorCSSAgent* cssAgent, InspectorDebuggerAgent*
debuggerAgent, InspectorDOMAgent* domAgent) |
| 212 { | 212 { |
| 213 m_debuggerAgent = debuggerAgent; | 213 m_debuggerAgent = debuggerAgent; |
| 214 m_domAgent = domAgent; | 214 m_domAgent = domAgent; |
| 215 m_cssAgent = cssAgent; | 215 m_cssAgent = cssAgent; |
| 216 m_overlayHost->setListener(this); | 216 m_overlayHost->setListener(this); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void InspectorOverlayImpl::invalidate() | 219 void InspectorOverlay::invalidate() |
| 220 { | 220 { |
| 221 if (!m_pageOverlay) | 221 if (!m_pageOverlay) |
| 222 m_pageOverlay = PageOverlay::create(m_webViewImpl, new InspectorPageOver
layDelegate(*this)); | 222 m_pageOverlay = PageOverlay::create(m_webViewImpl, new InspectorPageOver
layDelegate(*this)); |
| 223 | 223 |
| 224 m_pageOverlay->update(); | 224 m_pageOverlay->update(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void InspectorOverlayImpl::layout() | 227 void InspectorOverlay::layout() |
| 228 { | 228 { |
| 229 if (isEmpty()) | 229 if (isEmpty()) |
| 230 return; | 230 return; |
| 231 | 231 |
| 232 TemporaryChange<bool> scoped(m_inLayout, true); | 232 TemporaryChange<bool> scoped(m_inLayout, true); |
| 233 if (m_needsUpdate) { | 233 if (m_needsUpdate) { |
| 234 m_needsUpdate = false; | 234 m_needsUpdate = false; |
| 235 rebuildOverlayPage(); | 235 rebuildOverlayPage(); |
| 236 } | 236 } |
| 237 overlayMainFrame()->view()->updateAllLifecyclePhases(); | 237 overlayMainFrame()->view()->updateAllLifecyclePhases(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool InspectorOverlayImpl::handleInputEvent(const WebInputEvent& inputEvent) | 240 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) |
| 241 { | 241 { |
| 242 bool handled = false; | 242 bool handled = false; |
| 243 | 243 |
| 244 if (isEmpty()) | 244 if (isEmpty()) |
| 245 return false; | 245 return false; |
| 246 | 246 |
| 247 if (WebInputEvent::isGestureEventType(inputEvent.type) && inputEvent.type ==
WebInputEvent::GestureTap) { | 247 if (WebInputEvent::isGestureEventType(inputEvent.type) && inputEvent.type ==
WebInputEvent::GestureTap) { |
| 248 // Only let GestureTab in (we only need it and we know PlatformGestureEv
entBuilder supports it). | 248 // Only let GestureTab in (we only need it and we know PlatformGestureEv
entBuilder supports it). |
| 249 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder(m_webVie
wImpl->mainFrameImpl()->frameView(), static_cast<const WebGestureEvent&>(inputEv
ent)); | 249 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder(m_webVie
wImpl->mainFrameImpl()->frameView(), static_cast<const WebGestureEvent&>(inputEv
ent)); |
| 250 handled = handleGestureEvent(gestureEvent); | 250 handled = handleGestureEvent(gestureEvent); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 } | 286 } |
| 287 | 287 |
| 288 if (inputEvent.type == WebInputEvent::MouseWheel) { | 288 if (inputEvent.type == WebInputEvent::MouseWheel) { |
| 289 PlatformWheelEvent wheelEvent = PlatformWheelEventBuilder(m_webViewImpl-
>mainFrameImpl()->frameView(), static_cast<const WebMouseWheelEvent&>(inputEvent
)); | 289 PlatformWheelEvent wheelEvent = PlatformWheelEventBuilder(m_webViewImpl-
>mainFrameImpl()->frameView(), static_cast<const WebMouseWheelEvent&>(inputEvent
)); |
| 290 handled = overlayMainFrame()->eventHandler().handleWheelEvent(wheelEvent
); | 290 handled = overlayMainFrame()->eventHandler().handleWheelEvent(wheelEvent
); |
| 291 } | 291 } |
| 292 | 292 |
| 293 return handled; | 293 return handled; |
| 294 } | 294 } |
| 295 | 295 |
| 296 void InspectorOverlayImpl::setPausedInDebuggerMessage(const String* message) | 296 void InspectorOverlay::setPausedInDebuggerMessage(const String* message) |
| 297 { | 297 { |
| 298 m_pausedInDebuggerMessage = message ? *message : String(); | 298 m_pausedInDebuggerMessage = message ? *message : String(); |
| 299 scheduleUpdate(); | 299 scheduleUpdate(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void InspectorOverlayImpl::hideHighlight() | 302 void InspectorOverlay::hideHighlight() |
| 303 { | 303 { |
| 304 m_highlightNode.clear(); | 304 m_highlightNode.clear(); |
| 305 m_eventTargetNode.clear(); | 305 m_eventTargetNode.clear(); |
| 306 m_highlightQuad.clear(); | 306 m_highlightQuad.clear(); |
| 307 | 307 |
| 308 if (m_layoutEditor && m_inspectModeHighlightConfig) | 308 if (m_layoutEditor && m_inspectModeHighlightConfig) |
| 309 highlightNode(m_layoutEditor->element(), *m_inspectModeHighlightConfig,
false); | 309 highlightNode(m_layoutEditor->element(), *m_inspectModeHighlightConfig,
false); |
| 310 else | 310 else |
| 311 scheduleUpdate(); | 311 scheduleUpdate(); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void InspectorOverlayImpl::highlightNode(Node* node, const InspectorHighlightCon
fig& highlightConfig, bool omitTooltip) | 314 void InspectorOverlay::highlightNode(Node* node, const InspectorHighlightConfig&
highlightConfig, bool omitTooltip) |
| 315 { | 315 { |
| 316 highlightNode(node, nullptr, highlightConfig, omitTooltip); | 316 highlightNode(node, nullptr, highlightConfig, omitTooltip); |
| 317 } | 317 } |
| 318 | 318 |
| 319 void InspectorOverlayImpl::highlightNode(Node* node, Node* eventTarget, const In
spectorHighlightConfig& highlightConfig, bool omitTooltip) | 319 void InspectorOverlay::highlightNode(Node* node, Node* eventTarget, const Inspec
torHighlightConfig& highlightConfig, bool omitTooltip) |
| 320 { | 320 { |
| 321 m_nodeHighlightConfig = highlightConfig; | 321 m_nodeHighlightConfig = highlightConfig; |
| 322 m_highlightNode = node; | 322 m_highlightNode = node; |
| 323 m_eventTargetNode = eventTarget; | 323 m_eventTargetNode = eventTarget; |
| 324 m_omitTooltip = omitTooltip; | 324 m_omitTooltip = omitTooltip; |
| 325 scheduleUpdate(); | 325 scheduleUpdate(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void InspectorOverlayImpl::setInspectMode(InspectorDOMAgent::SearchMode searchMo
de, PassOwnPtr<InspectorHighlightConfig> highlightConfig) | 328 void InspectorOverlay::setInspectMode(InspectorDOMAgent::SearchMode searchMode,
PassOwnPtr<InspectorHighlightConfig> highlightConfig) |
| 329 { | 329 { |
| 330 if (m_layoutEditor) | 330 if (m_layoutEditor) |
| 331 overlayClearSelection(true); | 331 overlayClearSelection(true); |
| 332 | 332 |
| 333 m_inspectMode = searchMode; | 333 m_inspectMode = searchMode; |
| 334 scheduleUpdate(); | 334 scheduleUpdate(); |
| 335 | 335 |
| 336 if (searchMode != InspectorDOMAgent::NotSearching) { | 336 if (searchMode != InspectorDOMAgent::NotSearching) { |
| 337 m_inspectModeHighlightConfig = highlightConfig; | 337 m_inspectModeHighlightConfig = highlightConfig; |
| 338 } else { | 338 } else { |
| 339 m_hoveredNodeForInspectMode.clear(); | 339 m_hoveredNodeForInspectMode.clear(); |
| 340 hideHighlight(); | 340 hideHighlight(); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 void InspectorOverlayImpl::highlightQuad(PassOwnPtr<FloatQuad> quad, const Inspe
ctorHighlightConfig& highlightConfig) | 344 void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const Inspector
HighlightConfig& highlightConfig) |
| 345 { | 345 { |
| 346 m_quadHighlightConfig = highlightConfig; | 346 m_quadHighlightConfig = highlightConfig; |
| 347 m_highlightQuad = quad; | 347 m_highlightQuad = quad; |
| 348 m_omitTooltip = false; | 348 m_omitTooltip = false; |
| 349 scheduleUpdate(); | 349 scheduleUpdate(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 bool InspectorOverlayImpl::isEmpty() | 352 bool InspectorOverlay::isEmpty() |
| 353 { | 353 { |
| 354 if (m_suspendCount) | 354 if (m_suspendCount) |
| 355 return true; | 355 return true; |
| 356 bool hasVisibleElements = m_highlightNode || m_eventTargetNode || m_highligh
tQuad || (m_resizeTimerActive && m_drawViewSize) || !m_pausedInDebuggerMessage.
isNull(); | 356 bool hasVisibleElements = m_highlightNode || m_eventTargetNode || m_highligh
tQuad || (m_resizeTimerActive && m_drawViewSize) || !m_pausedInDebuggerMessage.
isNull(); |
| 357 return !hasVisibleElements && m_inspectMode == InspectorDOMAgent::NotSearchi
ng; | 357 return !hasVisibleElements && m_inspectMode == InspectorDOMAgent::NotSearchi
ng; |
| 358 } | 358 } |
| 359 | 359 |
| 360 void InspectorOverlayImpl::scheduleUpdate() | 360 void InspectorOverlay::scheduleUpdate() |
| 361 { | 361 { |
| 362 if (isEmpty()) { | 362 if (isEmpty()) { |
| 363 if (m_pageOverlay) | 363 if (m_pageOverlay) |
| 364 m_pageOverlay.clear(); | 364 m_pageOverlay.clear(); |
| 365 return; | 365 return; |
| 366 } | 366 } |
| 367 m_needsUpdate = true; | 367 m_needsUpdate = true; |
| 368 m_webViewImpl->page()->chromeClient().scheduleAnimation(); | 368 m_webViewImpl->page()->chromeClient().scheduleAnimation(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void InspectorOverlayImpl::rebuildOverlayPage() | 371 void InspectorOverlay::rebuildOverlayPage() |
| 372 { | 372 { |
| 373 FrameView* view = m_webViewImpl->mainFrameImpl()->frameView(); | 373 FrameView* view = m_webViewImpl->mainFrameImpl()->frameView(); |
| 374 if (!view) | 374 if (!view) |
| 375 return; | 375 return; |
| 376 | 376 |
| 377 IntRect visibleRectInDocument = view->scrollableArea()->visibleContentRect()
; | 377 IntRect visibleRectInDocument = view->scrollableArea()->visibleContentRect()
; |
| 378 IntSize viewportSize = m_webViewImpl->page()->frameHost().visualViewport().s
ize(); | 378 IntSize viewportSize = m_webViewImpl->page()->frameHost().visualViewport().s
ize(); |
| 379 toLocalFrame(overlayPage()->mainFrame())->view()->resize(viewportSize); | 379 toLocalFrame(overlayPage()->mainFrame())->view()->resize(viewportSize); |
| 380 overlayPage()->frameHost().visualViewport().setSize(viewportSize); | 380 overlayPage()->frameHost().visualViewport().setSize(viewportSize); |
| 381 reset(viewportSize, visibleRectInDocument.location()); | 381 reset(viewportSize, visibleRectInDocument.location()); |
| 382 | 382 |
| 383 drawNodeHighlight(); | 383 drawNodeHighlight(); |
| 384 drawQuadHighlight(); | 384 drawQuadHighlight(); |
| 385 drawPausedInDebuggerMessage(); | 385 drawPausedInDebuggerMessage(); |
| 386 drawViewSize(); | 386 drawViewSize(); |
| 387 } | 387 } |
| 388 | 388 |
| 389 static PassRefPtr<JSONObject> buildObjectForSize(const IntSize& size) | 389 static PassRefPtr<JSONObject> buildObjectForSize(const IntSize& size) |
| 390 { | 390 { |
| 391 RefPtr<JSONObject> result = JSONObject::create(); | 391 RefPtr<JSONObject> result = JSONObject::create(); |
| 392 result->setNumber("width", size.width()); | 392 result->setNumber("width", size.width()); |
| 393 result->setNumber("height", size.height()); | 393 result->setNumber("height", size.height()); |
| 394 return result.release(); | 394 return result.release(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 void InspectorOverlayImpl::drawNodeHighlight() | 397 void InspectorOverlay::drawNodeHighlight() |
| 398 { | 398 { |
| 399 if (!m_highlightNode) | 399 if (!m_highlightNode) |
| 400 return; | 400 return; |
| 401 | 401 |
| 402 bool appendElementInfo = m_highlightNode->isElementNode() && !m_omitTooltip
&& m_nodeHighlightConfig.showInfo && m_highlightNode->layoutObject() && m_highli
ghtNode->document().frame(); | 402 bool appendElementInfo = m_highlightNode->isElementNode() && !m_omitTooltip
&& m_nodeHighlightConfig.showInfo && m_highlightNode->layoutObject() && m_highli
ghtNode->document().frame(); |
| 403 InspectorHighlight highlight(m_highlightNode.get(), m_nodeHighlightConfig, a
ppendElementInfo); | 403 InspectorHighlight highlight(m_highlightNode.get(), m_nodeHighlightConfig, a
ppendElementInfo); |
| 404 if (m_eventTargetNode) | 404 if (m_eventTargetNode) |
| 405 highlight.appendEventTargetQuads(m_eventTargetNode.get(), m_nodeHighligh
tConfig); | 405 highlight.appendEventTargetQuads(m_eventTargetNode.get(), m_nodeHighligh
tConfig); |
| 406 | 406 |
| 407 RefPtr<JSONObject> highlightJSON = highlight.asJSONObject(); | 407 RefPtr<JSONObject> highlightJSON = highlight.asJSONObject(); |
| 408 evaluateInOverlay("drawHighlight", highlightJSON.release()); | 408 evaluateInOverlay("drawHighlight", highlightJSON.release()); |
| 409 if (m_layoutEditor && m_highlightNode == m_layoutEditor->element()) { | 409 if (m_layoutEditor && m_highlightNode == m_layoutEditor->element()) { |
| 410 RefPtr<JSONObject> layoutEditorInfo = m_layoutEditor->buildJSONInfo(); | 410 RefPtr<JSONObject> layoutEditorInfo = m_layoutEditor->buildJSONInfo(); |
| 411 if (layoutEditorInfo) | 411 if (layoutEditorInfo) |
| 412 evaluateInOverlay("showLayoutEditor", layoutEditorInfo.release()); | 412 evaluateInOverlay("showLayoutEditor", layoutEditorInfo.release()); |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 | 415 |
| 416 void InspectorOverlayImpl::drawQuadHighlight() | 416 void InspectorOverlay::drawQuadHighlight() |
| 417 { | 417 { |
| 418 if (!m_highlightQuad) | 418 if (!m_highlightQuad) |
| 419 return; | 419 return; |
| 420 | 420 |
| 421 InspectorHighlight highlight; | 421 InspectorHighlight highlight; |
| 422 highlight.appendQuad(*m_highlightQuad, m_quadHighlightConfig.content, m_quad
HighlightConfig.contentOutline); | 422 highlight.appendQuad(*m_highlightQuad, m_quadHighlightConfig.content, m_quad
HighlightConfig.contentOutline); |
| 423 evaluateInOverlay("drawHighlight", highlight.asJSONObject()); | 423 evaluateInOverlay("drawHighlight", highlight.asJSONObject()); |
| 424 } | 424 } |
| 425 | 425 |
| 426 void InspectorOverlayImpl::drawPausedInDebuggerMessage() | 426 void InspectorOverlay::drawPausedInDebuggerMessage() |
| 427 { | 427 { |
| 428 if (m_inspectMode == InspectorDOMAgent::NotSearching && !m_pausedInDebuggerM
essage.isNull()) | 428 if (m_inspectMode == InspectorDOMAgent::NotSearching && !m_pausedInDebuggerM
essage.isNull()) |
| 429 evaluateInOverlay("drawPausedInDebuggerMessage", m_pausedInDebuggerMessa
ge); | 429 evaluateInOverlay("drawPausedInDebuggerMessage", m_pausedInDebuggerMessa
ge); |
| 430 } | 430 } |
| 431 | 431 |
| 432 void InspectorOverlayImpl::drawViewSize() | 432 void InspectorOverlay::drawViewSize() |
| 433 { | 433 { |
| 434 if (m_resizeTimerActive && m_drawViewSize) | 434 if (m_resizeTimerActive && m_drawViewSize) |
| 435 evaluateInOverlay("drawViewSize", m_drawViewSizeWithGrid ? "true" : "fal
se"); | 435 evaluateInOverlay("drawViewSize", m_drawViewSizeWithGrid ? "true" : "fal
se"); |
| 436 } | 436 } |
| 437 | 437 |
| 438 Page* InspectorOverlayImpl::overlayPage() | 438 Page* InspectorOverlay::overlayPage() |
| 439 { | 439 { |
| 440 if (m_overlayPage) | 440 if (m_overlayPage) |
| 441 return m_overlayPage.get(); | 441 return m_overlayPage.get(); |
| 442 | 442 |
| 443 ScriptForbiddenScope::AllowUserAgentScript allowScript; | 443 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
| 444 | 444 |
| 445 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FrameLoaderClient>, dummyFrameLoa
derClient, (EmptyFrameLoaderClient::create())); | 445 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FrameLoaderClient>, dummyFrameLoa
derClient, (EmptyFrameLoaderClient::create())); |
| 446 Page::PageClients pageClients; | 446 Page::PageClients pageClients; |
| 447 fillWithEmptyClients(pageClients); | 447 fillWithEmptyClients(pageClients); |
| 448 ASSERT(!m_overlayChromeClient); | 448 ASSERT(!m_overlayChromeClient); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 evaluateInOverlay("setPlatform", "windows"); | 492 evaluateInOverlay("setPlatform", "windows"); |
| 493 #elif OS(MACOSX) | 493 #elif OS(MACOSX) |
| 494 evaluateInOverlay("setPlatform", "mac"); | 494 evaluateInOverlay("setPlatform", "mac"); |
| 495 #elif OS(POSIX) | 495 #elif OS(POSIX) |
| 496 evaluateInOverlay("setPlatform", "linux"); | 496 evaluateInOverlay("setPlatform", "linux"); |
| 497 #endif | 497 #endif |
| 498 | 498 |
| 499 return m_overlayPage.get(); | 499 return m_overlayPage.get(); |
| 500 } | 500 } |
| 501 | 501 |
| 502 LocalFrame* InspectorOverlayImpl::overlayMainFrame() | 502 LocalFrame* InspectorOverlay::overlayMainFrame() |
| 503 { | 503 { |
| 504 return toLocalFrame(overlayPage()->mainFrame()); | 504 return toLocalFrame(overlayPage()->mainFrame()); |
| 505 } | 505 } |
| 506 | 506 |
| 507 void InspectorOverlayImpl::reset(const IntSize& viewportSize, const IntPoint& do
cumentScrollOffset) | 507 void InspectorOverlay::reset(const IntSize& viewportSize, const IntPoint& docume
ntScrollOffset) |
| 508 { | 508 { |
| 509 RefPtr<JSONObject> resetData = JSONObject::create(); | 509 RefPtr<JSONObject> resetData = JSONObject::create(); |
| 510 resetData->setNumber("deviceScaleFactor", m_webViewImpl->page()->deviceScale
Factor()); | 510 resetData->setNumber("deviceScaleFactor", m_webViewImpl->page()->deviceScale
Factor()); |
| 511 resetData->setObject("viewportSize", buildObjectForSize(viewportSize)); | 511 resetData->setObject("viewportSize", buildObjectForSize(viewportSize)); |
| 512 resetData->setNumber("pageZoomFactor", m_webViewImpl->mainFrameImpl()->frame
()->pageZoomFactor()); | 512 resetData->setNumber("pageZoomFactor", m_webViewImpl->mainFrameImpl()->frame
()->pageZoomFactor()); |
| 513 resetData->setNumber("scrollX", documentScrollOffset.x()); | 513 resetData->setNumber("scrollX", documentScrollOffset.x()); |
| 514 resetData->setNumber("scrollY", documentScrollOffset.y()); | 514 resetData->setNumber("scrollY", documentScrollOffset.y()); |
| 515 evaluateInOverlay("reset", resetData.release()); | 515 evaluateInOverlay("reset", resetData.release()); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void InspectorOverlayImpl::evaluateInOverlay(const String& method, const String&
argument) | 518 void InspectorOverlay::evaluateInOverlay(const String& method, const String& arg
ument) |
| 519 { | 519 { |
| 520 ScriptForbiddenScope::AllowUserAgentScript allowScript; | 520 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
| 521 RefPtr<JSONArray> command = JSONArray::create(); | 521 RefPtr<JSONArray> command = JSONArray::create(); |
| 522 command->pushString(method); | 522 command->pushString(method); |
| 523 command->pushString(argument); | 523 command->pushString(argument); |
| 524 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld(
"dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen
ScriptsDisabled); | 524 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld(
"dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen
ScriptsDisabled); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void InspectorOverlayImpl::evaluateInOverlay(const String& method, PassRefPtr<JS
ONValue> argument) | 527 void InspectorOverlay::evaluateInOverlay(const String& method, PassRefPtr<JSONVa
lue> argument) |
| 528 { | 528 { |
| 529 ScriptForbiddenScope::AllowUserAgentScript allowScript; | 529 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
| 530 RefPtr<JSONArray> command = JSONArray::create(); | 530 RefPtr<JSONArray> command = JSONArray::create(); |
| 531 command->pushString(method); | 531 command->pushString(method); |
| 532 command->pushValue(argument); | 532 command->pushValue(argument); |
| 533 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld(
"dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen
ScriptsDisabled); | 533 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld(
"dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen
ScriptsDisabled); |
| 534 } | 534 } |
| 535 | 535 |
| 536 void InspectorOverlayImpl::onTimer(Timer<InspectorOverlayImpl>*) | 536 void InspectorOverlay::onTimer(Timer<InspectorOverlay>*) |
| 537 { | 537 { |
| 538 m_resizeTimerActive = false; | 538 m_resizeTimerActive = false; |
| 539 scheduleUpdate(); | 539 scheduleUpdate(); |
| 540 } | 540 } |
| 541 | 541 |
| 542 void InspectorOverlayImpl::clear() | 542 void InspectorOverlay::clear() |
| 543 { | 543 { |
| 544 if (m_overlayPage) { | 544 if (m_overlayPage) { |
| 545 m_overlayPage->willBeDestroyed(); | 545 m_overlayPage->willBeDestroyed(); |
| 546 m_overlayPage.clear(); | 546 m_overlayPage.clear(); |
| 547 m_overlayChromeClient.clear(); | 547 m_overlayChromeClient.clear(); |
| 548 } | 548 } |
| 549 m_resizeTimerActive = false; | 549 m_resizeTimerActive = false; |
| 550 m_pausedInDebuggerMessage = String(); | 550 m_pausedInDebuggerMessage = String(); |
| 551 m_inspectMode = InspectorDOMAgent::NotSearching; | 551 m_inspectMode = InspectorDOMAgent::NotSearching; |
| 552 m_timer.stop(); | 552 m_timer.stop(); |
| 553 hideHighlight(); | 553 hideHighlight(); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void InspectorOverlayImpl::overlayResumed() | 556 void InspectorOverlay::overlayResumed() |
| 557 { | 557 { |
| 558 if (m_debuggerAgent) { | 558 if (m_debuggerAgent) { |
| 559 ErrorString error; | 559 ErrorString error; |
| 560 m_debuggerAgent->resume(&error); | 560 m_debuggerAgent->resume(&error); |
| 561 } | 561 } |
| 562 } | 562 } |
| 563 | 563 |
| 564 void InspectorOverlayImpl::overlaySteppedOver() | 564 void InspectorOverlay::overlaySteppedOver() |
| 565 { | 565 { |
| 566 if (m_debuggerAgent) { | 566 if (m_debuggerAgent) { |
| 567 ErrorString error; | 567 ErrorString error; |
| 568 m_debuggerAgent->stepOver(&error); | 568 m_debuggerAgent->stepOver(&error); |
| 569 } | 569 } |
| 570 } | 570 } |
| 571 | 571 |
| 572 void InspectorOverlayImpl::overlayStartedPropertyChange(const String& property) | 572 void InspectorOverlay::overlayStartedPropertyChange(const String& property) |
| 573 { | 573 { |
| 574 ASSERT(m_layoutEditor); | 574 ASSERT(m_layoutEditor); |
| 575 m_layoutEditor->overlayStartedPropertyChange(property); | 575 m_layoutEditor->overlayStartedPropertyChange(property); |
| 576 } | 576 } |
| 577 | 577 |
| 578 void InspectorOverlayImpl::overlayPropertyChanged(float value) | 578 void InspectorOverlay::overlayPropertyChanged(float value) |
| 579 { | 579 { |
| 580 ASSERT(m_layoutEditor); | 580 ASSERT(m_layoutEditor); |
| 581 m_layoutEditor->overlayPropertyChanged(value); | 581 m_layoutEditor->overlayPropertyChanged(value); |
| 582 } | 582 } |
| 583 | 583 |
| 584 void InspectorOverlayImpl::overlayEndedPropertyChange() | 584 void InspectorOverlay::overlayEndedPropertyChange() |
| 585 { | 585 { |
| 586 ASSERT(m_layoutEditor); | 586 ASSERT(m_layoutEditor); |
| 587 m_layoutEditor->overlayEndedPropertyChange(); | 587 m_layoutEditor->overlayEndedPropertyChange(); |
| 588 } | 588 } |
| 589 | 589 |
| 590 void InspectorOverlayImpl::overlayNextSelector() | 590 void InspectorOverlay::overlayNextSelector() |
| 591 { | 591 { |
| 592 ASSERT(m_layoutEditor); | 592 ASSERT(m_layoutEditor); |
| 593 m_layoutEditor->nextSelector(); | 593 m_layoutEditor->nextSelector(); |
| 594 } | 594 } |
| 595 | 595 |
| 596 void InspectorOverlayImpl::overlayPreviousSelector() | 596 void InspectorOverlay::overlayPreviousSelector() |
| 597 { | 597 { |
| 598 ASSERT(m_layoutEditor); | 598 ASSERT(m_layoutEditor); |
| 599 m_layoutEditor->previousSelector(); | 599 m_layoutEditor->previousSelector(); |
| 600 } | 600 } |
| 601 | 601 |
| 602 String InspectorOverlayImpl::overlayCurrentSelectorInfo() | 602 String InspectorOverlay::overlayCurrentSelectorInfo() |
| 603 { | 603 { |
| 604 ASSERT(m_layoutEditor); | 604 ASSERT(m_layoutEditor); |
| 605 return m_layoutEditor->currentSelectorInfo(); | 605 return m_layoutEditor->currentSelectorInfo(); |
| 606 } | 606 } |
| 607 | 607 |
| 608 void InspectorOverlayImpl::overlayClearSelection(bool commitChanges) | 608 void InspectorOverlay::overlayClearSelection(bool commitChanges) |
| 609 { | 609 { |
| 610 ASSERT(m_layoutEditor); | 610 ASSERT(m_layoutEditor); |
| 611 m_hoveredNodeForInspectMode = m_layoutEditor->element(); | 611 m_hoveredNodeForInspectMode = m_layoutEditor->element(); |
| 612 | 612 |
| 613 if (commitChanges) | 613 if (commitChanges) |
| 614 m_layoutEditor->commitChanges(); | 614 m_layoutEditor->commitChanges(); |
| 615 | 615 |
| 616 if (m_layoutEditor) { | 616 if (m_layoutEditor) { |
| 617 m_layoutEditor->dispose(); | 617 m_layoutEditor->dispose(); |
| 618 m_layoutEditor.clear(); | 618 m_layoutEditor.clear(); |
| 619 } | 619 } |
| 620 | 620 |
| 621 if (m_inspectModeHighlightConfig) | 621 if (m_inspectModeHighlightConfig) |
| 622 highlightNode(m_hoveredNodeForInspectMode.get(), *m_inspectModeHighlight
Config, false); | 622 highlightNode(m_hoveredNodeForInspectMode.get(), *m_inspectModeHighlight
Config, false); |
| 623 | 623 |
| 624 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde
n(false); | 624 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde
n(false); |
| 625 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursor(pointerC
ursor()); | 625 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursor(pointerC
ursor()); |
| 626 } | 626 } |
| 627 | 627 |
| 628 void InspectorOverlayImpl::profilingStarted() | 628 void InspectorOverlay::profilingStarted() |
| 629 { | 629 { |
| 630 if (!m_suspendCount++) | 630 if (!m_suspendCount++) |
| 631 clear(); | 631 clear(); |
| 632 } | 632 } |
| 633 | 633 |
| 634 void InspectorOverlayImpl::profilingStopped() | 634 void InspectorOverlay::profilingStopped() |
| 635 { | 635 { |
| 636 --m_suspendCount; | 636 --m_suspendCount; |
| 637 } | 637 } |
| 638 | 638 |
| 639 void InspectorOverlayImpl::pageLayoutInvalidated(bool resized) | 639 void InspectorOverlay::pageLayoutInvalidated(bool resized) |
| 640 { | 640 { |
| 641 if (resized && m_drawViewSize) { | 641 if (resized && m_drawViewSize) { |
| 642 m_resizeTimerActive = true; | 642 m_resizeTimerActive = true; |
| 643 m_timer.startOneShot(1, FROM_HERE); | 643 m_timer.startOneShot(1, FROM_HERE); |
| 644 } | 644 } |
| 645 scheduleUpdate(); | 645 scheduleUpdate(); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void InspectorOverlayImpl::setShowViewportSizeOnResize(bool show, bool showGrid) | 648 void InspectorOverlay::setShowViewportSizeOnResize(bool show, bool showGrid) |
| 649 { | 649 { |
| 650 m_drawViewSize = show; | 650 m_drawViewSize = show; |
| 651 m_drawViewSizeWithGrid = showGrid; | 651 m_drawViewSizeWithGrid = showGrid; |
| 652 } | 652 } |
| 653 | 653 |
| 654 bool InspectorOverlayImpl::handleMouseMove(const PlatformMouseEvent& event) | 654 bool InspectorOverlay::handleMouseMove(const PlatformMouseEvent& event) |
| 655 { | 655 { |
| 656 if (!shouldSearchForNode()) | 656 if (!shouldSearchForNode()) |
| 657 return false; | 657 return false; |
| 658 | 658 |
| 659 LocalFrame* frame = m_webViewImpl->mainFrameImpl()->frame(); | 659 LocalFrame* frame = m_webViewImpl->mainFrameImpl()->frame(); |
| 660 if (!frame->view() || !frame->contentLayoutObject()) | 660 if (!frame->view() || !frame->contentLayoutObject()) |
| 661 return false; | 661 return false; |
| 662 Node* node = hoveredNodeForEvent(frame, event, event.shiftKey()); | 662 Node* node = hoveredNodeForEvent(frame, event, event.shiftKey()); |
| 663 | 663 |
| 664 // Do not highlight within user agent shadow root unless requested. | 664 // Do not highlight within user agent shadow root unless requested. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 679 if (eventTarget == node) | 679 if (eventTarget == node) |
| 680 eventTarget = nullptr; | 680 eventTarget = nullptr; |
| 681 | 681 |
| 682 if (node && m_inspectModeHighlightConfig) { | 682 if (node && m_inspectModeHighlightConfig) { |
| 683 m_hoveredNodeForInspectMode = node; | 683 m_hoveredNodeForInspectMode = node; |
| 684 highlightNode(node, eventTarget, *m_inspectModeHighlightConfig, event.ct
rlKey() || event.metaKey()); | 684 highlightNode(node, eventTarget, *m_inspectModeHighlightConfig, event.ct
rlKey() || event.metaKey()); |
| 685 } | 685 } |
| 686 return true; | 686 return true; |
| 687 } | 687 } |
| 688 | 688 |
| 689 bool InspectorOverlayImpl::handleMousePress() | 689 bool InspectorOverlay::handleMousePress() |
| 690 { | 690 { |
| 691 if (!shouldSearchForNode()) | 691 if (!shouldSearchForNode()) |
| 692 return false; | 692 return false; |
| 693 | 693 |
| 694 if (m_hoveredNodeForInspectMode) { | 694 if (m_hoveredNodeForInspectMode) { |
| 695 inspect(m_hoveredNodeForInspectMode.get()); | 695 inspect(m_hoveredNodeForInspectMode.get()); |
| 696 m_hoveredNodeForInspectMode.clear(); | 696 m_hoveredNodeForInspectMode.clear(); |
| 697 return true; | 697 return true; |
| 698 } | 698 } |
| 699 return false; | 699 return false; |
| 700 } | 700 } |
| 701 | 701 |
| 702 bool InspectorOverlayImpl::handleGestureEvent(const PlatformGestureEvent& event) | 702 bool InspectorOverlay::handleGestureEvent(const PlatformGestureEvent& event) |
| 703 { | 703 { |
| 704 if (!shouldSearchForNode() || event.type() != PlatformEvent::GestureTap) | 704 if (!shouldSearchForNode() || event.type() != PlatformEvent::GestureTap) |
| 705 return false; | 705 return false; |
| 706 Node* node = hoveredNodeForEvent(m_webViewImpl->mainFrameImpl()->frame(), ev
ent, false); | 706 Node* node = hoveredNodeForEvent(m_webViewImpl->mainFrameImpl()->frame(), ev
ent, false); |
| 707 if (node && m_inspectModeHighlightConfig) { | 707 if (node && m_inspectModeHighlightConfig) { |
| 708 highlightNode(node, *m_inspectModeHighlightConfig, false); | 708 highlightNode(node, *m_inspectModeHighlightConfig, false); |
| 709 inspect(node); | 709 inspect(node); |
| 710 return true; | 710 return true; |
| 711 } | 711 } |
| 712 return false; | 712 return false; |
| 713 } | 713 } |
| 714 | 714 |
| 715 bool InspectorOverlayImpl::handleTouchEvent(const PlatformTouchEvent& event) | 715 bool InspectorOverlay::handleTouchEvent(const PlatformTouchEvent& event) |
| 716 { | 716 { |
| 717 if (!shouldSearchForNode()) | 717 if (!shouldSearchForNode()) |
| 718 return false; | 718 return false; |
| 719 Node* node = hoveredNodeForEvent(m_webViewImpl->mainFrameImpl()->frame(), ev
ent, false); | 719 Node* node = hoveredNodeForEvent(m_webViewImpl->mainFrameImpl()->frame(), ev
ent, false); |
| 720 if (node && m_inspectModeHighlightConfig) { | 720 if (node && m_inspectModeHighlightConfig) { |
| 721 highlightNode(node, *m_inspectModeHighlightConfig, false); | 721 highlightNode(node, *m_inspectModeHighlightConfig, false); |
| 722 inspect(node); | 722 inspect(node); |
| 723 return true; | 723 return true; |
| 724 } | 724 } |
| 725 return false; | 725 return false; |
| 726 } | 726 } |
| 727 | 727 |
| 728 bool InspectorOverlayImpl::shouldSearchForNode() | 728 bool InspectorOverlay::shouldSearchForNode() |
| 729 { | 729 { |
| 730 return m_inspectMode != InspectorDOMAgent::NotSearching && !m_layoutEditor; | 730 return m_inspectMode != InspectorDOMAgent::NotSearching && !m_layoutEditor; |
| 731 } | 731 } |
| 732 | 732 |
| 733 void InspectorOverlayImpl::inspect(Node* node) | 733 void InspectorOverlay::inspect(Node* node) |
| 734 { | 734 { |
| 735 if (m_domAgent) | 735 if (m_domAgent) |
| 736 m_domAgent->inspect(node); | 736 m_domAgent->inspect(node); |
| 737 | 737 |
| 738 if (node && node->isElementNode() && m_inspectMode == InspectorDOMAgent::Sho
wLayoutEditor && !m_layoutEditor) { | 738 if (node && node->isElementNode() && m_inspectMode == InspectorDOMAgent::Sho
wLayoutEditor && !m_layoutEditor) { |
| 739 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_dom
Agent); | 739 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_dom
Agent); |
| 740 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverr
idden(true); | 740 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverr
idden(true); |
| 741 highlightNode(node, *m_inspectModeHighlightConfig, false); | 741 highlightNode(node, *m_inspectModeHighlightConfig, false); |
| 742 } | 742 } |
| 743 } | 743 } |
| 744 | 744 |
| 745 } // namespace blink | 745 } // namespace blink |
| OLD | NEW |