Index: Source/core/editing/VisibleUnitsTest.cpp |
diff --git a/Source/core/editing/VisibleUnitsTest.cpp b/Source/core/editing/VisibleUnitsTest.cpp |
index 58f4b284079f9c26926828f8ab1bbf53cc9c4e85..26707c80be65c0a0600c737eaeeb8b878ab9a1f4 100644 |
--- a/Source/core/editing/VisibleUnitsTest.cpp |
+++ b/Source/core/editing/VisibleUnitsTest.cpp |
@@ -27,6 +27,24 @@ PositionInComposedTreeWithAffinity positionWithAffinityInComposedTree(Node& anch |
class VisibleUnitsTest : public EditingTestBase { |
}; |
+TEST_F(VisibleUnitsTest, absoluteCaretBoundsOf) |
+{ |
+ const char* bodyContent = "<p id='host'><b id='one'>11</b><b id='two'>22</b></p>"; |
+ const char* shadowContent = "<div><content select=#two></content><content select=#one></content></div>"; |
+ setBodyContent(bodyContent); |
+ RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host"); |
+ updateLayoutAndStyleForPainting(); |
+ |
+ RefPtrWillBeRawPtr<Element> body = document().body(); |
+ RefPtrWillBeRawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCEPTION); |
+ |
+ IntRect boundsInDOMTree = absoluteCaretBoundsOf(createVisiblePosition(Position(one.get(), 0))); |
+ IntRect boundsInComposedTree = absoluteCaretBoundsOf(createVisiblePosition(PositionInComposedTree(one.get(), 0))); |
+ |
+ EXPECT_FALSE(boundsInDOMTree.isEmpty()); |
+ EXPECT_EQ(boundsInDOMTree, boundsInComposedTree); |
+} |
+ |
TEST_F(VisibleUnitsTest, inSameLine) |
{ |
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>"; |