Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Unified Diff: LayoutTests/fast/dom/Window/webkitConvertPoint.html

Issue 524523003: Revert of Remove webkitConvertPointFromPageToNode() and webkitConvertPointFromNodeToPage() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/webkitConvertPoint-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Window/webkitConvertPoint.html
diff --git a/LayoutTests/fast/dom/Window/webkitConvertPoint.html b/LayoutTests/fast/dom/Window/webkitConvertPoint.html
new file mode 100644
index 0000000000000000000000000000000000000000..0a26675bc770da05959c9220c9287b9704f622ea
--- /dev/null
+++ b/LayoutTests/fast/dom/Window/webkitConvertPoint.html
@@ -0,0 +1,187 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <title>Test of webkitConvertPointFromNodeToPage function</title>
+ <script src="../../../resources/js-test.js"></script>
+ <style type="text/css" media="screen">
+ body {
+ height: 1000px;
+ }
+
+ h1 {
+ font-size: 14pt;
+ }
+ .layer {
+ position: relative;
+ width: 600px;
+ height: 500px;
+ -webkit-transform: translate(0px);
+ }
+ .dot {
+ position: absolute;
+ background-color: #0f0;
+ width: 10px;
+ height: 10px;
+ left: 0px;
+ top: 0px;
+ visibility: hidden;
+ }
+ b.border {
+ border: 5px solid blue;
+ }
+
+ .a {
+ position: relative;
+ left: 10px;
+ background: #cbc;
+ width: 800px;
+ -webkit-transform-origin: top left;
+ -webkit-transform: translate(130px, 20px) rotate(-35deg) scale(0.6);
+ padding: 5px;
+ margin-bottom: 20px;
+ }
+ .b {
+ position: relative;
+ background: #bcc;
+ -webkit-transform: translate(20px);
+ }
+ .c {
+ position: relative;
+ -webkit-transform: translate(20px);
+ background: #99c;
+ }
+ .d {
+ position: relative;
+ background: #cc9;
+ }
+
+ </style>
+ <script>
+ function runTest(name, id, x1, y1, x2, y2)
+ {
+ debug("");
+ debug(name);
+ var node = document.getElementById(id);
+ p = webkitConvertPointFromNodeToPage(node, new WebKitPoint(0, 0));
+ x = Math.round(p.x);
+ y = Math.round(p.y);
+ shouldBe('x', x1+"");
+ shouldBe('y', y1+"");
+
+ debug("Round Trip of (0,0)");
+ p2 = webkitConvertPointFromPageToNode(node, p);
+ x = Math.round(p2.x);
+ y = Math.round(p2.y);
+ if (x == -0)
+ x = 0;
+ if (y == -0)
+ y = 0;
+ shouldBe('x', '0');
+ shouldBe('y', '0');
+
+ p = webkitConvertPointFromNodeToPage(node, new WebKitPoint(5, 40));
+ x = Math.round(p.x);
+ y = Math.round(p.y);
+ if (x == -0)
+ x = 0;
+ if (y == -0)
+ y = 0;
+ shouldBe('x', x2+"");
+ shouldBe('y', y2+"");
+
+ debug("Round Trip of (5,40)");
+ p2 = webkitConvertPointFromPageToNode(node, p);
+ x = Math.round(p2.x);
+ y = Math.round(p2.y);
+ if (x == -0)
+ x = 0;
+ if (y == -0)
+ y = 0;
+ shouldBe('x', '5');
+ shouldBe('y', '40');
+ }
+
+ function run() {
+ description("This test exercises the webkitConvertPointFromNodeToPage() function");
+
+ debug("Test parameter passing - should not crash");
+ var point = webkitConvertPointFromNodeToPage(new WebKitPoint(0, 0));
+ if (point == null)
+ testPassed("Missing parameter test");
+ else
+ testFailed("Missing parameter test");
+ debug("Test did not crash and therefore was successful");
+ debug("");
+ point = webkitConvertPointFromNodeToPage(null, new WebKitPoint(0, 0));
+ if (point == null)
+ testPassed("null parameter test a");
+ else
+ testFailed("null parameter test a");
+ debug("Test did not crash and therefore was successful");
+ debug("");
+ point = webkitConvertPointFromNodeToPage(null, null);
+ if (point == null)
+ testPassed("null parameter test b");
+ else
+ testFailed("null parameter test b");
+ debug("Test did not crash and therefore was successful");
+
+ runTest("Test 1", "test1", 8, 13, 13, 53);
+ runTest("Test 2", "test2", 8, 51, 13, 91);
+ runTest("Test 3", "test3", 8, 85, 13, 125);
+ runTest("Test 4", "test4", 8, 119, 13, 159);
+ runTest("Test 5", "test5", 28, 153, 33, 193);
+ runTest("Test 6", "test6", 28, 187, 33, 227);
+ runTest("Test 7", "test7", 8, 239, 13, 279);
+ runTest("Test 8", "test8", 8, 273, 13, 313);
+ runTest("Test 9", "test9", 28, 291, 33, 331);
+ runTest("Test 10", "test10", 28, 309, 33, 349);
+ runTest("Test 11", "test11", 158, 376, 174, 394);
+ runTest("Test 12", "test12", 168, 451, 184, 469);
+ runTest("Test 13", "test13", 28, 487, 33, 527);
+
+ isSuccessfullyParsed();
+ }
+
+ window.onload = run;
+
+ </script>
+ </head>
+ <body>
+ <h1 id="test1">Test 1 - This is a H1 heading.</h1>
+ <p id="test2">Test 2 - This is a simple paragraph.</p>
+ <p id="test3">Test 3 - This is a paragraph with a <b>nested</b> element.</p>
+ <p id="test4">Test 4 - This is a paragraph with a <b class="border">nested</b> element that has a border.</p>
+ <p id="test5" class="c">Test 5 - This is a transformed paragraph with a <b class="border">nested</b> element that has a border.</p>
+ <p id="test6" class="c">Test 6 - This is a transformed paragraph with a <b class="border">nested</b> element that has a border.<br>And then a second line.</p>
+ <div class="d">
+ <p id="test7">Test 7 - This is a paragraph inside something that does not have a compositing layer.</p>
+ </div>
+ <div id="test8" class="d">
+ Test 8 - This is raw text inside something that does not have a compositing layer.
+ </div>
+
+ <div id="test9" class="b">
+ Test 9 - This is raw text inside something that has a compositing layer.
+ <div id="test10" class="d">
+ Test 10 - This is raw text inside something that does not have a compositing layer.
+ </div>
+ </div>
+
+ <div class="a">
+ <p id="test11">Test 11 - This is a rotated and scaled paragraph</p>
+ </div>
+ <div class="a">
+ <div class="b">
+ <p id="test12">Test 12 - This is a rotated and scaled paragraph with a <b class="border">nested</b> element that has a border.</p>
+ </div>
+ </div>
+ <div class="b">
+ <p id="test13">Test 13 - This is a paragraph with a <b class="border">nested</b> element that has a border.</p>
+ </div>
+ <div id="description"></div>
+ <div id="console"></div>
+ </body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/webkitConvertPoint-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698