Index: third_party/WebKit/Source/core/css/RuleSetTest.cpp |
diff --git a/third_party/WebKit/Source/core/css/RuleSetTest.cpp b/third_party/WebKit/Source/core/css/RuleSetTest.cpp |
index de54ff6caca0eab47de60089f43bd35e106629c9..a1fdff3f848833b3c2f6f8e1285d1604afe80191 100644 |
--- a/third_party/WebKit/Source/core/css/RuleSetTest.cpp |
+++ b/third_party/WebKit/Source/core/css/RuleSetTest.cpp |
@@ -31,6 +31,7 @@ |
#include "core/css/CSSTestHelper.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#include "wtf/text/StringBuilder.h" |
namespace blink { |
@@ -195,4 +196,21 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_HostContextAndClass) { |
ASSERT_EQ(0u, rules->size()); |
} |
+TEST(RuleSetTest, SelectorIndexLimit) { |
+ StringBuilder builder; |
+ |
+ for (unsigned i = 0; i < 16383; i++) |
+ builder.append("div,"); |
+ |
+ builder.append("b,span {}"); |
+ |
+ CSSTestHelper helper; |
+ helper.addCSSRules(builder.toString().ascii().data()); |
+ const RuleSet& ruleSet = helper.ruleSet(); |
+ const HeapTerminatedArray<RuleData>* rules = ruleSet.tagRules("b"); |
+ ASSERT_EQ(1u, rules->size()); |
+ EXPECT_EQ("b", rules->at(0).selector().tagQName().localName()); |
+ EXPECT_FALSE(ruleSet.tagRules("span")); |
+} |
+ |
} // namespace blink |