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

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: Fixed failing test (/fast/forms/file/input-file-re-render.html) 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 7478467e2dd5fbee14ea4346e4c1a15c206cd01f..312b79894954f1505710b25de7b6259839fa0a43 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1762,6 +1762,12 @@ void Document::recalcStyle(StyleChange change)
}
InspectorInstrumentation::didRecalculateStyle(cookie);
+
+ // 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();
ojan 2013/06/23 17:58:11 To my surprised, firing the fake mouse move events
}
void Document::updateStyleIfNeeded()
@@ -5053,11 +5059,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