| 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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 // independent of the focused element changing. | 995 // independent of the focused element changing. |
| 996 void ContainerNode::focusStateChanged() | 996 void ContainerNode::focusStateChanged() |
| 997 { | 997 { |
| 998 // If we're just changing the window's active state and the focused node has
no | 998 // If we're just changing the window's active state and the focused node has
no |
| 999 // renderer we can just ignore the state change. | 999 // renderer we can just ignore the state change. |
| 1000 if (!renderer()) | 1000 if (!renderer()) |
| 1001 return; | 1001 return; |
| 1002 | 1002 |
| 1003 if (styleChangeType() < SubtreeStyleChange) { | 1003 if (styleChangeType() < SubtreeStyleChange) { |
| 1004 if (renderStyle()->affectedByFocus() && renderStyle()->hasPseudoStyle(FI
RST_LETTER)) | 1004 if (renderStyle()->affectedByFocus() && renderStyle()->hasPseudoStyle(FI
RST_LETTER)) |
| 1005 setNeedsStyleRecalc(SubtreeStyleChange); | 1005 setNeedsStyleRecalc(StyleChangeReasonForTracing::createWithExtraData
(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus), SubtreeStyleChang
e); |
| 1006 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yFocus()) | 1006 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yFocus()) |
| 1007 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); | 1007 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); |
| 1008 else if (renderStyle()->affectedByFocus()) | 1008 else if (renderStyle()->affectedByFocus()) |
| 1009 setNeedsStyleRecalc(LocalStyleChange); | 1009 setNeedsStyleRecalc(StyleChangeReasonForTracing::createWithExtraData
(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus), LocalStyleChange)
; |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 if (renderer() && renderer()->style()->hasAppearance()) | 1012 if (renderer() && renderer()->style()->hasAppearance()) |
| 1013 RenderTheme::theme().stateChanged(renderer(), FocusControlState); | 1013 RenderTheme::theme().stateChanged(renderer(), FocusControlState); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void ContainerNode::setFocus(bool received) | 1016 void ContainerNode::setFocus(bool received) |
| 1017 { | 1017 { |
| 1018 if (focused() == received) | 1018 if (focused() == received) |
| 1019 return; | 1019 return; |
| 1020 | 1020 |
| 1021 Node::setFocus(received); | 1021 Node::setFocus(received); |
| 1022 | 1022 |
| 1023 focusStateChanged(); | 1023 focusStateChanged(); |
| 1024 | 1024 |
| 1025 if (renderer() || received) | 1025 if (renderer() || received) |
| 1026 return; | 1026 return; |
| 1027 | 1027 |
| 1028 // If :focus sets display: none, we lose focus but still need to recalc our
style. | 1028 // If :focus sets display: none, we lose focus but still need to recalc our
style. |
| 1029 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByFocus()
&& styleChangeType() < SubtreeStyleChange) | 1029 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByFocus()
&& styleChangeType() < SubtreeStyleChange) |
| 1030 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().scheduleS
tyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); | 1030 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().scheduleS
tyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); |
| 1031 else | 1031 else |
| 1032 setNeedsStyleRecalc(LocalStyleChange); | 1032 setNeedsStyleRecalc(StyleChangeReasonForTracing::createWithExtraData(Sty
leChangeReason::PseudoClass, StyleChangeExtraData::Focus), LocalStyleChange); |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 void ContainerNode::setActive(bool down) | 1035 void ContainerNode::setActive(bool down) |
| 1036 { | 1036 { |
| 1037 if (down == active()) | 1037 if (down == active()) |
| 1038 return; | 1038 return; |
| 1039 | 1039 |
| 1040 Node::setActive(down); | 1040 Node::setActive(down); |
| 1041 | 1041 |
| 1042 // FIXME: Why does this not need to handle the display: none transition like
:hover does? | 1042 // FIXME: Why does this not need to handle the display: none transition like
:hover does? |
| 1043 if (renderer()) { | 1043 if (renderer()) { |
| 1044 if (styleChangeType() < SubtreeStyleChange) { | 1044 if (styleChangeType() < SubtreeStyleChange) { |
| 1045 if (renderStyle()->affectedByActive() && renderStyle()->hasPseudoSty
le(FIRST_LETTER)) | 1045 if (renderStyle()->affectedByActive() && renderStyle()->hasPseudoSty
le(FIRST_LETTER)) |
| 1046 setNeedsStyleRecalc(SubtreeStyleChange); | 1046 setNeedsStyleRecalc(StyleChangeReasonForTracing::createWithExtra
Data(StyleChangeReason::PseudoClass, StyleChangeExtraData::Active), SubtreeStyle
Change); |
| 1047 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffec
tedByActive()) | 1047 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffec
tedByActive()) |
| 1048 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().s
cheduleStyleInvalidationForPseudoChange(CSSSelector::PseudoActive, *toElement(th
is)); | 1048 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().s
cheduleStyleInvalidationForPseudoChange(CSSSelector::PseudoActive, *toElement(th
is)); |
| 1049 else if (renderStyle()->affectedByActive()) | 1049 else if (renderStyle()->affectedByActive()) |
| 1050 setNeedsStyleRecalc(LocalStyleChange); | 1050 setNeedsStyleRecalc(StyleChangeReasonForTracing::createWithExtra
Data(StyleChangeReason::PseudoClass, StyleChangeExtraData::Active), LocalStyleCh
ange); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 if (renderStyle()->hasAppearance()) | 1053 if (renderStyle()->hasAppearance()) |
| 1054 RenderTheme::theme().stateChanged(renderer(), PressedControlState); | 1054 RenderTheme::theme().stateChanged(renderer(), PressedControlState); |
| 1055 } | 1055 } |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 void ContainerNode::setHovered(bool over) | 1058 void ContainerNode::setHovered(bool over) |
| 1059 { | 1059 { |
| 1060 if (over == hovered()) | 1060 if (over == hovered()) |
| 1061 return; | 1061 return; |
| 1062 | 1062 |
| 1063 Node::setHovered(over); | 1063 Node::setHovered(over); |
| 1064 | 1064 |
| 1065 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. | 1065 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. |
| 1066 if (!renderer()) { | 1066 if (!renderer()) { |
| 1067 if (over) | 1067 if (over) |
| 1068 return; | 1068 return; |
| 1069 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove
r() && styleChangeType() < SubtreeStyleChange) | 1069 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove
r() && styleChangeType() < SubtreeStyleChange) |
| 1070 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); | 1070 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); |
| 1071 else | 1071 else |
| 1072 setNeedsStyleRecalc(LocalStyleChange); | 1072 setNeedsStyleRecalc(StyleChangeReasonForTracing::createWithExtraData
(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover), LocalStyleChange)
; |
| 1073 return; | 1073 return; |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 if (styleChangeType() < SubtreeStyleChange) { | 1076 if (styleChangeType() < SubtreeStyleChange) { |
| 1077 if (renderStyle()->affectedByHover() && renderStyle()->hasPseudoStyle(FI
RST_LETTER)) | 1077 if (renderStyle()->affectedByHover() && renderStyle()->hasPseudoStyle(FI
RST_LETTER)) |
| 1078 setNeedsStyleRecalc(SubtreeStyleChange); | 1078 setNeedsStyleRecalc(StyleChangeReasonForTracing::createWithExtraData
(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover), SubtreeStyleChang
e); |
| 1079 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yHover()) | 1079 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB
yHover()) |
| 1080 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); | 1080 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); |
| 1081 else if (renderStyle()->affectedByHover()) | 1081 else if (renderStyle()->affectedByHover()) |
| 1082 setNeedsStyleRecalc(LocalStyleChange); | 1082 setNeedsStyleRecalc(StyleChangeReasonForTracing::createWithExtraData
(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover), LocalStyleChange)
; |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 if (renderer()->style()->hasAppearance()) | 1085 if (renderer()->style()->hasAppearance()) |
| 1086 RenderTheme::theme().stateChanged(renderer(), HoverControlState); | 1086 RenderTheme::theme().stateChanged(renderer(), HoverControlState); |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children() | 1089 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children() |
| 1090 { | 1090 { |
| 1091 return ensureCachedCollection<HTMLCollection>(NodeChildren); | 1091 return ensureCachedCollection<HTMLCollection>(NodeChildren); |
| 1092 } | 1092 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 return; | 1245 return; |
| 1246 | 1246 |
| 1247 unsigned forceCheckOfNextElementCount = 0; | 1247 unsigned forceCheckOfNextElementCount = 0; |
| 1248 bool forceCheckOfAnyElementSibling = false; | 1248 bool forceCheckOfAnyElementSibling = false; |
| 1249 Document& document = this->document(); | 1249 Document& document = this->document(); |
| 1250 | 1250 |
| 1251 for (Element* child = ElementTraversal::firstChild(*this); child; child = El
ementTraversal::nextSibling(*child)) { | 1251 for (Element* child = ElementTraversal::firstChild(*this); child; child = El
ementTraversal::nextSibling(*child)) { |
| 1252 bool childRulesChanged = child->needsStyleRecalc() && child->styleChange
Type() >= SubtreeStyleChange; | 1252 bool childRulesChanged = child->needsStyleRecalc() && child->styleChange
Type() >= SubtreeStyleChange; |
| 1253 | 1253 |
| 1254 if (forceCheckOfNextElementCount || forceCheckOfAnyElementSibling) | 1254 if (forceCheckOfNextElementCount || forceCheckOfAnyElementSibling) |
| 1255 child->setNeedsStyleRecalc(SubtreeStyleChange); | 1255 child->setNeedsStyleRecalc(StyleChangeReasonForTracing::create(Style
ChangeReason::SiblingSelector), SubtreeStyleChange); |
| 1256 | 1256 |
| 1257 if (childRulesChanged && hasDirectAdjacentRules) | 1257 if (childRulesChanged && hasDirectAdjacentRules) |
| 1258 forceCheckOfNextElementCount = document.styleEngine()->maxDirectAdja
centSelectors(); | 1258 forceCheckOfNextElementCount = document.styleEngine()->maxDirectAdja
centSelectors(); |
| 1259 else if (forceCheckOfNextElementCount) | 1259 else if (forceCheckOfNextElementCount) |
| 1260 --forceCheckOfNextElementCount; | 1260 --forceCheckOfNextElementCount; |
| 1261 | 1261 |
| 1262 forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childR
ulesChanged && hasIndirectAdjacentRules); | 1262 forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childR
ulesChanged && hasIndirectAdjacentRules); |
| 1263 } | 1263 } |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, Nod
e* nodeBeforeChange, Node* nodeAfterChange) | 1266 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, Nod
e* nodeBeforeChange, Node* nodeAfterChange) |
| 1267 { | 1267 { |
| 1268 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() || style
ChangeType() >= SubtreeStyleChange) | 1268 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() || style
ChangeType() >= SubtreeStyleChange) |
| 1269 return; | 1269 return; |
| 1270 | 1270 |
| 1271 if (needsStyleRecalc() && childrenAffectedByPositionalRules()) | 1271 if (needsStyleRecalc() && childrenAffectedByPositionalRules()) |
| 1272 return; | 1272 return; |
| 1273 | 1273 |
| 1274 // Forward positional selectors include nth-child, nth-of-type, first-of-typ
e and only-of-type. | 1274 // Forward positional selectors include nth-child, nth-of-type, first-of-typ
e and only-of-type. |
| 1275 // The indirect adjacent selector is the ~ selector. | 1275 // The indirect adjacent selector is the ~ selector. |
| 1276 // Backward positional selectors include nth-last-child, nth-last-of-type, l
ast-of-type and only-of-type. | 1276 // Backward positional selectors include nth-last-child, nth-last-of-type, l
ast-of-type and only-of-type. |
| 1277 // We have to invalidate everything following the insertion point in the for
ward and indirect adjacent case, | 1277 // We have to invalidate everything following the insertion point in the for
ward and indirect adjacent case, |
| 1278 // and everything before the insertion point in the backward case. | 1278 // and everything before the insertion point in the backward case. |
| 1279 // |afterChange| is 0 in the parser callback case, so we won't do any work f
or the forward case if we don't have to. | 1279 // |afterChange| is 0 in the parser callback case, so we won't do any work f
or the forward case if we don't have to. |
| 1280 // For performance reasons we just mark the parent node as changed, since we
don't want to make childrenChanged O(n^2) by crawling all our kids | 1280 // For performance reasons we just mark the parent node as changed, since we
don't want to make childrenChanged O(n^2) by crawling all our kids |
| 1281 // here. recalcStyle will then force a walk of the children when it sees tha
t this has happened. | 1281 // here. recalcStyle will then force a walk of the children when it sees tha
t this has happened. |
| 1282 if (((childrenAffectedByForwardPositionalRules() || childrenAffectedByIndire
ctAdjacentRules()) && nodeAfterChange) | 1282 if (((childrenAffectedByForwardPositionalRules() || childrenAffectedByIndire
ctAdjacentRules()) && nodeAfterChange) |
| 1283 || (childrenAffectedByBackwardPositionalRules() && nodeBeforeChange)) { | 1283 || (childrenAffectedByBackwardPositionalRules() && nodeBeforeChange)) { |
| 1284 setNeedsStyleRecalc(SubtreeStyleChange); | 1284 setNeedsStyleRecalc(StyleChangeReasonForTracing::create(StyleChangeReaso
n::SiblingSelector), SubtreeStyleChange); |
| 1285 return; | 1285 return; |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 // :first-child. In the parser callback case, we don't have to check anythin
g, since we were right the first time. | 1288 // :first-child. In the parser callback case, we don't have to check anythin
g, since we were right the first time. |
| 1289 // In the DOM case, we only need to do something if |afterChange| is not 0. | 1289 // In the DOM case, we only need to do something if |afterChange| is not 0. |
| 1290 // |afterChange| is 0 in the parser case, so it works out that we'll skip th
is block. | 1290 // |afterChange| is 0 in the parser case, so it works out that we'll skip th
is block. |
| 1291 if (childrenAffectedByFirstChildRules() && nodeAfterChange) { | 1291 if (childrenAffectedByFirstChildRules() && nodeAfterChange) { |
| 1292 ASSERT(changeType != FinishedParsingChildren); | 1292 ASSERT(changeType != FinishedParsingChildren); |
| 1293 // Find our new first child element. | 1293 // Find our new first child element. |
| 1294 Element* firstChildElement = ElementTraversal::firstChild(*this); | 1294 Element* firstChildElement = ElementTraversal::firstChild(*this); |
| 1295 RenderStyle* firstChildElementStyle = firstChildElement ? firstChildElem
ent->renderStyle() : 0; | 1295 RenderStyle* firstChildElementStyle = firstChildElement ? firstChildElem
ent->renderStyle() : 0; |
| 1296 | 1296 |
| 1297 // Find the first element after the change. | 1297 // Find the first element after the change. |
| 1298 Element* elementAfterChange = nodeAfterChange->isElementNode() ? toEleme
nt(nodeAfterChange) : ElementTraversal::nextSibling(*nodeAfterChange); | 1298 Element* elementAfterChange = nodeAfterChange->isElementNode() ? toEleme
nt(nodeAfterChange) : ElementTraversal::nextSibling(*nodeAfterChange); |
| 1299 RenderStyle* elementAfterChangeStyle = elementAfterChange ? elementAfter
Change->renderStyle() : 0; | 1299 RenderStyle* elementAfterChangeStyle = elementAfterChange ? elementAfter
Change->renderStyle() : 0; |
| 1300 | 1300 |
| 1301 // This is the element insertion as first child element case. | 1301 // This is the element insertion as first child element case. |
| 1302 if (firstChildElement != elementAfterChange && elementAfterChangeStyle &
& elementAfterChangeStyle->firstChildState()) { | 1302 if (firstChildElement != elementAfterChange && elementAfterChangeStyle &
& elementAfterChangeStyle->firstChildState()) { |
| 1303 ASSERT(changeType == SiblingElementInserted); | 1303 ASSERT(changeType == SiblingElementInserted); |
| 1304 elementAfterChange->setNeedsStyleRecalc(SubtreeStyleChange); | 1304 elementAfterChange->setNeedsStyleRecalc(StyleChangeReasonForTracing:
:create(StyleChangeReason::SiblingSelector), SubtreeStyleChange); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 // This is the first child element removal case. | 1307 // This is the first child element removal case. |
| 1308 if (changeType == SiblingElementRemoved && firstChildElement == elementA
fterChange && firstChildElement && (!firstChildElementStyle || !firstChildElemen
tStyle->firstChildState())) | 1308 if (changeType == SiblingElementRemoved && firstChildElement == elementA
fterChange && firstChildElement && (!firstChildElementStyle || !firstChildElemen
tStyle->firstChildState())) |
| 1309 firstChildElement->setNeedsStyleRecalc(SubtreeStyleChange); | 1309 firstChildElement->setNeedsStyleRecalc(StyleChangeReasonForTracing::
create(StyleChangeReason::SiblingSelector), SubtreeStyleChange); |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 // :last-child. In the parser callback case, we don't have to check anything
, since we were right the first time. | 1312 // :last-child. In the parser callback case, we don't have to check anything
, since we were right the first time. |
| 1313 // In the DOM case, we only need to do something if |afterChange| is not 0. | 1313 // In the DOM case, we only need to do something if |afterChange| is not 0. |
| 1314 if (childrenAffectedByLastChildRules() && nodeBeforeChange) { | 1314 if (childrenAffectedByLastChildRules() && nodeBeforeChange) { |
| 1315 // Find our new last child element. | 1315 // Find our new last child element. |
| 1316 Element* lastChildElement = ElementTraversal::lastChild(*this); | 1316 Element* lastChildElement = ElementTraversal::lastChild(*this); |
| 1317 RenderStyle* lastChildElementStyle = lastChildElement ? lastChildElement
->renderStyle() : 0; | 1317 RenderStyle* lastChildElementStyle = lastChildElement ? lastChildElement
->renderStyle() : 0; |
| 1318 | 1318 |
| 1319 // Find the last element before the change. | 1319 // Find the last element before the change. |
| 1320 Element* elementBeforeChange = nodeBeforeChange->isElementNode() ? toEle
ment(nodeBeforeChange) : ElementTraversal::previousSibling(*nodeBeforeChange); | 1320 Element* elementBeforeChange = nodeBeforeChange->isElementNode() ? toEle
ment(nodeBeforeChange) : ElementTraversal::previousSibling(*nodeBeforeChange); |
| 1321 RenderStyle* elementBeforeChangeStyle = elementBeforeChange ? elementBef
oreChange->renderStyle() : 0; | 1321 RenderStyle* elementBeforeChangeStyle = elementBeforeChange ? elementBef
oreChange->renderStyle() : 0; |
| 1322 | 1322 |
| 1323 // This is the element insertion as last child element case. | 1323 // This is the element insertion as last child element case. |
| 1324 if (lastChildElement != elementBeforeChange && elementBeforeChangeStyle
&& elementBeforeChangeStyle->lastChildState()) { | 1324 if (lastChildElement != elementBeforeChange && elementBeforeChangeStyle
&& elementBeforeChangeStyle->lastChildState()) { |
| 1325 ASSERT(SiblingElementInserted); | 1325 ASSERT(SiblingElementInserted); |
| 1326 elementBeforeChange->setNeedsStyleRecalc(SubtreeStyleChange); | 1326 elementBeforeChange->setNeedsStyleRecalc(StyleChangeReasonForTracing
::create(StyleChangeReason::SiblingSelector), SubtreeStyleChange); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 // This is the last child element removal case. The parser callback case
is similar to node removal as well in that we need to change the last child | 1329 // This is the last child element removal case. The parser callback case
is similar to node removal as well in that we need to change the last child |
| 1330 // to match now. | 1330 // to match now. |
| 1331 if ((changeType == SiblingElementRemoved || changeType == FinishedParsin
gChildren) && lastChildElement == elementBeforeChange && lastChildElement && (!l
astChildElementStyle || !lastChildElementStyle->lastChildState())) | 1331 if ((changeType == SiblingElementRemoved || changeType == FinishedParsin
gChildren) && lastChildElement == elementBeforeChange && lastChildElement && (!l
astChildElementStyle || !lastChildElementStyle->lastChildState())) |
| 1332 lastChildElement->setNeedsStyleRecalc(SubtreeStyleChange); | 1332 lastChildElement->setNeedsStyleRecalc(StyleChangeReasonForTracing::c
reate(StyleChangeReason::SiblingSelector), SubtreeStyleChange); |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 // The + selector. We need to invalidate the first element following the cha
nge. It is the only possible element | 1335 // The + selector. We need to invalidate the first element following the cha
nge. It is the only possible element |
| 1336 // that could be affected by this DOM change. | 1336 // that could be affected by this DOM change. |
| 1337 if (childrenAffectedByDirectAdjacentRules() && nodeAfterChange) { | 1337 if (childrenAffectedByDirectAdjacentRules() && nodeAfterChange) { |
| 1338 if (Element* elementAfterChange = nodeAfterChange->isElementNode() ? toE
lement(nodeAfterChange) : ElementTraversal::nextSibling(*nodeAfterChange)) | 1338 if (Element* elementAfterChange = nodeAfterChange->isElementNode() ? toE
lement(nodeAfterChange) : ElementTraversal::nextSibling(*nodeAfterChange)) |
| 1339 elementAfterChange->setNeedsStyleRecalc(SubtreeStyleChange); | 1339 elementAfterChange->setNeedsStyleRecalc(StyleChangeReasonForTracing:
:create(StyleChangeReason::SiblingSelector), SubtreeStyleChange); |
| 1340 } | 1340 } |
| 1341 } | 1341 } |
| 1342 | 1342 |
| 1343 void ContainerNode::invalidateNodeListCachesInAncestors(const QualifiedName* att
rName, Element* attributeOwnerElement) | 1343 void ContainerNode::invalidateNodeListCachesInAncestors(const QualifiedName* att
rName, Element* attributeOwnerElement) |
| 1344 { | 1344 { |
| 1345 if (hasRareData() && (!attrName || isAttributeNode())) { | 1345 if (hasRareData() && (!attrName || isAttributeNode())) { |
| 1346 if (NodeListsNodeData* lists = rareData()->nodeLists()) { | 1346 if (NodeListsNodeData* lists = rareData()->nodeLists()) { |
| 1347 if (ChildNodeList* childNodeList = lists->childNodeList(*this)) | 1347 if (ChildNodeList* childNodeList = lists->childNodeList(*this)) |
| 1348 childNodeList->invalidateCache(); | 1348 childNodeList->invalidateCache(); |
| 1349 } | 1349 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 return true; | 1441 return true; |
| 1442 | 1442 |
| 1443 if (node->isElementNode() && toElement(node)->shadow()) | 1443 if (node->isElementNode() && toElement(node)->shadow()) |
| 1444 return true; | 1444 return true; |
| 1445 | 1445 |
| 1446 return false; | 1446 return false; |
| 1447 } | 1447 } |
| 1448 #endif | 1448 #endif |
| 1449 | 1449 |
| 1450 } // namespace blink | 1450 } // namespace blink |
| OLD | NEW |