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

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

Issue 1328113005: Introduce composed tree version of characterAfter() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-07T18:55:16 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 520ecd6c8cc362b9f18833eab0b7d8f94da2779c..83d154b677878533e39de674d757412afbee04e4 100644
--- a/Source/core/editing/VisibleUnitsTest.cpp
+++ b/Source/core/editing/VisibleUnitsTest.cpp
@@ -55,6 +55,24 @@ TEST_F(VisibleUnitsTest, absoluteCaretBoundsOf)
EXPECT_EQ(boundsInDOMTree, boundsInComposedTree);
}
+TEST_F(VisibleUnitsTest, characterAfter)
+{
+ const char* bodyContent = "<p id='host'><b id='one'>1</b><b id='two'>22</b></p><b id='three'>333</b>";
+ const char* shadowContent = "<b id='four'>4444</b><content select=#two></content><content select=#one></content><b id='five'>5555</b>";
+ setBodyContent(bodyContent);
+ setShadowContent(shadowContent, "host");
+ updateLayoutAndStyleForPainting();
+
+ RefPtrWillBeRawPtr<Element> one = document().getElementById("one");
+ RefPtrWillBeRawPtr<Element> two = document().getElementById("two");
+
+ EXPECT_EQ('2', characterAfter(createVisiblePositionInDOMTree(*one->firstChild(), 1)));
+ EXPECT_EQ('5', characterAfter(createVisiblePositionInComposedTree(*one->firstChild(), 1)));
+
+ EXPECT_EQ(0, characterAfter(createVisiblePositionInDOMTree(*two->firstChild(), 2)));
+ EXPECT_EQ('1', characterAfter(createVisiblePositionInComposedTree(*two->firstChild(), 2)));
+}
+
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