Skip to content
Permalink
Browse files
[CSSRegions]Implement NamedFlow::getRegionsByContentNode
https://bugs.webkit.org/show_bug.cgi?id=77746

Reviewed by David Hyatt.

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

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/Node.cpp:
(WebCore::Node::removeCachedRegionNodeList):
(WebCore):
(WebCore::Node::getRegionsByContentNode):
(WebCore::NodeListsNodeData::invalidateCaches):
(WebCore::NodeListsNodeData::isEmpty):
* dom/Node.h:
(WebCore):
(Node):
* dom/NodeRareData.h:
(NodeListsNodeData):
* dom/RegionNodeList.cpp:
(WebCore):
(WebCore::RegionNodeList::RegionNodeList):
(WebCore::RegionNodeList::~RegionNodeList):
(WebCore::RegionNodeList::nodeMatches):
* dom/RegionNodeList.h:
(WebCore):
(RegionNodeList):
(WebCore::RegionNodeList::create):
* dom/WebKitNamedFlow.cpp:
(WebCore::WebKitNamedFlow::getRegionsByContentNode):
(WebCore):
* dom/WebKitNamedFlow.h:
(WebCore):
(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/96740@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@108970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mihneaOMV committed Feb 27, 2012
1 parent 7358867 commit 95ea45caf7cb518c5768f0867836d6871843e4e3
Showing 31 changed files with 1,469 additions and 3 deletions.
@@ -1,3 +1,23 @@
2012-02-27 Mihnea Ovidenie <mihnea@adobe.com>

[CSSRegions]Implement NamedFlow::getRegionsByContentNode
https://bugs.webkit.org/show_bug.cgi?id=77746

Reviewed by David Hyatt.

* 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.

2012-02-27 Kenichi Ishibashi <bashi@chromium.org>

[Chromium] Unreviewed test expectaion update.
@@ -0,0 +1,15 @@
Test for 77746: [CSSRegions]Implement NamedFlow::getRegionsByContentNode

On success, you should see a series of PASS below.

PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS



@@ -0,0 +1,48 @@
Test for 77746: [CSSRegions]Implement NamedFlow::getRegionsByContentNode

On success, you should see a series of PASS below.

PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS




@@ -0,0 +1,171 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="resources/region-style.css">
<script src="resources/helper.js"></script>
<style>
html { -webkit-writing-mode: horizontal-bt; }
body { font-family: monospace; }
.regionBox { width: 250px; height: 50px; }
#article { -webkit-flow-into: flow; }
#region, #region2, #region3 { -webkit-flow-from: flow; }

#article2 { -webkit-flow-into: flow2; }
#region4, #region5 { -webkit-flow-from: flow2; }
</style>
</head>
<body>
<div id="containerMessage">
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=77746">
77746: [CSSRegions]Implement NamedFlow::getRegionsByContentNode</a></p>
<p>On success, you should see a series of PASS below.</p>
</div>
<div id="console"></div>
<!-- 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" class="regionBox"></div>
<div id="region2" class="regionBox"></div>

<!-- some tests with block elements -->
<div id="article2">
<p id="p1">Text inside paragraph p1.</p>
</div>
<div id="region4" class="regionBox"></region>
<script>
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
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"));
assert(regionListArticle != null, "Region list for article should not be null");
assert(regionListArticle.length == 2, "Region list for article should have 2 elements, has " + regionListArticle.length);
if (regionListArticle.length > 0)
assert(regionListArticle.item(0) == document.getElementById("region"), "First element in region list for article should be region, it is " + regionListArticle.item(0).id);
if (regionListArticle.length > 1)
assert(regionListArticle.item(1) == document.getElementById("region2"), "Second element in region list for article should be region2, it is " + regionListArticle.item(1).id);

var spanNode = document.getElementById("spanNode");
var regionListSpan = namedFlow.getRegionsByContentNode(spanNode);
assert(regionListSpan != null, "Region list for span should not be null");
assert(regionListSpan.length == 1, "Region list for span should have 1 element, has " + regionListSpan.length);
if (regionListSpan.length > 0)
assert(regionListSpan.item(0) == document.getElementById("region"), "First region for span should be region, it is " + regionListSpan.item(0).id);

var spanNode2 = document.getElementById("spanNode2");
var regionListSpan2 = namedFlow.getRegionsByContentNode(spanNode2);
assert(regionListSpan2 != null, "Region list for span2 should not be null");
assert(regionListSpan2.length == 2, "Region list for span2 should have 2 elements, has " + regionListSpan2.length);

var spanNode3 = document.getElementById("spanNode3");
var regionListSpan3 = namedFlow.getRegionsByContentNode(spanNode3);
assert(regionListSpan3 != null, "Region list for span3 should not be null");
assert(regionListSpan3.length == 1, "Region list for span3 should have 1 element, has " + regionListSpan3.length);
if (regionListSpan3.length > 0)
assert(regionListSpan3.item(0) == document.getElementById("region2"), "First region for span node 3 should be the second region, it is " + regionListSpan3.item(0).id);

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);
assert(regionListTextNode != null, "Region list for text node should not be null");
assert(regionListTextNode.length == 1, "Region list for text node should have 1 element, has " + regionListTextNode.length);
if (regionListTextNode.length > 0)
assert(regionListTextNode.item(0) == document.getElementById("region2"), "First region for text node should be second region, it is " + regionListTextNode.item(0).id);

