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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 helper.addCSSRules(".foo:host-context(*) { }"); | 193 helper.addCSSRules(".foo:host-context(*) { }"); |
194 RuleSet& ruleSet = helper.ruleSet(); | 194 RuleSet& ruleSet = helper.ruleSet(); |
195 const HeapVector<RuleData>* rules = ruleSet.shadowHostRules(); | 195 const HeapVector<RuleData>* rules = ruleSet.shadowHostRules(); |
196 ASSERT_EQ(0u, rules->size()); | 196 ASSERT_EQ(0u, rules->size()); |
197 } | 197 } |
198 | 198 |
199 TEST(RuleSetTest, SelectorIndexLimit) { | 199 TEST(RuleSetTest, SelectorIndexLimit) { |
200 StringBuilder builder; | 200 StringBuilder builder; |
201 | 201 |
202 for (unsigned i = 0; i < 16383; i++) | 202 // We use 13 bits to storing the selector start index in RuleData. This is a |
| 203 // test to check that we don't regress. We WONTFIX issues asking for more |
| 204 // since 2^13 simple selectors in a style rule is already excessive. |
| 205 for (unsigned i = 0; i < 8191; i++) |
203 builder.append("div,"); | 206 builder.append("div,"); |
204 | 207 |
205 builder.append("b,span {}"); | 208 builder.append("b,span {}"); |
206 | 209 |
207 CSSTestHelper helper; | 210 CSSTestHelper helper; |
208 helper.addCSSRules(builder.toString().ascii().data()); | 211 helper.addCSSRules(builder.toString().ascii().data()); |
209 const RuleSet& ruleSet = helper.ruleSet(); | 212 const RuleSet& ruleSet = helper.ruleSet(); |
210 const HeapTerminatedArray<RuleData>* rules = ruleSet.tagRules("b"); | 213 const HeapTerminatedArray<RuleData>* rules = ruleSet.tagRules("b"); |
211 ASSERT_EQ(1u, rules->size()); | 214 ASSERT_EQ(1u, rules->size()); |
212 EXPECT_EQ("b", rules->at(0).selector().tagQName().localName()); | 215 EXPECT_EQ("b", rules->at(0).selector().tagQName().localName()); |
213 EXPECT_FALSE(ruleSet.tagRules("span")); | 216 EXPECT_FALSE(ruleSet.tagRules("span")); |
214 } | 217 } |
215 | 218 |
216 } // namespace blink | 219 } // namespace blink |
OLD | NEW |