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

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

Issue 584893004: Use the pinch viewport offset for tap disambiguation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed the unit test for Android. Created 6 years, 3 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 | « Source/core/frame/PinchViewport.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | 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, 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 RefPtr<PopupContainer> selectPopup; 744 RefPtr<PopupContainer> selectPopup;
745 selectPopup = m_selectPopup; 745 selectPopup = m_selectPopup;
746 hideSelectPopup(); 746 hideSelectPopup();
747 ASSERT(!m_selectPopup); 747 ASSERT(!m_selectPopup);
748 748
749 // Don't trigger a disambiguation popup on sites designed for mobile dev ices. 749 // Don't trigger a disambiguation popup on sites designed for mobile dev ices.
750 // Instead, assume that the page has been designed with big enough butto ns and links. 750 // Instead, assume that the page has been designed with big enough butto ns and links.
751 // Don't trigger a disambiguation popup when screencasting, since it's i mplemented outside of 751 // Don't trigger a disambiguation popup when screencasting, since it's i mplemented outside of
752 // compositor pipeline and is not being screencasted itself. This leads to bad user experience. 752 // compositor pipeline and is not being screencasted itself. This leads to bad user experience.
753 if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds() && !p age()->inspectorController().screencastEnabled()) { 753 if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds() && !p age()->inspectorController().screencastEnabled()) {
754 // FIXME: didTapMultipleTargets should just take a rect instead of
755 // an event.
756 WebGestureEvent scaledEvent = event; 754 WebGestureEvent scaledEvent = event;
757 scaledEvent.x = event.x / pageScaleFactor(); 755 scaledEvent.x = event.x / pageScaleFactor();
758 scaledEvent.y = event.y / pageScaleFactor(); 756 scaledEvent.y = event.y / pageScaleFactor();
759 scaledEvent.data.tap.width = event.data.tap.width / pageScaleFactor( ); 757 scaledEvent.data.tap.width = event.data.tap.width / pageScaleFactor( );
760 scaledEvent.data.tap.height = event.data.tap.height / pageScaleFacto r(); 758 scaledEvent.data.tap.height = event.data.tap.height / pageScaleFacto r();
761 IntRect boundingBox(scaledEvent.x - scaledEvent.data.tap.width / 2, scaledEvent.y - scaledEvent.data.tap.height / 2, scaledEvent.data.tap.width, sca ledEvent.data.tap.height); 759 IntRect boundingBox(
760 scaledEvent.x - scaledEvent.data.tap.width / 2,
761 scaledEvent.y - scaledEvent.data.tap.height / 2,
762 scaledEvent.data.tap.width,
763 scaledEvent.data.tap.height);
764
765 WebSize pinchViewportOffset = pinchVirtualViewportEnabled() ?
766 flooredIntSize(page()->frameHost().pinchViewport().location()) : IntSize();
767
768 // Keep bounding box relative to the main frame.
769 boundingBox.move(pinchViewportOffset);
770
762 Vector<IntRect> goodTargets; 771 Vector<IntRect> goodTargets;
763 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes; 772 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes;
764 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), goodTarg ets, highlightNodes); 773 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), goodTarg ets, highlightNodes);
765 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1? 774 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1?
766 // Single candidate case is currently handled by: https://bugs.webki t.org/show_bug.cgi?id=85101 775 // Single candidate case is currently handled by: https://bugs.webki t.org/show_bug.cgi?id=85101
767 if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleT argets(scaledEvent, goodTargets)) { 776 if (goodTargets.size() >= 2 && m_client
777 && m_client->didTapMultipleTargets(pinchViewportOffset, bounding Box, goodTargets)) {
778
768 enableTapHighlights(highlightNodes); 779 enableTapHighlights(highlightNodes);
769 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 780 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
770 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); 781 m_linkHighlights[i]->startHighlightAnimationIfNeeded();
771 eventSwallowed = true; 782 eventSwallowed = true;
772 eventCancelled = true; 783 eventCancelled = true;
773 break; 784 break;
774 } 785 }
775 } 786 }
776 787
777 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(targetedEvent); 788 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(targetedEvent);
(...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after
4374 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4385 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4375 4386
4376 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4387 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4377 return false; 4388 return false;
4378 4389
4379 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4390 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4380 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4391 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4381 } 4392 }
4382 4393
4383 } // namespace blink 4394 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/PinchViewport.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698