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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 309473002: [DevTools] Cleanup inspector overlay and make it work with virtual viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 1605
1606 { 1606 {
1607 // Avoids unnecessary invalidations while various bits of state in FastT extAutosizer are updated. 1607 // Avoids unnecessary invalidations while various bits of state in FastT extAutosizer are updated.
1608 FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); 1608 FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
1609 1609
1610 m_pageScaleConstraintsSet.didChangeViewSize(m_size); 1610 m_pageScaleConstraintsSet.didChangeViewSize(m_size);
1611 1611
1612 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription()); 1612 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription());
1613 updateMainFrameLayoutSize(); 1613 updateMainFrameLayoutSize();
1614 1614
1615 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
1616 if (agentPrivate)
1617 agentPrivate->webViewResized(newSize);
1618
1619 // If the virtual viewport pinch mode is enabled, the main frame will be resized 1615 // If the virtual viewport pinch mode is enabled, the main frame will be resized
1620 // after layout so it can be sized to the contentsSize. 1616 // after layout so it can be sized to the contentsSize.
1621 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView()) 1617 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView())
1622 mainFrameImpl()->frameView()->resize(m_size); 1618 mainFrameImpl()->frameView()->resize(m_size);
1623 1619
1624 if (pinchVirtualViewportEnabled()) 1620 if (pinchVirtualViewportEnabled())
1625 page()->frameHost().pinchViewport().setSize(m_size); 1621 page()->frameHost().pinchViewport().setSize(m_size);
1626 } 1622 }
1627 1623
1628 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { 1624 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after
3308 { 3304 {
3309 if (!m_page) 3305 if (!m_page)
3310 return; 3306 return;
3311 3307
3312 if (point.x == -1 || point.y == -1) { 3308 if (point.x == -1 || point.y == -1) {
3313 m_page->inspectorController().inspect(0); 3309 m_page->inspectorController().inspect(0);
3314 } else { 3310 } else {
3315 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move | HitT estRequest::ReadOnly | HitTestRequest::AllowChildFrameContent; 3311 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move | HitT estRequest::ReadOnly | HitTestRequest::AllowChildFrameContent;
3316 HitTestRequest request(hitType); 3312 HitTestRequest request(hitType);
3317 3313
3318 FrameView* frameView = m_page->mainFrame()->view(); 3314 WebMouseEvent dummyEvent;
pfeldman 2014/05/29 15:20:30 Why do we have to do this?
dgozman 2014/05/29 15:28:37 We want to hit exactly the same node as mouse even
3319 IntPoint transformedPoint(point); 3315 dummyEvent.type = WebInputEvent::MouseDown;
3320 transformedPoint = transformedPoint - frameView->inputEventsOffsetForEmu lation(); 3316 dummyEvent.x = point.x;
3321 transformedPoint.scale(1 / frameView->inputEventsScaleFactor(), 1 / fram eView->inputEventsScaleFactor()); 3317 dummyEvent.y = point.y;
3318 IntPoint transformedPoint = PlatformMouseEventBuilder(m_page->mainFrame( )->view(), dummyEvent).position();
3322 HitTestResult result(m_page->mainFrame()->view()->windowToContents(trans formedPoint)); 3319 HitTestResult result(m_page->mainFrame()->view()->windowToContents(trans formedPoint));
3323 m_page->mainFrame()->contentRenderer()->hitTest(request, result); 3320 m_page->mainFrame()->contentRenderer()->hitTest(request, result);
3324 Node* node = result.innerNode(); 3321 Node* node = result.innerNode();
3325 if (!node && m_page->mainFrame()->document()) 3322 if (!node && m_page->mainFrame()->document())
3326 node = m_page->mainFrame()->document()->documentElement(); 3323 node = m_page->mainFrame()->document()->documentElement();
3327 m_page->inspectorController().inspect(node); 3324 m_page->inspectorController().inspect(node);
3328 } 3325 }
3329 } 3326 }
3330 3327
3331 WebString WebViewImpl::inspectorSettings() const 3328 WebString WebViewImpl::inspectorSettings() const
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
4050 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4047 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4051 4048
4052 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4049 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4053 return false; 4050 return false;
4054 4051
4055 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4052 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4056 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4053 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4057 } 4054 }
4058 4055
4059 } // namespace blink 4056 } // namespace blink
OLDNEW
« Source/core/inspector/InspectorOverlay.cpp ('K') | « Source/web/WebDevToolsAgentPrivate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698