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

Unified Diff: Source/core/dom/Document.cpp

Issue 724673003: Don't make :hover sticky on tap on sites that set a mobile viewport set (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Don't make :hover sticky on tap on sites that set a mobile viewport set Created 6 years, 1 month 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 | Source/core/page/EventHandler.cpp » ('j') | Source/core/page/EventHandler.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 5ef85b8c99b269694a820145e9b53603cb2d594f..264fb8d500a66c80f374fcd3a16b246e6e5020b2 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -3425,6 +3425,10 @@ void Document::styleResolverMayHaveChanged()
void Document::setHoverNode(PassRefPtrWillBeRawPtr<Node> newHoverNode)
{
+ if (!newHoverNode) {
+ m_hoverNode.clear();
Rick Byers 2014/11/17 22:00:10 why is this change necessary? Doesn't it already
+ return;
+ }
m_hoverNode = newHoverNode;
}
@@ -5424,10 +5428,21 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
}
}
- // Now set the hover state for our new object up to the root.
- for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) {
- if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain()))
- nodesToAddToChain.append(curr->node());
+ if ((settings() && settings()->viewportEnabled())
Rick Byers 2014/11/17 22:00:10 The logic to decide when to apply this policy belo
+ && oldHoverObj == newHoverObj && request.touchEvent() && !request.active() && !request.hover()) {
+ // clear the :hover style after Tap, when meta viewport is set
+ for (RenderObject* curr = oldHoverObj; curr; curr = curr->hoverAncestor()) {
Rick Byers 2014/11/17 22:00:10 please don't copy/paste code from above. We shoul
+ if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain())) {
+ nodesToRemoveFromChain.append(curr->node());
+ }
+ }
+ setHoverNode(nullptr);
+ } else {
+ // Now set the hover state for our new object up to the root.
+ for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) {
+ if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain()))
+ nodesToAddToChain.append(curr->node());
+ }
}
// mouseenter and mouseleave events do not bubble, so they are dispatched iff there is a capturing
« no previous file with comments | « no previous file | Source/core/page/EventHandler.cpp » ('j') | Source/core/page/EventHandler.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698