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 24 matching lines...) Expand all Loading... |
35 { | 35 { |
36 const char* bodyContent = "<p id='host'><b id='one'>11</b></p>"; | 36 const char* bodyContent = "<p id='host'><b id='one'>11</b></p>"; |
37 const char* shadowContent = "<content select=#two></content><div id='three'>
<content select=#one></div></content>"; | 37 const char* shadowContent = "<content select=#two></content><div id='three'>
<content select=#one></div></content>"; |
38 setBodyContent(bodyContent); | 38 setBodyContent(bodyContent); |
39 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent); | 39 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent); |
40 updateLayoutAndStyleForPainting(); | 40 updateLayoutAndStyleForPainting(); |
41 Node* host = document().getElementById("host"); | 41 Node* host = document().getElementById("host"); |
42 Node* one = document().getElementById("one"); | 42 Node* one = document().getElementById("one"); |
43 Node* three = shadowRoot->getElementById("three"); | 43 Node* three = shadowRoot->getElementById("three"); |
44 | 44 |
45 EXPECT_EQ(host, enclosingNodeOfType(Position(one, 0), isBlock)); | 45 EXPECT_EQ(host, enclosingNodeOfType(Position(one, 0), isEnclosingBlock)); |
46 EXPECT_EQ(three, enclosingNodeOfType(PositionInComposedTree(one, 0), isBlock
)); | 46 EXPECT_EQ(three, enclosingNodeOfType(PositionInComposedTree(one, 0), isEnclo
singBlock)); |
47 } | 47 } |
48 | 48 |
49 TEST_F(EditingUtilitiesTest, NextNodeIndex) | 49 TEST_F(EditingUtilitiesTest, NextNodeIndex) |
50 { | 50 { |
51 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</
b>33</p>"; | 51 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</
b>33</p>"; |
52 const char* shadowContent = "<content select=#two></content><content select=
#one></content>"; | 52 const char* shadowContent = "<content select=#two></content><content select=
#one></content>"; |
53 setBodyContent(bodyContent); | 53 setBodyContent(bodyContent); |
54 setShadowContent(shadowContent); | 54 setShadowContent(shadowContent); |
55 Node* host = document().getElementById("host"); | 55 Node* host = document().getElementById("host"); |
56 Node* two = document().getElementById("two"); | 56 Node* two = document().getElementById("two"); |
(...skipping 11 matching lines...) Expand all Loading... |
68 updateLayoutAndStyleForPainting(); | 68 updateLayoutAndStyleForPainting(); |
69 Node* one = document().getElementById("one"); | 69 Node* one = document().getElementById("one"); |
70 Node* two = document().getElementById("two"); | 70 Node* two = document().getElementById("two"); |
71 Node* three = document().getElementById("three"); | 71 Node* three = document().getElementById("three"); |
72 | 72 |
73 EXPECT_EQ(Position(two->firstChild(), 1), nextVisuallyDistinctCandidate(Posi
tion(one, 1))); | 73 EXPECT_EQ(Position(two->firstChild(), 1), nextVisuallyDistinctCandidate(Posi
tion(one, 1))); |
74 EXPECT_EQ(PositionInComposedTree(three->firstChild(), 1), nextVisuallyDistin
ctCandidate(PositionInComposedTree(one, 1))); | 74 EXPECT_EQ(PositionInComposedTree(three->firstChild(), 1), nextVisuallyDistin
ctCandidate(PositionInComposedTree(one, 1))); |
75 } | 75 } |
76 | 76 |
77 } // namespace blink | 77 } // namespace blink |
OLD | NEW |