| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014, Google Inc. All rights reserved. | 2 * Copyright (c) 2014, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 ASSERT_EQ(str, rules->at(0).selector().tagQName().localName()); | 72 ASSERT_EQ(str, rules->at(0).selector().tagQName().localName()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 TEST(RuleSetTest, findBestRuleSetAndAdd_ClassThenId) | 75 TEST(RuleSetTest, findBestRuleSetAndAdd_ClassThenId) |
| 76 { | 76 { |
| 77 CSSTestHelper helper; | 77 CSSTestHelper helper; |
| 78 | 78 |
| 79 helper.addCSSRules(".class#id { }"); | 79 helper.addCSSRules(".class#id { }"); |
| 80 RuleSet& ruleSet = helper.ruleSet(); | 80 RuleSet& ruleSet = helper.ruleSet(); |
| 81 AtomicString str("id"); | 81 AtomicString str("id"); |
| 82 // id is prefered over class even if class preceeds it in the selector. | 82 // id is preferred over class even if class precedes it in the selector. |
| 83 const TerminatedArray<RuleData>* rules = ruleSet.idRules(str); | 83 const TerminatedArray<RuleData>* rules = ruleSet.idRules(str); |
| 84 ASSERT_EQ(1u, rules->size()); | 84 ASSERT_EQ(1u, rules->size()); |
| 85 AtomicString classStr("class"); | 85 AtomicString classStr("class"); |
| 86 ASSERT_EQ(classStr, rules->at(0).selector().value()); | 86 ASSERT_EQ(classStr, rules->at(0).selector().value()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 TEST(RuleSetTest, findBestRuleSetAndAdd_IdThenClass) | 89 TEST(RuleSetTest, findBestRuleSetAndAdd_IdThenClass) |
| 90 { | 90 { |
| 91 CSSTestHelper helper; | 91 CSSTestHelper helper; |
| 92 | 92 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 { | 205 { |
| 206 CSSTestHelper helper; | 206 CSSTestHelper helper; |
| 207 | 207 |
| 208 helper.addCSSRules(".foo:host-context(*) { }"); | 208 helper.addCSSRules(".foo:host-context(*) { }"); |
| 209 RuleSet& ruleSet = helper.ruleSet(); | 209 RuleSet& ruleSet = helper.ruleSet(); |
| 210 const WillBeHeapVector<RuleData>* rules = ruleSet.shadowHostRules(); | 210 const WillBeHeapVector<RuleData>* rules = ruleSet.shadowHostRules(); |
| 211 ASSERT_EQ(0u, rules->size()); | 211 ASSERT_EQ(0u, rules->size()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |