Commit 1a0a1c26 authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Add attribute selectors to the SelectorCountScaling performance test.

BUG=352300

Review URL: https://codereview.chromium.org/209153002

git-svn-id: svn://svn.chromium.org/blink/trunk@169783 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 926b396e
......@@ -17,18 +17,27 @@ function insertStyleSheet(css)
return styleElement;
}
function cssStr(count) {
function cssStrWithClassSelectors(count) {
var selector = '.a' + count + ' .b' + count + ' { color: red } ';
// Intentionally repeat the same classes many times, to test duplicate optimizations.
return selector + selector + selector + selector + selector + selector + selector;
}
function cssStrWithAttributeSelectors(count) {
var selector = '[attrA' + count + '="1"]' + ' [attrB' + count + '="1"]' + ' { color: red } ';
// Intentionally repeat the same classes many times, to test duplicate optimizations.
return selector + selector + selector + selector + selector + selector + selector;
}
function runFunction()
{
var numRules = 1000;
var arr = new Array(numRules);
for (var i = 0 ; i < numRules; i++) {
arr[i] = cssStr(i);
arr[i] = cssStrWithClassSelectors(i);
}
for (var i = 0 ; i < numRules; i++) {
arr[numRules + i] = cssStrWithAttributeSelectors(i);
}
var styleElement = insertStyleSheet(arr.join(' '));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment