[CSS Regions] Layout Tests for selecting text in 2 regions for other writing modes
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2013 21:59:32 +0000 (21:59 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2013 21:59:32 +0000 (21:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122327

Reviewed by Alexandru Chiculita.

Add versions for other writing modes (horizontal-bt, vertical-lr and
vertical-rl) for test
fast/regions/selection/selecting-text-in-2-regions.html.

* fast/regions/resources/helper.js:
(selectContentByIdsVert): Add new method when selecting context in a
vertical writing mode.
* fast/regions/resources/region-style.css: Add some new CSS classes for
vertical writing mode.
* fast/regions/selection/selecting-text-in-2-regions-horiz-bt-expected.html:
Added.
* fast/regions/selection/selecting-text-in-2-regions-horiz-bt.html:
Added.
* fast/regions/selection/selecting-text-in-2-regions-vert-lr-expected.html:
Added.
* fast/regions/selection/selecting-text-in-2-regions-vert-lr.html:
Added.
* fast/regions/selection/selecting-text-in-2-regions-vert-rl-expected.html:
Added.
* fast/regions/selection/selecting-text-in-2-regions-vert-rl.html:
Added.

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

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

index 055a482..61828f3 100644 (file)
@@ -1,3 +1,32 @@
+2013-10-04  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [CSS Regions] Layout Tests for selecting text in 2 regions for other writing modes
+        https://bugs.webkit.org/show_bug.cgi?id=122327
+
+        Reviewed by Alexandru Chiculita.
+
+        Add versions for other writing modes (horizontal-bt, vertical-lr and
+        vertical-rl) for test
+        fast/regions/selection/selecting-text-in-2-regions.html.
+
+        * fast/regions/resources/helper.js:
+        (selectContentByIdsVert): Add new method when selecting context in a
+        vertical writing mode.
+        * fast/regions/resources/region-style.css: Add some new CSS classes for
+        vertical writing mode.
+        * fast/regions/selection/selecting-text-in-2-regions-horiz-bt-expected.html:
+        Added.
+        * fast/regions/selection/selecting-text-in-2-regions-horiz-bt.html:
+        Added.
+        * fast/regions/selection/selecting-text-in-2-regions-vert-lr-expected.html:
+        Added.
+        * fast/regions/selection/selecting-text-in-2-regions-vert-lr.html:
+        Added.
+        * fast/regions/selection/selecting-text-in-2-regions-vert-rl-expected.html:
+        Added.
+        * fast/regions/selection/selecting-text-in-2-regions-vert-rl.html:
+        Added.
+
 2013-10-04  Oliver Hunt  <oliver@apple.com>
 
         Support for-of syntax
index d19133b..ab9a319 100644 (file)
@@ -224,6 +224,16 @@ function selectContentByIds(fromId, toId) {
     selectContentByRange(fromRect.left, fromRectVerticalCenter, toRect.right, toRectVerticalCenter);
 }
 
+function selectContentByIdsVert(fromId, toId) {
+    var fromRect = document.getElementById(fromId).getBoundingClientRect();
+    var toRect = document.getElementById(toId).getBoundingClientRect();
+
+    var fromRectHorizontalCenter = fromRect.left + fromRect.width / 2;
+    var toRectHorizontalCenter = toRect.left + toRect.width / 2;
+
+    selectContentByRange(fromRectHorizontalCenter, fromRect.top, toRectHorizontalCenter, toRect.bottom);
+}
+
 function selectBaseAndExtent(fromId, fromOffset, toId, toOffset) {
     var from = document.getElementById(fromId);
     var to = document.getElementById(toId);
index 487af02..580494d 100644 (file)
     width: 300px;
     background-color: lightgrey;
 }
+
+.descriptionVert {
+    height: 600px;
+}
+
+.bigBoxVert {
+    height: 300px;
+    width: 100px;
+}
+
+.greyBigBoxVert {
+    height: 300px;
+    width: 100px;
+    background-color: lightgrey;
+}
diff --git a/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-horiz-bt-expected.html b/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-horiz-bt-expected.html
new file mode 100644 (file)
index 0000000..62eb437
--- /dev/null
@@ -0,0 +1,59 @@
+<!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;
+        }
+
+        #region-1 {
+            position: absolute;
+            bottom: 0px;
+        }
+
+        #region-2 {
+            position: absolute;
+            bottom: 200px;
+        }
+
+        #outside {
+            position: absolute;
+            bottom: 100px;
+        }
+
+        #description {
+            position: absolute;
+            bottom: 300px;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIds('word1', 'word2');" style="margin-bottom: 0;">
+    <div id="region-1" class="greyBigBox">
+        inside region inside region inside region inside region
+        <span id="word1" class="token">word1</span>
+        inside region inside region inside region inside region
+    </div>
+    <div id="region-2" class="greyBigBox">
+        inside region inside region inside region inside region
+        <span id="word2" class="token">word2</span>
+        inside region inside region inside region inside region
+    </div>
+    <div id="outside" class="bigBox">
+        outside region outside region outside region outside region
+        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=121841">Bug #121841 - [CSS Regions] Layout Test for selecting text in 2 regions</a></h1>
+        <p>This test checks the selection in 2 regions. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "outside region" text is not highlighted and not included in the selected content.</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-horiz-bt.html b/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-horiz-bt.html
new file mode 100644 (file)
index 0000000..bde0081
--- /dev/null
@@ -0,0 +1,40 @@
+<!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;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIds('word1', 'word2');" style="margin-bottom: 0;">
+    <div class="flowArticle">
+        inside region inside region inside region inside region
+        <span id="word1" class="token">word1</span>
+        inside region inside region inside region inside region
+        <span class="break"></span>
+        inside region inside region inside region inside region
+        <span id="word2" class="token">word2</span>
+        inside region inside region inside region inside region
+    </div>
+    <div class="regionArticle greyBigBox"></div>
+    <div class="bigBox">
+        outside region outside region outside region outside region
+        outside region outside region outside region outside region
+    </div>
+    <div class="regionArticle greyBigBox"></div>
+    <div class="description">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=121841">Bug #121841 - [CSS Regions] Layout Test for selecting text in 2 regions</a></h1>
+        <p>This test checks the selection in 2 regions. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "outside region" text is not highlighted and not included in the selected content.</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-vert-lr-expected.html b/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-vert-lr-expected.html
new file mode 100644 (file)
index 0000000..06236a5
--- /dev/null
@@ -0,0 +1,59 @@
+<!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;
+        }
+
+        #region-1 {
+            position: absolute;
+            left: 0px;
+        }
+
+        #region-2 {
+            position: absolute;
+            left: 200px;
+        }
+
+        #outside {
+            position: absolute;
+            left: 100px;
+        }
+
+        #description {
+            position: absolute;
+            left: 300px;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIdsVert('word1', 'word2');" style="margin-left: 0;">
+    <div id="region-1" class="greyBigBoxVert">
+        inside region inside region inside region inside region
+        <span id="word1" class="token">word1</span>
+        inside region inside region inside region inside region
+    </div>
+    <div id="region-2" class="greyBigBoxVert">
+        inside region inside region inside region inside region
+        <span id="word2" class="token">word2</span>
+        inside region inside region inside region inside region
+    </div>
+    <div id="outside" class="bigBoxVert">
+        outside region outside region outside region outside region
+        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=121841">Bug #121841 - [CSS Regions] Layout Test for selecting text in 2 regions</a></h1>
+        <p>This test checks the selection in 2 regions. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "outside region" text is not highlighted and not included in the selected content.</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-vert-lr.html b/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-vert-lr.html
new file mode 100644 (file)
index 0000000..c3b7da4
--- /dev/null
@@ -0,0 +1,40 @@
+<!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;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIdsVert('word1', 'word2');" style="margin-left: 0;">
+    <div class="flowArticle">
+        inside region inside region inside region inside region
+        <span id="word1" class="token">word1</span>
+        inside region inside region inside region inside region
+        <span class="break"></span>
+        inside region inside region inside region inside region
+        <span id="word2" class="token">word2</span>
+        inside region inside region inside region inside region
+    </div>
+    <div class="regionArticle greyBigBoxVert"></div>
+    <div class="bigBoxVert">
+        outside region outside region outside region outside region
+        outside region outside region outside region outside region
+    </div>
+    <div class="regionArticle greyBigBoxVert"></div>
+    <div class="descriptionVert">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=121841">Bug #121841 - [CSS Regions] Layout Test for selecting text in 2 regions</a></h1>
+        <p>This test checks the selection in 2 regions. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "outside region" text is not highlighted and not included in the selected content.</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-vert-rl-expected.html b/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-vert-rl-expected.html
new file mode 100644 (file)
index 0000000..9fab1b3
--- /dev/null
@@ -0,0 +1,59 @@
+<!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;
+        }
+
+        #region-1 {
+            position: absolute;
+            right: 0px;
+        }
+
+        #region-2 {
+            position: absolute;
+            right: 200px;
+        }
+
+        #outside {
+            position: absolute;
+            right: 100px;
+        }
+
+        #description {
+            position: absolute;
+            right: 300px;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIdsVert('word1', 'word2');" style="margin-right: 0;">
+    <div id="region-1" class="greyBigBoxVert">
+        inside region inside region inside region inside region
+        <span id="word1" class="token">word1</span>
+        inside region inside region inside region inside region
+    </div>
+    <div id="region-2" class="greyBigBoxVert">
+        inside region inside region inside region inside region
+        <span id="word2" class="token">word2</span>
+        inside region inside region inside region inside region
+    </div>
+    <div id="outside" class="bigBoxVert">
+        outside region outside region outside region outside region
+        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=121841">Bug #121841 - [CSS Regions] Layout Test for selecting text in 2 regions</a></h1>
+        <p>This test checks the selection in 2 regions. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "outside region" text is not highlighted and not included in the selected content.</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-vert-rl.html b/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-vert-rl.html
new file mode 100644 (file)
index 0000000..ce65e9d
--- /dev/null
@@ -0,0 +1,40 @@
+<!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;
+        }
+    </style>
+    <script>
+        onMouseUpLogSelection("selected-content");
+    </script>
+</head>
+<body onload="selectContentByIdsVert('word1', 'word2');" style="margin-right: 0;">
+    <div class="flowArticle">
+        inside region inside region inside region inside region
+        <span id="word1" class="token">word1</span>
+        inside region inside region inside region inside region
+        <span class="break"></span>
+        inside region inside region inside region inside region
+        <span id="word2" class="token">word2</span>
+        inside region inside region inside region inside region
+    </div>
+    <div class="regionArticle greyBigBoxVert"></div>
+    <div class="bigBoxVert">
+        outside region outside region outside region outside region
+        outside region outside region outside region outside region
+    </div>
+    <div class="regionArticle greyBigBoxVert"></div>
+    <div class="descriptionVert">
+        <h1><a href="https://bugs.webkit.org/show_bug.cgi?id=121841">Bug #121841 - [CSS Regions] Layout Test for selecting text in 2 regions</a></h1>
+        <p>This test checks the selection in 2 regions. If you select from <span class="token">word1</span> to <span class="token">word2</span> you will see that "outside region" text is not highlighted and not included in the selected content.</p>
+        <dl>
+            <dt>Selected content:</dt>
+            <dd id="selected-content"></dd>
+        </dl>
+    </div>
+</body>
+</html>