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

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

Issue 2668133003: Change hover element to scrollbar's parent when hit test contains scrollbar (Closed)
Patch Set: add test Created 3 years, 11 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
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 987f43e2c966951bc6e1f3cf4a3d0644d1e95c0b..1fc56067385a9dc46092084d1601a3e77f06dc4c 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -6088,14 +6088,22 @@ void Document::updateHoverActiveState(const HitTestRequest& request,
Scrollbar* hitScrollbar) {
DCHECK(!request.readOnly());
- // 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();
-
- if (request.active() && m_frame && !hitNativeScrollbar)
+ if (request.active() && m_frame)
m_frame->eventHandler().notifyElementActivated();
- Element* innerElementInDocument = hitNativeScrollbar ? nullptr : innerElement;
+ 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 =
bokan 2017/02/02 23:29:26 You've confirmed that this preserves the hover eff
chaopeng 2017/02/03 01:12:05 Yes, the customer scrollbar issue is also cause by
+ toElement(hitScrollbar->getScrollableArea()->layoutBox()->node());
+ }
+ }
+
while (innerElementInDocument && innerElementInDocument->document() != this) {
innerElementInDocument->document().updateHoverActiveState(
request, innerElementInDocument, hitScrollbar);
@@ -6104,7 +6112,7 @@ void Document::updateHoverActiveState(const HitTestRequest& request,
updateDistribution();
Element* oldActiveElement = activeHoverElement();
- if (oldActiveElement && (!request.active() || hitNativeScrollbar)) {
+ if (oldActiveElement && !request.active()) {
// 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.

Powered by Google App Engine
This is Rietveld 408576698