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

Unified Diff: Source/core/editing/EditingUtilitiesTest.cpp

Issue 1310073006: Introduce PositionInComposedTree version of enclosingBlock() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-27T15:40:36 Created 5 years, 4 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/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditingUtilitiesTest.cpp
diff --git a/Source/core/editing/EditingUtilitiesTest.cpp b/Source/core/editing/EditingUtilitiesTest.cpp
index 17ecf820b31cbe1f3957d3b66ba23b50841f7bfc..b59de6ae640c2b9ac8576daeda2afa3a8f3bbe74 100644
--- a/Source/core/editing/EditingUtilitiesTest.cpp
+++ b/Source/core/editing/EditingUtilitiesTest.cpp
@@ -31,6 +31,21 @@ TEST_F(EditingUtilitiesTest, firstEditablePositionAfterPositionInRoot)
EXPECT_EQ(PositionInComposedTree::afterNode(host), firstEditablePositionAfterPositionInRoot(PositionInComposedTree(three, 0), host));
}
+TEST_F(EditingUtilitiesTest, enclosingBlock)
+{
+ const char* bodyContent = "<p id='host'><b id='one'>11</b></p>";
+ const char* shadowContent = "<content select=#two></content><div id='three'><content select=#one></content></div>";
+ setBodyContent(bodyContent);
+ RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
+ updateLayoutAndStyleForPainting();
+ Node* host = document().getElementById("host");
+ Node* one = document().getElementById("one");
+ Node* three = shadowRoot->getElementById("three");
+
+ EXPECT_EQ(host, enclosingBlock(Position(one, 0), CannotCrossEditingBoundary));
+ EXPECT_EQ(three, enclosingBlock(PositionInComposedTree(one, 0), CannotCrossEditingBoundary));
+}
+
TEST_F(EditingUtilitiesTest, enclosingNodeOfType)
{
const char* bodyContent = "<p id='host'><b id='one'>11</b></p>";
« no previous file with comments | « Source/core/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698