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

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

Issue 16599003: :hover style not applied on hover if its display property is different from original style's (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch (fixed test that was expected to fail and is now passing) 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/Document.h ('k') | Source/core/dom/Element.h » ('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 a5bcd2e1bcfd4c3882b61ca5016fb83d540b70d5..99c23a12ae833cdc5e8e37afc3339ad47f033eba 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1871,7 +1871,7 @@ void Document::clearStyleResolver()
m_styleResolver.clear();
}
-void Document::attach()
+void Document::attach(const AttachContext& context)
{
ASSERT(!attached());
ASSERT(!m_axObjectCache || this != topDocument());
@@ -1885,10 +1885,10 @@ void Document::attach()
recalcStyle(Force);
- ContainerNode::attach();
+ ContainerNode::attach(context);
}
-void Document::detach()
+void Document::detach(const AttachContext& context)
{
ASSERT(attached());
@@ -1931,7 +1931,7 @@ void Document::detach()
m_focusedNode = 0;
m_activeElement = 0;
- ContainerNode::detach();
+ ContainerNode::detach(context);
unscheduleStyleRecalc();
@@ -5446,6 +5446,14 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
Vector<RefPtr<Node>, 32> nodesToAddToChain;
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
+ // must be updated, to ensure it's normal style is re-applied.
+ if (oldHoverNode && !oldHoverObj) {
+ if (!mustBeInActiveChain || oldHoverNode->inActiveChain())
+ nodesToRemoveFromChain.append(oldHoverNode);
+ }
+
// The old hover path only needs to be cleared up to (and not including) the common ancestor;
for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) {
if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain()))
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698