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

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: Added a unit test. Created 6 years, 2 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 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.
718 WebGestureEvent scaledEvent = event; 716 WebGestureEvent scaledEvent = event;
719 scaledEvent.x = event.x / pageScaleFactor(); 717 scaledEvent.x = event.x / pageScaleFactor();
720 scaledEvent.y = event.y / pageScaleFactor(); 718 scaledEvent.y = event.y / pageScaleFactor();
721 scaledEvent.data.tap.width = event.data.tap.width / pageScaleFactor( ); 719 scaledEvent.data.tap.width = event.data.tap.width / pageScaleFactor( );
722 scaledEvent.data.tap.height = event.data.tap.height / pageScaleFacto r(); 720 scaledEvent.data.tap.height = event.data.tap.height / pageScaleFacto r();
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); 721 IntRect boundingBox(
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
724 Vector<IntRect> goodTargets; 733 Vector<IntRect> goodTargets;
725 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes; 734 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes;
726 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), goodTarg ets, highlightNodes); 735 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), goodTarg ets, highlightNodes);
727 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1? 736 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1?
728 // Single candidate case is currently handled by: https://bugs.webki t.org/show_bug.cgi?id=85101 737 // Single candidate case is currently handled by: https://bugs.webki t.org/show_bug.cgi?id=85101
729 if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleT argets(scaledEvent, goodTargets)) { 738 if (goodTargets.size() >= 2 && m_client
739 && m_client->didTapMultipleTargets(pinchViewportOffset, bounding Box, goodTargets)) {
740
730 enableTapHighlights(highlightNodes); 741 enableTapHighlights(highlightNodes);
731 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 742 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
732 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); 743 m_linkHighlights[i]->startHighlightAnimationIfNeeded();
733 eventSwallowed = true; 744 eventSwallowed = true;
734 eventCancelled = true; 745 eventCancelled = true;
735 break; 746 break;
736 } 747 }
737 } 748 }
738 749
739 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent); 750 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent);
(...skipping 3633 matching lines...) Expand 10 before | Expand all | Expand 10 after
4373 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4384 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4374 4385
4375 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4386 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4376 return false; 4387 return false;
4377 4388
4378 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4389 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4379 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4390 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4380 } 4391 }
4381 4392
4382 } // namespace blink 4393 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698