| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 ASSERT_EQ(str, rules->at(0).selector().tagQName().localName()); | 71 ASSERT_EQ(str, rules->at(0).selector().tagQName().localName()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 TEST(RuleSetTest, findBestRuleSetAndAdd_ClassThenId) | 74 TEST(RuleSetTest, findBestRuleSetAndAdd_ClassThenId) |
| 75 { | 75 { |
| 76 CSSTestHelper helper; | 76 CSSTestHelper helper; |
| 77 | 77 |
| 78 helper.addCSSRules(".class#id { }"); | 78 helper.addCSSRules(".class#id { }"); |
| 79 RuleSet& ruleSet = helper.ruleSet(); | 79 RuleSet& ruleSet = helper.ruleSet(); |
| 80 AtomicString str("id"); | 80 AtomicString str("id"); |
| 81 // id is prefered over class even if class preceeds it in the selector. | 81 // id is preferred over class even if class precedes it in the selector. |
| 82 const TerminatedArray<RuleData>* rules = ruleSet.idRules(str); | 82 const TerminatedArray<RuleData>* rules = ruleSet.idRules(str); |
| 83 ASSERT_EQ(1u, rules->size()); | 83 ASSERT_EQ(1u, rules->size()); |
| 84 AtomicString classStr("class"); | 84 AtomicString classStr("class"); |
| 85 ASSERT_EQ(classStr, rules->at(0).selector().value()); | 85 ASSERT_EQ(classStr, rules->at(0).selector().value()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 TEST(RuleSetTest, findBestRuleSetAndAdd_IdThenClass) | 88 TEST(RuleSetTest, findBestRuleSetAndAdd_IdThenClass) |
| 89 { | 89 { |
| 90 CSSTestHelper helper; | 90 CSSTestHelper helper; |
| 91 | 91 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 { | 204 { |
| 205 CSSTestHelper helper; | 205 CSSTestHelper helper; |
| 206 | 206 |
| 207 helper.addCSSRules(".foo:host-context(*) { }"); | 207 helper.addCSSRules(".foo:host-context(*) { }"); |
| 208 RuleSet& ruleSet = helper.ruleSet(); | 208 RuleSet& ruleSet = helper.ruleSet(); |
| 209 const WillBeHeapVector<RuleData>* rules = ruleSet.shadowHostRules(); | 209 const WillBeHeapVector<RuleData>* rules = ruleSet.shadowHostRules(); |
| 210 ASSERT_EQ(0u, rules->size()); | 210 ASSERT_EQ(0u, rules->size()); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace blink | 213 } // namespace blink |
| OLD | NEW |