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 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 | 1072 |
1073 // This is used by FrameSelection to denote when the active-state of the page ha
s changed | 1073 // This is used by FrameSelection to denote when the active-state of the page ha
s changed |
1074 // independent of the focused element changing. | 1074 // independent of the focused element changing. |
1075 void ContainerNode::focusStateChanged() | 1075 void ContainerNode::focusStateChanged() |
1076 { | 1076 { |
1077 // If we're just changing the window's active state and the focused node has
no | 1077 // If we're just changing the window's active state and the focused node has
no |
1078 // layoutObject we can just ignore the state change. | 1078 // layoutObject we can just ignore the state change. |
1079 if (!layoutObject()) | 1079 if (!layoutObject()) |
1080 return; | 1080 return; |
1081 | 1081 |
1082 if (styleChangeType() < SubtreeStyleChange) { | 1082 if (computedStyle()->affectedByFocus() && computedStyle()->hasPseudoStyle(FI
RST_LETTER)) |
1083 if (computedStyle()->affectedByFocus() && computedStyle()->hasPseudoStyl
e(FIRST_LETTER)) | 1083 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre
ateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)); |
1084 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing:
:createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus
)); | 1084 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByFoc
us()) |
1085 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yFocus()) | 1085 toElement(this)->pseudoStateChanged(CSSSelector::PseudoFocus); |
1086 toElement(this)->pseudoStateChanged(CSSSelector::PseudoFocus); | 1086 else if (computedStyle()->affectedByFocus()) |
1087 else if (computedStyle()->affectedByFocus()) | 1087 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat
eWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)); |
1088 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus))
; | |
1089 } | |
1090 | 1088 |
1091 LayoutTheme::theme().controlStateChanged(*layoutObject(), FocusControlState)
; | 1089 LayoutTheme::theme().controlStateChanged(*layoutObject(), FocusControlState)
; |
1092 } | 1090 } |
1093 | 1091 |
1094 void ContainerNode::setFocus(bool received) | 1092 void ContainerNode::setFocus(bool received) |
1095 { | 1093 { |
1096 // Recurse up author shadow trees to mark shadow hosts if it matches :focus. | 1094 // Recurse up author shadow trees to mark shadow hosts if it matches :focus. |
1097 // TODO(kochi): Handle UA shadows which marks multiple nodes as focused such
as | 1095 // TODO(kochi): Handle UA shadows which marks multiple nodes as focused such
as |
1098 // <input type="date"> the same way as author shadow. | 1096 // <input type="date"> the same way as author shadow. |
1099 if (ShadowRoot* root = containingShadowRoot()) { | 1097 if (ShadowRoot* root = containingShadowRoot()) { |
(...skipping 27 matching lines...) Expand all Loading... |
1127 | 1125 |
1128 void ContainerNode::setActive(bool down) | 1126 void ContainerNode::setActive(bool down) |
1129 { | 1127 { |
1130 if (down == active()) | 1128 if (down == active()) |
1131 return; | 1129 return; |
1132 | 1130 |
1133 Node::setActive(down); | 1131 Node::setActive(down); |
1134 | 1132 |
1135 // FIXME: Why does this not need to handle the display: none transition like
:hover does? | 1133 // FIXME: Why does this not need to handle the display: none transition like
:hover does? |
1136 if (layoutObject()) { | 1134 if (layoutObject()) { |
1137 if (styleChangeType() < SubtreeStyleChange) { | 1135 if (computedStyle()->affectedByActive() && computedStyle()->hasPseudoSty
le(FIRST_LETTER)) |
1138 if (computedStyle()->affectedByActive() && computedStyle()->hasPseud
oStyle(FIRST_LETTER)) | 1136 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing:
:createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Activ
e)); |
1139 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac
ing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::A
ctive)); | 1137 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yActive()) |
1140 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffec
tedByActive()) | 1138 toElement(this)->pseudoStateChanged(CSSSelector::PseudoActive); |
1141 toElement(this)->pseudoStateChanged(CSSSelector::PseudoActive); | 1139 else if (computedStyle()->affectedByActive()) |
1142 else if (computedStyle()->affectedByActive()) | 1140 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Active)
); |
1143 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin
g::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Act
ive)); | |
1144 } | |
1145 | 1141 |
1146 LayoutTheme::theme().controlStateChanged(*layoutObject(), PressedControl
State); | 1142 LayoutTheme::theme().controlStateChanged(*layoutObject(), PressedControl
State); |
1147 } | 1143 } |
1148 } | 1144 } |
1149 | 1145 |
1150 void ContainerNode::setHovered(bool over) | 1146 void ContainerNode::setHovered(bool over) |
1151 { | 1147 { |
1152 if (over == hovered()) | 1148 if (over == hovered()) |
1153 return; | 1149 return; |
1154 | 1150 |
1155 Node::setHovered(over); | 1151 Node::setHovered(over); |
1156 | 1152 |
1157 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. | 1153 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. |
1158 if (!layoutObject()) { | 1154 if (!layoutObject()) { |
1159 if (over) | 1155 if (over) |
1160 return; | 1156 return; |
1161 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove
r()) | 1157 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove
r()) |
1162 toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover); | 1158 toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover); |
1163 else | 1159 else |
1164 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover))
; | 1160 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover))
; |
1165 return; | 1161 return; |
1166 } | 1162 } |
1167 | 1163 |
1168 if (styleChangeType() < SubtreeStyleChange) { | 1164 if (computedStyle()->affectedByHover() && computedStyle()->hasPseudoStyle(FI
RST_LETTER)) |
1169 if (computedStyle()->affectedByHover() && computedStyle()->hasPseudoStyl
e(FIRST_LETTER)) | 1165 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre
ateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)); |
1170 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing:
:createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover
)); | 1166 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHov
er()) |
1171 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yHover()) | 1167 toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover); |
1172 toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover); | 1168 else if (computedStyle()->affectedByHover()) |
1173 else if (computedStyle()->affectedByHover()) | 1169 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat
eWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)); |
1174 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover))
; | |
1175 } | |
1176 | 1170 |
1177 LayoutTheme::theme().controlStateChanged(*layoutObject(), HoverControlState)
; | 1171 LayoutTheme::theme().controlStateChanged(*layoutObject(), HoverControlState)
; |
1178 } | 1172 } |
1179 | 1173 |
1180 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children() | 1174 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children() |
1181 { | 1175 { |
1182 return ensureCachedCollection<HTMLCollection>(NodeChildren); | 1176 return ensureCachedCollection<HTMLCollection>(NodeChildren); |
1183 } | 1177 } |
1184 | 1178 |
1185 unsigned ContainerNode::countChildren() const | 1179 unsigned ContainerNode::countChildren() const |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 return true; | 1522 return true; |
1529 | 1523 |
1530 if (node->isElementNode() && toElement(node)->shadow()) | 1524 if (node->isElementNode() && toElement(node)->shadow()) |
1531 return true; | 1525 return true; |
1532 | 1526 |
1533 return false; | 1527 return false; |
1534 } | 1528 } |
1535 #endif | 1529 #endif |
1536 | 1530 |
1537 } // namespace blink | 1531 } // namespace blink |
OLD | NEW |