// 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);
assert(regionListTextNode2 != null, "Region list for text node 2 should not be null");
assert(regionListTextNode2.length == 1, "Region list for text node 2 should have 1 element, has " + regionListTextNode2.length);
if (regionListTextNode2.length > 0)
assert(regionListTextNode2.item(0) == document.getElementById("region2"), "First region for text node 2 should be second region, it is " + regionListTextNode2.item(0).id);

// 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);
assert(regionListTextNode3 != null, "Region list for text node 3 should not be null");
assert(regionListTextNode3.length == 1, "Region list for text node 3 should have 1 element, has " + regionListTextNode3.length);
if (regionListTextNode3.length > 0)
assert(regionListTextNode3.item(0) == document.getElementById("region2"), "First region for text node 3 should be second region, it is " + regionListTextNode3.item(0).id);

// Add another region to take the overflowing elements from second region.
var region3 = document.createElement("div");
region3.id = "region3";
region3.className = "regionBox";
document.body.appendChild(region3);

var regionListTextNode2 = namedFlow.getRegionsByContentNode(textNode);
assert(regionListTextNode == regionListTextNode2, "Region lists for text node should reference the same object");
assert(regionListTextNode2.length == 2, "Region list for text node should have 2 element, has " + regionListTextNode2.length);
if (regionListTextNode2.length > 0)
assert(regionListTextNode2.item(0) == document.getElementById("region2"), "First region for text node should be the second region from flow, it is " + regionListTextNode2.item(0).id);
if (regionListTextNode2.length > 1)
assert(regionListTextNode2.item(1) == document.getElementById("region3"), "Second region for text node should be the third region from flow, it is " + regionListTextNode2.item(1).id);

var regionListTextNode32 = namedFlow.getRegionsByContentNode(textNode3);
assert(regionListTextNode3 == regionListTextNode32, "Region lists for text node 3 should reference the same object");
assert(regionListTextNode32.length == 1, "Region list for text node 3 should have 1 element, has " + regionListTextNode3.length);
if (regionListTextNode32.length > 0)
assert(regionListTextNode32.item(0) == document.getElementById("region3"), "First region for text node 3 should be the third region from flow, it is " + regionListTextNode32.item(0).id);

var namedFlow2 = document.webkitGetFlowByName("flow2");
var regionListP1 = namedFlow2.getRegionsByContentNode(document.getElementById("p1"));
assert(regionListP1 != null, "Region list for p1 node should not be null");
assert(regionListP1.length == 1, "Region list for p1 node should have 1 element, has " + regionListP1.length);
if (regionListP1.length > 0)
assert(regionListP1.item(0) == document.getElementById("region4"), "First region for p1 node should be region4, it is " + regionListP1.item(0).id);

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);
assert(regionListP2 != null, "Region list for p2 node should not be null");
assert(regionListP2.length == 1, "Region list for p2 node should have 1 element, has " + regionListP2.length);
if (regionListP2.length > 0)
assert(regionListP2.item(0) == document.getElementById("region4"), "First region for p2 should be region4, it is " + regionListP2.item(0).id);

// 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);
assert(regionListP3 != null, "Region list for p3 node should not be null");
assert(regionListP3.length == 1, "Region list for p3 should have 1 element, has " + regionListP3.length);
if (regionListP3.length > 0)
assert(regionListP3.item(0) == document.getElementById("region4"), "First region for p3 should be region4, it is " + regionListP3.item(0).id);

// add another region to flow2, p2 and p3 go to region5
var region5 = document.createElement("div");
region5.id = "region5";
region5.className = "regionBox";
document.body.appendChild(region5);

var regionListP22 = namedFlow2.getRegionsByContentNode(p2);
assert(regionListP2 == regionListP22, "Region lists for p2 should refer the same region list");
assert(regionListP22.length == 1, "Region list for p2 should have 1 element, has " + regionListP2.length);
if (regionListP22.length > 0)
assert(regionListP22.item(0) == region5, "First region for p2 should be region5, it is " + regionListP2.item(0).id);

hideRegions();
</script>
</body>
</html>
@@ -0,0 +1,48 @@
Test for 77746: [CSSRegions]Implement NamedFlow::getRegionsByContentNode

On success, you should see a series of PASS below.

PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS




0 comments on commit 95ea45c

Please sign in to comment.