Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1001)

Side by Side Diff: third_party/WebKit/Source/web/InspectorOverlay.cpp

Issue 2127053002: Revert of Fix inspector overlay when use-zoom-for-dsf is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/web/InspectorOverlay.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 { 382 {
383 FrameView* view = m_webViewImpl->mainFrameImpl()->frameView(); 383 FrameView* view = m_webViewImpl->mainFrameImpl()->frameView();
384 if (!view) 384 if (!view)
385 return; 385 return;
386 386
387 IntRect visibleRectInDocument = view->getScrollableArea()->visibleContentRec t(); 387 IntRect visibleRectInDocument = view->getScrollableArea()->visibleContentRec t();
388 IntSize viewportSize = m_webViewImpl->page()->frameHost().visualViewport().s ize(); 388 IntSize viewportSize = m_webViewImpl->page()->frameHost().visualViewport().s ize();
389 LocalFrame* frame = toLocalFrame(overlayPage()->mainFrame()); 389 LocalFrame* frame = toLocalFrame(overlayPage()->mainFrame());
390 frame->view()->resize(viewportSize); 390 frame->view()->resize(viewportSize);
391 overlayPage()->frameHost().visualViewport().setSize(viewportSize); 391 overlayPage()->frameHost().visualViewport().setSize(viewportSize);
392 frame->setPageZoomFactor(windowToViewportScale()); 392 float windowToViewportScale = m_webViewImpl->chromeClient().windowToViewport Scalar(1.0f);
393 frame->setPageZoomFactor(windowToViewportScale);
393 394
394 reset(viewportSize, visibleRectInDocument.location()); 395 reset(viewportSize, visibleRectInDocument.location());
395 396
396 drawNodeHighlight(); 397 drawNodeHighlight();
397 drawQuadHighlight(); 398 drawQuadHighlight();
398 drawPausedInDebuggerMessage(); 399 drawPausedInDebuggerMessage();
399 drawViewSize(); 400 drawViewSize();
400 if (m_layoutEditor && !m_highlightNode) 401 if (m_layoutEditor && !m_highlightNode)
401 m_layoutEditor->rebuild(); 402 m_layoutEditor->rebuild();
402 } 403 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 439
439 std::unique_ptr<protocol::DictionaryValue> highlightJSON = highlight.asProto colValue(); 440 std::unique_ptr<protocol::DictionaryValue> highlightJSON = highlight.asProto colValue();
440 evaluateInOverlay("drawHighlight", std::move(highlightJSON)); 441 evaluateInOverlay("drawHighlight", std::move(highlightJSON));
441 } 442 }
442 443
443 void InspectorOverlay::drawQuadHighlight() 444 void InspectorOverlay::drawQuadHighlight()
444 { 445 {
445 if (!m_highlightQuad) 446 if (!m_highlightQuad)
446 return; 447 return;
447 448
448 InspectorHighlight highlight(windowToViewportScale()); 449 InspectorHighlight highlight;
449 highlight.appendQuad(*m_highlightQuad, m_quadHighlightConfig.content, m_quad HighlightConfig.contentOutline); 450 highlight.appendQuad(*m_highlightQuad, m_quadHighlightConfig.content, m_quad HighlightConfig.contentOutline);
450 evaluateInOverlay("drawHighlight", highlight.asProtocolValue()); 451 evaluateInOverlay("drawHighlight", highlight.asProtocolValue());
451 } 452 }
452 453
453 void InspectorOverlay::drawPausedInDebuggerMessage() 454 void InspectorOverlay::drawPausedInDebuggerMessage()
454 { 455 {
455 if (m_inspectMode == InspectorDOMAgent::NotSearching && !m_pausedInDebuggerM essage.isNull()) 456 if (m_inspectMode == InspectorDOMAgent::NotSearching && !m_pausedInDebuggerM essage.isNull())
456 evaluateInOverlay("drawPausedInDebuggerMessage", m_pausedInDebuggerMessa ge); 457 evaluateInOverlay("drawPausedInDebuggerMessage", m_pausedInDebuggerMessa ge);
457 } 458 }
458 459
459 void InspectorOverlay::drawViewSize() 460 void InspectorOverlay::drawViewSize()
460 { 461 {
461 if (m_resizeTimerActive && m_drawViewSize) 462 if (m_resizeTimerActive && m_drawViewSize)
462 evaluateInOverlay("drawViewSize", ""); 463 evaluateInOverlay("drawViewSize", "");
463 } 464 }
464 465
465 float InspectorOverlay::windowToViewportScale() const
466 {
467 return m_webViewImpl->chromeClient().windowToViewportScalar(1.0f);
468 }
469
470 Page* InspectorOverlay::overlayPage() 466 Page* InspectorOverlay::overlayPage()
471 { 467 {
472 if (m_overlayPage) 468 if (m_overlayPage)
473 return m_overlayPage.get(); 469 return m_overlayPage.get();
474 470
475 ScriptForbiddenScope::AllowUserAgentScript allowScript; 471 ScriptForbiddenScope::AllowUserAgentScript allowScript;
476 472
477 DEFINE_STATIC_LOCAL(FrameLoaderClient, dummyFrameLoaderClient, (EmptyFrameLo aderClient::create())); 473 DEFINE_STATIC_LOCAL(FrameLoaderClient, dummyFrameLoaderClient, (EmptyFrameLo aderClient::create()));
478 Page::PageClients pageClients; 474 Page::PageClients pageClients;
479 fillWithEmptyClients(pageClients); 475 fillWithEmptyClients(pageClients);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 std::unique_ptr<protocol::DictionaryValue> resetData = protocol::DictionaryV alue::create(); 537 std::unique_ptr<protocol::DictionaryValue> resetData = protocol::DictionaryV alue::create();
542 resetData->setNumber("deviceScaleFactor", m_webViewImpl->page()->deviceScale Factor()); 538 resetData->setNumber("deviceScaleFactor", m_webViewImpl->page()->deviceScale Factor());
543 resetData->setNumber("pageScaleFactor", m_webViewImpl->page()->pageScaleFact or()); 539 resetData->setNumber("pageScaleFactor", m_webViewImpl->page()->pageScaleFact or());
544 540
545 IntRect viewportInScreen = m_webViewImpl->chromeClient().viewportToScreen( 541 IntRect viewportInScreen = m_webViewImpl->chromeClient().viewportToScreen(
546 IntRect(IntPoint(), viewportSize), m_webViewImpl->mainFrameImpl()->frame ()->view()); 542 IntRect(IntPoint(), viewportSize), m_webViewImpl->mainFrameImpl()->frame ()->view());
547 resetData->setObject("viewportSize", buildObjectForSize(viewportInScreen.siz e())); 543 resetData->setObject("viewportSize", buildObjectForSize(viewportInScreen.siz e()));
548 544
549 // The zoom factor in the overlay frame already has been multiplied by the w indow to viewport scale 545 // The zoom factor in the overlay frame already has been multiplied by the w indow to viewport scale
550 // (aka device scale factor), so cancel it. 546 // (aka device scale factor), so cancel it.
551 resetData->setNumber("pageZoomFactor", m_webViewImpl->mainFrameImpl()->frame ()->pageZoomFactor() / windowToViewportScale()); 547 float windowToViewportScale = m_webViewImpl->chromeClient().windowToViewport Scalar(1.0f);
548 resetData->setNumber("pageZoomFactor", m_webViewImpl->mainFrameImpl()->frame ()->pageZoomFactor() / windowToViewportScale);
552 549
553 resetData->setNumber("scrollX", documentScrollOffset.x()); 550 resetData->setNumber("scrollX", documentScrollOffset.x());
554 resetData->setNumber("scrollY", documentScrollOffset.y()); 551 resetData->setNumber("scrollY", documentScrollOffset.y());
555 evaluateInOverlay("reset", std::move(resetData)); 552 evaluateInOverlay("reset", std::move(resetData));
556 } 553 }
557 554
558 void InspectorOverlay::evaluateInOverlay(const String& method, const String& arg ument) 555 void InspectorOverlay::evaluateInOverlay(const String& method, const String& arg ument)
559 { 556 {
560 ScriptForbiddenScope::AllowUserAgentScript allowScript; 557 ScriptForbiddenScope::AllowUserAgentScript allowScript;
561 std::unique_ptr<protocol::ListValue> command = protocol::ListValue::create() ; 558 std::unique_ptr<protocol::ListValue> command = protocol::ListValue::create() ;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 790
794 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) 791 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node)
795 { 792 {
796 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node-> isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg ent) 793 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node-> isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg ent)
797 return; 794 return;
798 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen t, &overlayMainFrame()->script()); 795 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen t, &overlayMainFrame()->script());
799 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde n(true); 796 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde n(true);
800 } 797 }
801 798
802 } // namespace blink 799 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/InspectorOverlay.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698