Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 1491183007: Call pseudoStateChangedForElement from Element::pseudoStateChanged only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 { 1075 {
1076 // If we're just changing the window's active state and the focused node has no 1076 // If we're just changing the window's active state and the focused node has no
1077 // layoutObject we can just ignore the state change. 1077 // layoutObject we can just ignore the state change.
1078 if (!layoutObject()) 1078 if (!layoutObject())
1079 return; 1079 return;
1080 1080
1081 if (styleChangeType() < SubtreeStyleChange) { 1081 if (styleChangeType() < SubtreeStyleChange) {
1082 if (computedStyle()->affectedByFocus() && computedStyle()->hasPseudoStyl e(FIRST_LETTER)) 1082 if (computedStyle()->affectedByFocus() && computedStyle()->hasPseudoStyl e(FIRST_LETTER))
1083 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus )); 1083 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus ));
1084 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB yFocus()) 1084 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB yFocus())
1085 document().styleEngine().pseudoStateChangedForElement(CSSSelector::P seudoFocus, *toElement(this)); 1085 toElement(this)->pseudoStateChanged(CSSSelector::PseudoFocus);
1086 else if (computedStyle()->affectedByFocus()) 1086 else if (computedStyle()->affectedByFocus())
1087 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)) ; 1087 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)) ;
1088 } 1088 }
1089 1089
1090 LayoutTheme::theme().controlStateChanged(*layoutObject(), FocusControlState) ; 1090 LayoutTheme::theme().controlStateChanged(*layoutObject(), FocusControlState) ;
1091 } 1091 }
1092 1092
1093 void ContainerNode::setFocus(bool received) 1093 void ContainerNode::setFocus(bool received)
1094 { 1094 {
1095 // Recurse up author shadow trees to mark shadow hosts if it matches :focus. 1095 // Recurse up author shadow trees to mark shadow hosts if it matches :focus.
(...skipping 15 matching lines...) Expand all
1111 return; 1111 return;
1112 1112
1113 Node::setFocus(received); 1113 Node::setFocus(received);
1114 1114
1115 focusStateChanged(); 1115 focusStateChanged();
1116 1116
1117 if (layoutObject() || received) 1117 if (layoutObject() || received)
1118 return; 1118 return;
1119 1119
1120 // If :focus sets display: none, we lose focus but still need to recalc our style. 1120 // If :focus sets display: none, we lose focus but still need to recalc our style.
1121 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByFocus() && styleChangeType() < SubtreeStyleChange) 1121 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByFocus())
1122 document().styleEngine().pseudoStateChangedForElement(CSSSelector::Pseud oFocus, *toElement(this)); 1122 toElement(this)->pseudoStateChanged(CSSSelector::PseudoFocus);
1123 else 1123 else
1124 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat eWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)); 1124 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat eWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus));
1125 } 1125 }
1126 1126
1127 void ContainerNode::setActive(bool down) 1127 void ContainerNode::setActive(bool down)
1128 { 1128 {
1129 if (down == active()) 1129 if (down == active())
1130 return; 1130 return;
1131 1131
1132 Node::setActive(down); 1132 Node::setActive(down);
1133 1133
1134 // FIXME: Why does this not need to handle the display: none transition like :hover does? 1134 // FIXME: Why does this not need to handle the display: none transition like :hover does?
1135 if (layoutObject()) { 1135 if (layoutObject()) {
1136 if (styleChangeType() < SubtreeStyleChange) { 1136 if (styleChangeType() < SubtreeStyleChange) {
1137 if (computedStyle()->affectedByActive() && computedStyle()->hasPseud oStyle(FIRST_LETTER)) 1137 if (computedStyle()->affectedByActive() && computedStyle()->hasPseud oStyle(FIRST_LETTER))
1138 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac ing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::A ctive)); 1138 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac ing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::A ctive));
1139 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffec tedByActive()) 1139 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffec tedByActive())
1140 document().styleEngine().pseudoStateChangedForElement(CSSSelecto r::PseudoActive, *toElement(this)); 1140 toElement(this)->pseudoStateChanged(CSSSelector::PseudoActive);
1141 else if (computedStyle()->affectedByActive()) 1141 else if (computedStyle()->affectedByActive())
1142 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin g::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Act ive)); 1142 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin g::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Act ive));
1143 } 1143 }
1144 1144
1145 LayoutTheme::theme().controlStateChanged(*layoutObject(), PressedControl State); 1145 LayoutTheme::theme().controlStateChanged(*layoutObject(), PressedControl State);
1146 } 1146 }
1147 } 1147 }
1148 1148
1149 void ContainerNode::setHovered(bool over) 1149 void ContainerNode::setHovered(bool over)
1150 { 1150 {
1151 if (over == hovered()) 1151 if (over == hovered())
1152 return; 1152 return;
1153 1153
1154 Node::setHovered(over); 1154 Node::setHovered(over);
1155 1155
1156 // If :hover sets display: none we lose our hover but still need to recalc o ur style. 1156 // If :hover sets display: none we lose our hover but still need to recalc o ur style.
1157 if (!layoutObject()) { 1157 if (!layoutObject()) {
1158 if (over) 1158 if (over)
1159 return; 1159 return;
1160 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove r() && styleChangeType() < SubtreeStyleChange) 1160 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove r())
1161 document().styleEngine().pseudoStateChangedForElement(CSSSelector::P seudoHover, *toElement(this)); 1161 toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover);
1162 else 1162 else
1163 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)) ; 1163 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)) ;
1164 return; 1164 return;
1165 } 1165 }
1166 1166
1167 if (styleChangeType() < SubtreeStyleChange) { 1167 if (styleChangeType() < SubtreeStyleChange) {
1168 if (computedStyle()->affectedByHover() && computedStyle()->hasPseudoStyl e(FIRST_LETTER)) 1168 if (computedStyle()->affectedByHover() && computedStyle()->hasPseudoStyl e(FIRST_LETTER))
1169 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover )); 1169 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover ));
1170 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB yHover()) 1170 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB yHover())
1171 document().styleEngine().pseudoStateChangedForElement(CSSSelector::P seudoHover, *toElement(this)); 1171 toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover);
1172 else if (computedStyle()->affectedByHover()) 1172 else if (computedStyle()->affectedByHover())
1173 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)) ; 1173 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)) ;
1174 } 1174 }
1175 1175
1176 LayoutTheme::theme().controlStateChanged(*layoutObject(), HoverControlState) ; 1176 LayoutTheme::theme().controlStateChanged(*layoutObject(), HoverControlState) ;
1177 } 1177 }
1178 1178
1179 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children() 1179 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children()
1180 { 1180 {
1181 return ensureCachedCollection<HTMLCollection>(NodeChildren); 1181 return ensureCachedCollection<HTMLCollection>(NodeChildren);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 return true; 1527 return true;
1528 1528
1529 if (node->isElementNode() && toElement(node)->shadow()) 1529 if (node->isElementNode() && toElement(node)->shadow())
1530 return true; 1530 return true;
1531 1531
1532 return false; 1532 return false;
1533 } 1533 }
1534 #endif 1534 #endif
1535 1535
1536 } // namespace blink 1536 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698