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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2563483003: Document::updateHoverActiveState only cancel hover and active state when hitting native scrollbar (Closed)
Patch Set: 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/scheduler/CancellableTaskFactory.h" 237 #include "platform/scheduler/CancellableTaskFactory.h"
238 #include "platform/scroll/Scrollbar.h"
238 #include "platform/scroll/ScrollbarTheme.h" 239 #include "platform/scroll/ScrollbarTheme.h"
239 #include "platform/text/PlatformLocale.h" 240 #include "platform/text/PlatformLocale.h"
240 #include "platform/text/SegmentedString.h" 241 #include "platform/text/SegmentedString.h"
241 #include "platform/tracing/TraceEvent.h" 242 #include "platform/tracing/TraceEvent.h"
242 #include "platform/weborigin/OriginAccessEntry.h" 243 #include "platform/weborigin/OriginAccessEntry.h"
243 #include "platform/weborigin/SchemeRegistry.h" 244 #include "platform/weborigin/SchemeRegistry.h"
244 #include "platform/weborigin/SecurityOrigin.h" 245 #include "platform/weborigin/SecurityOrigin.h"
245 #include "public/platform/InterfaceProvider.h" 246 #include "public/platform/InterfaceProvider.h"
246 #include "public/platform/Platform.h" 247 #include "public/platform/Platform.h"
247 #include "public/platform/WebAddressSpace.h" 248 #include "public/platform/WebAddressSpace.h"
(...skipping 5712 matching lines...) Expand 10 before | Expand all | Expand 10 after
5960 if (currObj1 == currObj2) 5961 if (currObj1 == currObj2)
5961 return currObj1; 5962 return currObj1;
5962 } 5963 }
5963 } 5964 }
5964 5965
5965 return 0; 5966 return 0;
5966 } 5967 }
5967 5968
5968 void Document::updateHoverActiveState(const HitTestRequest& request, 5969 void Document::updateHoverActiveState(const HitTestRequest& request,
5969 Element* innerElement, 5970 Element* innerElement,
5970 bool hitScrollbar) { 5971 Scrollbar* hitScrollbar) {
5971 DCHECK(!request.readOnly()); 5972 DCHECK(!request.readOnly());
5972 5973
5973 if (request.active() && m_frame && !hitScrollbar) 5974 // Only cancel hover state when hitting native scrollbar because custom
5975 // scrollbar's style depends on the owner element's hover state.
5976 bool hitNativeScrollbar = hitScrollbar && !hitScrollbar->isCustomScrollbar();
5977
5978 if (request.active() && m_frame && !hitNativeScrollbar)
5974 m_frame->eventHandler().notifyElementActivated(); 5979 m_frame->eventHandler().notifyElementActivated();
5975 5980
5976 Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement; 5981 Element* innerElementInDocument = hitNativeScrollbar ? nullptr : innerElement;
5977 while (innerElementInDocument && innerElementInDocument->document() != this) { 5982 while (innerElementInDocument && innerElementInDocument->document() != this) {
5978 innerElementInDocument->document().updateHoverActiveState( 5983 innerElementInDocument->document().updateHoverActiveState(
5979 request, innerElementInDocument, hitScrollbar); 5984 request, innerElementInDocument, hitScrollbar);
5980 innerElementInDocument = innerElementInDocument->document().localOwner(); 5985 innerElementInDocument = innerElementInDocument->document().localOwner();
5981 } 5986 }
5982 5987
5983 updateDistribution(); 5988 updateDistribution();
5984 Element* oldActiveElement = activeHoverElement(); 5989 Element* oldActiveElement = activeHoverElement();
5985 if (oldActiveElement && (!request.active() || hitScrollbar)) { 5990 if (oldActiveElement && (!request.active() || hitNativeScrollbar)) {
5986 // The oldActiveElement layoutObject is null, dropped on :active by setting 5991 // The oldActiveElement layoutObject is null, dropped on :active by setting
5987 // display: none, for instance. We still need to clear the ActiveChain as 5992 // display: none, for instance. We still need to clear the ActiveChain as
5988 // the mouse is released. 5993 // the mouse is released.
5989 for (Node* node = oldActiveElement; node; 5994 for (Node* node = oldActiveElement; node;
5990 node = FlatTreeTraversal::parent(*node)) { 5995 node = FlatTreeTraversal::parent(*node)) {
5991 DCHECK(!node->isTextNode()); 5996 DCHECK(!node->isTextNode());
5992 node->setActive(false); 5997 node->setActive(false);
5993 m_userActionElements.setInActiveChain(node, false); 5998 m_userActionElements.setInActiveChain(node, false);
5994 } 5999 }
5995 setActiveHoverElement(nullptr); 6000 setActiveHoverElement(nullptr);
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
6481 } 6486 }
6482 6487
6483 void showLiveDocumentInstances() { 6488 void showLiveDocumentInstances() {
6484 WeakDocumentSet& set = liveDocumentSet(); 6489 WeakDocumentSet& set = liveDocumentSet();
6485 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6490 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6486 for (Document* document : set) 6491 for (Document* document : set)
6487 fprintf(stderr, "- Document %p URL: %s\n", document, 6492 fprintf(stderr, "- Document %p URL: %s\n", document,
6488 document->url().getString().utf8().data()); 6493 document->url().getString().utf8().data());
6489 } 6494 }
6490 #endif 6495 #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