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

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

Issue 18297002: Optimize (slightly) Document::updateHoverActiveState. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: NeedsRebaseline. Created 7 years, 5 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 | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 22c3ffb5c9ebb5af0b4a6986b81d6b3ef0dbcc82..30687207b4c4beb57bae8b01403e1cd1678204e4 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -5088,11 +5088,16 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
for (size_t i = 0; i < removeCount; ++i)
nodesToRemoveFromChain[i]->setHovered(false);
+ bool sawCommonAncestor = false;
size_t addCount = nodesToAddToChain.size();
for (size_t i = 0; i < addCount; ++i) {
+ // Elements past the common ancestor do not change hover state, but might change active state.
+ if (ancestor && nodesToAddToChain[i] == ancestor->node())
+ sawCommonAncestor = true;
if (allowActiveChanges)
nodesToAddToChain[i]->setActive(true);
- nodesToAddToChain[i]->setHovered(true);
+ if (!sawCommonAncestor)
+ nodesToAddToChain[i]->setHovered(true);
}
updateStyleIfNeeded();
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698