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

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

Issue 2687543002: Change hover element to scrollbar's parent when hit test contains scrollbar (Closed)
Patch Set: Change hover element to scrollbar's parent when hit test contains scrollbar 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 6031 matching lines...) Expand 10 before | Expand all | Expand 10 after
6042 } 6042 }
6043 6043
6044 return 0; 6044 return 0;
6045 } 6045 }
6046 6046
6047 void Document::updateHoverActiveState(const HitTestRequest& request, 6047 void Document::updateHoverActiveState(const HitTestRequest& request,
6048 Element* innerElement, 6048 Element* innerElement,
6049 Scrollbar* hitScrollbar) { 6049 Scrollbar* hitScrollbar) {
6050 DCHECK(!request.readOnly()); 6050 DCHECK(!request.readOnly());
6051 6051
6052 // Only cancel hover state when hitting native scrollbar because custom 6052 if (request.active() && m_frame)
6053 // scrollbar's style depends on the owner element's hover state.
6054 bool hitNativeScrollbar = hitScrollbar && !hitScrollbar->isCustomScrollbar();
6055
6056 if (request.active() && m_frame && !hitNativeScrollbar)
6057 m_frame->eventHandler().notifyElementActivated(); 6053 m_frame->eventHandler().notifyElementActivated();
6058 6054
6059 Element* innerElementInDocument = hitNativeScrollbar ? nullptr : innerElement; 6055 Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement;
6056 // Replace the innerElementInDocument to be srollbar's parent when hit
6057 // scrollbar
6058 if (hitScrollbar) {
6059 ScrollableArea* scrollableArea = hitScrollbar->getScrollableArea();
6060 if (scrollableArea && scrollableArea->layoutBox() &&
6061 scrollableArea->layoutBox()->node() &&
6062 scrollableArea->layoutBox()->node()->isElementNode()) {
6063 innerElementInDocument =
6064 toElement(hitScrollbar->getScrollableArea()->layoutBox()->node());
6065 }
6066 }
6067
6060 while (innerElementInDocument && innerElementInDocument->document() != this) { 6068 while (innerElementInDocument && innerElementInDocument->document() != this) {
6061 innerElementInDocument->document().updateHoverActiveState( 6069 innerElementInDocument->document().updateHoverActiveState(
6062 request, innerElementInDocument, hitScrollbar); 6070 request, innerElementInDocument, hitScrollbar);
6063 innerElementInDocument = innerElementInDocument->document().localOwner(); 6071 innerElementInDocument = innerElementInDocument->document().localOwner();
6064 } 6072 }
6065 6073
6066 updateDistribution(); 6074 updateDistribution();
6067 Element* oldActiveElement = activeHoverElement(); 6075 Element* oldActiveElement = activeHoverElement();
6068 if (oldActiveElement && (!request.active() || hitNativeScrollbar)) { 6076 if (oldActiveElement && !request.active()) {
6069 // The oldActiveElement layoutObject is null, dropped on :active by setting 6077 // The oldActiveElement layoutObject is null, dropped on :active by setting
6070 // display: none, for instance. We still need to clear the ActiveChain as 6078 // display: none, for instance. We still need to clear the ActiveChain as
6071 // the mouse is released. 6079 // the mouse is released.
6072 for (Node* node = oldActiveElement; node; 6080 for (Node* node = oldActiveElement; node;
6073 node = FlatTreeTraversal::parent(*node)) { 6081 node = FlatTreeTraversal::parent(*node)) {
6074 DCHECK(!node->isTextNode()); 6082 DCHECK(!node->isTextNode());
6075 node->setActive(false); 6083 node->setActive(false);
6076 m_userActionElements.setInActiveChain(node, false); 6084 m_userActionElements.setInActiveChain(node, false);
6077 } 6085 }
6078 setActiveHoverElement(nullptr); 6086 setActiveHoverElement(nullptr);
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
6532 } 6540 }
6533 6541
6534 void showLiveDocumentInstances() { 6542 void showLiveDocumentInstances() {
6535 WeakDocumentSet& set = liveDocumentSet(); 6543 WeakDocumentSet& set = liveDocumentSet();
6536 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6544 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6537 for (Document* document : set) 6545 for (Document* document : set)
6538 fprintf(stderr, "- Document %p URL: %s\n", document, 6546 fprintf(stderr, "- Document %p URL: %s\n", document,
6539 document->url().getString().utf8().data()); 6547 document->url().getString().utf8().data());
6540 } 6548 }
6541 #endif 6549 #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