Skip to content
Permalink
Browse files
2010-10-19 Antonio Gomes <agomes@rim.com>
        Reviewed by Kenneth Rohde Christiansen.

        Add an inner frame test to Document::nodesFromRect
        https://bugs.webkit.org/show_bug.cgi?id=47794

        Patch continues to improve the test coverage of Document::nodesFromRect,
        similarly to bugs 47795 (Add a test to nodesFromRect involving links and
        text nodes) and 47766 (Enrich /fast/dom/nodesFromRect-basic.html test).
        This time it is being adding tests involving inner frame contents.

        Three situations are added:
        1) Hit testing an inner frame from an outer document should not include
           nodes of the former in the returned result, but the inner frame itself;
        2) Hit testing inner frame and outer frame contents should return all
           nodes in the later whose area intersect with the hit area and the intersected
           inner frame itself;
        3) Hit testing an inner document content should return all nodes in the inner document
           whose area intersect the hit area.

        Tests skipped on Win, Qt, GTK and Chromium.

        * fast/dom/nodesFromRect-inner-documents-expected.txt: Added.
        * fast/dom/nodesFromRect-inner-documents.html: Added.
        * fast/dom/resources/nodesFromRect.css:
        * fast/dom/resources/nodesFromRect.js:

Canonical link: https://commits.webkit.org/60702@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70147 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Antonio Gomes committed Oct 20, 2010
1 parent 9cb7ee2 commit c909b95e00365f8844a17942ebeec50a97014a41
Showing 9 changed files with 104 additions and 3 deletions.
@@ -1,3 +1,29 @@
2010-10-19 Antonio Gomes <agomes@rim.com>

Reviewed by Kenneth Rohde Christiansen.

Add an inner frame test to Document::nodesFromRect
https://bugs.webkit.org/show_bug.cgi?id=47794

Patch continues to improve the test coverage of Document::nodesFromRect,
similarly to bugs 47795 (Add a test to nodesFromRect involving links and
text nodes) and 47766 (Enrich /fast/dom/nodesFromRect-basic.html test).
This time it is being adding tests involving inner frame contents.

Three situations are added:
1) Hit testing an inner frame from an outer document should not include
nodes of the former in the returned result, but the inner frame itself;
2) Hit testing inner frame and outer frame contents should return all
nodes in the later whose area intersect with the hit area and the intersected
inner frame itself;
3) Hit testing an inner document content should return all nodes in the inner document
whose area intersect the hit area.

* fast/dom/nodesFromRect-inner-documents-expected.txt: Added.
* fast/dom/nodesFromRect-inner-documents.html: Added.
* fast/dom/resources/nodesFromRect.css:
* fast/dom/resources/nodesFromRect.js:

2010-10-20 Dirk Schulze <krit@webkit.org>

Unreviewed rebaseline of Snow Leopard pixel result after commit r69922.
@@ -0,0 +1,10 @@
A PASS successfullyParsed is true

TEST COMPLETE
PASS All correct nodes found for rect [176,120], [0,0,0,0]
PASS All correct nodes found for rect [176,120], [10,10,10,10]
PASS All correct nodes found for rect [14,167], [0,10,0,0]
PASS All correct nodes found for rect [150,17], [0,0,0,0]
PASS All correct nodes found for rect [150,17], [0,0,10,0]
PASS All correct nodes found for rect [150,17], [0,0,25,0]

@@ -0,0 +1,58 @@
<html>
<head>
<title>Document::nodesFromRect : basic text nodes and links test - bug 47795</title>
<style type="text/css"> @import "resources/nodesFromRect.css"; </style>
<script src="../js/resources/js-test-pre.js"></script>
<script src="resources/nodesFromRect.js"></script>
<script type="application/javascript">
function runTest()
{
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}

var e = {};

// Set up shortcut access to elements
e['html'] = document.getElementsByTagName("html")[0];
['a1', 'iframe1', 'body'].forEach(function(a) {
e[a] = document.getElementById(a);
});

window.scrollTo(0, 0);

