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

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

Issue 1326323002: Introduce composed tree version of endOfParagraph() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-08T18:03:54 Created 5 years, 3 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/VisibleUnits.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/VisibleUnitsTest.cpp
diff --git a/Source/core/editing/VisibleUnitsTest.cpp b/Source/core/editing/VisibleUnitsTest.cpp
index b353f78d5a77adf138ec9897b2d9bdd433cd2e95..7ab1afcfa5054e4fd1b50b15cc7a08c67ca26820 100644
--- a/Source/core/editing/VisibleUnitsTest.cpp
+++ b/Source/core/editing/VisibleUnitsTest.cpp
@@ -74,6 +74,25 @@ TEST_F(VisibleUnitsTest, characterAfter)
EXPECT_EQ('1', characterAfter(createVisiblePositionInComposedTree(*two->firstChild(), 2)));
}
+TEST_F(VisibleUnitsTest, endOfParagraph)
+{
+ const char* bodyContent = "<a id=host><b id=one>1</b><b id=two>22</b></a><b id=three>333</b>";
+ const char* shadowContent = "<p><content select=#two></content></p><p><content select=#one></content></p>";
+ setBodyContent(bodyContent);
+ setShadowContent(shadowContent, "host");
+ updateLayoutAndStyleForPainting();
+
+ Element* one = document().getElementById("one");
+ Element* two = document().getElementById("two");
+ Element* three = document().getElementById("three");
+
+ EXPECT_EQ(Position(three->firstChild(), 3), endOfParagraph(createVisiblePositionInDOMTree(*one->firstChild(), 1)).deepEquivalent());
+ EXPECT_EQ(PositionInComposedTree(one->firstChild(), 1), endOfParagraph(createVisiblePositionInComposedTree(*one->firstChild(), 1)).deepEquivalent());
+
+ EXPECT_EQ(Position(three->firstChild(), 3), endOfParagraph(createVisiblePositionInDOMTree(*two->firstChild(), 2)).deepEquivalent());
+ EXPECT_EQ(PositionInComposedTree(two->firstChild(), 2), endOfParagraph(createVisiblePositionInComposedTree(*two->firstChild(), 2)).deepEquivalent());
+}
+
TEST_F(VisibleUnitsTest, inSameLine)
{
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
« no previous file with comments | « Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698