| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 | 172 |
| 173 InspectorOverlay::InspectorOverlay(WebViewImpl* webViewImpl) | 173 InspectorOverlay::InspectorOverlay(WebViewImpl* webViewImpl) |
| 174 : m_webViewImpl(webViewImpl) | 174 : m_webViewImpl(webViewImpl) |
| 175 , m_overlayHost(InspectorOverlayHost::create()) | 175 , m_overlayHost(InspectorOverlayHost::create()) |
| 176 , m_drawViewSize(false) | 176 , m_drawViewSize(false) |
| 177 , m_resizeTimerActive(false) | 177 , m_resizeTimerActive(false) |
| 178 , m_omitTooltip(false) | 178 , m_omitTooltip(false) |
| 179 , m_timer(this, &InspectorOverlay::onTimer) | 179 , m_timer(this, &InspectorOverlay::onTimer) |
| 180 , m_suspended(false) | 180 , m_suspended(false) |
| 181 , m_showReloadingBlanket(false) |
| 181 , m_inLayout(false) | 182 , m_inLayout(false) |
| 182 , m_needsUpdate(false) | 183 , m_needsUpdate(false) |
| 183 , m_inspectMode(InspectorDOMAgent::NotSearching) | 184 , m_inspectMode(InspectorDOMAgent::NotSearching) |
| 184 { | 185 { |
| 185 } | 186 } |
| 186 | 187 |
| 187 InspectorOverlay::~InspectorOverlay() | 188 InspectorOverlay::~InspectorOverlay() |
| 188 { | 189 { |
| 189 DCHECK(!m_overlayPage); | 190 DCHECK(!m_overlayPage); |
| 190 } | 191 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 287 |
| 287 return handled; | 288 return handled; |
| 288 } | 289 } |
| 289 | 290 |
| 290 void InspectorOverlay::setPausedInDebuggerMessage(const String& message) | 291 void InspectorOverlay::setPausedInDebuggerMessage(const String& message) |
| 291 { | 292 { |
| 292 m_pausedInDebuggerMessage = message; | 293 m_pausedInDebuggerMessage = message; |
| 293 scheduleUpdate(); | 294 scheduleUpdate(); |
| 294 } | 295 } |
| 295 | 296 |
| 297 void InspectorOverlay::showReloadingBlanket() |
| 298 { |
| 299 m_showReloadingBlanket = true; |
| 300 scheduleUpdate(); |
| 301 } |
| 302 |
| 303 void InspectorOverlay::hideReloadingBlanket() |
| 304 { |
| 305 if (!m_showReloadingBlanket) |
| 306 return; |
| 307 m_showReloadingBlanket = false; |
| 308 if (m_suspended) |
| 309 clearInternal(); |
| 310 else |
| 311 scheduleUpdate(); |
| 312 } |
| 313 |
| 296 void InspectorOverlay::hideHighlight() | 314 void InspectorOverlay::hideHighlight() |
| 297 { | 315 { |
| 298 m_highlightNode.clear(); | 316 m_highlightNode.clear(); |
| 299 m_eventTargetNode.clear(); | 317 m_eventTargetNode.clear(); |
| 300 m_highlightQuad.reset(); | 318 m_highlightQuad.reset(); |
| 301 scheduleUpdate(); | 319 scheduleUpdate(); |
| 302 } | 320 } |
| 303 | 321 |
| 304 void InspectorOverlay::highlightNode(Node* node, const InspectorHighlightConfig&
highlightConfig, bool omitTooltip) | 322 void InspectorOverlay::highlightNode(Node* node, const InspectorHighlightConfig&
highlightConfig, bool omitTooltip) |
| 305 { | 323 { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 void InspectorOverlay::highlightQuad(std::unique_ptr<FloatQuad> quad, const Insp
ectorHighlightConfig& highlightConfig) | 364 void InspectorOverlay::highlightQuad(std::unique_ptr<FloatQuad> quad, const Insp
ectorHighlightConfig& highlightConfig) |
| 347 { | 365 { |
| 348 m_quadHighlightConfig = highlightConfig; | 366 m_quadHighlightConfig = highlightConfig; |
| 349 m_highlightQuad = std::move(quad); | 367 m_highlightQuad = std::move(quad); |
| 350 m_omitTooltip = false; | 368 m_omitTooltip = false; |
| 351 scheduleUpdate(); | 369 scheduleUpdate(); |
| 352 } | 370 } |
| 353 | 371 |
| 354 bool InspectorOverlay::isEmpty() | 372 bool InspectorOverlay::isEmpty() |
| 355 { | 373 { |
| 374 if (m_showReloadingBlanket) |
| 375 return false; |
| 356 if (m_suspended) | 376 if (m_suspended) |
| 357 return true; | 377 return true; |
| 358 bool hasVisibleElements = m_highlightNode || m_eventTargetNode || m_highligh
tQuad || (m_resizeTimerActive && m_drawViewSize) || !m_pausedInDebuggerMessage.
isNull(); | 378 bool hasVisibleElements = m_highlightNode || m_eventTargetNode || m_highligh
tQuad || (m_resizeTimerActive && m_drawViewSize) || !m_pausedInDebuggerMessage.
isNull(); |
| 359 return !hasVisibleElements && m_inspectMode == InspectorDOMAgent::NotSearchi
ng; | 379 return !hasVisibleElements && m_inspectMode == InspectorDOMAgent::NotSearchi
ng; |
| 360 } | 380 } |
| 361 | 381 |
| 362 void InspectorOverlay::scheduleUpdate() | 382 void InspectorOverlay::scheduleUpdate() |
| 363 { | 383 { |
| 364 if (isEmpty()) { | 384 if (isEmpty()) { |
| 365 if (m_pageOverlay) | 385 if (m_pageOverlay) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 380 | 400 |
| 381 IntRect visibleRectInDocument = view->getScrollableArea()->visibleContentRec
t(); | 401 IntRect visibleRectInDocument = view->getScrollableArea()->visibleContentRec
t(); |
| 382 IntSize viewportSize = m_webViewImpl->page()->frameHost().visualViewport().s
ize(); | 402 IntSize viewportSize = m_webViewImpl->page()->frameHost().visualViewport().s
ize(); |
| 383 LocalFrame* frame = toLocalFrame(overlayPage()->mainFrame()); | 403 LocalFrame* frame = toLocalFrame(overlayPage()->mainFrame()); |
| 384 frame->view()->resize(viewportSize); | 404 frame->view()->resize(viewportSize); |
| 385 overlayPage()->frameHost().visualViewport().setSize(viewportSize); | 405 overlayPage()->frameHost().visualViewport().setSize(viewportSize); |
| 386 frame->setPageZoomFactor(windowToViewportScale()); | 406 frame->setPageZoomFactor(windowToViewportScale()); |
| 387 | 407 |
| 388 reset(viewportSize, visibleRectInDocument.location()); | 408 reset(viewportSize, visibleRectInDocument.location()); |
| 389 | 409 |
| 410 if (m_showReloadingBlanket) { |
| 411 evaluateInOverlay("showReloadingBlanket", ""); |
| 412 return; |
| 413 } |
| 390 drawNodeHighlight(); | 414 drawNodeHighlight(); |
| 391 drawQuadHighlight(); | 415 drawQuadHighlight(); |
| 392 drawPausedInDebuggerMessage(); | 416 drawPausedInDebuggerMessage(); |
| 393 drawViewSize(); | 417 drawViewSize(); |
| 394 if (m_layoutEditor && !m_highlightNode) | 418 if (m_layoutEditor && !m_highlightNode) |
| 395 m_layoutEditor->rebuild(); | 419 m_layoutEditor->rebuild(); |
| 396 } | 420 } |
| 397 | 421 |
| 398 static std::unique_ptr<protocol::DictionaryValue> buildObjectForSize(const IntSi
ze& size) | 422 static std::unique_ptr<protocol::DictionaryValue> buildObjectForSize(const IntSi
ze& size) |
| 399 { | 423 { |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 | 813 |
| 790 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) | 814 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) |
| 791 { | 815 { |
| 792 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node->
isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg
ent) | 816 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node->
isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg
ent) |
| 793 return; | 817 return; |
| 794 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen
t, &overlayMainFrame()->script()); | 818 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen
t, &overlayMainFrame()->script()); |
| 795 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde
n(true); | 819 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde
n(true); |
| 796 } | 820 } |
| 797 | 821 |
| 798 } // namespace blink | 822 } // namespace blink |
| OLD | NEW |