[CSS Regions] Layout Test for selecting text ignoring region content
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Oct 2013 17:07:25 +0000 (17:07 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Oct 2013 17:07:25 +0000 (17:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122353

Reviewed by Darin Adler.

Add new reftests for selecting text in texts wrapping a region, where
the region content is ignored. It compares the behavior (highlighted
text and selected content) in regions and absolute positions.

Absolute positioned elements do not fill the gaps on the right during
the selection, unlike regular elements. This is the reason why some
regular elements are floated in order to avoid such problems in the
reftests.

Provided layout tests for different writing models.

* fast/regions/resources/region-style.css: New CSS classes required for these tests.
* fast/regions/selection/selecting-text-ignoring-region-expected.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-horiz-bt-expected.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-horiz-bt.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-vert-lr-expected.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-vert-lr.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-vert-rl-expected.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-vert-rl.html: Added.
* fast/regions/selection/selecting-text-ignoring-region.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156962 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/regions/resources/region-style.css
LayoutTests/fast/regions/selection/selecting-text-ignoring-region-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/selection/selecting-text-ignoring-region-horiz-bt-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/selection/selecting-text-ignoring-region-horiz-bt.html [new file with mode: 0644]
LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-lr-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-lr.html [new file with mode: 0644]
LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-rl-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-rl.html [new file with mode: 0644]
LayoutTests/fast/regions/selection/selecting-text-ignoring-region.html [new file with mode: 0644]

index c02daa3..4a63fc2 100644 (file)
@@ -1,3 +1,31 @@
+2013-10-05  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [CSS Regions] Layout Test for selecting text ignoring region content
+        https://bugs.webkit.org/show_bug.cgi?id=122353
+
+        Reviewed by Darin Adler.
+
+        Add new reftests for selecting text in texts wrapping a region, where
+        the region content is ignored. It compares the behavior (highlighted
+        text and selected content) in regions and absolute positions.
+
+        Absolute positioned elements do not fill the gaps on the right during
+        the selection, unlike regular elements. This is the reason why some
+        regular elements are floated in order to avoid such problems in the
+        reftests.
+
+        Provided layout tests for different writing models.
+
+        * fast/regions/resources/region-style.css: New CSS classes required for these tests.
+        * fast/regions/selection/selecting-text-ignoring-region-expected.html: Added.
+        * fast/regions/selection/selecting-text-ignoring-region-horiz-bt-expected.html: Added.
+        * fast/regions/selection/selecting-text-ignoring-region-horiz-bt.html: Added.
+        * fast/regions/selection/selecting-text-ignoring-region-vert-lr-expected.html: Added.
+        * fast/regions/selection/selecting-text-ignoring-region-vert-lr.html: Added.
+        * fast/regions/selection/selecting-text-ignoring-region-vert-rl-expected.html: Added.
+        * fast/regions/selection/selecting-text-ignoring-region-vert-rl.html: Added.
+        * fast/regions/selection/selecting-text-ignoring-region.html: Added.
+
 2013-10-04  Filip Pizlo  <fpizlo@apple.com>
 
         Have run-javascriptcore-tests run JS LayoutTests using run-jsc-stress-tests so that it runs in parallel
index 580494d..72a9dc6 100644 (file)
     width: 100px;
     background-color: lightgrey;
 }
+
+.float {
+    float: left;
+}
+
+.clear {
+    clear: both;
+}
diff --git a/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-expected.html b/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-expected.html
new file mode 100644 (file)
index 0000000..eb32026
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="../resources/helper.js"></script>
+    <link rel="stylesheet" href="../resources/region-style.css"></link>
+    <style>
+        #outside-1 {
+            position: absolute;
+            top: 0px;
+        }
+
+        #outside-2 {
+            position: absolute;
+            top: 200px;
+        }
+
+        #region {
+            position: absolute;
+            top: 100px;
+        }
+
+        #description {
+            position: absolute;
+            top: 300px;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIds('word1', 'word2');" style="margin-top: 0;">
+    <div id="region" class="greyBigBox">
+        inside region inside region inside region inside region
+        inside region inside region inside region inside region
+    </div>
+    <div id="outside-1" class="bigBox">
+        outside region outside region outside region outside region
+        <span id="word1" class="token">word1</span>
+        outside region outside region outside region outside region
+    </div>
+    <div id="outside-2" class="bigBox">
+        outside region outside region outside region outside region
+        <span id="word2" class="token">word2</span>
+        outside region outside region outside region outside region
+    </div>
+    <div id="description" class="description">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=122353">Bug #122353 - [CSS Regions] Layout Test for selecting text ignoring region content</a></h1>
+        <p>This test checks the selection in 2 text wrapping a region. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "inside region" text is not highlighted and not included in the selected content (because of the content of the region is before the "outside region" element in the DOM).</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-horiz-bt-expected.html b/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-horiz-bt-expected.html
new file mode 100644 (file)
index 0000000..e2b1b63
--- /dev/null
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="../resources/helper.js"></script>
+    <link rel="stylesheet" href="../resources/region-style.css"></link>
+    <style>
+        html {
+            -webkit-writing-mode: horizontal-bt;
+        }
+
+        body {
+            margin-bottom: 0;
+        }
+
+        #outside-1 {
+            position: absolute;
+            bottom: 0px;
+        }
+
+        #outside-2 {
+            position: absolute;
+            bottom: 200px;
+        }
+
+        #region {
+            position: absolute;
+            bottom: 100px;
+        }
+
+        #description {
+            position: absolute;
+            bottom: 300px;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIds('word1', 'word2');">
+    <div id="region" class="greyBigBox">
+        inside region inside region inside region inside region
+        inside region inside region inside region inside region
+    </div>
+    <div id="outside-1" class="bigBox">
+        outside region outside region outside region outside region
+        <span id="word1" class="token">word1</span>
+        outside region outside region outside region outside region
+    </div>
+    <div id="outside-2" class="bigBox">
+        outside region outside region outside region outside region
+        <span id="word2" class="token">word2</span>
+        outside region outside region outside region outside region
+    </div>
+    <div id="description" class="description">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=122353">Bug #122353 - [CSS Regions] Layout Test for selecting text ignoring region content</a></h1>
+        <p>This test checks the selection in 2 text wrapping a region. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "inside region" text is not highlighted and not included in the selected content (because of the content of the region is before the "outside region" element in the DOM).</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-horiz-bt.html b/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-horiz-bt.html
new file mode 100644 (file)
index 0000000..dc030ec
--- /dev/null
@@ -0,0 +1,45 @@
+<html>
+<head>
+    <script src="../resources/helper.js"></script>
+    <link rel="stylesheet" href="../resources/region-style.css"></link>
+    <style>
+        html {
+            -webkit-writing-mode: horizontal-bt;
+        }
+
+        body {
+            margin-bottom: 0;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIds('word1', 'word2');">
+    <div class="flowArticle">
+        inside region inside region inside region inside region
+        inside region inside region inside region inside region
+    </div>
+    <div class="bigBox float">
+        outside region outside region outside region outside region
+        <span id="word1" class="token">word1</span>
+        outside region outside region outside region outside region
+    </div>
+    <div class="clear"></div>
+    <div class="regionArticle greyBigBox"></div>
+    <div class="bigBox float">
+        outside region outside region outside region outside region
+        <span id="word2" class="token">word2</span>
+        outside region outside region outside region outside region
+    </div>
+    <div class="clear"></div>
+    <div class="description">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=122353">Bug #122353 - [CSS Regions] Layout Test for selecting text ignoring region content</a></h1>
+        <p>This test checks the selection in 2 text wrapping a region. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "inside region" text is not highlighted and not included in the selected content (because of the content of the region is before the "outside region" element in the DOM).</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-lr-expected.html b/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-lr-expected.html
new file mode 100644 (file)
index 0000000..a72d01d
--- /dev/null
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="../resources/helper.js"></script>
+    <link rel="stylesheet" href="../resources/region-style.css"></link>
+    <style>
+        html {
+            -webkit-writing-mode: vertical-lr;
+        }
+
+        body {
+            margin-left: 0;
+        }
+
+        #outside-1 {
+            position: absolute;
+            left: 0px;
+        }
+
+        #outside-2 {
+            position: absolute;
+            left: 200px;
+        }
+
+        #region {
+            position: absolute;
+            left: 100px;
+        }
+
+        #description {
+            position: absolute;
+            left: 300px;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIdsVert('word1', 'word2');">
+    <div id="region" class="greyBigBoxVert">
+        inside region inside region inside region inside region
+        inside region inside region inside region inside region
+    </div>
+    <div id="outside-1" class="bigBoxVert">
+        outside region outside region outside region outside region
+        <span id="word1" class="token">word1</span>
+        outside region outside region outside region outside region
+    </div>
+    <div id="outside-2" class="bigBoxVert">
+        outside region outside region outside region outside region
+        <span id="word2" class="token">word2</span>
+        outside region outside region outside region outside region
+    </div>
+    <div id="description" class="descriptionVert">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=122353">Bug #122353 - [CSS Regions] Layout Test for selecting text ignoring region content</a></h1>
+        <p>This test checks the selection in 2 text wrapping a region. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "inside region" text is not highlighted and not included in the selected content (because of the content of the region is before the "outside region" element in the DOM).</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-lr.html b/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-lr.html
new file mode 100644 (file)
index 0000000..41febb3
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="../resources/helper.js"></script>
+    <link rel="stylesheet" href="../resources/region-style.css"></link>
+    <style>
+        html {
+            -webkit-writing-mode: vertical-lr;
+        }
+
+        body {
+            margin-left: 0;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIdsVert('word1', 'word2');">
+    <div class="flowArticle">
+        inside region inside region inside region inside region
+        inside region inside region inside region inside region
+    </div>
+    <div class="bigBoxVert float">
+        outside region outside region outside region outside region
+        <span id="word1" class="token">word1</span>
+        outside region outside region outside region outside region
+    </div>
+    <div class="clear"></div>
+    <div class="regionArticle greyBigBoxVert"></div>
+    <div class="bigBoxVert float">
+        outside region outside region outside region outside region
+        <span id="word2" class="token">word2</span>
+        outside region outside region outside region outside region
+    </div>
+    <div class="clear"></div>
+    <div class="descriptionVert">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=122353">Bug #122353 - [CSS Regions] Layout Test for selecting text ignoring region content</a></h1>
+        <p>This test checks the selection in 2 text wrapping a region. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "inside region" text is not highlighted and not included in the selected content (because of the content of the region is before the "outside region" element in the DOM).</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-rl-expected.html b/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-rl-expected.html
new file mode 100644 (file)
index 0000000..e09d0eb
--- /dev/null
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="../resources/helper.js"></script>
+    <link rel="stylesheet" href="../resources/region-style.css"></link>
+    <style>
+        html {
+            -webkit-writing-mode: vertical-rl;
+        }
+
+        body {
+            margin-right: 0;
+        }
+
+        #outside-1 {
+            position: absolute;
+            right: 0px;
+        }
+
+        #outside-2 {
+            position: absolute;
+            right: 200px;
+        }
+
+        #region {
+            position: absolute;
+            right: 100px;
+        }
+
+        #description {
+            position: absolute;
+            right: 300px;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIdsVert('word1', 'word2');">
+    <div id="region" class="greyBigBoxVert">
+        inside region inside region inside region inside region
+        inside region inside region inside region inside region
+    </div>
+    <div id="outside-1" class="bigBoxVert">
+        outside region outside region outside region outside region
+        <span id="word1" class="token">word1</span>
+        outside region outside region outside region outside region
+    </div>
+    <div id="outside-2" class="bigBoxVert">
+        outside region outside region outside region outside region
+        <span id="word2" class="token">word2</span>
+        outside region outside region outside region outside region
+    </div>
+    <div id="description" class="descriptionVert">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=122353">Bug #122353 - [CSS Regions] Layout Test for selecting text ignoring region content</a></h1>
+        <p>This test checks the selection in 2 text wrapping a region. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "inside region" text is not highlighted and not included in the selected content (because of the content of the region is before the "outside region" element in the DOM).</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-rl.html b/LayoutTests/fast/regions/selection/selecting-text-ignoring-region-vert-rl.html
new file mode 100644 (file)
index 0000000..9563b55
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="../resources/helper.js"></script>
+    <link rel="stylesheet" href="../resources/region-style.css"></link>
+    <style>
+        html {
+            -webkit-writing-mode: vertical-rl;
+        }
+
+        body {
+            margin-right: 0;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIdsVert('word1', 'word2');">
+    <div class="flowArticle">
+        inside region inside region inside region inside region
+        inside region inside region inside region inside region
+    </div>
+    <div class="bigBoxVert float">
+        outside region outside region outside region outside region
+        <span id="word1" class="token">word1</span>
+        outside region outside region outside region outside region
+    </div>
+    <div class="clear"></div>
+    <div class="regionArticle greyBigBoxVert"></div>
+    <div class="bigBoxVert float">
+        outside region outside region outside region outside region
+        <span id="word2" class="token">word2</span>
+        outside region outside region outside region outside region
+    </div>
+    <div class="clear"></div>
+    <div class="descriptionVert">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=122353">Bug #122353 - [CSS Regions] Layout Test for selecting text ignoring region content</a></h1>
+        <p>This test checks the selection in 2 text wrapping a region. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "inside region" text is not highlighted and not included in the selected content (because of the content of the region is before the "outside region" element in the DOM).</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-ignoring-region.html b/LayoutTests/fast/regions/selection/selecting-text-ignoring-region.html
new file mode 100644 (file)
index 0000000..485c9d9
--- /dev/null
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="../resources/helper.js"></script>
+    <link rel="stylesheet" href="../resources/region-style.css"></link>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIds('word1', 'word2');" style="margin-top: 0;">
+    <div class="flowArticle">
+        inside region inside region inside region inside region
+        inside region inside region inside region inside region
+    </div>
+    <div class="bigBox float">
+        outside region outside region outside region outside region
+        <span id="word1" class="token">word1</span>
+        outside region outside region outside region outside region
+    </div>
+    <div class="clear"></div>
+    <div class="regionArticle greyBigBox"></div>
+    <div class="bigBox float">
+        outside region outside region outside region outside region
+        <span id="word2" class="token">word2</span>
+        outside region outside region outside region outside region
+    </div>
+    <div class="clear"></div>
+    <div class="description">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=122353">Bug #122353 - [CSS Regions] Layout Test for selecting text ignoring region content</a></h1>
+        <p>This test checks the selection in 2 text wrapping a region. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "inside region" text is not highlighted and not included in the selected content (because of the content of the region is before the "outside region" element in the DOM).</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>