Index: Source/core/dom/ContainerNode.cpp |
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp |
index 2f162a0cb0305a279256f431cf7689ece6d524c5..bb6f72bfbdd85ebd4372a2e140aca270f2c4c164 100644 |
--- a/Source/core/dom/ContainerNode.cpp |
+++ b/Source/core/dom/ContainerNode.cpp |
@@ -805,10 +805,12 @@ void ContainerNode::focusStateChanged() |
// renderer we can just ignore the state change. |
if (!renderer()) |
return; |
- // FIXME: This could probably setNeedsStyleRecalc(LocalStyleChange) in the affectedByFocus case |
- // and only setNeedsStyleRecalc(SubtreeStyleChange) in the childrenAffectedByFocus case. |
- if (renderStyle()->affectedByFocus() || (isElementNode() && toElement(this)->childrenAffectedByFocus())) |
+ |
+ if (isElementNode() && toElement(this)->childrenAffectedByFocus()) |
setNeedsStyleRecalc(); |
+ else if (renderStyle()->affectedByFocus()) |
+ setNeedsStyleRecalc(LocalStyleChange); |
+ |
if (renderer() && renderer()->style()->hasAppearance()) |
RenderTheme::theme().stateChanged(renderer(), FocusState); |
} |
@@ -821,9 +823,15 @@ void ContainerNode::setFocus(bool received) |
Node::setFocus(received); |
focusStateChanged(); |
+ |
+ if (renderer() || received) |
+ return; |
+ |
// If :focus sets display: none, we lose focus but still need to recalc our style. |
- if (!renderer() && !received) |
+ if (isElementNode() && toElement(this)->childrenAffectedByFocus()) |
setNeedsStyleRecalc(); |
+ else |
+ setNeedsStyleRecalc(LocalStyleChange); |
} |
void ContainerNode::setActive(bool down) |