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

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

Issue 2668133003: Change hover element to scrollbar's parent when hit test contains scrollbar (Closed)
Patch Set: bokan comment addressed Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('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 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 6071 matching lines...) Expand 10 before | Expand all | Expand 10 after
6082 } 6082 }
6083 6083
6084 return 0; 6084 return 0;
6085 } 6085 }
6086 6086
6087 void Document::updateHoverActiveState(const HitTestRequest& request, 6087 void Document::updateHoverActiveState(const HitTestRequest& request,
6088 Element* innerElement, 6088 Element* innerElement,
6089 Scrollbar* hitScrollbar) { 6089 Scrollbar* hitScrollbar) {
6090 DCHECK(!request.readOnly()); 6090 DCHECK(!request.readOnly());
6091 6091
6092 // Only cancel hover state when hitting native scrollbar because custom 6092 if (request.active() && m_frame)
6093 // scrollbar's style depends on the owner element's hover state.
6094 bool hitNativeScrollbar = hitScrollbar && !hitScrollbar->isCustomScrollbar();
6095
6096 if (request.active() && m_frame && !hitNativeScrollbar)
6097 m_frame->eventHandler().notifyElementActivated(); 6093 m_frame->eventHandler().notifyElementActivated();
6098 6094
6099 Element* innerElementInDocument = hitNativeScrollbar ? nullptr : innerElement; 6095 Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement;
6096 // Replace the innerElementInDocument to be srollbar's parent when hit
6097 // scrollbar
6098 if (hitScrollbar) {
6099 ScrollableArea* scrollableArea = hitScrollbar->getScrollableArea();
6100 if (scrollableArea && scrollableArea->layoutBox() &&
6101 scrollableArea->layoutBox()->node() &&
6102 scrollableArea->layoutBox()->node()->isElementNode()) {
6103 innerElementInDocument =
6104 toElement(hitScrollbar->getScrollableArea()->layoutBox()->node());
6105 }
6106 }
6107
6100 while (innerElementInDocument && innerElementInDocument->document() != this) { 6108 while (innerElementInDocument && innerElementInDocument->document() != this) {
6101 innerElementInDocument->document().updateHoverActiveState( 6109 innerElementInDocument->document().updateHoverActiveState(
6102 request, innerElementInDocument, hitScrollbar); 6110 request, innerElementInDocument, hitScrollbar);
6103 innerElementInDocument = innerElementInDocument->document().localOwner(); 6111 innerElementInDocument = innerElementInDocument->document().localOwner();
6104 } 6112 }
6105 6113
6106 updateDistribution(); 6114 updateDistribution();
6107 Element* oldActiveElement = activeHoverElement(); 6115 Element* oldActiveElement = activeHoverElement();
6108 if (oldActiveElement && (!request.active() || hitNativeScrollbar)) { 6116 if (oldActiveElement && !request.active()) {
6109 // The oldActiveElement layoutObject is null, dropped on :active by setting 6117 // The oldActiveElement layoutObject is null, dropped on :active by setting
6110 // display: none, for instance. We still need to clear the ActiveChain as 6118 // display: none, for instance. We still need to clear the ActiveChain as
6111 // the mouse is released. 6119 // the mouse is released.
6112 for (Node* node = oldActiveElement; node; 6120 for (Node* node = oldActiveElement; node;
6113 node = FlatTreeTraversal::parent(*node)) { 6121 node = FlatTreeTraversal::parent(*node)) {
6114 DCHECK(!node->isTextNode()); 6122 DCHECK(!node->isTextNode());
6115 node->setActive(false); 6123 node->setActive(false);
6116 m_userActionElements.setInActiveChain(node, false); 6124 m_userActionElements.setInActiveChain(node, false);
6117 } 6125 }
6118 setActiveHoverElement(nullptr); 6126 setActiveHoverElement(nullptr);
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
6570 } 6578 }
6571 6579
6572 void showLiveDocumentInstances() { 6580 void showLiveDocumentInstances() {
6573 WeakDocumentSet& set = liveDocumentSet(); 6581 WeakDocumentSet& set = liveDocumentSet();
6574 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6582 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6575 for (blink::Document* document : set) 6583 for (blink::Document* document : set)
6576 fprintf(stderr, "- Document %p URL: %s\n", document, 6584 fprintf(stderr, "- Document %p URL: %s\n", document,
6577 document->url().getString().utf8().data()); 6585 document->url().getString().utf8().data());
6578 } 6586 }
6579 #endif 6587 #endif
OLDNEW
« 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