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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2931433002: Disable hover state change for touch event on page with viewport meta and mobile. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 #include "core/frame/EventHandlerRegistry.h" 137 #include "core/frame/EventHandlerRegistry.h"
138 #include "core/frame/FrameConsole.h" 138 #include "core/frame/FrameConsole.h"
139 #include "core/frame/History.h" 139 #include "core/frame/History.h"
140 #include "core/frame/HostsUsingFeatures.h" 140 #include "core/frame/HostsUsingFeatures.h"
141 #include "core/frame/LocalDOMWindow.h" 141 #include "core/frame/LocalDOMWindow.h"
142 #include "core/frame/LocalFrame.h" 142 #include "core/frame/LocalFrame.h"
143 #include "core/frame/LocalFrameClient.h" 143 #include "core/frame/LocalFrameClient.h"
144 #include "core/frame/LocalFrameView.h" 144 #include "core/frame/LocalFrameView.h"
145 #include "core/frame/PerformanceMonitor.h" 145 #include "core/frame/PerformanceMonitor.h"
146 #include "core/frame/Settings.h" 146 #include "core/frame/Settings.h"
147 #include "core/frame/VisualViewport.h"
147 #include "core/frame/csp/ContentSecurityPolicy.h" 148 #include "core/frame/csp/ContentSecurityPolicy.h"
148 #include "core/html/DocumentNameCollection.h" 149 #include "core/html/DocumentNameCollection.h"
149 #include "core/html/HTMLAllCollection.h" 150 #include "core/html/HTMLAllCollection.h"
150 #include "core/html/HTMLAnchorElement.h" 151 #include "core/html/HTMLAnchorElement.h"
151 #include "core/html/HTMLBaseElement.h" 152 #include "core/html/HTMLBaseElement.h"
152 #include "core/html/HTMLBodyElement.h" 153 #include "core/html/HTMLBodyElement.h"
153 #include "core/html/HTMLCanvasElement.h" 154 #include "core/html/HTMLCanvasElement.h"
154 #include "core/html/HTMLCollection.h" 155 #include "core/html/HTMLCollection.h"
155 #include "core/html/HTMLDialogElement.h" 156 #include "core/html/HTMLDialogElement.h"
156 #include "core/html/HTMLDocument.h" 157 #include "core/html/HTMLDocument.h"
(...skipping 6247 matching lines...) Expand 10 before | Expand all | Expand 10 after
6404 !request.TouchMove()) { 6405 !request.TouchMove()) {
6405 // We are setting the :active chain and freezing it. If future moves 6406 // We are setting the :active chain and freezing it. If future moves
6406 // happen, they will need to reference this chain. 6407 // happen, they will need to reference this chain.
6407 for (Element* element = new_active_element; element; 6408 for (Element* element = new_active_element; element;
6408 element = FlatTreeTraversal::ParentElement(*element)) { 6409 element = FlatTreeTraversal::ParentElement(*element)) {
6409 user_action_elements_.SetInActiveChain(element, true); 6410 user_action_elements_.SetInActiveChain(element, true);
6410 } 6411 }
6411 SetActiveHoverElement(new_active_element); 6412 SetActiveHoverElement(new_active_element);
6412 } 6413 }
6413 } 6414 }
6415
6416 // Do not set hover state if event is from touch and on mobile.
6417 if (request.TouchEvent() && GetPage() &&
6418 GetPage()->GetVisualViewport().ShouldDisableDesktopWorkarounds())
6419 return;
6420
6414 // If the mouse has just been pressed, set :active on the chain. Those (and 6421 // If the mouse has just been pressed, set :active on the chain. Those (and
6415 // only those) nodes should remain :active until the mouse is released. 6422 // only those) nodes should remain :active until the mouse is released.
6416 bool allow_active_changes = !old_active_element && ActiveHoverElement(); 6423 bool allow_active_changes = !old_active_element && ActiveHoverElement();
6417 6424
6418 // If the mouse is down and if this is a mouse move event, we want to restrict 6425 // If the mouse is down and if this is a mouse move event, we want to restrict
6419 // changes in :hover/:active to only apply to elements that are in the :active 6426 // changes in :hover/:active to only apply to elements that are in the :active
6420 // chain that we froze at the time the mouse went down. 6427 // chain that we froze at the time the mouse went down.
6421 bool must_be_in_active_chain = request.Active() && request.Move(); 6428 bool must_be_in_active_chain = request.Active() && request.Move();
6422 6429
6423 Element* old_hover_element = HoverElement(); 6430 Element* old_hover_element = HoverElement();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
6474 for (Element* element : elements_to_remove_from_chain) 6481 for (Element* element : elements_to_remove_from_chain)
6475 element->SetHovered(false); 6482 element->SetHovered(false);
6476 6483
6477 bool saw_common_ancestor = false; 6484 bool saw_common_ancestor = false;
6478 for (Element* element : elements_to_add_to_chain) { 6485 for (Element* element : elements_to_add_to_chain) {
6479 // Elements past the common ancestor do not change hover state, but might 6486 // Elements past the common ancestor do not change hover state, but might
6480 // change active state. 6487 // change active state.
6481 if (element == ancestor_element) 6488 if (element == ancestor_element)
6482 saw_common_ancestor = true; 6489 saw_common_ancestor = true;
6483 if (allow_active_changes) 6490 if (allow_active_changes)
6484 element->SetActive(true); 6491 element->SetActive(true);
chaopeng 2017/06/06 17:18:49 I don't know should we keep setActive here?
bokan 2017/06/06 21:07:08 Active makes sense in the context of touch so we c
6485 if (!saw_common_ancestor || element == hover_element_) 6492 if (!saw_common_ancestor || element == hover_element_)
6486 element->SetHovered(true); 6493 element->SetHovered(true);
6487 } 6494 }
6488 } 6495 }
6489 6496
6490 bool Document::HaveScriptBlockingStylesheetsLoaded() const { 6497 bool Document::HaveScriptBlockingStylesheetsLoaded() const {
6491 return style_engine_->HaveScriptBlockingStylesheetsLoaded(); 6498 return style_engine_->HaveScriptBlockingStylesheetsLoaded();
6492 } 6499 }
6493 6500
6494 bool Document::HaveRenderBlockingStylesheetsLoaded() const { 6501 bool Document::HaveRenderBlockingStylesheetsLoaded() const {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
6842 } 6849 }
6843 6850
6844 void showLiveDocumentInstances() { 6851 void showLiveDocumentInstances() {
6845 WeakDocumentSet& set = liveDocumentSet(); 6852 WeakDocumentSet& set = liveDocumentSet();
6846 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6853 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6847 for (blink::Document* document : set) 6854 for (blink::Document* document : set)
6848 fprintf(stderr, "- Document %p URL: %s\n", document, 6855 fprintf(stderr, "- Document %p URL: %s\n", document,
6849 document->Url().GetString().Utf8().data()); 6856 document->Url().GetString().Utf8().data());
6850 } 6857 }
6851 #endif 6858 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698