OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/dom/Position.h" | 6 #include "core/dom/Position.h" |
7 | 7 |
8 #include "core/editing/EditingTestBase.h" | 8 #include "core/editing/EditingTestBase.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 EXPECT_EQ(t1, PositionInComposedTree::afterNode(host).nodeAsRangeLastNode())
; | 75 EXPECT_EQ(t1, PositionInComposedTree::afterNode(host).nodeAsRangeLastNode())
; |
76 } | 76 } |
77 | 77 |
78 TEST_F(PositionTest, ToPositionInComposedTreeWithActiveInsertionPoint) | 78 TEST_F(PositionTest, ToPositionInComposedTreeWithActiveInsertionPoint) |
79 { | 79 { |
80 const char* bodyContent = "<p id='host'>00<b id='one'>11</b>22</p>"; | 80 const char* bodyContent = "<p id='host'>00<b id='one'>11</b>22</p>"; |
81 const char* shadowContent = "<a id='a'><content select=#one id='content'></c
ontent><content></content></a>"; | 81 const char* shadowContent = "<a id='a'><content select=#one id='content'></c
ontent><content></content></a>"; |
82 setBodyContent(bodyContent); | 82 setBodyContent(bodyContent); |
83 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent); | 83 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent); |
84 RefPtrWillBeRawPtr<Element> anchor = shadowRoot->getElementById("a"); | 84 RefPtrWillBeRawPtr<Element> anchor = shadowRoot->getElementById("a"); |
85 RefPtrWillBeRawPtr<Element> insertionPoint = shadowRoot->getElementById("con
tent"); | |
86 | 85 |
87 EXPECT_EQ(positionInComposedTree(*anchor, 0), toPositionInComposedTree(posit
ionInDOMTree(*anchor, 0))); | 86 EXPECT_EQ(positionInComposedTree(*anchor, 0), toPositionInComposedTree(posit
ionInDOMTree(*anchor, 0))); |
88 EXPECT_EQ(positionInComposedTree(*anchor, 1), toPositionInComposedTree(posit
ionInDOMTree(*anchor, 1))); | 87 EXPECT_EQ(positionInComposedTree(*anchor, 1), toPositionInComposedTree(posit
ionInDOMTree(*anchor, 1))); |
89 EXPECT_EQ(PositionInComposedTree(anchor, PositionInComposedTree::PositionIsA
fterChildren), toPositionInComposedTree(positionInDOMTree(*anchor, 2))); | 88 EXPECT_EQ(PositionInComposedTree(anchor, PositionInComposedTree::PositionIsA
fterChildren), toPositionInComposedTree(positionInDOMTree(*anchor, 2))); |
90 } | 89 } |
91 | 90 |
92 TEST_F(PositionTest, ToPositionInComposedTreeWithInactiveInsertionPoint) | 91 TEST_F(PositionTest, ToPositionInComposedTreeWithInactiveInsertionPoint) |
93 { | 92 { |
94 const char* bodyContent = "<p id='p'><content></content></p>"; | 93 const char* bodyContent = "<p id='p'><content></content></p>"; |
95 setBodyContent(bodyContent); | 94 setBodyContent(bodyContent); |
96 RefPtrWillBeRawPtr<Element> anchor = document().getElementById("p"); | 95 RefPtrWillBeRawPtr<Element> anchor = document().getElementById("p"); |
97 | 96 |
98 EXPECT_EQ(positionInComposedTree(*anchor, 0), toPositionInComposedTree(posit
ionInDOMTree(*anchor, 0))); | 97 EXPECT_EQ(positionInComposedTree(*anchor, 0), toPositionInComposedTree(posit
ionInDOMTree(*anchor, 0))); |
99 EXPECT_EQ(PositionInComposedTree(anchor, PositionInComposedTree::PositionIsA
fterChildren), toPositionInComposedTree(positionInDOMTree(*anchor, 1))); | 98 EXPECT_EQ(PositionInComposedTree(anchor, PositionInComposedTree::PositionIsA
fterChildren), toPositionInComposedTree(positionInDOMTree(*anchor, 1))); |
100 } | 99 } |
101 | 100 |
102 } // namespace blink | 101 } // namespace blink |
OLD | NEW |