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

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

Issue 2523903002: Document::updateHoverActiveState only cancel hover and active state when hitting native scrollbar (Closed)
Patch Set: bokan@ comment addressed Created 4 years 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
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 6001 matching lines...) Expand 10 before | Expand all | Expand 10 after
6012 if (currObj1 == currObj2) 6012 if (currObj1 == currObj2)
6013 return currObj1; 6013 return currObj1;
6014 } 6014 }
6015 } 6015 }
6016 6016
6017 return 0; 6017 return 0;
6018 } 6018 }
6019 6019
6020 void Document::updateHoverActiveState(const HitTestRequest& request, 6020 void Document::updateHoverActiveState(const HitTestRequest& request,
6021 Element* innerElement, 6021 Element* innerElement,
6022 bool hitScrollbar) { 6022 Scrollbar* hitScrollbar) {
6023 DCHECK(!request.readOnly()); 6023 DCHECK(!request.readOnly());
6024 6024
6025 if (request.active() && m_frame && !hitScrollbar) 6025 bool hitNativeScrollbar = hitScrollbar && !hitScrollbar->isCustomScrollbar();
bokan 2016/11/23 17:09:51 Please add a comment here on why custom scrollbars
6026
6027 if (request.active() && m_frame && !hitNativeScrollbar)
6026 m_frame->eventHandler().notifyElementActivated(); 6028 m_frame->eventHandler().notifyElementActivated();
6027 6029
6028 Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement; 6030 Element* innerElementInDocument = hitNativeScrollbar ? nullptr : innerElement;
6029 while (innerElementInDocument && innerElementInDocument->document() != this) { 6031 while (innerElementInDocument && innerElementInDocument->document() != this) {
6030 innerElementInDocument->document().updateHoverActiveState( 6032 innerElementInDocument->document().updateHoverActiveState(
6031 request, innerElementInDocument, hitScrollbar); 6033 request, innerElementInDocument, hitScrollbar);
6032 innerElementInDocument = innerElementInDocument->document().localOwner(); 6034 innerElementInDocument = innerElementInDocument->document().localOwner();
6033 } 6035 }
6034 6036
6035 updateDistribution(); 6037 updateDistribution();
6036 Element* oldActiveElement = activeHoverElement(); 6038 Element* oldActiveElement = activeHoverElement();
6037 if (oldActiveElement && (!request.active() || hitScrollbar)) { 6039 if (oldActiveElement && (!request.active() || hitNativeScrollbar)) {
6038 // The oldActiveElement layoutObject is null, dropped on :active by setting 6040 // The oldActiveElement layoutObject is null, dropped on :active by setting
6039 // display: none, for instance. We still need to clear the ActiveChain as 6041 // display: none, for instance. We still need to clear the ActiveChain as
6040 // the mouse is released. 6042 // the mouse is released.
6041 for (Node* node = oldActiveElement; node; 6043 for (Node* node = oldActiveElement; node;
6042 node = FlatTreeTraversal::parent(*node)) { 6044 node = FlatTreeTraversal::parent(*node)) {
6043 DCHECK(!node->isTextNode()); 6045 DCHECK(!node->isTextNode());
6044 node->setActive(false); 6046 node->setActive(false);
6045 m_userActionElements.setInActiveChain(node, false); 6047 m_userActionElements.setInActiveChain(node, false);
6046 } 6048 }
6047 setActiveHoverElement(nullptr); 6049 setActiveHoverElement(nullptr);
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
6522 } 6524 }
6523 6525
6524 void showLiveDocumentInstances() { 6526 void showLiveDocumentInstances() {
6525 WeakDocumentSet& set = liveDocumentSet(); 6527 WeakDocumentSet& set = liveDocumentSet();
6526 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6528 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6527 for (Document* document : set) 6529 for (Document* document : set)
6528 fprintf(stderr, "- Document %p URL: %s\n", document, 6530 fprintf(stderr, "- Document %p URL: %s\n", document,
6529 document->url().getString().utf8().data()); 6531 document->url().getString().utf8().data());
6530 } 6532 }
6531 #endif 6533 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698