Chromium Code Reviews| Index: Source/core/dom/ContainerNode.cpp |
| diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp |
| index 5664bd9e4f684f44513e6859349ef746e444976c..4d2285f5aee00b9cd026faa5a3e150637e21b7d5 100644 |
| --- a/Source/core/dom/ContainerNode.cpp |
| +++ b/Source/core/dom/ContainerNode.cpp |
| @@ -791,6 +791,18 @@ LayoutRect ContainerNode::boundingBox() const |
| return enclosingLayoutRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft)); |
| } |
| +static inline StyleChangeType focusStyleChange(const ContainerNode* node) |
|
esprehn
2014/01/22 20:58:52
This should be a private method, you always pass |
rune
2014/01/30 23:24:36
Done. That is, the method is now gone.
|
| +{ |
| + // -webkit-user-modify (from contenteditable) needs special propagation (see StyleResolver) |
| + // into the shadow dom. Do SubtreeStyleChange even if children are not affected by focus to |
| + // cover that. |
| + if (node->isElementNode() && (toElement(node)->childrenAffectedByFocus() || toElement(node)->shadow())) |
|
esprehn
2014/01/22 20:58:52
This shadow check doesn't seem right, why do you n
rune
2014/01/30 17:24:40
It's about the propagation of -webkit-user-modify
rune
2014/01/30 23:24:36
Done.
|
| + return SubtreeStyleChange; |
| + if (!node->renderer() || node->renderStyle()->affectedByFocus()) |
| + return LocalStyleChange; |
| + return NoStyleChange; |
| +} |
| + |
| // This is used by FrameSelection to denote when the active-state of the page has changed |
| // independent of the focused element changing. |
| void ContainerNode::focusStateChanged() |
| @@ -799,10 +811,10 @@ 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())) |
| - setNeedsStyleRecalc(); |
| + |
| + StyleChangeType change = focusStyleChange(this); |
| + if (change != NoStyleChange) |
| + setNeedsStyleRecalc(change); |
| if (renderer() && renderer()->style()->hasAppearance()) |
| RenderTheme::theme().stateChanged(renderer(), FocusState); |
| } |
| @@ -816,8 +828,10 @@ void ContainerNode::setFocus(bool received) |
| focusStateChanged(); |
| // If :focus sets display: none, we lose focus but still need to recalc our style. |
| - if (!renderer() && !received) |
| - setNeedsStyleRecalc(); |
| + if (!renderer() && !received) { |
| + ASSERT(focusStyleChange(this) != NoStyleChange); |
| + setNeedsStyleRecalc(focusStyleChange(this)); |
| + } |
| } |
| void ContainerNode::setActive(bool down) |