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/editing/EditingUtilities.h" | 6 #include "core/editing/EditingUtilities.h" |
7 | 7 |
8 #include "core/editing/EditingTestBase.h" | 8 #include "core/editing/EditingTestBase.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 EXPECT_EQ(host, enclosingNodeOfType(Position(one, 0), isEnclosingBlock)); | 78 EXPECT_EQ(host, enclosingNodeOfType(Position(one, 0), isEnclosingBlock)); |
79 EXPECT_EQ(three, enclosingNodeOfType(PositionInComposedTree(one, 0), isEnclo
singBlock)); | 79 EXPECT_EQ(three, enclosingNodeOfType(PositionInComposedTree(one, 0), isEnclo
singBlock)); |
80 } | 80 } |
81 | 81 |
82 TEST_F(EditingUtilitiesTest, isFirstPositionAfterTable) | 82 TEST_F(EditingUtilitiesTest, isFirstPositionAfterTable) |
83 { | 83 { |
84 const char* bodyContent = "<div contenteditable id=host><table id=table><tr>
<td>1</td></tr></table><b id=two>22</b></div>"; | 84 const char* bodyContent = "<div contenteditable id=host><table id=table><tr>
<td>1</td></tr></table><b id=two>22</b></div>"; |
85 const char* shadowContent = "<content select=#two></content><content select=
#table></content>"; | 85 const char* shadowContent = "<content select=#two></content><content select=
#table></content>"; |
86 setBodyContent(bodyContent); | 86 setBodyContent(bodyContent); |
87 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent,
"host"); | 87 setShadowContent(shadowContent, "host"); |
88 updateLayoutAndStyleForPainting(); | 88 updateLayoutAndStyleForPainting(); |
89 Node* host = document().getElementById("host"); | 89 Node* host = document().getElementById("host"); |
90 Node* table = document().getElementById("table"); | 90 Node* table = document().getElementById("table"); |
91 | 91 |
92 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::a
fterNode(table)))); | 92 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::a
fterNode(table)))); |
93 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInC
omposedTree::afterNode(table)))); | 93 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInC
omposedTree::afterNode(table)))); |
94 | 94 |
95 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::l
astPositionInNode(table)))); | 95 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::l
astPositionInNode(table)))); |
96 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInC
omposedTree::lastPositionInNode(table)))); | 96 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInC
omposedTree::lastPositionInNode(table)))); |
97 | 97 |
(...skipping 29 matching lines...) Expand all Loading... |
127 updateLayoutAndStyleForPainting(); | 127 updateLayoutAndStyleForPainting(); |
128 Node* one = document().getElementById("one"); | 128 Node* one = document().getElementById("one"); |
129 Node* two = document().getElementById("two"); | 129 Node* two = document().getElementById("two"); |
130 Node* three = document().getElementById("three"); | 130 Node* three = document().getElementById("three"); |
131 | 131 |
132 EXPECT_EQ(Position(two->firstChild(), 1), nextVisuallyDistinctCandidate(Posi
tion(one, 1))); | 132 EXPECT_EQ(Position(two->firstChild(), 1), nextVisuallyDistinctCandidate(Posi
tion(one, 1))); |
133 EXPECT_EQ(PositionInComposedTree(three->firstChild(), 1), nextVisuallyDistin
ctCandidate(PositionInComposedTree(one, 1))); | 133 EXPECT_EQ(PositionInComposedTree(three->firstChild(), 1), nextVisuallyDistin
ctCandidate(PositionInComposedTree(one, 1))); |
134 } | 134 } |
135 | 135 |
136 } // namespace blink | 136 } // namespace blink |
OLD | NEW |