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

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

Issue 1111643003: Move StyleInvalidator to StyleEngine. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Avoid calling ensureUpdatedRuleFeatureSet multiple times Created 5 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/invalidation/StyleInvalidator.h ('k') | Source/core/dom/Document.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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 { 1036 {
1037 // If we're just changing the window's active state and the focused node has no 1037 // If we're just changing the window's active state and the focused node has no
1038 // renderer we can just ignore the state change. 1038 // renderer we can just ignore the state change.
1039 if (!layoutObject()) 1039 if (!layoutObject())
1040 return; 1040 return;
1041 1041
1042 if (styleChangeType() < SubtreeStyleChange) { 1042 if (styleChangeType() < SubtreeStyleChange) {
1043 if (computedStyle()->affectedByFocus() && computedStyle()->hasPseudoStyl e(FIRST_LETTER)) 1043 if (computedStyle()->affectedByFocus() && computedStyle()->hasPseudoStyl e(FIRST_LETTER))
1044 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus )); 1044 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus ));
1045 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB yFocus()) 1045 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB yFocus())
1046 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched uleStyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); 1046 document().styleEngine().pseudoStateChangedForElement(CSSSelector::P seudoFocus, *toElement(this));
1047 else if (computedStyle()->affectedByFocus()) 1047 else if (computedStyle()->affectedByFocus())
1048 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)) ; 1048 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)) ;
1049 } 1049 }
1050 1050
1051 if (layoutObject() && layoutObject()->style()->hasAppearance()) 1051 if (layoutObject() && layoutObject()->style()->hasAppearance())
1052 LayoutTheme::theme().stateChanged(layoutObject(), FocusControlState); 1052 LayoutTheme::theme().stateChanged(layoutObject(), FocusControlState);
1053 } 1053 }
1054 1054
1055 void ContainerNode::setFocus(bool received) 1055 void ContainerNode::setFocus(bool received)
1056 { 1056 {
(...skipping 15 matching lines...) Expand all
1072 host->focusStateChanged(); 1072 host->focusStateChanged();
1073 host->document().userActionElements().setFocused(host, received); 1073 host->document().userActionElements().setFocused(host, received);
1074 } 1074 }
1075 } 1075 }
1076 1076
1077 if (layoutObject() || received) 1077 if (layoutObject() || received)
1078 return; 1078 return;
1079 1079
1080 // If :focus sets display: none, we lose focus but still need to recalc our style. 1080 // If :focus sets display: none, we lose focus but still need to recalc our style.
1081 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByFocus() && styleChangeType() < SubtreeStyleChange) 1081 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByFocus() && styleChangeType() < SubtreeStyleChange)
1082 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().scheduleS tyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); 1082 document().styleEngine().pseudoStateChangedForElement(CSSSelector::Pseud oFocus, *toElement(this));
1083 else 1083 else
1084 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat eWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)); 1084 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat eWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus));
1085 } 1085 }
1086 1086
1087 void ContainerNode::setActive(bool down) 1087 void ContainerNode::setActive(bool down)
1088 { 1088 {
1089 if (down == active()) 1089 if (down == active())
1090 return; 1090 return;
1091 1091
1092 Node::setActive(down); 1092 Node::setActive(down);
1093 1093
1094 // FIXME: Why does this not need to handle the display: none transition like :hover does? 1094 // FIXME: Why does this not need to handle the display: none transition like :hover does?
1095 if (layoutObject()) { 1095 if (layoutObject()) {
1096 if (styleChangeType() < SubtreeStyleChange) { 1096 if (styleChangeType() < SubtreeStyleChange) {
1097 if (computedStyle()->affectedByActive() && computedStyle()->hasPseud oStyle(FIRST_LETTER)) 1097 if (computedStyle()->affectedByActive() && computedStyle()->hasPseud oStyle(FIRST_LETTER))
1098 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac ing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::A ctive)); 1098 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac ing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::A ctive));
1099 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffec tedByActive()) 1099 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffec tedByActive())
1100 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().s cheduleStyleInvalidationForPseudoChange(CSSSelector::PseudoActive, *toElement(th is)); 1100 document().styleEngine().pseudoStateChangedForElement(CSSSelecto r::PseudoActive, *toElement(this));
1101 else if (computedStyle()->affectedByActive()) 1101 else if (computedStyle()->affectedByActive())
1102 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin g::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Act ive)); 1102 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin g::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Act ive));
1103 } 1103 }
1104 1104
1105 if (computedStyle()->hasAppearance()) 1105 if (computedStyle()->hasAppearance())
1106 LayoutTheme::theme().stateChanged(layoutObject(), PressedControlStat e); 1106 LayoutTheme::theme().stateChanged(layoutObject(), PressedControlStat e);
1107 } 1107 }
1108 } 1108 }
1109 1109
1110 void ContainerNode::setHovered(bool over) 1110 void ContainerNode::setHovered(bool over)
1111 { 1111 {
1112 if (over == hovered()) 1112 if (over == hovered())
1113 return; 1113 return;
1114 1114
1115 Node::setHovered(over); 1115 Node::setHovered(over);
1116 1116
1117 // If :hover sets display: none we lose our hover but still need to recalc o ur style. 1117 // If :hover sets display: none we lose our hover but still need to recalc o ur style.
1118 if (!layoutObject()) { 1118 if (!layoutObject()) {
1119 if (over) 1119 if (over)
1120 return; 1120 return;
1121 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove r() && styleChangeType() < SubtreeStyleChange) 1121 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHove r() && styleChangeType() < SubtreeStyleChange)
1122 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); 1122 document().styleEngine().pseudoStateChangedForElement(CSSSelector::P seudoHover, *toElement(this));
1123 else 1123 else
1124 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)) ; 1124 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)) ;
1125 return; 1125 return;
1126 } 1126 }
1127 1127
1128 if (styleChangeType() < SubtreeStyleChange) { 1128 if (styleChangeType() < SubtreeStyleChange) {
1129 if (computedStyle()->affectedByHover() && computedStyle()->hasPseudoStyl e(FIRST_LETTER)) 1129 if (computedStyle()->affectedByHover() && computedStyle()->hasPseudoStyl e(FIRST_LETTER))
1130 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover )); 1130 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover ));
1131 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB yHover()) 1131 else if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedB yHover())
1132 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); 1132 document().styleEngine().pseudoStateChangedForElement(CSSSelector::P seudoHover, *toElement(this));
1133 else if (computedStyle()->affectedByHover()) 1133 else if (computedStyle()->affectedByHover())
1134 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)) ; 1134 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover)) ;
1135 } 1135 }
1136 1136
1137 if (layoutObject()->style()->hasAppearance()) 1137 if (layoutObject()->style()->hasAppearance())
1138 LayoutTheme::theme().stateChanged(layoutObject(), HoverControlState); 1138 LayoutTheme::theme().stateChanged(layoutObject(), HoverControlState);
1139 } 1139 }
1140 1140
1141 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children() 1141 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children()
1142 { 1142 {
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 return true; 1492 return true;
1493 1493
1494 if (node->isElementNode() && toElement(node)->shadow()) 1494 if (node->isElementNode() && toElement(node)->shadow())
1495 return true; 1495 return true;
1496 1496
1497 return false; 1497 return false;
1498 } 1498 }
1499 #endif 1499 #endif
1500 1500
1501 } // namespace blink 1501 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/invalidation/StyleInvalidator.h ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698