| OLD | NEW |
| 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 3439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3450 // lead to a premature layout() happening, which could show a flash of white. | 3450 // lead to a premature layout() happening, which could show a flash of white. |
| 3451 // See also the similar code in EventHandler::hitTestResultAtPoint. | 3451 // See also the similar code in EventHandler::hitTestResultAtPoint. |
| 3452 if (layoutViewItem().isNull() || !view() || !view()->didFirstLayout()) | 3452 if (layoutViewItem().isNull() || !view() || !view()->didFirstLayout()) |
| 3453 return MouseEventWithHitTestResults(event, | 3453 return MouseEventWithHitTestResults(event, |
| 3454 HitTestResult(request, LayoutPoint())); | 3454 HitTestResult(request, LayoutPoint())); |
| 3455 | 3455 |
| 3456 HitTestResult result(request, documentPoint); | 3456 HitTestResult result(request, documentPoint); |
| 3457 layoutViewItem().hitTest(result); | 3457 layoutViewItem().hitTest(result); |
| 3458 | 3458 |
| 3459 if (!request.readOnly()) | 3459 if (!request.readOnly()) |
| 3460 updateHoverActiveState(request, result.innerElement()); | 3460 updateHoverActiveState(request, result.innerElement(), result.scrollbar()); |
| 3461 | 3461 |
| 3462 if (isHTMLCanvasElement(result.innerNode())) { | 3462 if (isHTMLCanvasElement(result.innerNode())) { |
| 3463 PlatformMouseEvent eventWithRegion = event; | 3463 PlatformMouseEvent eventWithRegion = event; |
| 3464 HitTestCanvasResult* hitTestCanvasResult = | 3464 HitTestCanvasResult* hitTestCanvasResult = |
| 3465 toHTMLCanvasElement(result.innerNode()) | 3465 toHTMLCanvasElement(result.innerNode()) |
| 3466 ->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); | 3466 ->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); |
| 3467 if (hitTestCanvasResult->getControl()) { | 3467 if (hitTestCanvasResult->getControl()) { |
| 3468 result.setInnerNode(hitTestCanvasResult->getControl()); | 3468 result.setInnerNode(hitTestCanvasResult->getControl()); |
| 3469 } | 3469 } |
| 3470 eventWithRegion.setRegion(hitTestCanvasResult->getId()); | 3470 eventWithRegion.setRegion(hitTestCanvasResult->getId()); |
| (...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5957 currObj2 = currObj2->hoverAncestor()) { | 5957 currObj2 = currObj2->hoverAncestor()) { |
| 5958 if (currObj1 == currObj2) | 5958 if (currObj1 == currObj2) |
| 5959 return currObj1; | 5959 return currObj1; |
| 5960 } | 5960 } |
| 5961 } | 5961 } |
| 5962 | 5962 |
| 5963 return 0; | 5963 return 0; |
| 5964 } | 5964 } |
| 5965 | 5965 |
| 5966 void Document::updateHoverActiveState(const HitTestRequest& request, | 5966 void Document::updateHoverActiveState(const HitTestRequest& request, |
| 5967 Element* innerElement) { | 5967 Element* innerElement, |
| 5968 bool hasScrollbar) { |
| 5968 DCHECK(!request.readOnly()); | 5969 DCHECK(!request.readOnly()); |
| 5969 | 5970 |
| 5970 if (request.active() && m_frame) | 5971 if (request.active() && m_frame && !hasScrollbar) |
| 5971 m_frame->eventHandler().notifyElementActivated(); | 5972 m_frame->eventHandler().notifyElementActivated(); |
| 5972 | 5973 |
| 5973 Element* innerElementInDocument = innerElement; | 5974 Element* innerElementInDocument = hasScrollbar ? nullptr : innerElement; |
| 5974 while (innerElementInDocument && innerElementInDocument->document() != this) { | 5975 while (innerElementInDocument && innerElementInDocument->document() != this) { |
| 5975 innerElementInDocument->document().updateHoverActiveState( | 5976 innerElementInDocument->document().updateHoverActiveState( |
| 5976 request, innerElementInDocument); | 5977 request, innerElementInDocument, hasScrollbar); |
| 5977 innerElementInDocument = innerElementInDocument->document().localOwner(); | 5978 innerElementInDocument = innerElementInDocument->document().localOwner(); |
| 5978 } | 5979 } |
| 5979 | 5980 |
| 5980 updateDistribution(); | 5981 updateDistribution(); |
| 5981 Element* oldActiveElement = activeHoverElement(); | 5982 Element* oldActiveElement = activeHoverElement(); |
| 5982 if (oldActiveElement && !request.active()) { | 5983 if (oldActiveElement && (!request.active() || hasScrollbar)) { |
| 5983 // The oldActiveElement layoutObject is null, dropped on :active by setting | 5984 // The oldActiveElement layoutObject is null, dropped on :active by setting |
| 5984 // display: none, for instance. We still need to clear the ActiveChain as | 5985 // display: none, for instance. We still need to clear the ActiveChain as |
| 5985 // the mouse is released. | 5986 // the mouse is released. |
| 5986 for (Node* node = oldActiveElement; node; | 5987 for (Node* node = oldActiveElement; node; |
| 5987 node = FlatTreeTraversal::parent(*node)) { | 5988 node = FlatTreeTraversal::parent(*node)) { |
| 5988 DCHECK(!node->isTextNode()); | 5989 DCHECK(!node->isTextNode()); |
| 5989 node->setActive(false); | 5990 node->setActive(false); |
| 5990 m_userActionElements.setInActiveChain(node, false); | 5991 m_userActionElements.setInActiveChain(node, false); |
| 5991 } | 5992 } |
| 5992 setActiveHoverElement(nullptr); | 5993 setActiveHoverElement(nullptr); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6454 } | 6455 } |
| 6455 | 6456 |
| 6456 void showLiveDocumentInstances() { | 6457 void showLiveDocumentInstances() { |
| 6457 WeakDocumentSet& set = liveDocumentSet(); | 6458 WeakDocumentSet& set = liveDocumentSet(); |
| 6458 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6459 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6459 for (Document* document : set) | 6460 for (Document* document : set) |
| 6460 fprintf(stderr, "- Document %p URL: %s\n", document, | 6461 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6461 document->url().getString().utf8().data()); | 6462 document->url().getString().utf8().data()); |
| 6462 } | 6463 } |
| 6463 #endif | 6464 #endif |
| OLD | NEW |