https://bugs.webkit.org/show_bug.cgi?id=126427
Reviewed by Ryosuke Niwa.
Add new performance tests for selection in CSS Regions mixing regular
content with regions. 2 new tests are added, one checking select all
command and another simulating a user selection passing through all the
paragraphs (similar to Layout/RegionsSelection.html).
Test are skipped for now while implementation of selection in CSS
Regions is still evolving.
* Layout/RegionsExtendingSelectionMixedContent.html: Added.
* Layout/RegionsSelectAllMixedContent.html: Added.
* Layout/resources/regions.css:
(.regular):
* Layout/resources/regions.js:
* Skipped:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162065
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-01-15 Manuel Rego Casasnovas <rego@igalia.com>
+
+ [CSS Regions] Add performance tests for selection with mixed content
+ https://bugs.webkit.org/show_bug.cgi?id=126427
+
+ Reviewed by Ryosuke Niwa.
+
+ Add new performance tests for selection in CSS Regions mixing regular
+ content with regions. 2 new tests are added, one checking select all
+ command and another simulating a user selection passing through all the
+ paragraphs (similar to Layout/RegionsSelection.html).
+
+ Test are skipped for now while implementation of selection in CSS
+ Regions is still evolving.
+
+ * Layout/RegionsExtendingSelectionMixedContent.html: Added.
+ * Layout/RegionsSelectAllMixedContent.html: Added.
+ * Layout/resources/regions.css:
+ (.regular):
+ * Layout/resources/regions.js:
+ * Skipped:
+
2014-01-14 Ryosuke Niwa <rniwa@webkit.org>
Make DoYouEvenBench runnable by run-perf-tests
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" href="resources/regions.css" type="text/css"></link>
+ <script src="../resources/runner.js"></script>
+ <script src="resources/regions.js"></script>
+ <style type="text/css">
+ #log {
+ position: fixed;
+ }
+ </style>
+ </head>
+ <body>
+ <pre id="log"></pre>
+ <script>
+ function performSelectionMixedContent() {
+ var paragraphs = document.getElementsByClassName("contentParagraph");
+ var selection = getSelection();
+
+ selection.collapse(paragraphs[paragraphs.length / 2], 0);
+
+ // Traverse the paragraphs following visual order and not DOM order.
+ for (var i = 1; i < paragraphs.length; i++) {
+ var paragraph;
+ if (i % 2)
+ paragraph = paragraphs[(i - 1) / 2];
+ else
+ paragraph = paragraphs[(paragraphs.length + i) / 2];
+ selection.extend(paragraph, 0);
+ }
+ }
+
+ function createRegionsExtendingSelectionMixedContentTest(regionCount) {
+ var article = createArticle(regionCount, 1);
+ article.className = "articleInFlow";
+ var container = createMixedContent(regionCount);
+ document.body.appendChild(article);
+ document.body.appendChild(container);
+ return {
+ description: "Testing selection with mixed content (" + regionCount + " regular paragraphs and " + regionCount + " regions). Select text from first paragraph to last one passing through all the paragraphs.",
+ run: function() {
+ performSelectionMixedContent();
+ },
+ setup: function() {
+ window.getSelection().removeAllRanges();
+ },
+ done: function() {
+ document.body.removeChild(article);
+ document.body.removeChild(container);
+ templateParagraph = null;
+ templateRegion = null;
+ }
+ };
+ }
+
+ PerfTestRunner.measureTime(createRegionsExtendingSelectionMixedContentTest(100));
+ </script>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" href="resources/regions.css" type="text/css"></link>
+ <script src="../resources/runner.js"></script>
+ <script src="resources/regions.js"></script>
+ <style type="text/css">
+ #log {
+ position: fixed;
+ }
+ </style>
+ </head>
+ <body>
+ <pre id="log"></pre>
+ <script>
+ function createRegionsSelectAllMixedContentTest(regionCount) {
+ var article = createArticle(regionCount, 1);
+ article.className = "articleInFlow";
+ var container = createMixedContent(regionCount);
+ document.body.appendChild(article);
+ document.body.appendChild(container);
+ return {
+ description: "Testing selection with mixed content (" + regionCount + " regular paragraphs and " + regionCount + " regions). Select text using select all command.",
+ run: function() {
+ document.execCommand('SelectAll');
+ },
+ setup: function() {
+ window.getSelection().removeAllRanges();
+ },
+ done: function() {
+ document.body.removeChild(article);
+ document.body.removeChild(container);
+ templateParagraph = null;
+ templateRegion = null;
+ }
+ };
+ }
+
+ PerfTestRunner.measureTime(createRegionsSelectAllMixedContentTest(1000));
+ </script>
+ </body>
+</html>
-webkit-region-fragment: break;
}
+.regular {
+ border: 1px solid red;
+}
+
.contentParagraph {
font-size: 16px;
}
(function() {
var templateParagraph = null;
var templateRegion = null;
+ var templateNode = null;
var DEFAULT_PARAGRAPH_COUNT = 100;
var DEFAULT_REGION_COUNT = 100;
return region;
}
+ function createRegularNode(nodeWidth, nodeHeight, nodeMaxHeight) {
+ if (!templateNode) {
+ templateNode = document.createElement("div");
+ templateNode.appendChild(createParagraphNode(0));
+ templateNode.className = "regular";
+ }
+
+ var node = templateNode.cloneNode(true);
+ node.style.width = nodeWidth;
+ node.style.height = nodeHeight;
+ node.style.maxHeight = nodeMaxHeight;
+ return node;
+ }
+
function createArticle(paragraphCount, breakChance) {
var article = document.createElement("div");
for (var i = 0 ; i < paragraphCount; ++i) {
};
}
+ function createMixedContent(regionCount) {
+ var container = document.createElement("div");
+ for (var i = 0; i < regionCount; ++i) {
+ container.appendChild(createRegularNode("600px", "auto", "auto"));
+ container.appendChild(createRegionNode("600px", "auto", "auto"));
+ }
+ return container;
+ }
+
window.createRegionsTest = createRegionsTest;
window.createRegionsSelectionTest = createRegionsSelectionTest;
+ window.createArticle = createArticle;
+ window.createMixedContent = createMixedContent;
})();
Layout/RegionsFixed.html
Layout/RegionsFixedShort.html
Layout/RegionsSelection.html
+Layout/RegionsSelectionMixedContent.html
+Layout/RegionsSelectAllMixedContent.html
# https://bugs.webkit.org/show_bug.cgi?id=113811#c2
Layout/LineLayoutJapanese.html