Index: Source/core/editing/VisibleUnitsTest.cpp |
diff --git a/Source/core/editing/VisibleUnitsTest.cpp b/Source/core/editing/VisibleUnitsTest.cpp |
index dd10dad9ce2131072af40c01a4b186bcef36c200..041612b1dc7ced0fd16b831ff92c386f93f364cb 100644 |
--- a/Source/core/editing/VisibleUnitsTest.cpp |
+++ b/Source/core/editing/VisibleUnitsTest.cpp |
@@ -52,6 +52,16 @@ TEST_F(VisibleUnitsTest, inSameLine) |
EXPECT_TRUE(inSameLine(positionWithAffinityInComposedTree(*two->firstChild(), 0), positionWithAffinityInComposedTree(*four->firstChild(), 0))); |
} |
+TEST_F(VisibleUnitsTest, localCaretRectOfPosition) |
yoichio
2015/08/25 05:24:31
What does this test test?
yosin_UTC9
2015/08/25 09:23:48
Checks DOM tree version and composed tree version
yosin_UTC9
2015/08/25 09:46:08
Oops, my brain was damaged.
I put expectation into
|
+{ |
+ const char* bodyContent = "<p id='host'><b id='one'>1</b></p><b id='two'>22</b>"; |
+ const char* shadowContent = "<b id='two'>22</b><content select=#one></content><b id='three'>333</b>"; |
+ setBodyContent(bodyContent); |
+ setShadowContent(shadowContent); |
+ updateLayoutAndStyleForPainting(); |
+ |
+} |
+ |
TEST_F(VisibleUnitsTest, mostBackwardCaretPositionAfterAnchor) |
{ |
const char* bodyContent = "<p id='host'><b id='one'>1</b></p><b id='two'>22</b>"; |
@@ -60,10 +70,16 @@ TEST_F(VisibleUnitsTest, mostBackwardCaretPositionAfterAnchor) |
setShadowContent(shadowContent); |
updateLayoutAndStyleForPainting(); |
- RefPtrWillBeRawPtr<Element> host = document().getElementById("host"); |
+ RefPtrWillBeRawPtr<Element> one = document().getElementById("one"); |
+ |
+ LayoutObject* layoutObjectFromDOMTree; |
+ LayoutRect layoutRectFromDOMTree = localCaretRectOfPosition(Position(one, 0), layoutObjectFromDOMTree); |
+ |
+ LayoutObject* layoutObjectFromComposedTree; |
+ LayoutRect layoutRectFromComposedTree = localCaretRectOfPosition(PositionInComposedTree(one, 0), layoutObjectFromComposedTree); |
- EXPECT_EQ(Position::lastPositionInNode(host.get()), mostForwardCaretPosition(Position::afterNode(host.get()))); |
- EXPECT_EQ(PositionInComposedTree::lastPositionInNode(host.get()), mostForwardCaretPosition(PositionInComposedTree::afterNode(host.get()))); |
+ EXPECT_EQ(layoutObjectFromDOMTree, layoutObjectFromComposedTree); |
+ EXPECT_EQ(layoutRectFromDOMTree, layoutRectFromComposedTree); |
} |
TEST_F(VisibleUnitsTest, mostForwardCaretPositionAfterAnchor) |