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

Unified 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: merge crrev.com/2934853002 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 252d0aa7089ab20330dc086bc1cf3870f0b1afb5..becff01c5a7ab15128e4fcdf15c1a4acf31da9ac 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -143,6 +143,7 @@
#include "core/frame/LocalFrameView.h"
#include "core/frame/PerformanceMonitor.h"
#include "core/frame/Settings.h"
+#include "core/frame/VisualViewport.h"
#include "core/frame/csp/ContentSecurityPolicy.h"
#include "core/html/DocumentNameCollection.h"
#include "core/html/HTMLAllCollection.h"
@@ -6443,6 +6444,12 @@ void Document::UpdateHoverActiveState(const HitTestRequest& request,
SetActiveHoverElement(new_active_element);
}
}
+
+ // Do not set hover state if event is from touch and on mobile.
+ bool allow_hover_changes =
+ !(request.TouchEvent() && GetPage() &&
+ GetPage()->GetVisualViewport().ShouldDisableDesktopWorkarounds());
+
// If the mouse has just been pressed, set :active on the chain. Those (and
// only those) nodes should remain :active until the mouse is released.
bool allow_active_changes = !old_active_element && ActiveHoverElement();
@@ -6462,7 +6469,8 @@ void Document::UpdateHoverActiveState(const HitTestRequest& request,
SkipDisplayNoneAncestors(inner_element_in_document);
// Update our current hover element.
- SetHoverElement(new_hover_element);
+ if (allow_hover_changes)
+ SetHoverElement(new_hover_element);
Node* ancestor_element = nullptr;
if (old_hover_element && old_hover_element->isConnected() &&
@@ -6503,8 +6511,10 @@ void Document::UpdateHoverActiveState(const HitTestRequest& request,
elements_to_add_to_chain.push_back(curr);
}
- for (Element* element : elements_to_remove_from_chain)
- element->SetHovered(false);
+ if (allow_hover_changes) {
+ for (Element* element : elements_to_remove_from_chain)
+ element->SetHovered(false);
+ }
bool saw_common_ancestor = false;
for (Element* element : elements_to_add_to_chain) {
@@ -6514,7 +6524,8 @@ void Document::UpdateHoverActiveState(const HitTestRequest& request,
saw_common_ancestor = true;
if (allow_active_changes)
element->SetActive(true);
- if (!saw_common_ancestor || element == hover_element_)
+ if (allow_hover_changes &&
+ (!saw_common_ancestor || element == hover_element_))
element->SetHovered(true);
}
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698