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

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

Issue 2523903002: Document::updateHoverActiveState only cancel hover and active state when hitting native scrollbar (Closed)
Patch Set: comment update Created 4 years, 1 month 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 c44b227186644837c5a4a628e8e496940d1075d4..c745a0990a6316e9588ce577966767d36d5b4509 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -234,6 +234,7 @@
#include "platform/ScriptForbiddenScope.h"
#include "platform/network/ContentSecurityPolicyParsers.h"
#include "platform/network/HTTPParsers.h"
+#include "platform/scroll/Scrollbar.h"
#include "platform/scroll/ScrollbarTheme.h"
#include "platform/text/PlatformLocale.h"
#include "platform/text/SegmentedString.h"
@@ -6019,13 +6020,17 @@ static LayoutObject* nearestCommonHoverAncestor(LayoutObject* obj1,
void Document::updateHoverActiveState(const HitTestRequest& request,
Element* innerElement,
- bool hitScrollbar) {
+ Scrollbar* hitScrollbar) {
DCHECK(!request.readOnly());
- if (request.active() && m_frame && !hitScrollbar)
+ // 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)
m_frame->eventHandler().notifyElementActivated();
- Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement;
+ Element* innerElementInDocument = hitNativeScrollbar ? nullptr : innerElement;
while (innerElementInDocument && innerElementInDocument->document() != this) {
innerElementInDocument->document().updateHoverActiveState(
request, innerElementInDocument, hitScrollbar);
@@ -6034,7 +6039,7 @@ void Document::updateHoverActiveState(const HitTestRequest& request,
updateDistribution();
Element* oldActiveElement = activeHoverElement();
- if (oldActiveElement && (!request.active() || hitScrollbar)) {
+ 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 | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698