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

Side by Side 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: Refactored logic and corrected viewport checking 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/page/ChromeClient.h » ('j') | 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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 5406 matching lines...) Expand 10 before | Expand all | Expand 10 after
5417 5417
5418 } 5418 }
5419 5419
5420 // The old hover path only needs to be cleared up to (and not including) the common ancestor; 5420 // The old hover path only needs to be cleared up to (and not including) the common ancestor;
5421 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) { 5421 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) {
5422 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain())) 5422 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain()))
5423 nodesToRemoveFromChain.append(curr->node()); 5423 nodesToRemoveFromChain.append(curr->node());
5424 } 5424 }
5425 } 5425 }
5426 5426
5427 // Now set the hover state for our new object up to the root. 5427 if (oldHoverObj == newHoverObj && request.leave()) {
5428 for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { 5428 // clear hover path upto including the ancestor
5429 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->no de()->inActiveChain())) 5429 for (RenderObject* curr = oldHoverObj; curr; curr = curr->hoverAncestor( )) {
5430 nodesToAddToChain.append(curr->node()); 5430 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain())) {
5431 nodesToRemoveFromChain.append(curr->node());
5432 }
5433 }
5434 setHoverNode(nullptr);
5435 } else {
5436 // Now set the hover state for our new object up to the root.
5437 for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor( )) {
5438 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain()))
5439 nodesToAddToChain.append(curr->node());
5440 }
5431 } 5441 }
5432 5442
5433 // mouseenter and mouseleave events do not bubble, so they are dispatched if f there is a capturing 5443 // mouseenter and mouseleave events do not bubble, so they are dispatched if f there is a capturing
5434 // event handler on an ancestor or a normal event handler on the element its elf. This special 5444 // event handler on an ancestor or a normal event handler on the element its elf. This special
5435 // handling is necessary to avoid O(n^2) capturing event handler checks. We' ll check the previously 5445 // handling is necessary to avoid O(n^2) capturing event handler checks. We' ll check the previously
5436 // hovered node's ancestor tree for 'mouseleave' handlers here, then check t he newly hovered node's 5446 // hovered node's ancestor tree for 'mouseleave' handlers here, then check t he newly hovered node's
5437 // ancestor tree for 'mouseenter' handlers after dispatching the 'mouseleave ' events (as the handler 5447 // ancestor tree for 'mouseenter' handlers after dispatching the 'mouseleave ' events (as the handler
5438 // for 'mouseleave' might set a capturing 'mouseenter' handler, odd as that might be). 5448 // for 'mouseleave' might set a capturing 'mouseenter' handler, odd as that might be).
5439 bool ancestorHasCapturingMouseleaveListener = false; 5449 bool ancestorHasCapturingMouseleaveListener = false;
5440 if (event && newHoverNode != oldHoverNode.get()) { 5450 if (event && newHoverNode != oldHoverNode.get()) {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
5848 #ifndef NDEBUG 5858 #ifndef NDEBUG
5849 using namespace blink; 5859 using namespace blink;
5850 void showLiveDocumentInstances() 5860 void showLiveDocumentInstances()
5851 { 5861 {
5852 WeakDocumentSet& set = liveDocumentSet(); 5862 WeakDocumentSet& set = liveDocumentSet();
5853 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5863 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5854 for (Document* document : set) 5864 for (Document* document : set)
5855 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5865 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5856 } 5866 }
5857 #endif 5867 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/page/ChromeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698