[CSS Regions] Layout Test for selecting text in 2 regions
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Oct 2013 21:07:07 +0000 (21:07 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Oct 2013 21:07:07 +0000 (21:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121841

Reviewed by Alexandru Chiculita.

Add new reftest for selecting text in 2 regions. It compares the
behavior (highlighted text and selected content) in regions and absolute
positions.

* fast/regions/resources/helper.js: Add new function to set selected
content in an element onmouseup.
(onMouseUpLogSelection.document.onmouseup):
(onMouseUpLogSelection):
* fast/regions/resources/region-style.css: Define some styles that could
be reused in other tests.
* fast/regions/selection/selecting-text-in-2-regions-expected.html:
Added.
* fast/regions/selection/selecting-text-in-2-regions.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156857 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-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/selection/selecting-text-in-2-regions.html [new file with mode: 0644]

index f5713ad..2699a37 100644 (file)
@@ -1,3 +1,24 @@
+2013-10-03  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [CSS Regions] Layout Test for selecting text in 2 regions
+        https://bugs.webkit.org/show_bug.cgi?id=121841
+
+        Reviewed by Alexandru Chiculita.
+
+        Add new reftest for selecting text in 2 regions. It compares the
+        behavior (highlighted text and selected content) in regions and absolute
+        positions.
+
+        * fast/regions/resources/helper.js: Add new function to set selected
+        content in an element onmouseup.
+        (onMouseUpLogSelection.document.onmouseup):
+        (onMouseUpLogSelection):
+        * fast/regions/resources/region-style.css: Define some styles that could
+        be reused in other tests.
+        * fast/regions/selection/selecting-text-in-2-regions-expected.html:
+        Added.
+        * fast/regions/selection/selecting-text-in-2-regions.html: Added.
+
 2013-10-03  Alexey Proskuryakov  <ap@apple.com>
 
         Flaky Test: fast/history/history-back-while-pdf-in-pagecache.html
index 6cf7d3f..d19133b 100644 (file)
@@ -240,3 +240,10 @@ function mouseClick(positionX, positionY) {
     eventSender.mouseDown();
     eventSender.mouseUp();
 }
+
+function onMouseUpLogSelection(elementId) {
+    document.onmouseup = function() {
+        var selectedContent = document.getElementById(elementId);
+        selectedContent.innerHTML = window.getSelection().getRangeAt(0);
+    }
+}
index 6f075b5..487af02 100644 (file)
     font-weight: bold;
     color: red;
 }
+
+.break {
+    -webkit-region-break-before: always;
+    display: block;
+}
+
+.token {
+    color: blue;
+    font-weight: bold;
+}
+
+.description {
+    width: 600px;
+}
+
+.bigBox {
+    height: 100px;
+    width: 300px;
+}
+
+.greyBigBox {
+    height: 100px;
+    width: 300px;
+    background-color: lightgrey;
+}
diff --git a/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-expected.html b/LayoutTests/fast/regions/selection/selecting-text-in-2-regions-expected.html
new file mode 100644 (file)
index 0000000..8788f76
--- /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>
+        #region-1 {
+            position: absolute;
+            top: 0px;
+        }
+
+        #region-2 {
+            position: absolute;
+            top: 200px;
+        }
+
+        #outside {
+            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-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.html b/LayoutTests/fast/regions/selection/selecting-text-in-2-regions.html
new file mode 100644 (file)
index 0000000..3af23a6
--- /dev/null
@@ -0,0 +1,35 @@
+<!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
+        <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>