Commit ed6edbcb authored by philipj@opera.com's avatar philipj@opera.com

Remove webkitConvertPointFromPageToNode() and webkitConvertPointFromNodeToPage()

Intent to Deprecate and Remove:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/KS5GAM7JXtg/7KyhsqQFZMkJ

BUG=398352

Review URL: https://codereview.chromium.org/428533003

git-svn-id: svn://svn.chromium.org/blink/trunk@179135 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3d332f7f
Test 1 - This is a H1 heading.
Test 2 - This is a simple paragraph.
Test 3 - This is a paragraph with a nested element.
Test 4 - This is a paragraph with a nested element that has a border.
Test 5 - This is a transformed paragraph with a nested element that has a border.
Test 6 - This is a transformed paragraph with a nested element that has a border.
And then a second line.
Test 7 - This is a paragraph inside something that does not have a compositing layer.
Test 8 - This is raw text inside something that does not have a compositing layer.
Test 9 - This is raw text inside something that has a compositing layer.
Test 10 - This is raw text inside something that does not have a compositing layer.
Test 11 - This is a rotated and scaled paragraph
Test 12 - This is a rotated and scaled paragraph with a nested element that has a border.
Test 13 - This is a paragraph with a nested element that has a border.
This test exercises the webkitConvertPointFromNodeToPage() function
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
Test parameter passing - should not crash
PASS Missing parameter test
Test did not crash and therefore was successful
PASS null parameter test a
Test did not crash and therefore was successful
PASS null parameter test b
Test did not crash and therefore was successful
Test 1
PASS x is 8
PASS y is 13
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
PASS y is 53
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 2
PASS x is 8
PASS y is 51
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
PASS y is 91
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 3
PASS x is 8
PASS y is 85
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
PASS y is 125
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 4
PASS x is 8
PASS y is 119
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
PASS y is 159
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 5
PASS x is 28
PASS y is 153
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
PASS y is 193
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 6
PASS x is 28
PASS y is 187
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
PASS y is 227
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 7
PASS x is 8
PASS y is 239
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
PASS y is 279
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 8
PASS x is 8
PASS y is 273
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
PASS y is 313
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 9
PASS x is 28
PASS y is 291
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
PASS y is 331
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 10
PASS x is 28
PASS y is 309
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
PASS y is 349
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 11
PASS x is 158
FAIL y should be 376. Was 355.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 174
FAIL y should be 394. Was 373.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 12
PASS x is 168
FAIL y should be 451. Was 428.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 184
FAIL y should be 469. Was 446.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 13
PASS x is 28
PASS y is 487
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
PASS y is 527
Round Trip of (5,40)
PASS x is 5
PASS y is 40
PASS successfullyParsed is true
TEST COMPLETE
<!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>
This test exercises the webkitConvertPointFromNodeToPage() function after changing the transform.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
PASS x is 60
PASS y is 70
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<title>webkitConvertPointFromNodeToPage Test</title>
<script src="../../../resources/js-test.js"></script>
<style type="text/css" media="screen">
#test {
position: absolute;
left: 10px;
top: 10px;
width: 50px;
height: 50px;
background-color: blue;
}
</style>
<script type="text/javascript" charset="utf-8">
function doTest()
{
description("This test exercises the webkitConvertPointFromNodeToPage() function after changing the transform.");
var node = document.getElementById('test');
node.style.webkitTransform = 'translate(50px, 60px)';
var p = webkitConvertPointFromNodeToPage(node, new WebKitPoint(0, 0));
x = Math.round(p.x);
y = Math.round(p.y);
shouldBe('x', 60 + "");
shouldBe('y', 70 + "");
isSuccessfullyParsed();
}
window.onload = doTest;
</script>
</head>
<body>
<div id="test"></div>
<div id="description" style="margin-top: 200px"></div>
<div id="console"></div>
</body>
</html>
...@@ -36,10 +36,10 @@ function runTest() { ...@@ -36,10 +36,10 @@ function runTest() {
var id2 = "b"; var id2 = "b";
var element1 = document.getElementById(id1); var element1 = document.getElementById(id1);
var element2 = document.getElementById(id2); var element2 = document.getElementById(id2);
var x1 = webkitConvertPointFromNodeToPage(element1, new WebKitPoint(0,0)).x; var x1 = element1.getBoundingClientRect().left;
var y1 = webkitConvertPointFromNodeToPage(element1, new WebKitPoint(0,0)).y; var y1 = element1.getBoundingClientRect().top;
var x2 = webkitConvertPointFromNodeToPage(element2, new WebKitPoint(0,0)).x; var x2 = element2.getBoundingClientRect().left;
var y2 = webkitConvertPointFromNodeToPage(element2, new WebKitPoint(0,0)).y; var y2 = element2.getBoundingClientRect().top;
var resultString = ''; var resultString = '';
if (x1 == x2 && y1 == y2) { if (x1 == x2 && y1 == y2) {
......
Test 1 - This is a H1 heading.
Test 2 - This is a simple paragraph.
Test 3 - This is a paragraph with a nested element.
Test 4 - This is a paragraph with a nested element that has a border.
Test 5 - This is a transformed paragraph with a nested element that has a border.
Test 6 - This is a transformed paragraph with a nested element that has a border.
And then a second line.
Test 7 - This is a paragraph inside something that does not have a compositing layer.
Test 8 - This is raw text inside something that does not have a compositing layer.
Test 9 - This is raw text inside something that has a compositing layer.
Test 10 - This is raw text inside something that does not have a compositing layer.
Test 11 - This is a rotated and scaled paragraph
Test 12 - This is a rotated and scaled paragraph with a nested element that has a border.
Test 13 - This is a paragraph with a nested element that has a border.
This test exercises the webkitConvertPointFromNodeToPage() function
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
Test parameter passing - should not crash
PASS Missing parameter test
Test did not crash and therefore was successful
PASS null parameter test a
Test did not crash and therefore was successful
PASS null parameter test b
Test did not crash and therefore was successful
Test 1
PASS x is 8
PASS y is 13
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
PASS y is 53
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 2
PASS x is 8
FAIL y should be 51. Was 52.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 91. Was 92.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 3
PASS x is 8
FAIL y should be 85. Was 88.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 125. Was 128.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 4
PASS x is 8
FAIL y should be 119. Was 124.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 159. Was 164.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 5
PASS x is 28
FAIL y should be 153. Was 160.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 193. Was 200.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 6
PASS x is 28
FAIL y should be 187. Was 196.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 227. Was 236.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 7
PASS x is 8
FAIL y should be 239. Was 252.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 279. Was 292.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 8
PASS x is 8
FAIL y should be 273. Was 288.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 313. Was 328.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 9
PASS x is 28
FAIL y should be 291. Was 308.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 331. Was 348.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 10
PASS x is 28
FAIL y should be 309. Was 328.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 349. Was 368.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 11
PASS x is 158
PASS y is 376
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 174
PASS y is 394
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 12
PASS x is 168
PASS y is 451
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 184
PASS y is 469
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 13
PASS x is 28
FAIL y should be 487. Was 512.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 527. Was 552.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
PASS successfullyParsed is true
TEST COMPLETE
Test 1 - This is a H1 heading.
Test 2 - This is a simple paragraph.
Test 3 - This is a paragraph with a nested element.
Test 4 - This is a paragraph with a nested element that has a border.
Test 5 - This is a transformed paragraph with a nested element that has a border.
Test 6 - This is a transformed paragraph with a nested element that has a border.
And then a second line.
Test 7 - This is a paragraph inside something that does not have a compositing layer.
Test 8 - This is raw text inside something that does not have a compositing layer.
Test 9 - This is raw text inside something that has a compositing layer.
Test 10 - This is raw text inside something that does not have a compositing layer.
Test 11 - This is a rotated and scaled paragraph
Test 12 - This is a rotated and scaled paragraph with a nested element that has a border.
Test 13 - This is a paragraph with a nested element that has a border.
This test exercises the webkitConvertPointFromNodeToPage() function
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
Test parameter passing - should not crash
PASS Missing parameter test
Test did not crash and therefore was successful
PASS null parameter test a
Test did not crash and therefore was successful
PASS null parameter test b
Test did not crash and therefore was successful
Test 1
PASS x is 8
PASS y is 13
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
PASS y is 53
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 2
PASS x is 8
FAIL y should be 51. Was 52.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 91. Was 92.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 3
PASS x is 8
FAIL y should be 85. Was 88.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 125. Was 128.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 4
PASS x is 8
FAIL y should be 119. Was 124.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 159. Was 164.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 5
PASS x is 28
FAIL y should be 153. Was 160.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 193. Was 200.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 6
PASS x is 28
FAIL y should be 187. Was 196.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 227. Was 236.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 7
PASS x is 8
FAIL y should be 239. Was 252.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 279. Was 292.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 8
PASS x is 8
FAIL y should be 273. Was 288.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 13
FAIL y should be 313. Was 328.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 9
PASS x is 28
FAIL y should be 291. Was 308.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 331. Was 348.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 10
PASS x is 28
FAIL y should be 309. Was 328.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 349. Was 368.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 11
PASS x is 158
PASS y is 376
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 174
PASS y is 394
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 12
PASS x is 168
PASS y is 451
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 184
PASS y is 469
Round Trip of (5,40)
PASS x is 5
PASS y is 40
Test 13
PASS x is 28
FAIL y should be 487. Was 512.
Round Trip of (0,0)
PASS x is 0
PASS y is 0
PASS x is 33
FAIL y should be 527. Was 552.
Round Trip of (5,40)
PASS x is 5
PASS y is 40
PASS successfullyParsed is true
TEST COMPLETE
...@@ -35,10 +35,10 @@ function runTest() { ...@@ -35,10 +35,10 @@ function runTest() {
var id2 = "b"; var id2 = "b";
var element1 = document.getElementById(id1); var element1 = document.getElementById(id1);
var element2 = document.getElementById(id2); var element2 = document.getElementById(id2);
var x1 = webkitConvertPointFromNodeToPage(element1, new WebKitPoint(0,0)).x; var x1 = element1.getBoundingClientRect().left;
var y1 = webkitConvertPointFromNodeToPage(element1, new WebKitPoint(0,0)).y; var y1 = element1.getBoundingClientRect().top;
var x2 = webkitConvertPointFromNodeToPage(element2, new WebKitPoint(0,0)).x; var x2 = element2.getBoundingClientRect().left;
var y2 = webkitConvertPointFromNodeToPage(element2, new WebKitPoint(0,0)).y; var y2 = element2.getBoundingClientRect().top;
var resultString = ''; var resultString = '';
if (x1 == x2 && y1 == y2) { if (x1 == x2 && y1 == y2) {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
function checkPosition(id) { function checkPosition(id) {
var element = document.getElementById(id); var element = document.getElementById(id);
var y = webkitConvertPointFromNodeToPage(element, new WebKitPoint(0,0)).y; var y = element.getBoundingClientRect().top;
var resultString = ''; var resultString = '';
if (y > 250) { if (y > 250) {
......
...@@ -35,10 +35,10 @@ function runTest() { ...@@ -35,10 +35,10 @@ function runTest() {
var id2 = "b"; var id2 = "b";
var element1 = document.getElementById(id1); var element1 = document.getElementById(id1);
var element2 = document.getElementById(id2); var element2 = document.getElementById(id2);
var x1 = webkitConvertPointFromNodeToPage(element1, new WebKitPoint(0,0)).x; var x1 = element1.getBoundingClientRect().left;
var y1 = webkitConvertPointFromNodeToPage(element1, new WebKitPoint(0,0)).y; var y1 = element1.getBoundingClientRect().top;
var x2 = webkitConvertPointFromNodeToPage(element2, new WebKitPoint(0,0)).x; var x2 = element2.getBoundingClientRect().left;
var y2 = webkitConvertPointFromNodeToPage(element2, new WebKitPoint(0,0)).y; var y2 = element2.getBoundingClientRect().top;
var resultString = ''; var resultString = '';
if (x1 == x2 && y1 == y2) { if (x1 == x2 && y1 == y2) {
......
...@@ -37,10 +37,10 @@ function runTest() { ...@@ -37,10 +37,10 @@ function runTest() {
var id2 = "b"; var id2 = "b";
var element1 = document.getElementById(id1); var element1 = document.getElementById(id1);
var element2 = document.getElementById(id2); var element2 = document.getElementById(id2);
var x1 = webkitConvertPointFromNodeToPage(element1, new WebKitPoint(0,0)).x; var x1 = element1.getBoundingClientRect().left;
var y1 = webkitConvertPointFromNodeToPage(element1, new WebKitPoint(0,0)).y; var y1 = element1.getBoundingClientRect().top;
var x2 = webkitConvertPointFromNodeToPage(element2, new WebKitPoint(0,0)).x; var x2 = element2.getBoundingClientRect().left;
var y2 = webkitConvertPointFromNodeToPage(element2, new WebKitPoint(0,0)).y; var y2 = element2.getBoundingClientRect().top;
var resultString = ''; var resultString = '';
if (x1 == x2 && y1 == y2) { if (x1 == x2 && y1 == y2) {
......
...@@ -1613,34 +1613,6 @@ unsigned short Node::compareDocumentPosition(const Node* otherNode, ShadowTreesT ...@@ -1613,34 +1613,6 @@ unsigned short Node::compareDocumentPosition(const Node* otherNode, ShadowTreesT
DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS | connection; DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS | connection;
} }
FloatPoint Node::convertToPage(const FloatPoint& p) const
{
// If there is a renderer, just ask it to do the conversion
if (renderer())
return renderer()->localToAbsolute(p, UseTransforms);
// Otherwise go up the tree looking for a renderer
if (Element* parent = parentElement())
return parent->convertToPage(p);
// No parent - no conversion needed
return p;
}
FloatPoint Node::convertFromPage(const FloatPoint& p) const
{
// If there is a renderer, just ask it to do the conversion
if (renderer())
return renderer()->absoluteToLocal(p, UseTransforms);
// Otherwise go up the tree looking for a renderer
if (Element* parent = parentElement())
return parent->convertFromPage(p);
// No parent - no conversion needed
return p;
}
String Node::debugName() const String Node::debugName() const
{ {
StringBuilder name; StringBuilder name;
......
...@@ -487,10 +487,6 @@ public: ...@@ -487,10 +487,6 @@ public:
// Whether or not a selection can be started in this object // Whether or not a selection can be started in this object
virtual bool canStartSelection() const; virtual bool canStartSelection() const;
// Getting points into and out of screen space
FloatPoint convertToPage(const FloatPoint&) const;
FloatPoint convertFromPage(const FloatPoint&) const;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Integration with rendering tree // Integration with rendering tree
......
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
#include "core/frame/Navigator.h" #include "core/frame/Navigator.h"
#include "core/frame/Screen.h" #include "core/frame/Screen.h"
#include "core/frame/Settings.h" #include "core/frame/Settings.h"
#include "core/frame/WebKitPoint.h"
#include "core/html/HTMLFrameOwnerElement.h" #include "core/html/HTMLFrameOwnerElement.h"
#include "core/inspector/InspectorInstrumentation.h" #include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTraceEvents.h" #include "core/inspector/InspectorTraceEvents.h"
...@@ -1344,36 +1343,6 @@ PassRefPtrWillBeRawPtr<CSSRuleList> LocalDOMWindow::getMatchedCSSRules(Element* ...@@ -1344,36 +1343,6 @@ PassRefPtrWillBeRawPtr<CSSRuleList> LocalDOMWindow::getMatchedCSSRules(Element*
return m_frame->document()->ensureStyleResolver().pseudoCSSRulesForElement(element, pseudoId, rulesToInclude); return m_frame->document()->ensureStyleResolver().pseudoCSSRulesForElement(element, pseudoId, rulesToInclude);
} }
PassRefPtrWillBeRawPtr<WebKitPoint> LocalDOMWindow::webkitConvertPointFromNodeToPage(Node* node, const WebKitPoint* p) const
{
if (!node || !p)
return nullptr;
if (!document())
return nullptr;
document()->updateLayoutIgnorePendingStylesheets();
FloatPoint pagePoint(p->x(), p->y());
pagePoint = node->convertToPage(pagePoint);
return WebKitPoint::create(pagePoint.x(), pagePoint.y());
}
PassRefPtrWillBeRawPtr<WebKitPoint> LocalDOMWindow::webkitConvertPointFromPageToNode(Node* node, const WebKitPoint* p) const
{
if (!node || !p)
return nullptr;
if (!document())
return nullptr;
document()->updateLayoutIgnorePendingStylesheets();
FloatPoint nodePoint(p->x(), p->y());
nodePoint = node->convertFromPage(nodePoint);
return WebKitPoint::create(nodePoint.x(), nodePoint.y());
}
double LocalDOMWindow::devicePixelRatio() const double LocalDOMWindow::devicePixelRatio() const
{ {
if (!m_frame) if (!m_frame)
......
...@@ -44,7 +44,6 @@ namespace blink { ...@@ -44,7 +44,6 @@ namespace blink {
class CSSRuleList; class CSSRuleList;
class CSSStyleDeclaration; class CSSStyleDeclaration;
class Console; class Console;
class WebKitPoint;
class DOMSelection; class DOMSelection;
class DOMURL; class DOMURL;
class DOMWindowProperty; class DOMWindowProperty;
...@@ -219,9 +218,6 @@ enum PageshowEventPersistence { ...@@ -219,9 +218,6 @@ enum PageshowEventPersistence {
PassRefPtrWillBeRawPtr<CSSRuleList> getMatchedCSSRules(Element*, const String& pseudoElt) const; PassRefPtrWillBeRawPtr<CSSRuleList> getMatchedCSSRules(Element*, const String& pseudoElt) const;
double devicePixelRatio() const; double devicePixelRatio() const;
PassRefPtrWillBeRawPtr<WebKitPoint> webkitConvertPointFromPageToNode(Node*, const WebKitPoint*) const;
PassRefPtrWillBeRawPtr<WebKitPoint> webkitConvertPointFromNodeToPage(Node*, const WebKitPoint*) const;
Console& console() const; Console& console() const;
FrameConsole* frameConsole() const; FrameConsole* frameConsole() const;
......
...@@ -148,11 +148,6 @@ ...@@ -148,11 +148,6 @@
[Replaceable] readonly attribute double devicePixelRatio; [Replaceable] readonly attribute double devicePixelRatio;
[MeasureAs=PrefixedConvertPointFromPageToNode] WebKitPoint webkitConvertPointFromPageToNode([Default=Undefined] optional Node node,
[Default=Undefined] optional WebKitPoint p);
[MeasureAs=PrefixedConvertPointFromNodeToPage] WebKitPoint webkitConvertPointFromNodeToPage([Default=Undefined] optional Node node,
[Default=Undefined] optional WebKitPoint p);
[RuntimeEnabled=ApplicationCache, LogActivity=GetterOnly] readonly attribute ApplicationCache applicationCache; [RuntimeEnabled=ApplicationCache, LogActivity=GetterOnly] readonly attribute ApplicationCache applicationCache;
[RuntimeEnabled=SessionStorage, LogActivity=GetterOnly, RaisesException=Getter] readonly attribute Storage sessionStorage; [RuntimeEnabled=SessionStorage, LogActivity=GetterOnly, RaisesException=Getter] readonly attribute Storage sessionStorage;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment