Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index baff1f456d551dd148bc6a6f4db1b2a2bbf54906..53d69df8b7bebd37217f1c7cac4ccafa9963ce8a 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -6049,22 +6049,14 @@ void Document::updateHoverActiveState(const HitTestRequest& request, |
Scrollbar* hitScrollbar) { |
DCHECK(!request.readOnly()); |
- if (request.active() && m_frame) |
- m_frame->eventHandler().notifyElementActivated(); |
+ // Only cancel hover state when hitting native scrollbar because custom |
+ // scrollbar's style depends on the owner element's hover state. |
+ bool hitNativeScrollbar = hitScrollbar && !hitScrollbar->isCustomScrollbar(); |
- Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement; |
- // Replace the innerElementInDocument to be srollbar's parent when hit |
- // scrollbar |
- if (hitScrollbar) { |
- ScrollableArea* scrollableArea = hitScrollbar->getScrollableArea(); |
- if (scrollableArea && scrollableArea->layoutBox() && |
- scrollableArea->layoutBox()->node() && |
- scrollableArea->layoutBox()->node()->isElementNode()) { |
- innerElementInDocument = |
- toElement(hitScrollbar->getScrollableArea()->layoutBox()->node()); |
- } |
- } |
+ if (request.active() && m_frame && !hitNativeScrollbar) |
+ m_frame->eventHandler().notifyElementActivated(); |
+ Element* innerElementInDocument = hitNativeScrollbar ? nullptr : innerElement; |
while (innerElementInDocument && innerElementInDocument->document() != this) { |
innerElementInDocument->document().updateHoverActiveState( |
request, innerElementInDocument, hitScrollbar); |
@@ -6073,7 +6065,7 @@ void Document::updateHoverActiveState(const HitTestRequest& request, |
updateDistribution(); |
Element* oldActiveElement = activeHoverElement(); |
- if (oldActiveElement && !request.active()) { |
+ if (oldActiveElement && (!request.active() || hitNativeScrollbar)) { |
// The oldActiveElement layoutObject is null, dropped on :active by setting |
// display: none, for instance. We still need to clear the ActiveChain as |
// the mouse is released. |