| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "core/dom/ContainerNode.h" | 24 #include "core/dom/ContainerNode.h" |
| 25 | 25 |
| 26 #include "bindings/core/v8/ExceptionState.h" | 26 #include "bindings/core/v8/ExceptionState.h" |
| 27 #include "core/dom/ChildFrameDisconnector.h" | 27 #include "core/dom/ChildFrameDisconnector.h" |
| 28 #include "core/dom/ChildListMutationScope.h" | 28 #include "core/dom/ChildListMutationScope.h" |
| 29 #include "core/dom/ClassCollection.h" | 29 #include "core/dom/ClassCollection.h" |
| 30 #include "core/dom/ElementTraversal.h" | 30 #include "core/dom/ElementTraversal.h" |
| 31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
| 32 #include "core/dom/NameNodeList.h" | 32 #include "core/dom/NameNodeList.h" |
| 33 #include "core/dom/NodeChildRemovalTracker.h" | 33 #include "core/dom/NodeChildRemovalTracker.h" |
| 34 #include "core/dom/NodeLayoutStyle.h" | 34 #include "core/dom/NodeComputedStyle.h" |
| 35 #include "core/dom/NodeRareData.h" | 35 #include "core/dom/NodeRareData.h" |
| 36 #include "core/dom/NodeTraversal.h" | 36 #include "core/dom/NodeTraversal.h" |
| 37 #include "core/dom/SelectorQuery.h" | 37 #include "core/dom/SelectorQuery.h" |
| 38 #include "core/dom/StaticNodeList.h" | 38 #include "core/dom/StaticNodeList.h" |
| 39 #include "core/dom/StyleEngine.h" | 39 #include "core/dom/StyleEngine.h" |
| 40 #include "core/dom/shadow/ElementShadow.h" | 40 #include "core/dom/shadow/ElementShadow.h" |
| 41 #include "core/dom/shadow/ShadowRoot.h" | 41 #include "core/dom/shadow/ShadowRoot.h" |
| 42 #include "core/events/MutationEvent.h" | 42 #include "core/events/MutationEvent.h" |
| 43 #include "core/html/HTMLCollection.h" | 43 #include "core/html/HTMLCollection.h" |
| 44 #include "core/html/HTMLFrameOwnerElement.h" | 44 #include "core/html/HTMLFrameOwnerElement.h" |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 // This is used by FrameSelection to denote when the active-state of the page ha
s changed | 1035 // This is used by FrameSelection to denote when the active-state of the page ha
s changed |
| 1036 // independent of the focused element changing. | 1036 // independent of the focused element changing. |
| 1037 void ContainerNode::focusStateChanged() | 1037 void ContainerNode::focusStateChanged() |
| 1038 { | 1038 { |
| 1039 // If we're just changing the window's active state and the focused node has
no | 1039 // If we're just changing the window's active state and the focused node has
no |
| 1040 // renderer we can just ignore the state change. | 1040 // renderer we can just ignore the state change. |
| 1041 if (!layoutObject()) | 1041 if (!layoutObject()) |
| 1042 return; | 1042 return; |
| 1043 | 1043 |
| 1044 if (styleChangeType() < SubtreeStyleChange) { | 1044 if (styleChangeType() < SubtreeStyleChange) { |
| 1045 if (layoutStyle()->affectedByFocus() && layoutStyle()->hasPseudoStyle(FI
RST_LETTER)) | 1045 if (computedStyle()->affectedByFocus() && computedStyle()->hasPseudoStyl
e(FIRST_LETTER)) |
| 1046 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing:
:createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus
)); | 1046 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing:
:createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus
)); |
| 1047 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yFocus()) | 1047 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yFocus()) |
| 1048 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); | 1048 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); |
| 1049 else if (layoutStyle()->affectedByFocus()) | 1049 else if (computedStyle()->affectedByFocus()) |
| 1050 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus))
; | 1050 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus))
; |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 if (layoutObject() && layoutObject()->style()->hasAppearance()) | 1053 if (layoutObject() && layoutObject()->style()->hasAppearance()) |
| 1054 LayoutTheme::theme().stateChanged(layoutObject(), FocusControlState); | 1054 LayoutTheme::theme().stateChanged(layoutObject(), FocusControlState); |
| 1055 | 1055 |
| 1056 // If any of the shadow hosts above has :focus CSS style rule, this focus ha
s to affect the | 1056 // If any of the shadow hosts above has :focus CSS style rule, this focus ha
s to affect the |
| 1057 // style of the shadow host. | 1057 // style of the shadow host. |
| 1058 if (isInShadowTree()) { | 1058 if (isInShadowTree()) { |
| 1059 if (Element* host = shadowHost()) | 1059 if (Element* host = shadowHost()) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1083 void ContainerNode::setActive(bool down) | 1083 void ContainerNode::setActive(bool down) |
| 1084 { | 1084 { |
| 1085 if (down == active()) | 1085 if (down == active()) |
| 1086 return; | 1086 return; |
| 1087 | 1087 |
| 1088 Node::setActive(down); | 1088 Node::setActive(down); |
| 1089 | 1089 |
| 1090 // FIXME: Why does this not need to handle the display: none transition like
:hover does? | 1090 // FIXME: Why does this not need to handle the display: none transition like
:hover does? |
| 1091 if (layoutObject()) { | 1091 if (layoutObject()) { |
| 1092 if (styleChangeType() < SubtreeStyleChange) { | 1092 if (styleChangeType() < SubtreeStyleChange) { |
| 1093 if (layoutStyle()->affectedByActive() && layoutStyle()->hasPseudoSty
le(FIRST_LETTER)) | 1093 if (computedStyle()->affectedByActive() && computedStyle()->hasPseud
oStyle(FIRST_LETTER)) |
| 1094 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac
ing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::A
ctive)); | 1094 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac
ing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::A
ctive)); |
| 1095 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffec
tedByActive()) | 1095 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffec
tedByActive()) |
| 1096 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().s
cheduleStyleInvalidationForPseudoChange(CSSSelector::PseudoActive, *toElement(th
is)); | 1096 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().s
cheduleStyleInvalidationForPseudoChange(CSSSelector::PseudoActive, *toElement(th
is)); |
| 1097 else if (layoutStyle()->affectedByActive()) | 1097 else if (computedStyle()->affectedByActive()) |
| 1098 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin
g::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Act
ive)); | 1098 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin
g::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Act
ive)); |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 if (layoutStyle()->hasAppearance()) | 1101 if (computedStyle()->hasAppearance()) |
| 1102 LayoutTheme::theme().stateChanged(layoutObject(), PressedControlStat
e); | 1102 LayoutTheme::theme().stateChanged(layoutObject(), PressedControlStat
e); |
| 1103 } | 1103 } |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 void ContainerNode::setHovered(bool over) | 1106 void ContainerNode::setHovered(bool over) |
| 1107 { | 1107 { |
| 1108 if (over == hovered()) | 1108 if (over == hovered()) |
| 1109 return; | 1109 return; |
| 1110 | 1110 |
| 1111 Node::setHovered(over); | 1111 Node::setHovered(over); |
| 1112 | 1112 |
| 1113 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. | 1113 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. |
| 1114 if (!layoutObject()) { | 1114 if (!layoutObject()) { |
| 1115 if (over) | 1115 if (over) |
| 1116 return; | 1116 return; |
| 1117 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove
r() && styleChangeType() < SubtreeStyleChange) | 1117 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove
r() && styleChangeType() < SubtreeStyleChange) |
| 1118 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); | 1118 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); |
| 1119 else | 1119 else |
| 1120 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover))
; | 1120 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover))
; |
| 1121 return; | 1121 return; |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 if (styleChangeType() < SubtreeStyleChange) { | 1124 if (styleChangeType() < SubtreeStyleChange) { |
| 1125 if (layoutStyle()->affectedByHover() && layoutStyle()->hasPseudoStyle(FI
RST_LETTER)) | 1125 if (computedStyle()->affectedByHover() && computedStyle()->hasPseudoStyl
e(FIRST_LETTER)) |
| 1126 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing:
:createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover
)); | 1126 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing:
:createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover
)); |
| 1127 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yHover()) | 1127 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yHover()) |
| 1128 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); | 1128 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); |
| 1129 else if (layoutStyle()->affectedByHover()) | 1129 else if (computedStyle()->affectedByHover()) |
| 1130 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover))
; | 1130 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover))
; |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 if (layoutObject()->style()->hasAppearance()) | 1133 if (layoutObject()->style()->hasAppearance()) |
| 1134 LayoutTheme::theme().stateChanged(layoutObject(), HoverControlState); | 1134 LayoutTheme::theme().stateChanged(layoutObject(), HoverControlState); |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children() | 1137 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children() |
| 1138 { | 1138 { |
| 1139 return ensureCachedCollection<HTMLCollection>(NodeChildren); | 1139 return ensureCachedCollection<HTMLCollection>(NodeChildren); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 return true; | 1485 return true; |
| 1486 | 1486 |
| 1487 if (node->isElementNode() && toElement(node)->shadow()) | 1487 if (node->isElementNode() && toElement(node)->shadow()) |
| 1488 return true; | 1488 return true; |
| 1489 | 1489 |
| 1490 return false; | 1490 return false; |
| 1491 } | 1491 } |
| 1492 #endif | 1492 #endif |
| 1493 | 1493 |
| 1494 } // namespace blink | 1494 } // namespace blink |
| OLD | NEW |