var a1Center = getCenterFor(e.a1);
var iframe1Center = getCenterFor(e.iframe1);

// Elements inside iframe shouldn't be returned:
check(iframe1Center.x, iframe1Center.y, 0, 0, 0, 0, [e.iframe1]);
check(iframe1Center.x, iframe1Center.y, 10, 10, 10, 10, [e.iframe1]);

// NOTE: e.body.childNodes[2] is a TextNode whose content is ' '.
check(a1Center.x, a1Center.y, 0, e.iframe1.getBoundingClientRect().left - a1Center.x, 0, 0, [e.iframe1, e.body.childNodes[2], e.a1.firstChild, e.a1, e.body]);

// Testing nodesFromRect in an inner node.
var innerDocument = window.frames[0].document;
var div = innerDocument.getElementsByTagName('div')[0];
var p = innerDocument.getElementsByTagName('p')[0];
var body = innerDocument.getElementsByTagName('body')[0];
var divCenter = getCenterFor(div);
check(divCenter.x, divCenter.y, 0, 0, 0, 0, [div], innerDocument);
check(divCenter.x, divCenter.y, 0, 0, 10, 0, [div, body], innerDocument);
check(divCenter.x, divCenter.y, 0, 0, 25, 0, [p, div, body], innerDocument);

if (window.layoutTestController)
layoutTestController.notifyDone();
}

window.onload = runTest;
</script>
</head>
<body id="body">
<a id="a1" href="#">A</a>
<iframe id="iframe1" src="data:text/html,<div>div</div><p>p</p>"></iframe>
<span id="console"></span>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
@@ -3,7 +3,7 @@ body {
padding: 0;
}

h1, div, p, iframe {
h1, div, p {
display: block;
width: 100px;
height: 30px;
@@ -3,12 +3,15 @@
* * Antonio Gomes <tonikitoo@webkit.org>
**/

function check(x, y, topPadding, rightPadding, bottomPadding, leftPadding, list)
function check(x, y, topPadding, rightPadding, bottomPadding, leftPadding, list, doc)
{
if (!window.layoutTestController)
return;

var nodes = layoutTestController.nodesFromRect(document, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */);
if (!doc)
doc = document;

var nodes = layoutTestController.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */);
if (!nodes)
return;

@@ -3219,6 +3219,7 @@ BUGWK47901 MAC : fast/canvas/canvas-getImageData-negative-source.html = TEXT

// We don't support layoutTestController.nodesFromRect so this test just times out
BUGWK46600 SKIP : fast/dom/nodesFromRect-links-and-text.html = TEXT
BUGWK46600 SKIP : fast/dom/nodesFromRect-inner-documents.html = TEXT

// Many flaky SVG tests
BUG59671 LINUX : svg/W3C-SVG-1.1-SE/pservers-grad-17-b.svg = IMAGE+TEXT PASS
@@ -5868,6 +5868,7 @@ fast/filesystem
# LayoutTestController::nodesFromRect is not supported.
fast/dom/nodesFromRect-basic.html
fast/dom/nodesFromRect-links-and-text.html
fast/dom/nodesFromRect-inner-documents.html

# https://bugs.webkit.org/show_bug.cgi?id=46644
fast/text/large-text-composed-char-dos.html
@@ -5434,6 +5434,7 @@ fast/filesystem
# LayoutTestController::nodesFromRect is not supported.
fast/dom/nodesFromRect-basic.html
fast/dom/nodesFromRect-links-and-text.html
fast/dom/nodesFromRect-inner-documents.html

# It fails, because 3D canvas is disabled by default.
http/tests/canvas/webgl/origin-clean-conformance.html
@@ -1030,6 +1030,7 @@ fast/filesystem
# LayoutTestController::nodesFromRect is not supported.
fast/dom/nodesFromRect-basic.html
fast/dom/nodesFromRect-links-and-text.html
fast/dom/nodesFromRect-inner-documents.html

# https://bugs.webkit.org/show_bug.cgi?id=46223
# The WebKit plugin implementation does not support iframe shims.

0 comments on commit c909b95

Please sign in to comment.