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

Unified Diff: Source/core/dom/PositionTest.cpp

Issue 1205023003: Bug fix: toPositionInCoposedTree should treat positions with insertion points (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/PositionTest.cpp
diff --git a/Source/core/dom/PositionTest.cpp b/Source/core/dom/PositionTest.cpp
index f1e4ef9092636f51ca133325d8611645de93cfe6..a78af36aecd35ea5bab98d13f1d22f435dd68053 100644
--- a/Source/core/dom/PositionTest.cpp
+++ b/Source/core/dom/PositionTest.cpp
@@ -75,4 +75,28 @@ TEST_F(PositionTest, NodeAsRangeLastNodeShadow)
EXPECT_EQ(t1, PositionInComposedTree::afterNode(host).nodeAsRangeLastNode());
}
+TEST_F(PositionTest, ToPositionInComposedTreeWithActiveInsertionPoint)
+{
+ const char* bodyContent = "<p id='host'>00<b id='one'>11</b>22</p>";
+ const char* shadowContent = "<a id='a'><content select=#one id='content'></content><content></content></a>";
+ setBodyContent(bodyContent);
+ RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
+ RefPtrWillBeRawPtr<Element> anchor = shadowRoot->getElementById("a");
+ RefPtrWillBeRawPtr<Element> insertionPoint = shadowRoot->getElementById("content");
+
+ EXPECT_EQ(positionInComposedTree(*anchor, 0), toPositionInComposedTree(positionInDOMTree(*anchor, 0)));
+ EXPECT_EQ(positionInComposedTree(*anchor, 1), toPositionInComposedTree(positionInDOMTree(*anchor, 1)));
+ EXPECT_EQ(PositionInComposedTree(anchor, PositionInComposedTree::PositionIsAfterChildren), toPositionInComposedTree(positionInDOMTree(*anchor, 2)));
+}
+
+TEST_F(PositionTest, ToPositionInComposedTreeWithInactiveInsertionPoint)
+{
+ const char* bodyContent = "<p id='p'><content></content></p>";
+ setBodyContent(bodyContent);
+ RefPtrWillBeRawPtr<Element> anchor = document().getElementById("p");
+
+ EXPECT_EQ(positionInComposedTree(*anchor, 0), toPositionInComposedTree(positionInDOMTree(*anchor, 0)));
+ EXPECT_EQ(PositionInComposedTree(anchor, PositionInComposedTree::PositionIsAfterChildren), toPositionInComposedTree(positionInDOMTree(*anchor, 1)));
+}
+
} // namespace blink
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698