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

Side by Side 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 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 #include "platform/EventDispatchForbiddenScope.h" 227 #include "platform/EventDispatchForbiddenScope.h"
228 #include "platform/Histogram.h" 228 #include "platform/Histogram.h"
229 #include "platform/InstanceCounters.h" 229 #include "platform/InstanceCounters.h"
230 #include "platform/Language.h" 230 #include "platform/Language.h"
231 #include "platform/LengthFunctions.h" 231 #include "platform/LengthFunctions.h"
232 #include "platform/PluginScriptForbiddenScope.h" 232 #include "platform/PluginScriptForbiddenScope.h"
233 #include "platform/RuntimeEnabledFeatures.h" 233 #include "platform/RuntimeEnabledFeatures.h"
234 #include "platform/ScriptForbiddenScope.h" 234 #include "platform/ScriptForbiddenScope.h"
235 #include "platform/network/ContentSecurityPolicyParsers.h" 235 #include "platform/network/ContentSecurityPolicyParsers.h"
236 #include "platform/network/HTTPParsers.h" 236 #include "platform/network/HTTPParsers.h"
237 #include "platform/scroll/Scrollbar.h"
237 #include "platform/scroll/ScrollbarTheme.h" 238 #include "platform/scroll/ScrollbarTheme.h"
238 #include "platform/text/PlatformLocale.h" 239 #include "platform/text/PlatformLocale.h"
239 #include "platform/text/SegmentedString.h" 240 #include "platform/text/SegmentedString.h"
240 #include "platform/tracing/TraceEvent.h" 241 #include "platform/tracing/TraceEvent.h"
241 #include "platform/weborigin/OriginAccessEntry.h" 242 #include "platform/weborigin/OriginAccessEntry.h"
242 #include "platform/weborigin/SchemeRegistry.h" 243 #include "platform/weborigin/SchemeRegistry.h"
243 #include "platform/weborigin/SecurityOrigin.h" 244 #include "platform/weborigin/SecurityOrigin.h"
244 #include "public/platform/Platform.h" 245 #include "public/platform/Platform.h"
245 #include "public/platform/WebAddressSpace.h" 246 #include "public/platform/WebAddressSpace.h"
246 #include "public/platform/WebFrameScheduler.h" 247 #include "public/platform/WebFrameScheduler.h"
(...skipping 5765 matching lines...) Expand 10 before | Expand all | Expand 10 after
6012 if (currObj1 == currObj2) 6013 if (currObj1 == currObj2)
6013 return currObj1; 6014 return currObj1;
6014 } 6015 }
6015 } 6016 }
6016 6017
6017 return 0; 6018 return 0;
6018 } 6019 }
6019 6020
6020 void Document::updateHoverActiveState(const HitTestRequest& request, 6021 void Document::updateHoverActiveState(const HitTestRequest& request,
6021 Element* innerElement, 6022 Element* innerElement,
6022 bool hitScrollbar) { 6023 Scrollbar* hitScrollbar) {
6023 DCHECK(!request.readOnly()); 6024 DCHECK(!request.readOnly());
6024 6025
6025 if (request.active() && m_frame && !hitScrollbar) 6026 // Only cancel hover state when hitting native scrollbar because custom
6027 // scrollbar's style depends on the owner element's hover state.
6028 bool hitNativeScrollbar = hitScrollbar && !hitScrollbar->isCustomScrollbar();
6029
6030 if (request.active() && m_frame && !hitNativeScrollbar)
6026 m_frame->eventHandler().notifyElementActivated(); 6031 m_frame->eventHandler().notifyElementActivated();
6027 6032
6028 Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement; 6033 Element* innerElementInDocument = hitNativeScrollbar ? nullptr : innerElement;
6029 while (innerElementInDocument && innerElementInDocument->document() != this) { 6034 while (innerElementInDocument && innerElementInDocument->document() != this) {
6030 innerElementInDocument->document().updateHoverActiveState( 6035 innerElementInDocument->document().updateHoverActiveState(
6031 request, innerElementInDocument, hitScrollbar); 6036 request, innerElementInDocument, hitScrollbar);
6032 innerElementInDocument = innerElementInDocument->document().localOwner(); 6037 innerElementInDocument = innerElementInDocument->document().localOwner();
6033 } 6038 }
6034 6039
6035 updateDistribution(); 6040 updateDistribution();
6036 Element* oldActiveElement = activeHoverElement(); 6041 Element* oldActiveElement = activeHoverElement();
6037 if (oldActiveElement && (!request.active() || hitScrollbar)) { 6042 if (oldActiveElement && (!request.active() || hitNativeScrollbar)) {
6038 // The oldActiveElement layoutObject is null, dropped on :active by setting 6043 // The oldActiveElement layoutObject is null, dropped on :active by setting
6039 // display: none, for instance. We still need to clear the ActiveChain as 6044 // display: none, for instance. We still need to clear the ActiveChain as
6040 // the mouse is released. 6045 // the mouse is released.
6041 for (Node* node = oldActiveElement; node; 6046 for (Node* node = oldActiveElement; node;
6042 node = FlatTreeTraversal::parent(*node)) { 6047 node = FlatTreeTraversal::parent(*node)) {
6043 DCHECK(!node->isTextNode()); 6048 DCHECK(!node->isTextNode());
6044 node->setActive(false); 6049 node->setActive(false);
6045 m_userActionElements.setInActiveChain(node, false); 6050 m_userActionElements.setInActiveChain(node, false);
6046 } 6051 }
6047 setActiveHoverElement(nullptr); 6052 setActiveHoverElement(nullptr);
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
6522 } 6527 }
6523 6528
6524 void showLiveDocumentInstances() { 6529 void showLiveDocumentInstances() {
6525 WeakDocumentSet& set = liveDocumentSet(); 6530 WeakDocumentSet& set = liveDocumentSet();
6526 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6531 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6527 for (Document* document : set) 6532 for (Document* document : set)
6528 fprintf(stderr, "- Document %p URL: %s\n", document, 6533 fprintf(stderr, "- Document %p URL: %s\n", document,
6529 document->url().getString().utf8().data()); 6534 document->url().getString().utf8().data());
6530 } 6535 }
6531 #endif 6536 #endif
OLDNEW
« 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