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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2679193003: Revert "Change hover element to scrollbar's parent when hit test contains scrollbar"
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« 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