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()) { |