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

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

Issue 16951003: Fix broken AttachContext from r152289 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Final patch Created 7 years, 6 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 | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Element.cpp » ('j') | 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 6f0e65b65d5f8070dafac6d173eb755a75ec4c26..309b3a9d8f1cfb7c9e201fe77cf56e0ee0e69e57 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1772,6 +1772,12 @@ void Document::updateStyleIfNeeded()
AnimationUpdateBlock animationUpdateBlock(m_frame ? m_frame->animation() : 0);
recalcStyle(NoChange);
+
+ // As a result of the style recalculation, the currently hovered element might have been
+ // detached (for example, by setting display:none in the :hover style), schedule another mouseMove event
+ // to check if any other elements ended up under the mouse pointer due to re-layout.
+ if (hoverNode() && !hoverNode()->renderer() && frame())
+ frame()->eventHandler()->dispatchFakeMouseMoveEventSoon();
esprehn 2013/06/17 22:00:27 Hmm, there's a number of other places where we mig
stavila 2013/06/18 08:54:00 Yes, I know Document::recalcStyle is called in mul
}
void Document::updateLayout()
@@ -5050,11 +5056,14 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
if (oldHoverObj != newHoverObj) {
// If the old hovered node is not nil but it's renderer is, it was probably detached as part of the :hover style
- // (for instance by setting display:none in the :hover pseudo-class). In this case, the old hovered element
+ // (for instance by setting display:none in the :hover pseudo-class). In this case, the old hovered element (and its ancestors)
// must be updated, to ensure it's normal style is re-applied.
if (oldHoverNode && !oldHoverObj) {
- if (!mustBeInActiveChain || oldHoverNode->inActiveChain())
- nodesToRemoveFromChain.append(oldHoverNode);
+ for (Node* node = oldHoverNode.get(); node; node = node->parentNode()) {
+ if (!mustBeInActiveChain || (node->isElementNode() && toElement(node)->inActiveChain()))
+ nodesToRemoveFromChain.append(node);
+ }
+
}
// The old hover path only needs to be cleared up to (and not including) the common ancestor;
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698