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

Unified Diff: Source/core/dom/ContainerNode.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/ContainerNode.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index c4e6a4a1fd78631c26ca0be7b37491e327aaf48e..ce9ecf5275321b03e0202f7189f3b1b4eff974d4 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -708,17 +708,17 @@ void ContainerNode::dispatchPostAttachCallbacks()
s_postAttachCallbackQueue->clear();
}
-void ContainerNode::attach()
+void ContainerNode::attach(const AttachContext& context)
{
attachChildren();
- Node::attach();
+ Node::attach(context);
}
-void ContainerNode::detach()
+void ContainerNode::detach(const AttachContext& context)
{
detachChildren();
clearChildNeedsStyleRecalc();
- Node::detach();
+ Node::detach(context);
}
void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int childCountDelta)
@@ -902,6 +902,18 @@ void ContainerNode::setHovered(bool over)
Node::setHovered(over);
+ if (!renderer()) {
+ // When setting hover to false, the style needs to be recalc'd even when
+ // there's no renderer (imagine setting display:none in the :hover class,
+ // if a nil renderer would prevent this element from recalculating its
+ // style, it would never go back to its normal style and remain
+ // stuck in its hovered style).
+ if (!over)
+ setNeedsStyleRecalc();
+
+ return;
+ }
+
// note that we need to recalc the style
// FIXME: Move to Element
if (renderer()) {
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698