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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights |
6 * reserved. | 6 * reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByDrag()) | 1125 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByDrag()) |
1126 toElement(this)->pseudoStateChanged(CSSSelector::PseudoDrag); | 1126 toElement(this)->pseudoStateChanged(CSSSelector::PseudoDrag); |
1127 } | 1127 } |
1128 | 1128 |
1129 void ContainerNode::setHovered(bool over) { | 1129 void ContainerNode::setHovered(bool over) { |
1130 if (over == isHovered()) | 1130 if (over == isHovered()) |
1131 return; | 1131 return; |
1132 | 1132 |
1133 Node::setHovered(over); | 1133 Node::setHovered(over); |
1134 | 1134 |
1135 // If :hover sets display: none we lose our hover but still need to recalc our | 1135 const ComputedStyle* style = computedStyle(); |
1136 // style. | 1136 if (!style || style->affectedByHover()) { |
1137 if (!layoutObject()) { | 1137 StyleChangeType changeType = LocalStyleChange; |
1138 if (over) | 1138 if (style && style->hasPseudoStyle(PseudoIdFirstLetter)) |
1139 return; | 1139 changeType = SubtreeStyleChange; |
1140 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHover()) | |
1141 toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover); | |
1142 else | |
1143 setNeedsStyleRecalc( | |
1144 LocalStyleChange, | |
1145 StyleChangeReasonForTracing::createWithExtraData( | |
1146 StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)); | |
1147 return; | |
1148 } | |
1149 | |
1150 if (computedStyle()->affectedByHover()) { | |
1151 StyleChangeType changeType = | |
1152 computedStyle()->hasPseudoStyle(PseudoIdFirstLetter) | |
1153 ? SubtreeStyleChange | |
1154 : LocalStyleChange; | |
1155 setNeedsStyleRecalc( | 1140 setNeedsStyleRecalc( |
1156 changeType, | 1141 changeType, |
1157 StyleChangeReasonForTracing::createWithExtraData( | 1142 StyleChangeReasonForTracing::createWithExtraData( |
1158 StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)); | 1143 StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)); |
1159 } | 1144 } |
1160 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHover()) | 1145 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHover()) |
1161 toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover); | 1146 toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover); |
1162 | 1147 |
1163 LayoutTheme::theme().controlStateChanged(*layoutObject(), HoverControlState); | 1148 if (layoutObject()) { |
| 1149 LayoutTheme::theme().controlStateChanged(*layoutObject(), |
| 1150 HoverControlState); |
| 1151 } |
1164 } | 1152 } |
1165 | 1153 |
1166 HTMLCollection* ContainerNode::children() { | 1154 HTMLCollection* ContainerNode::children() { |
1167 return ensureCachedCollection<HTMLCollection>(NodeChildren); | 1155 return ensureCachedCollection<HTMLCollection>(NodeChildren); |
1168 } | 1156 } |
1169 | 1157 |
1170 unsigned ContainerNode::countChildren() const { | 1158 unsigned ContainerNode::countChildren() const { |
1171 unsigned count = 0; | 1159 unsigned count = 0; |
1172 for (Node* node = firstChild(); node; node = node->nextSibling()) | 1160 for (Node* node = firstChild(); node; node = node->nextSibling()) |
1173 count++; | 1161 count++; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 return true; | 1475 return true; |
1488 | 1476 |
1489 if (node->isElementNode() && toElement(node)->shadow()) | 1477 if (node->isElementNode() && toElement(node)->shadow()) |
1490 return true; | 1478 return true; |
1491 | 1479 |
1492 return false; | 1480 return false; |
1493 } | 1481 } |
1494 #endif | 1482 #endif |
1495 | 1483 |
1496 } // namespace blink | 1484 } // namespace blink |
OLD | NEW |