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

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: bokan comment addressed 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 6366ad7e02ade36f65937688ddca1d8b59f5c748..6643b522c8654e18c93e0e3822dd875ca377a551 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -6089,14 +6089,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 =
+ toElement(hitScrollbar->getScrollableArea()->layoutBox()->node());
+ }
+ }
+
while (innerElementInDocument && innerElementInDocument->document() != this) {
innerElementInDocument->document().updateHoverActiveState(
request, innerElementInDocument, hitScrollbar);
@@ -6105,7 +6113,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.
« 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