Chromium Code Reviews| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 | 172 |
| 173 | 173 |
| 174 InspectorOverlay::InspectorOverlay(WebViewImpl* webViewImpl) | 174 InspectorOverlay::InspectorOverlay(WebViewImpl* webViewImpl) |
| 175 : m_webViewImpl(webViewImpl) | 175 : m_webViewImpl(webViewImpl) |
| 176 , m_overlayHost(InspectorOverlayHost::create()) | 176 , m_overlayHost(InspectorOverlayHost::create()) |
| 177 , m_drawViewSize(false) | 177 , m_drawViewSize(false) |
| 178 , m_resizeTimerActive(false) | 178 , m_resizeTimerActive(false) |
| 179 , m_omitTooltip(false) | 179 , m_omitTooltip(false) |
| 180 , m_timer(this, &InspectorOverlay::onTimer) | 180 , m_timer(this, &InspectorOverlay::onTimer) |
| 181 , m_suspended(false) | 181 , m_suspended(false) |
| 182 , m_showReloadingBlanket(false) | |
| 182 , m_inLayout(false) | 183 , m_inLayout(false) |
| 183 , m_needsUpdate(false) | 184 , m_needsUpdate(false) |
| 184 , m_inspectMode(InspectorDOMAgent::NotSearching) | 185 , m_inspectMode(InspectorDOMAgent::NotSearching) |
| 185 { | 186 { |
| 186 } | 187 } |
| 187 | 188 |
| 188 InspectorOverlay::~InspectorOverlay() | 189 InspectorOverlay::~InspectorOverlay() |
| 189 { | 190 { |
| 190 DCHECK(!m_overlayPage); | 191 DCHECK(!m_overlayPage); |
| 191 } | 192 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 | 288 |
| 288 return handled; | 289 return handled; |
| 289 } | 290 } |
| 290 | 291 |
| 291 void InspectorOverlay::setPausedInDebuggerMessage(const String& message) | 292 void InspectorOverlay::setPausedInDebuggerMessage(const String& message) |
| 292 { | 293 { |
| 293 m_pausedInDebuggerMessage = message; | 294 m_pausedInDebuggerMessage = message; |
| 294 scheduleUpdate(); | 295 scheduleUpdate(); |
| 295 } | 296 } |
| 296 | 297 |
| 298 void InspectorOverlay::showReloadingBlanket() | |
| 299 { | |
| 300 m_showReloadingBlanket = true; | |
| 301 scheduleUpdate(); | |
| 302 } | |
| 303 | |
| 304 void InspectorOverlay::maybeClearReloadingBlanket() | |
| 305 { | |
| 306 if (!m_showReloadingBlanket) | |
| 307 return; | |
| 308 m_showReloadingBlanket = false; | |
| 309 if (m_suspended) | |
| 310 clearInternal(); | |
| 311 else | |
| 312 scheduleUpdate(); | |
| 313 } | |
| 314 | |
| 297 void InspectorOverlay::hideHighlight() | 315 void InspectorOverlay::hideHighlight() |
| 298 { | 316 { |
| 299 m_highlightNode.clear(); | 317 m_highlightNode.clear(); |
| 300 m_eventTargetNode.clear(); | 318 m_eventTargetNode.clear(); |
| 301 m_highlightQuad.reset(); | 319 m_highlightQuad.reset(); |
| 302 scheduleUpdate(); | 320 scheduleUpdate(); |
| 303 } | 321 } |
| 304 | 322 |
| 305 void InspectorOverlay::highlightNode(Node* node, const InspectorHighlightConfig& highlightConfig, bool omitTooltip) | 323 void InspectorOverlay::highlightNode(Node* node, const InspectorHighlightConfig& highlightConfig, bool omitTooltip) |
| 306 { | 324 { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 void InspectorOverlay::highlightQuad(std::unique_ptr<FloatQuad> quad, const Insp ectorHighlightConfig& highlightConfig) | 365 void InspectorOverlay::highlightQuad(std::unique_ptr<FloatQuad> quad, const Insp ectorHighlightConfig& highlightConfig) |
| 348 { | 366 { |
| 349 m_quadHighlightConfig = highlightConfig; | 367 m_quadHighlightConfig = highlightConfig; |
| 350 m_highlightQuad = std::move(quad); | 368 m_highlightQuad = std::move(quad); |
| 351 m_omitTooltip = false; | 369 m_omitTooltip = false; |
| 352 scheduleUpdate(); | 370 scheduleUpdate(); |
| 353 } | 371 } |
| 354 | 372 |
| 355 bool InspectorOverlay::isEmpty() | 373 bool InspectorOverlay::isEmpty() |
| 356 { | 374 { |
| 375 if (m_showReloadingBlanket) | |
| 376 return false; | |
| 357 if (m_suspended) | 377 if (m_suspended) |
| 358 return true; | 378 return true; |
| 359 bool hasVisibleElements = m_highlightNode || m_eventTargetNode || m_highligh tQuad || (m_resizeTimerActive && m_drawViewSize) || !m_pausedInDebuggerMessage. isNull(); | 379 bool hasVisibleElements = m_highlightNode || m_eventTargetNode || m_highligh tQuad || (m_resizeTimerActive && m_drawViewSize) || !m_pausedInDebuggerMessage. isNull(); |
| 360 return !hasVisibleElements && m_inspectMode == InspectorDOMAgent::NotSearchi ng; | 380 return !hasVisibleElements && m_inspectMode == InspectorDOMAgent::NotSearchi ng; |
| 361 } | 381 } |
| 362 | 382 |
| 363 void InspectorOverlay::scheduleUpdate() | 383 void InspectorOverlay::scheduleUpdate() |
| 364 { | 384 { |
| 365 if (isEmpty()) { | 385 if (isEmpty()) { |
| 366 if (m_pageOverlay) | 386 if (m_pageOverlay) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 381 | 401 |
| 382 IntRect visibleRectInDocument = view->getScrollableArea()->visibleContentRec t(); | 402 IntRect visibleRectInDocument = view->getScrollableArea()->visibleContentRec t(); |
| 383 IntSize viewportSize = m_webViewImpl->page()->frameHost().visualViewport().s ize(); | 403 IntSize viewportSize = m_webViewImpl->page()->frameHost().visualViewport().s ize(); |
| 384 LocalFrame* frame = toLocalFrame(overlayPage()->mainFrame()); | 404 LocalFrame* frame = toLocalFrame(overlayPage()->mainFrame()); |
| 385 frame->view()->resize(viewportSize); | 405 frame->view()->resize(viewportSize); |
| 386 overlayPage()->frameHost().visualViewport().setSize(viewportSize); | 406 overlayPage()->frameHost().visualViewport().setSize(viewportSize); |
| 387 frame->setPageZoomFactor(windowToViewportScale()); | 407 frame->setPageZoomFactor(windowToViewportScale()); |
| 388 | 408 |
| 389 reset(viewportSize, visibleRectInDocument.location()); | 409 reset(viewportSize, visibleRectInDocument.location()); |
| 390 | 410 |
| 411 if (m_showReloadingBlanket) { | |
| 412 evaluateInOverlay("showReloadingBlanket", ""); | |
| 413 return; | |
| 414 } | |
| 391 drawNodeHighlight(); | 415 drawNodeHighlight(); |
| 392 drawQuadHighlight(); | 416 drawQuadHighlight(); |
| 393 drawPausedInDebuggerMessage(); | 417 drawPausedInDebuggerMessage(); |
| 394 drawViewSize(); | 418 drawViewSize(); |
| 395 if (m_layoutEditor && !m_highlightNode) | 419 if (m_layoutEditor && !m_highlightNode) |
| 396 m_layoutEditor->rebuild(); | 420 m_layoutEditor->rebuild(); |
| 397 } | 421 } |
| 398 | 422 |
| 399 static std::unique_ptr<protocol::DictionaryValue> buildObjectForSize(const IntSi ze& size) | 423 static std::unique_ptr<protocol::DictionaryValue> buildObjectForSize(const IntSi ze& size) |
| 400 { | 424 { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde n(false); | 693 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde n(false); |
| 670 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursor(pointerC ursor(), overlayMainFrame()); | 694 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursor(pointerC ursor(), overlayMainFrame()); |
| 671 } | 695 } |
| 672 | 696 |
| 673 void InspectorOverlay::suspend() | 697 void InspectorOverlay::suspend() |
| 674 { | 698 { |
| 675 if (!m_suspended) { | 699 if (!m_suspended) { |
| 676 m_suspended = true; | 700 m_suspended = true; |
| 677 clearInternal(); | 701 clearInternal(); |
| 678 } | 702 } |
| 703 m_suspended = true; | |
|
dgozman
2016/08/10 21:28:37
This code looks strange.
| |
| 704 clearInternal(); | |
| 679 } | 705 } |
| 680 | 706 |
| 681 void InspectorOverlay::resume() | 707 void InspectorOverlay::resume() |
| 682 { | 708 { |
| 683 m_suspended = false; | 709 m_suspended = false; |
| 684 } | 710 } |
| 685 | 711 |
| 686 void InspectorOverlay::pageLayoutInvalidated(bool resized) | 712 void InspectorOverlay::pageLayoutInvalidated(bool resized) |
| 687 { | 713 { |
| 688 if (resized && m_drawViewSize) { | 714 if (resized && m_drawViewSize) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 790 | 816 |
| 791 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) | 817 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) |
| 792 { | 818 { |
| 793 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node-> isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg ent) | 819 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node-> isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg ent) |
| 794 return; | 820 return; |
| 795 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen t, &overlayMainFrame()->script()); | 821 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen t, &overlayMainFrame()->script()); |
| 796 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde n(true); | 822 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde n(true); |
| 797 } | 823 } |
| 798 | 824 |
| 799 } // namespace blink | 825 } // namespace blink |
| OLD | NEW |