| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/RuleFeature.h" | 5 #include "core/css/RuleFeature.h" |
| 6 | 6 |
| 7 #include "core/css/CSSSelectorList.h" | 7 #include "core/css/CSSSelectorList.h" |
| 8 #include "core/css/RuleSet.h" | 8 #include "core/css/RuleSet.h" |
| 9 #include "core/css/StylePropertySet.h" | 9 #include "core/css/StylePropertySet.h" |
| 10 #include "core/css/StyleRule.h" | 10 #include "core/css/StyleRule.h" |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 CollectFeatures(":nth-child(2) ::content .a")); | 500 CollectFeatures(":nth-child(2) ::content .a")); |
| 501 ExpectSiblingRuleCount(0); | 501 ExpectSiblingRuleCount(0); |
| 502 } | 502 } |
| 503 | 503 |
| 504 TEST_F(RuleFeatureSetTest, siblingRulesNthAfterContentPseudo) { | 504 TEST_F(RuleFeatureSetTest, siblingRulesNthAfterContentPseudo) { |
| 505 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, | 505 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, |
| 506 CollectFeatures(".a ::content :nth-child(2)")); | 506 CollectFeatures(".a ::content :nth-child(2)")); |
| 507 ExpectSiblingRuleCount(1); | 507 ExpectSiblingRuleCount(1); |
| 508 } | 508 } |
| 509 | 509 |
| 510 TEST_F(RuleFeatureSetTest, siblingRulesBeforeDeep) { | |
| 511 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, | |
| 512 CollectFeatures("a + b /deep/ .c")); | |
| 513 ExpectSiblingRuleCount(1); | |
| 514 } | |
| 515 | |
| 516 TEST_F(RuleFeatureSetTest, siblingRulesAfterDeep) { | |
| 517 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, | |
| 518 CollectFeatures(".a /deep/ .b + .c")); | |
| 519 ExpectSiblingRuleCount(1); | |
| 520 } | |
| 521 | |
| 522 TEST_F(RuleFeatureSetTest, siblingRulesBeforeShadow) { | |
| 523 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, | |
| 524 CollectFeatures(".a + .b::shadow .c")); | |
| 525 ExpectSiblingRuleCount(1); | |
| 526 } | |
| 527 | |
| 528 TEST_F(RuleFeatureSetTest, siblingRulesAfterShadow) { | |
| 529 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, | |
| 530 CollectFeatures(".a ::shadow .b + .c")); | |
| 531 ExpectSiblingRuleCount(1); | |
| 532 } | |
| 533 | |
| 534 TEST_F(RuleFeatureSetTest, siblingRulesBeforeSlotted) { | 510 TEST_F(RuleFeatureSetTest, siblingRulesBeforeSlotted) { |
| 535 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, | 511 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, |
| 536 CollectFeatures(".a + ::slotted(.b)")); | 512 CollectFeatures(".a + ::slotted(.b)")); |
| 537 ExpectSiblingRuleCount(0); | 513 ExpectSiblingRuleCount(0); |
| 538 } | 514 } |
| 539 | 515 |
| 540 TEST_F(RuleFeatureSetTest, siblingRulesBeforeHost) { | 516 TEST_F(RuleFeatureSetTest, siblingRulesBeforeHost) { |
| 541 EXPECT_EQ(RuleFeatureSet::kSelectorNeverMatches, | 517 EXPECT_EQ(RuleFeatureSet::kSelectorNeverMatches, |
| 542 CollectFeatures(".a + :host(.b)")); | 518 CollectFeatures(".a + :host(.b)")); |
| 543 ExpectSiblingRuleCount(0); | 519 ExpectSiblingRuleCount(0); |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 CollectFeatures(":-webkit-any(:-webkit-any(.a, *), #x)")); | 1035 CollectFeatures(":-webkit-any(:-webkit-any(.a, *), #x)")); |
| 1060 ExpectFullRecalcForRuleSetInvalidation(true); | 1036 ExpectFullRecalcForRuleSetInvalidation(true); |
| 1061 ClearFeatures(); | 1037 ClearFeatures(); |
| 1062 | 1038 |
| 1063 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, | 1039 EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, |
| 1064 CollectFeatures(":-webkit-any(*, .a) *")); | 1040 CollectFeatures(":-webkit-any(*, .a) *")); |
| 1065 ExpectFullRecalcForRuleSetInvalidation(true); | 1041 ExpectFullRecalcForRuleSetInvalidation(true); |
| 1066 } | 1042 } |
| 1067 | 1043 |
| 1068 } // namespace blink | 1044 } // namespace blink |
| OLD | NEW |