Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CSSRegions]Implement NamedFlow::getRegionsByContentNode
https://bugs.webkit.org/show_bug.cgi?id=77746 Reviewed by David Hyatt. The list of regions returned is a static node list. Source/WebCore: Tests: fast/regions/get-regions-by-content-node-horiz-bt.html fast/regions/get-regions-by-content-node-horiz-tb.html fast/regions/get-regions-by-content-node-vert-lr.html fast/regions/get-regions-by-content-node-vert-rl.html fast/regions/get-regions-by-content-node.html fast/regions/get-regions-by-content-node2.html * dom/WebKitNamedFlow.cpp: (WebCore::WebKitNamedFlow::getRegionsByContentNode): (WebCore): * dom/WebKitNamedFlow.h: (WebKitNamedFlow): * dom/WebKitNamedFlow.idl: * rendering/RenderFlowThread.cpp: (WebCore::RenderFlowThread::regionInRange): (WebCore): (WebCore::RenderFlowThread::objectInFlowRegion): * rendering/RenderFlowThread.h: * rendering/RenderRegion.h: (WebCore::RenderRegion::flowThread): LayoutTests: * fast/regions/get-regions-by-content-node-expected.txt: Added. * fast/regions/get-regions-by-content-node-horiz-bt-expected.txt: Added. * fast/regions/get-regions-by-content-node-horiz-bt.html: Added. * fast/regions/get-regions-by-content-node-horiz-tb-expected.txt: Added. * fast/regions/get-regions-by-content-node-horiz-tb.html: Added. * fast/regions/get-regions-by-content-node-vert-lr-expected.txt: Added. * fast/regions/get-regions-by-content-node-vert-lr.html: Added. * fast/regions/get-regions-by-content-node-vert-rl-expected.txt: Added. * fast/regions/get-regions-by-content-node-vert-rl.html: Added. * fast/regions/get-regions-by-content-node.html: Added. * fast/regions/get-regions-by-content-node2-expected.txt: Added. * fast/regions/get-regions-by-content-node2.html: Added. Canonical link: https://commits.webkit.org/98898@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111376 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
20 changed files
with
1,159 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
LayoutTests/fast/regions/get-regions-by-content-node-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Test for 77746: [CSSRegions]Implement NamedFlow::getRegionsByContentNode. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS regionList.length is 1 | ||
PASS regionList.item(0).id is "region" | ||
PASS regionList.length is 2 | ||
PASS regionList.item(0).id is "region21" | ||
PASS regionList.item(1).id is "region22" | ||
PASS regionList.length is 0 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
||
|
||
|
49 changes: 49 additions & 0 deletions
49
LayoutTests/fast/regions/get-regions-by-content-node-horiz-bt-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Test for 77746: [CSSRegions]Implement NamedFlow::getRegionsByContentNode | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS regionListArticle is non-null. | ||
PASS regionListArticle.length is 2 | ||
PASS regionListArticle.item(0).id is "region" | ||
PASS regionListArticle.item(1).id is "region2" | ||
PASS regionListSpan is non-null. | ||
PASS regionListSpan.length is 1 | ||
PASS regionListSpan.item(0).id is "region" | ||
PASS regionListSpan2 is non-null. | ||
PASS regionListSpan2.length is 2 | ||
PASS regionListSpan3 is non-null. | ||
PASS regionListSpan3.length is 1 | ||
PASS regionListSpan3.item(0).id is "region2" | ||
PASS regionListTextNode is non-null. | ||
PASS regionListTextNode.length is 1 | ||
PASS regionListTextNode.item(0).id is "region2" | ||
PASS regionListTextNode2 is non-null. | ||
PASS regionListTextNode2.length is 1 | ||
PASS regionListTextNode2.item(0).id is "region2" | ||
PASS regionListTextNode3 is non-null. | ||
PASS regionListTextNode3.length is 1 | ||
PASS regionListTextNode3.item(0).id is "region2" | ||
PASS regionListTextNode2.length is 2 | ||
PASS regionListTextNode2.item(0).id is "region2" | ||
PASS regionListTextNode2.item(1).id is "region3" | ||
PASS regionListTextNode32.length is 1 | ||
PASS regionListTextNode32.item(0).id is "region3" | ||
PASS regionListP1 is non-null. | ||
PASS regionListP1.length is 1 | ||
PASS regionListP1.item(0).id is "region4" | ||
PASS regionListP2 is non-null. | ||
PASS regionListP2.length is 1 | ||
PASS regionListP2.item(0).id is "region4" | ||
PASS regionListP3 is non-null. | ||
PASS regionListP3.length is 1 | ||
PASS regionListP3.item(0).id is "region4" | ||
PASS regionListP22.length is 1 | ||
PASS regionListP22.item(0).id is "region5" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
||
|
||
|
||
|
151 changes: 151 additions & 0 deletions
151
LayoutTests/fast/regions/get-regions-by-content-node-horiz-bt.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<script src="../../fast/js/resources/js-test-pre.js"></script> | ||
<style> | ||
html { -webkit-writing-mode: horizontal-bt; } | ||
body { font-family: monospace; } | ||
#article { -webkit-flow-into: flow; } | ||
#region { -webkit-flow-from: flow; width: 250px; height: 50px; } | ||
#region2 { -webkit-flow-from: flow; width: 250px; height: 50px; } | ||
#region3 { -webkit-flow-from: flow; width: 250px; height: 50px; } | ||
|
||
#article2 { -webkit-flow-into: flow2; } | ||
#region4 { -webkit-flow-from: flow2; width: 250px; height: 50px; } | ||
#region5 { -webkit-flow-from: flow2; width: 250px; height: 50px; } | ||
|
||
.noRegion { -webkit-flow-from: none; } | ||
</style> | ||
</head> | ||
<body> | ||
<!-- some tests with inline elements --> | ||
<div id="article"> | ||
<span id="spanNode">Text inside span.</span> | ||
Text outside span. Text outside span. Text outside span. | ||
<span id="spanNode2">Text inside span2.</span> | ||
<span id="spanNode3">Text inside span3</span> | ||
</div> | ||
<div id="region"></div> | ||
<div id="region2"></div> | ||
|
||
<!-- some tests with block elements --> | ||
<div id="article2"> | ||
<p id="p1">Text inside paragraph p1.</p> | ||
</div> | ||
<div id="region4"></region> | ||
<script> | ||
if (window.layoutTestController) | ||
window.layoutTestController.dumpAsText(); | ||
description("Test for 77746: [CSSRegions]Implement NamedFlow::getRegionsByContentNode"); | ||
var namedFlow = document.webkitGetFlowByName("flow"); | ||
|
||
function hideRegions() | ||
{ | ||
document.getElementById("article").style.visibility = "hidden"; | ||
document.getElementById("article2").style.visibility = "hidden"; | ||
document.getElementById("region").style.visibility = "hidden"; | ||
document.getElementById("region2").style.visibility = "hidden"; | ||
document.getElementById("region3").style.visibility = "hidden"; | ||
document.getElementById("region4").style.visibility = "hidden"; | ||
document.getElementById("region5").style.visibility = "hidden"; | ||
} | ||
|
||
var regionListArticle = namedFlow.getRegionsByContentNode(document.getElementById("article")); | ||
shouldBeNonNull("regionListArticle"); | ||
shouldEvaluateTo("regionListArticle.length", 2); | ||
shouldBeEqualToString("regionListArticle.item(0).id", "region"); | ||
shouldBeEqualToString("regionListArticle.item(1).id", "region2"); | ||
|
||
var spanNode = document.getElementById("spanNode"); | ||
var regionListSpan = namedFlow.getRegionsByContentNode(spanNode); | ||
shouldBeNonNull("regionListSpan"); | ||
shouldEvaluateTo("regionListSpan.length", 1); | ||
shouldBeEqualToString("regionListSpan.item(0).id", "region"); | ||
|
||
var spanNode2 = document.getElementById("spanNode2"); | ||
var regionListSpan2 = namedFlow.getRegionsByContentNode(spanNode2); | ||
shouldBeNonNull("regionListSpan2"); | ||
shouldEvaluateTo("regionListSpan2.length", 2); | ||
|
||
var spanNode3 = document.getElementById("spanNode3"); | ||
var regionListSpan3 = namedFlow.getRegionsByContentNode(spanNode3); | ||
shouldBeNonNull("regionListSpan3"); | ||
shouldEvaluateTo("regionListSpan3.length", 1); | ||
shouldBeEqualToString("regionListSpan3.item(0).id", "region2"); | ||
|
||
var textNode = document.createTextNode("Text node. Text node. Text node. Text node. Text node. Text node. Text node. "); | ||
document.getElementById("article").appendChild(textNode); | ||
var regionListTextNode = namedFlow.getRegionsByContentNode(textNode); | ||
shouldBeNonNull("regionListTextNode"); | ||
shouldEvaluateTo("regionListTextNode.length", 1); | ||
shouldBeEqualToString("regionListTextNode.item(0).id", "region2"); | ||
|
||
// Add another text node that will overflow the region2. | ||
var textNode2 = document.createTextNode("Text node2."); | ||
document.getElementById("article").appendChild(textNode2); | ||
var regionListTextNode2 = namedFlow.getRegionsByContentNode(textNode2); | ||
shouldBeNonNull("regionListTextNode2"); | ||
shouldEvaluateTo("regionListTextNode2.length", 1); | ||
shouldBeEqualToString("regionListTextNode2.item(0).id", "region2"); | ||
|
||
// Add another text node that is in the overflow of the last region. | ||
var textNode3 = document.createTextNode("Text node3."); | ||
document.getElementById("article").appendChild(textNode3); | ||
var regionListTextNode3 = namedFlow.getRegionsByContentNode(textNode3); | ||
shouldBeNonNull("regionListTextNode3"); | ||
shouldEvaluateTo("regionListTextNode3.length", 1); | ||
shouldBeEqualToString("regionListTextNode3.item(0).id", "region2"); | ||
|
||
// Add another region to take the overflowing elements from second region. | ||
var region3 = document.createElement("div"); | ||
region3.id = "region3"; | ||
document.body.appendChild(region3); | ||
|
||
var regionListTextNode2 = namedFlow.getRegionsByContentNode(textNode); | ||
shouldEvaluateTo("regionListTextNode2.length", 2); | ||
shouldBeEqualToString("regionListTextNode2.item(0).id", "region2"); | ||
shouldBeEqualToString("regionListTextNode2.item(1).id", "region3"); | ||
|
||
var regionListTextNode32 = namedFlow.getRegionsByContentNode(textNode3); | ||
shouldEvaluateTo("regionListTextNode32.length", 1); | ||
shouldBeEqualToString("regionListTextNode32.item(0).id", "region3"); | ||
|
||
var namedFlow2 = document.webkitGetFlowByName("flow2"); | ||
var regionListP1 = namedFlow2.getRegionsByContentNode(document.getElementById("p1")); | ||
shouldBeNonNull("regionListP1"); | ||
shouldEvaluateTo("regionListP1.length", 1); | ||
shouldBeEqualToString("regionListP1.item(0).id", "region4"); | ||
|
||
var p2 = document.createElement("p"); | ||
p2.id = "p2"; | ||
p2.appendChild(document.createTextNode("Text inside paragraph p2.")); | ||
document.getElementById("article2").appendChild(p2); | ||
var regionListP2 = namedFlow2.getRegionsByContentNode(p2); | ||
shouldBeNonNull("regionListP2"); | ||
shouldEvaluateTo("regionListP2.length", 1); | ||
shouldBeEqualToString("regionListP2.item(0).id", "region4"); | ||
|
||
// add another element p, in the overflow part of the region4 | ||
var p3 = document.createElement("p"); | ||
p3.id = "p3"; | ||
p3.appendChild(document.createTextNode("Text inside paragraph p3.")); | ||
document.getElementById("article2").appendChild(p3); | ||
var regionListP3 = namedFlow2.getRegionsByContentNode(p3); | ||
shouldBeNonNull("regionListP3"); | ||
shouldEvaluateTo("regionListP3.length", 1); | ||
shouldBeEqualToString("regionListP3.item(0).id", "region4"); | ||
|
||
// add another region to flow2, p2 and p3 go to region5 | ||
var region5 = document.createElement("div"); | ||
region5.id = "region5"; | ||
document.body.appendChild(region5); | ||
|
||
var regionListP22 = namedFlow2.getRegionsByContentNode(p2); | ||
shouldEvaluateTo("regionListP22.length", 1); | ||
shouldBeEqualToString("regionListP22.item(0).id", "region5"); | ||
|
||
hideRegions(); | ||
</script> | ||
<script src="../../fast/js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
49 changes: 49 additions & 0 deletions
49
LayoutTests/fast/regions/get-regions-by-content-node-horiz-tb-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Test for 77746: [CSSRegions]Implement NamedFlow::getRegionsByContentNode | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS regionListArticle is non-null. | ||
PASS regionListArticle.length is 2 | ||
PASS regionListArticle.item(0).id is "region" | ||
PASS regionListArticle.item(1).id is "region2" | ||
PASS regionListSpan is non-null. | ||
PASS regionListSpan.length is 1 | ||
PASS regionListSpan.item(0).id is "region" | ||
PASS regionListSpan2 is non-null. | ||
PASS regionListSpan2.length is 2 | ||
PASS regionListSpan3 is non-null. | ||
PASS regionListSpan3.length is 1 | ||
PASS regionListSpan3.item(0).id is "region2" | ||
PASS regionListTextNode is non-null. | ||
PASS regionListTextNode.length is 1 | ||
PASS regionListTextNode.item(0).id is "region2" | ||
PASS regionListTextNode2 is non-null. | ||
PASS regionListTextNode2.length is 1 | ||
PASS regionListTextNode2.item(0).id is "region2" | ||
PASS regionListTextNode3 is non-null. | ||
PASS regionListTextNode3.length is 1 | ||
PASS regionListTextNode3.item(0).id is "region2" | ||
PASS regionListTextNode2.length is 2 | ||
PASS regionListTextNode2.item(0).id is "region2" | ||
PASS regionListTextNode2.item(1).id is "region3" | ||
PASS regionListTextNode32.length is 1 | ||
PASS regionListTextNode32.item(0).id is "region3" | ||
PASS regionListP1 is non-null. | ||
PASS regionListP1.length is 1 | ||
PASS regionListP1.item(0).id is "region4" | ||
PASS regionListP2 is non-null. | ||
PASS regionListP2.length is 1 | ||
PASS regionListP2.item(0).id is "region4" | ||
PASS regionListP3 is non-null. | ||
PASS regionListP3.length is 1 | ||
PASS regionListP3.item(0).id is "region4" | ||
PASS regionListP22.length is 1 | ||
PASS regionListP22.item(0).id is "region5" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
||
|
||
|
||
|
Oops, something went wrong.