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

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

Issue 2491953004: Reland of Fix link's hover state if the link under scrollbar (Closed)
Patch Set: Rebase Created 4 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
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 3410 matching lines...) Expand 10 before | Expand all | Expand 10 after
3421 // lead to a premature layout() happening, which could show a flash of white. 3421 // lead to a premature layout() happening, which could show a flash of white.
3422 // See also the similar code in EventHandler::hitTestResultAtPoint. 3422 // See also the similar code in EventHandler::hitTestResultAtPoint.
3423 if (layoutViewItem().isNull() || !view() || !view()->didFirstLayout()) 3423 if (layoutViewItem().isNull() || !view() || !view()->didFirstLayout())
3424 return MouseEventWithHitTestResults(event, 3424 return MouseEventWithHitTestResults(event,
3425 HitTestResult(request, LayoutPoint())); 3425 HitTestResult(request, LayoutPoint()));
3426 3426
3427 HitTestResult result(request, documentPoint); 3427 HitTestResult result(request, documentPoint);
3428 layoutViewItem().hitTest(result); 3428 layoutViewItem().hitTest(result);
3429 3429
3430 if (!request.readOnly()) 3430 if (!request.readOnly())
3431 updateHoverActiveState(request, result.innerElement()); 3431 updateHoverActiveState(request, result.innerElement(), result.scrollbar());
3432 3432
3433 if (isHTMLCanvasElement(result.innerNode())) { 3433 if (isHTMLCanvasElement(result.innerNode())) {
3434 PlatformMouseEvent eventWithRegion = event; 3434 PlatformMouseEvent eventWithRegion = event;
3435 HitTestCanvasResult* hitTestCanvasResult = 3435 HitTestCanvasResult* hitTestCanvasResult =
3436 toHTMLCanvasElement(result.innerNode()) 3436 toHTMLCanvasElement(result.innerNode())
3437 ->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); 3437 ->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame());
3438 if (hitTestCanvasResult->getControl()) { 3438 if (hitTestCanvasResult->getControl()) {
3439 result.setInnerNode(hitTestCanvasResult->getControl()); 3439 result.setInnerNode(hitTestCanvasResult->getControl());
3440 } 3440 }
3441 eventWithRegion.setRegion(hitTestCanvasResult->getId()); 3441 eventWithRegion.setRegion(hitTestCanvasResult->getId());
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after
5928 currObj2 = currObj2->hoverAncestor()) { 5928 currObj2 = currObj2->hoverAncestor()) {
5929 if (currObj1 == currObj2) 5929 if (currObj1 == currObj2)
5930 return currObj1; 5930 return currObj1;
5931 } 5931 }
5932 } 5932 }
5933 5933
5934 return 0; 5934 return 0;
5935 } 5935 }
5936 5936
5937 void Document::updateHoverActiveState(const HitTestRequest& request, 5937 void Document::updateHoverActiveState(const HitTestRequest& request,
5938 Element* innerElement) { 5938 Element* innerElement,
5939 bool hitScrollbar) {
5939 DCHECK(!request.readOnly()); 5940 DCHECK(!request.readOnly());
5940 5941
5941 if (request.active() && m_frame) 5942 if (request.active() && m_frame && !hitScrollbar)
5942 m_frame->eventHandler().notifyElementActivated(); 5943 m_frame->eventHandler().notifyElementActivated();
5943 5944
5944 Element* innerElementInDocument = innerElement; 5945 Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement;
5945 while (innerElementInDocument && innerElementInDocument->document() != this) { 5946 while (innerElementInDocument && innerElementInDocument->document() != this) {
5946 innerElementInDocument->document().updateHoverActiveState( 5947 innerElementInDocument->document().updateHoverActiveState(
5947 request, innerElementInDocument); 5948 request, innerElementInDocument, hitScrollbar);
5948 innerElementInDocument = innerElementInDocument->document().localOwner(); 5949 innerElementInDocument = innerElementInDocument->document().localOwner();
5949 } 5950 }
5950 5951
5951 updateDistribution(); 5952 updateDistribution();
5952 Element* oldActiveElement = activeHoverElement(); 5953 Element* oldActiveElement = activeHoverElement();
5953 if (oldActiveElement && !request.active()) { 5954 if (oldActiveElement && (!request.active() || hitScrollbar)) {
5954 // The oldActiveElement layoutObject is null, dropped on :active by setting 5955 // The oldActiveElement layoutObject is null, dropped on :active by setting
5955 // display: none, for instance. We still need to clear the ActiveChain as 5956 // display: none, for instance. We still need to clear the ActiveChain as
5956 // the mouse is released. 5957 // the mouse is released.
5957 for (Node* node = oldActiveElement; node; 5958 for (Node* node = oldActiveElement; node;
5958 node = FlatTreeTraversal::parent(*node)) { 5959 node = FlatTreeTraversal::parent(*node)) {
5959 DCHECK(!node->isTextNode()); 5960 DCHECK(!node->isTextNode());
5960 node->setActive(false); 5961 node->setActive(false);
5961 m_userActionElements.setInActiveChain(node, false); 5962 m_userActionElements.setInActiveChain(node, false);
5962 } 5963 }
5963 setActiveHoverElement(nullptr); 5964 setActiveHoverElement(nullptr);
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
6437 } 6438 }
6438 6439
6439 void showLiveDocumentInstances() { 6440 void showLiveDocumentInstances() {
6440 WeakDocumentSet& set = liveDocumentSet(); 6441 WeakDocumentSet& set = liveDocumentSet();
6441 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6442 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6442 for (Document* document : set) 6443 for (Document* document : set)
6443 fprintf(stderr, "- Document %p URL: %s\n", document, 6444 fprintf(stderr, "- Document %p URL: %s\n", document,
6444 document->url().getString().utf8().data()); 6445 document->url().getString().utf8().data());
6445 } 6446 }
6446 #endif 6447 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698