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

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

Issue 604573002: Eliminate hit test for content detection on GestureTap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update hit test counts 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
« no previous file with comments | « Source/web/WebViewImpl.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, 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 726 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
727 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); 727 m_linkHighlights[i]->startHighlightAnimationIfNeeded();
728 break; 728 break;
729 default: 729 default:
730 break; 730 break;
731 } 731 }
732 732
733 switch (event.type) { 733 switch (event.type) {
734 case WebInputEvent::GestureTap: { 734 case WebInputEvent::GestureTap: {
735 m_client->cancelScheduledContentIntents(); 735 m_client->cancelScheduledContentIntents();
736 // FIXME: Use targeted event here and save another hit test. 736 if (detectContentOnTouch(targetedEvent)) {
737 // FIXME: Content intent should be generated using same node that was hi ghlighted. crbug.com/416746
738 if (detectContentOnTouch(platformEvent.position())) {
739 eventSwallowed = true; 737 eventSwallowed = true;
740 break; 738 break;
741 } 739 }
742 740
743 RefPtr<PopupContainer> selectPopup; 741 RefPtr<PopupContainer> selectPopup;
744 selectPopup = m_selectPopup; 742 selectPopup = m_selectPopup;
745 hideSelectPopup(); 743 hideSelectPopup();
746 ASSERT(!m_selectPopup); 744 ASSERT(!m_selectPopup);
747 745
748 // Don't trigger a disambiguation popup on sites designed for mobile dev ices. 746 // Don't trigger a disambiguation popup on sites designed for mobile dev ices.
(...skipping 3536 matching lines...) Expand 10 before | Expand all | Expand 10 after
4285 m_rootTransformLayer = m_page->deprecatedLocalMainFrame()->view()->rende rView()->compositor()->ensureRootTransformLayer(); 4283 m_rootTransformLayer = m_page->deprecatedLocalMainFrame()->view()->rende rView()->compositor()->ensureRootTransformLayer();
4286 4284
4287 if (m_rootTransformLayer) { 4285 if (m_rootTransformLayer) {
4288 TransformationMatrix transform; 4286 TransformationMatrix transform;
4289 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); 4287 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height);
4290 transform = transform.scale(m_rootLayerScale); 4288 transform = transform.scale(m_rootLayerScale);
4291 m_rootTransformLayer->setTransform(transform); 4289 m_rootTransformLayer->setTransform(transform);
4292 } 4290 }
4293 } 4291 }
4294 4292
4295 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) 4293 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar getedEvent)
4296 { 4294 {
4297 HitTestResult touchHit = hitTestResultForWindowPos(position); 4295 if (!m_page->mainFrame()->isLocalFrame())
4296 return false;
4297
4298 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo ot() will modify it.
4299 HitTestResult touchHit = targetedEvent.hitTestResult();
4300 touchHit.setToShadowHostIfInUserAgentShadowRoot();
4298 4301
4299 if (touchHit.isContentEditable()) 4302 if (touchHit.isContentEditable())
4300 return false; 4303 return false;
4301 4304
4302 Node* node = touchHit.innerNode(); 4305 Node* node = touchHit.innerNode();
4303 if (!node || !node->isTextNode()) 4306 if (!node || !node->isTextNode())
4304 return false; 4307 return false;
4305 4308
4306 // Ignore when tapping on links or nodes listening to click events, unless t he click event is on the 4309 // Ignore when tapping on links or nodes listening to click events, unless t he click event is on the
4307 // body element, in which case it's unlikely that the original node itself w as intended to be clickable. 4310 // body element, in which case it's unlikely that the original node itself w as intended to be clickable.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
4390 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4393 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4391 4394
4392 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4395 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4393 return false; 4396 return false;
4394 4397
4395 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4398 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4396 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4399 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4397 } 4400 }
4398 4401
4399 } // namespace blink 4402 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698