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

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

Issue 602583003: Revert of Use the pinch viewport offset for tap disambiguation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 } 706 }
707 707
708 RefPtr<PopupContainer> selectPopup; 708 RefPtr<PopupContainer> selectPopup;
709 selectPopup = m_selectPopup; 709 selectPopup = m_selectPopup;
710 hideSelectPopup(); 710 hideSelectPopup();
711 ASSERT(!m_selectPopup); 711 ASSERT(!m_selectPopup);
712 712
713 // Don't trigger a disambiguation popup on sites designed for mobile dev ices. 713 // Don't trigger a disambiguation popup on sites designed for mobile dev ices.
714 // Instead, assume that the page has been designed with big enough butto ns and links. 714 // Instead, assume that the page has been designed with big enough butto ns and links.
715 if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds()) { 715 if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds()) {
716 // FIXME: didTapMultipleTargets should just take a rect instead of
717 // an event.
716 WebGestureEvent scaledEvent = event; 718 WebGestureEvent scaledEvent = event;
717 scaledEvent.x = event.x / pageScaleFactor(); 719 scaledEvent.x = event.x / pageScaleFactor();
718 scaledEvent.y = event.y / pageScaleFactor(); 720 scaledEvent.y = event.y / pageScaleFactor();
719 scaledEvent.data.tap.width = event.data.tap.width / pageScaleFactor( ); 721 scaledEvent.data.tap.width = event.data.tap.width / pageScaleFactor( );
720 scaledEvent.data.tap.height = event.data.tap.height / pageScaleFacto r(); 722 scaledEvent.data.tap.height = event.data.tap.height / pageScaleFacto r();
721 IntRect boundingBox( 723 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);
722 scaledEvent.x - scaledEvent.data.tap.width / 2,
723 scaledEvent.y - scaledEvent.data.tap.height / 2,
724 scaledEvent.data.tap.width,
725 scaledEvent.data.tap.height);
726
727 WebSize pinchViewportOffset = pinchVirtualViewportEnabled() ?
728 flooredIntSize(page()->frameHost().pinchViewport().location()) : IntSize();
729
730 // Keep bounding box relative to the main frame.
731 boundingBox.move(pinchViewportOffset);
732
733 Vector<IntRect> goodTargets; 724 Vector<IntRect> goodTargets;
734 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes; 725 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes;
735 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), goodTarg ets, highlightNodes); 726 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), goodTarg ets, highlightNodes);
736 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1? 727 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1?
737 // Single candidate case is currently handled by: https://bugs.webki t.org/show_bug.cgi?id=85101 728 // Single candidate case is currently handled by: https://bugs.webki t.org/show_bug.cgi?id=85101
738 if (goodTargets.size() >= 2 && m_client 729 if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleT argets(scaledEvent, goodTargets)) {
739 && m_client->didTapMultipleTargets(pinchViewportOffset, bounding Box, goodTargets)) {
740
741 enableTapHighlights(highlightNodes); 730 enableTapHighlights(highlightNodes);
742 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 731 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
743 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); 732 m_linkHighlights[i]->startHighlightAnimationIfNeeded();
744 eventSwallowed = true; 733 eventSwallowed = true;
745 eventCancelled = true; 734 eventCancelled = true;
746 break; 735 break;
747 } 736 }
748 } 737 }
749 738
750 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent); 739 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent);
(...skipping 3633 matching lines...) Expand 10 before | Expand all | Expand 10 after
4384 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4373 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4385 4374
4386 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4375 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4387 return false; 4376 return false;
4388 4377
4389 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4378 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4390 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4379 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4391 } 4380 }
4392 4381
4393 } // namespace blink 4382 } // 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