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

Side by Side Diff: third_party/WebKit/Source/core/css/RuleFeature.cpp

Issue 2392343005: Reflow comments in core/css (Closed)
Patch Set: Revert clang-format Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All
6 * rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 11 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 12 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
11 * Copyright (C) 2012 Google Inc. All rights reserved. 13 * Copyright (C) 2012 Google Inc. All rights reserved.
12 * 14 *
13 * This library is free software; you can redistribute it and/or 15 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public 16 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either 17 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version. 18 * version 2 of the License, or (at your option) any later version.
17 * 19 *
18 * This library is distributed in the hope that it will be useful, 20 * This library is distributed in the hope that it will be useful,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 case CSSSelector::AttributeContain: 61 case CSSSelector::AttributeContain:
60 case CSSSelector::AttributeBegin: 62 case CSSSelector::AttributeBegin:
61 case CSSSelector::AttributeEnd: 63 case CSSSelector::AttributeEnd:
62 return true; 64 return true;
63 case CSSSelector::Unknown: 65 case CSSSelector::Unknown:
64 case CSSSelector::PagePseudoClass: 66 case CSSSelector::PagePseudoClass:
65 // These should not appear in StyleRule selectors. 67 // These should not appear in StyleRule selectors.
66 NOTREACHED(); 68 NOTREACHED();
67 return false; 69 return false;
68 default: 70 default:
69 // New match type added. Figure out if it needs a subtree invalidation or not. 71 // New match type added. Figure out if it needs a subtree invalidation or
72 // not.
70 NOTREACHED(); 73 NOTREACHED();
71 return false; 74 return false;
72 } 75 }
73 } 76 }
74 77
75 bool supportsInvalidation(CSSSelector::PseudoType type) { 78 bool supportsInvalidation(CSSSelector::PseudoType type) {
76 switch (type) { 79 switch (type) {
77 case CSSSelector::PseudoEmpty: 80 case CSSSelector::PseudoEmpty:
78 case CSSSelector::PseudoFirstChild: 81 case CSSSelector::PseudoFirstChild:
79 case CSSSelector::PseudoFirstOfType: 82 case CSSSelector::PseudoFirstOfType:
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 case CSSSelector::PseudoSlotted: 157 case CSSSelector::PseudoSlotted:
155 return true; 158 return true;
156 case CSSSelector::PseudoUnknown: 159 case CSSSelector::PseudoUnknown:
157 case CSSSelector::PseudoLeftPage: 160 case CSSSelector::PseudoLeftPage:
158 case CSSSelector::PseudoRightPage: 161 case CSSSelector::PseudoRightPage:
159 case CSSSelector::PseudoFirstPage: 162 case CSSSelector::PseudoFirstPage:
160 // These should not appear in StyleRule selectors. 163 // These should not appear in StyleRule selectors.
161 NOTREACHED(); 164 NOTREACHED();
162 return false; 165 return false;
163 default: 166 default:
164 // New pseudo type added. Figure out if it needs a subtree invalidation or not. 167 // New pseudo type added. Figure out if it needs a subtree invalidation or
168 // not.
165 NOTREACHED(); 169 NOTREACHED();
166 return false; 170 return false;
167 } 171 }
168 } 172 }
169 173
170 bool supportsInvalidationWithSelectorList(CSSSelector::PseudoType pseudo) { 174 bool supportsInvalidationWithSelectorList(CSSSelector::PseudoType pseudo) {
171 return pseudo == CSSSelector::PseudoAny || pseudo == CSSSelector::PseudoCue || 175 return pseudo == CSSSelector::PseudoAny || pseudo == CSSSelector::PseudoCue ||
172 pseudo == CSSSelector::PseudoHost || 176 pseudo == CSSSelector::PseudoHost ||
173 pseudo == CSSSelector::PseudoHostContext || 177 pseudo == CSSSelector::PseudoHostContext ||
174 pseudo == CSSSelector::PseudoNot || 178 pseudo == CSSSelector::PseudoNot ||
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 623
620 if (!simpleSelector->tagHistory() || 624 if (!simpleSelector->tagHistory() ||
621 simpleSelector->relation() != CSSSelector::SubSelector) { 625 simpleSelector->relation() != CSSSelector::SubSelector) {
622 features.hasFeaturesForRuleSetInvalidation = 626 features.hasFeaturesForRuleSetInvalidation =
623 features.hasTagIdClassOrAttribute(); 627 features.hasTagIdClassOrAttribute();
624 return simpleSelector; 628 return simpleSelector;
625 } 629 }
626 } 630 }
627 } 631 }
628 632
629 // Add features extracted from the rightmost compound selector to descendant inv alidation 633 // Add features extracted from the rightmost compound selector to descendant
630 // sets for features found in other compound selectors. 634 // invalidation sets for features found in other compound selectors.
631 // 635 //
632 // We use descendant invalidation for descendants, sibling invalidation for sibl ings and their subtrees. 636 // We use descendant invalidation for descendants, sibling invalidation for
637 // siblings and their subtrees.
633 // 638 //
634 // As we encounter a descendant type of combinator, the features only need to be checked 639 // As we encounter a descendant type of combinator, the features only need to be
635 // against descendants in the same subtree only. features.adjacent is set to fal se, and 640 // checked against descendants in the same subtree only. features.adjacent is
636 // we start adding features to the descendant invalidation set. 641 // set to false, and we start adding features to the descendant invalidation
642 // set.
637 643
638 void RuleFeatureSet::addFeaturesToInvalidationSet( 644 void RuleFeatureSet::addFeaturesToInvalidationSet(
639 InvalidationSet& invalidationSet, 645 InvalidationSet& invalidationSet,
640 const InvalidationSetFeatures& features) { 646 const InvalidationSetFeatures& features) {
641 if (features.treeBoundaryCrossing) 647 if (features.treeBoundaryCrossing)
642 invalidationSet.setTreeBoundaryCrossing(); 648 invalidationSet.setTreeBoundaryCrossing();
643 if (features.insertionPointCrossing) 649 if (features.insertionPointCrossing)
644 invalidationSet.setInsertionPointCrossing(); 650 invalidationSet.setInsertionPointCrossing();
645 if (features.invalidatesSlotted) 651 if (features.invalidatesSlotted)
646 invalidationSet.setInvalidatesSlotted(); 652 invalidationSet.setInvalidatesSlotted();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 addFeaturesToUniversalSiblingInvalidationSet(*siblingFeatures, 756 addFeaturesToUniversalSiblingInvalidationSet(*siblingFeatures,
751 descendantFeatures); 757 descendantFeatures);
752 758
753 return simpleSelector; 759 return simpleSelector;
754 } 760 }
755 761
756 void RuleFeatureSet::addFeaturesToInvalidationSets( 762 void RuleFeatureSet::addFeaturesToInvalidationSets(
757 const CSSSelector& selector, 763 const CSSSelector& selector,
758 InvalidationSetFeatures* siblingFeatures, 764 InvalidationSetFeatures* siblingFeatures,
759 InvalidationSetFeatures& descendantFeatures) { 765 InvalidationSetFeatures& descendantFeatures) {
760 // selector is the selector immediately to the left of the rightmost combinato r. 766 // selector is the selector immediately to the left of the rightmost
761 // descendantFeatures has the features of the rightmost compound selector. 767 // combinator. descendantFeatures has the features of the rightmost compound
768 // selector.
762 769
763 InvalidationSetFeatures lastCompoundInSiblingChainFeatures; 770 InvalidationSetFeatures lastCompoundInSiblingChainFeatures;
764 const CSSSelector* compound = &selector; 771 const CSSSelector* compound = &selector;
765 while (compound) { 772 while (compound) {
766 const CSSSelector* lastInCompound = 773 const CSSSelector* lastInCompound =
767 addFeaturesToInvalidationSetsForCompoundSelector( 774 addFeaturesToInvalidationSetsForCompoundSelector(
768 *compound, siblingFeatures, descendantFeatures); 775 *compound, siblingFeatures, descendantFeatures);
769 DCHECK(lastInCompound); 776 DCHECK(lastInCompound);
770 updateFeaturesFromCombinator(*lastInCompound, compound, 777 updateFeaturesFromCombinator(*lastInCompound, compound,
771 lastCompoundInSiblingChainFeatures, 778 lastCompoundInSiblingChainFeatures,
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() || 1182 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() ||
1176 !tagNames.isEmpty() || customPseudoElement; 1183 !tagNames.isEmpty() || customPseudoElement;
1177 } 1184 }
1178 1185
1179 bool RuleFeatureSet::InvalidationSetFeatures::hasTagIdClassOrAttribute() const { 1186 bool RuleFeatureSet::InvalidationSetFeatures::hasTagIdClassOrAttribute() const {
1180 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() || 1187 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() ||
1181 !tagNames.isEmpty(); 1188 !tagNames.isEmpty();
1182 } 1189 }
1183 1190
1184 } // namespace blink 1191 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/RuleFeature.h ('k') | third_party/WebKit/Source/core/css/RuleSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698