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

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: 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 3505 matching lines...) Expand 10 before | Expand all | Expand 10 after
3516 // page. Furthermore, mousemove events before the first layout should not 3516 // page. Furthermore, mousemove events before the first layout should not
3517 // lead to a premature layout() happening, which could show a flash of white. 3517 // lead to a premature layout() happening, which could show a flash of white.
3518 // See also the similar code in EventHandler::hitTestResultAtPoint. 3518 // See also the similar code in EventHandler::hitTestResultAtPoint.
3519 if (layoutViewItem().isNull() || !view() || !view()->didFirstLayout()) 3519 if (layoutViewItem().isNull() || !view() || !view()->didFirstLayout())
3520 return MouseEventWithHitTestResults(event, 3520 return MouseEventWithHitTestResults(event,
3521 HitTestResult(request, LayoutPoint())); 3521 HitTestResult(request, LayoutPoint()));
3522 3522
3523 HitTestResult result(request, documentPoint); 3523 HitTestResult result(request, documentPoint);
3524 layoutViewItem().hitTest(result); 3524 layoutViewItem().hitTest(result);
3525 3525
3526 if (!request.readOnly()) 3526 if (!request.readOnly()) {
3527 updateHoverActiveState(request, result.innerElement(), result.scrollbar()); 3527 updateHoverActiveState(
3528 request, result.innerElement(),
3529 result.scrollbar() && result.scrollbar()->isOverlayScrollbar());
3530 }
3528 3531
3529 if (isHTMLCanvasElement(result.innerNode())) { 3532 if (isHTMLCanvasElement(result.innerNode())) {
3530 PlatformMouseEvent eventWithRegion = event; 3533 PlatformMouseEvent eventWithRegion = event;
3531 HitTestCanvasResult* hitTestCanvasResult = 3534 HitTestCanvasResult* hitTestCanvasResult =
3532 toHTMLCanvasElement(result.innerNode()) 3535 toHTMLCanvasElement(result.innerNode())
3533 ->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); 3536 ->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame());
3534 if (hitTestCanvasResult->getControl()) { 3537 if (hitTestCanvasResult->getControl()) {
3535 result.setInnerNode(hitTestCanvasResult->getControl()); 3538 result.setInnerNode(hitTestCanvasResult->getControl());
3536 } 3539 }
3537 eventWithRegion.setRegion(hitTestCanvasResult->getId()); 3540 eventWithRegion.setRegion(hitTestCanvasResult->getId());
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after
6012 if (currObj1 == currObj2) 6015 if (currObj1 == currObj2)
6013 return currObj1; 6016 return currObj1;
6014 } 6017 }
6015 } 6018 }
6016 6019
6017 return 0; 6020 return 0;
6018 } 6021 }
6019 6022
6020 void Document::updateHoverActiveState(const HitTestRequest& request, 6023 void Document::updateHoverActiveState(const HitTestRequest& request,
6021 Element* innerElement, 6024 Element* innerElement,
6022 bool hitScrollbar) { 6025 bool hitOverlayScrollbar) {
bokan 2016/11/23 15:07:50 I think the distinction is native vs custom rather
6023 DCHECK(!request.readOnly()); 6026 DCHECK(!request.readOnly());
6024 6027
6025 if (request.active() && m_frame && !hitScrollbar) 6028 if (request.active() && m_frame && !hitOverlayScrollbar)
6026 m_frame->eventHandler().notifyElementActivated(); 6029 m_frame->eventHandler().notifyElementActivated();
6027 6030
6028 Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement; 6031 Element* innerElementInDocument =
6032 hitOverlayScrollbar ? nullptr : innerElement;
6029 while (innerElementInDocument && innerElementInDocument->document() != this) { 6033 while (innerElementInDocument && innerElementInDocument->document() != this) {
6030 innerElementInDocument->document().updateHoverActiveState( 6034 innerElementInDocument->document().updateHoverActiveState(
6031 request, innerElementInDocument, hitScrollbar); 6035 request, innerElementInDocument, hitOverlayScrollbar);
6032 innerElementInDocument = innerElementInDocument->document().localOwner(); 6036 innerElementInDocument = innerElementInDocument->document().localOwner();
6033 } 6037 }
6034 6038
6035 updateDistribution(); 6039 updateDistribution();
6036 Element* oldActiveElement = activeHoverElement(); 6040 Element* oldActiveElement = activeHoverElement();
6037 if (oldActiveElement && (!request.active() || hitScrollbar)) { 6041 if (oldActiveElement && (!request.active() || hitOverlayScrollbar)) {
6038 // The oldActiveElement layoutObject is null, dropped on :active by setting 6042 // The oldActiveElement layoutObject is null, dropped on :active by setting
6039 // display: none, for instance. We still need to clear the ActiveChain as 6043 // display: none, for instance. We still need to clear the ActiveChain as
6040 // the mouse is released. 6044 // the mouse is released.
6041 for (Node* node = oldActiveElement; node; 6045 for (Node* node = oldActiveElement; node;
6042 node = FlatTreeTraversal::parent(*node)) { 6046 node = FlatTreeTraversal::parent(*node)) {
6043 DCHECK(!node->isTextNode()); 6047 DCHECK(!node->isTextNode());
6044 node->setActive(false); 6048 node->setActive(false);
6045 m_userActionElements.setInActiveChain(node, false); 6049 m_userActionElements.setInActiveChain(node, false);
6046 } 6050 }
6047 setActiveHoverElement(nullptr); 6051 setActiveHoverElement(nullptr);
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
6522 } 6526 }
6523 6527
6524 void showLiveDocumentInstances() { 6528 void showLiveDocumentInstances() {
6525 WeakDocumentSet& set = liveDocumentSet(); 6529 WeakDocumentSet& set = liveDocumentSet();
6526 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6530 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6527 for (Document* document : set) 6531 for (Document* document : set)
6528 fprintf(stderr, "- Document %p URL: %s\n", document, 6532 fprintf(stderr, "- Document %p URL: %s\n", document,
6529 document->url().getString().utf8().data()); 6533 document->url().getString().utf8().data());
6530 } 6534 }
6531 #endif 6535 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698