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 "core/editing/EditingUtilities.h" | 5 #include "core/editing/EditingUtilities.h" |
6 | 6 |
7 #include "core/dom/StaticNodeList.h" | 7 #include "core/dom/StaticNodeList.h" |
8 #include "core/editing/EditingTestBase.h" | 8 #include "core/editing/EditingTestBase.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class EditingUtilitiesTest : public EditingTestBase { | 12 class EditingUtilitiesTest : public EditingTestBase { |
13 }; | 13 }; |
14 | 14 |
15 TEST_F(EditingUtilitiesTest, directionOfEnclosingBlock) | 15 TEST_F(EditingUtilitiesTest, directionOfEnclosingBlock) |
16 { | 16 { |
17 const char* bodyContent = "<p id='host'><b id='one'></b><b id='two'>22</b></
p>"; | 17 const char* bodyContent = "<p id='host'><b id='one'></b><b id='two'>22</b></
p>"; |
18 const char* shadowContent = "<content select=#two></content><p dir=rtl><cont
ent select=#one></content><p>"; | 18 const char* shadowContent = "<content select=#two></content><p dir=rtl><cont
ent select=#one></content><p>"; |
19 setBodyContent(bodyContent); | 19 setBodyContent(bodyContent); |
20 setShadowContent(shadowContent, "host"); | 20 setShadowContent(shadowContent, "host"); |
21 updateLayoutAndStyleForPainting(); | 21 updateLayoutAndStyleForPainting(); |
22 Node* one = document().getElementById("one"); | 22 Node* one = document().getElementById("one"); |
23 | 23 |
24 EXPECT_EQ(LTR, directionOfEnclosingBlock(Position(one, 0))); | 24 EXPECT_EQ(LTR, directionOfEnclosingBlock(Position(one, 0))); |
25 EXPECT_EQ(RTL, directionOfEnclosingBlock(PositionInComposedTree(one, 0))); | 25 EXPECT_EQ(RTL, directionOfEnclosingBlock(PositionInFlatTree(one, 0))); |
26 } | 26 } |
27 | 27 |
28 TEST_F(EditingUtilitiesTest, firstEditablePositionAfterPositionInRoot) | 28 TEST_F(EditingUtilitiesTest, firstEditablePositionAfterPositionInRoot) |
29 { | 29 { |
30 const char* bodyContent = "<p id='host' contenteditable><b id='one'>1</b><b
id='two'>22</b></p>"; | 30 const char* bodyContent = "<p id='host' contenteditable><b id='one'>1</b><b
id='two'>22</b></p>"; |
31 const char* shadowContent = "<content select=#two></content><content select=
#one></content><b id='three'>333</b>"; | 31 const char* shadowContent = "<content select=#two></content><content select=
#one></content><b id='three'>333</b>"; |
32 setBodyContent(bodyContent); | 32 setBodyContent(bodyContent); |
33 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent,
"host"); | 33 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent,
"host"); |
34 updateLayoutAndStyleForPainting(); | 34 updateLayoutAndStyleForPainting(); |
35 Element* host = document().getElementById("host"); | 35 Element* host = document().getElementById("host"); |
36 Node* one = document().getElementById("one"); | 36 Node* one = document().getElementById("one"); |
37 Node* two = document().getElementById("two"); | 37 Node* two = document().getElementById("two"); |
38 Node* three = shadowRoot->getElementById("three"); | 38 Node* three = shadowRoot->getElementById("three"); |
39 | 39 |
40 EXPECT_EQ(Position(one, 0), firstEditablePositionAfterPositionInRoot(Positio
n(one, 0), *host)); | 40 EXPECT_EQ(Position(one, 0), firstEditablePositionAfterPositionInRoot(Positio
n(one, 0), *host)); |
41 EXPECT_EQ(Position(one->firstChild(), 0), firstEditableVisiblePositionAfterP
ositionInRoot(Position(one, 0), *host).deepEquivalent()); | 41 EXPECT_EQ(Position(one->firstChild(), 0), firstEditableVisiblePositionAfterP
ositionInRoot(Position(one, 0), *host).deepEquivalent()); |
42 | 42 |
43 EXPECT_EQ(PositionInComposedTree(one, 0), firstEditablePositionAfterPosition
InRoot(PositionInComposedTree(one, 0), *host)); | 43 EXPECT_EQ(PositionInFlatTree(one, 0), firstEditablePositionAfterPositionInRo
ot(PositionInFlatTree(one, 0), *host)); |
44 EXPECT_EQ(PositionInComposedTree(two->firstChild(), 2), firstEditableVisible
PositionAfterPositionInRoot(PositionInComposedTree(one, 0), *host).deepEquivalen
t()); | 44 EXPECT_EQ(PositionInFlatTree(two->firstChild(), 2), firstEditableVisiblePosi
tionAfterPositionInRoot(PositionInFlatTree(one, 0), *host).deepEquivalent()); |
45 | 45 |
46 EXPECT_EQ(Position::firstPositionInNode(host), firstEditablePositionAfterPos
itionInRoot(Position(three, 0), *host)); | 46 EXPECT_EQ(Position::firstPositionInNode(host), firstEditablePositionAfterPos
itionInRoot(Position(three, 0), *host)); |
47 EXPECT_EQ(Position(one->firstChild(), 0), firstEditableVisiblePositionAfterP
ositionInRoot(Position(three, 0), *host).deepEquivalent()); | 47 EXPECT_EQ(Position(one->firstChild(), 0), firstEditableVisiblePositionAfterP
ositionInRoot(Position(three, 0), *host).deepEquivalent()); |
48 EXPECT_EQ(PositionInComposedTree::afterNode(host), firstEditablePositionAfte
rPositionInRoot(PositionInComposedTree(three, 0), *host)); | 48 EXPECT_EQ(PositionInFlatTree::afterNode(host), firstEditablePositionAfterPos
itionInRoot(PositionInFlatTree(three, 0), *host)); |
49 EXPECT_EQ(PositionInComposedTree::lastPositionInNode(host), firstEditableVis
iblePositionAfterPositionInRoot(PositionInComposedTree(three, 0), *host).deepEqu
ivalent()); | 49 EXPECT_EQ(PositionInFlatTree::lastPositionInNode(host), firstEditableVisible
PositionAfterPositionInRoot(PositionInFlatTree(three, 0), *host).deepEquivalent(
)); |
50 } | 50 } |
51 | 51 |
52 TEST_F(EditingUtilitiesTest, enclosingBlock) | 52 TEST_F(EditingUtilitiesTest, enclosingBlock) |
53 { | 53 { |
54 const char* bodyContent = "<p id='host'><b id='one'>11</b></p>"; | 54 const char* bodyContent = "<p id='host'><b id='one'>11</b></p>"; |
55 const char* shadowContent = "<content select=#two></content><div id='three'>
<content select=#one></content></div>"; | 55 const char* shadowContent = "<content select=#two></content><div id='three'>
<content select=#one></content></div>"; |
56 setBodyContent(bodyContent); | 56 setBodyContent(bodyContent); |
57 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent,
"host"); | 57 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent,
"host"); |
58 updateLayoutAndStyleForPainting(); | 58 updateLayoutAndStyleForPainting(); |
59 Node* host = document().getElementById("host"); | 59 Node* host = document().getElementById("host"); |
60 Node* one = document().getElementById("one"); | 60 Node* one = document().getElementById("one"); |
61 Node* three = shadowRoot->getElementById("three"); | 61 Node* three = shadowRoot->getElementById("three"); |
62 | 62 |
63 EXPECT_EQ(host, enclosingBlock(Position(one, 0), CannotCrossEditingBoundary)
); | 63 EXPECT_EQ(host, enclosingBlock(Position(one, 0), CannotCrossEditingBoundary)
); |
64 EXPECT_EQ(three, enclosingBlock(PositionInComposedTree(one, 0), CannotCrossE
ditingBoundary)); | 64 EXPECT_EQ(three, enclosingBlock(PositionInFlatTree(one, 0), CannotCrossEditi
ngBoundary)); |
65 } | 65 } |
66 | 66 |
67 TEST_F(EditingUtilitiesTest, enclosingNodeOfType) | 67 TEST_F(EditingUtilitiesTest, enclosingNodeOfType) |
68 { | 68 { |
69 const char* bodyContent = "<p id='host'><b id='one'>11</b></p>"; | 69 const char* bodyContent = "<p id='host'><b id='one'>11</b></p>"; |
70 const char* shadowContent = "<content select=#two></content><div id='three'>
<content select=#one></div></content>"; | 70 const char* shadowContent = "<content select=#two></content><div id='three'>
<content select=#one></div></content>"; |
71 setBodyContent(bodyContent); | 71 setBodyContent(bodyContent); |
72 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent,
"host"); | 72 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent,
"host"); |
73 updateLayoutAndStyleForPainting(); | 73 updateLayoutAndStyleForPainting(); |
74 Node* host = document().getElementById("host"); | 74 Node* host = document().getElementById("host"); |
75 Node* one = document().getElementById("one"); | 75 Node* one = document().getElementById("one"); |
76 Node* three = shadowRoot->getElementById("three"); | 76 Node* three = shadowRoot->getElementById("three"); |
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(PositionInFlatTree(one, 0), isEnclosing
Block)); |
80 } | 80 } |
81 | 81 |
82 TEST_F(EditingUtilitiesTest, isEditablePositionWithTable) | 82 TEST_F(EditingUtilitiesTest, isEditablePositionWithTable) |
83 { | 83 { |
84 // We would like to have below DOM tree without HTML, HEAD and BODY element. | 84 // We would like to have below DOM tree without HTML, HEAD and BODY element. |
85 // <table id=table><caption>foo</caption></table> | 85 // <table id=table><caption>foo</caption></table> |
86 // However, |setBodyContent()| automatically creates HTML, HEAD and BODY | 86 // However, |setBodyContent()| automatically creates HTML, HEAD and BODY |
87 // element. So, we build DOM tree manually. | 87 // element. So, we build DOM tree manually. |
88 // Note: This is unusual HTML taken from http://crbug.com/574230 | 88 // Note: This is unusual HTML taken from http://crbug.com/574230 |
89 RefPtrWillBeRawPtr<Element> table = document().createElement("table", ASSERT
_NO_EXCEPTION); | 89 RefPtrWillBeRawPtr<Element> table = document().createElement("table", ASSERT
_NO_EXCEPTION); |
(...skipping 11 matching lines...) Expand all Loading... |
101 { | 101 { |
102 const char* bodyContent = "<div contenteditable id=host><table id=table><tr>
<td>1</td></tr></table><b id=two>22</b></div>"; | 102 const char* bodyContent = "<div contenteditable id=host><table id=table><tr>
<td>1</td></tr></table><b id=two>22</b></div>"; |
103 const char* shadowContent = "<content select=#two></content><content select=
#table></content>"; | 103 const char* shadowContent = "<content select=#two></content><content select=
#table></content>"; |
104 setBodyContent(bodyContent); | 104 setBodyContent(bodyContent); |
105 setShadowContent(shadowContent, "host"); | 105 setShadowContent(shadowContent, "host"); |
106 updateLayoutAndStyleForPainting(); | 106 updateLayoutAndStyleForPainting(); |
107 Node* host = document().getElementById("host"); | 107 Node* host = document().getElementById("host"); |
108 Node* table = document().getElementById("table"); | 108 Node* table = document().getElementById("table"); |
109 | 109 |
110 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::a
fterNode(table)))); | 110 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::a
fterNode(table)))); |
111 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInC
omposedTree::afterNode(table)))); | 111 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInF
latTree::afterNode(table)))); |
112 | 112 |
113 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::l
astPositionInNode(table)))); | 113 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::l
astPositionInNode(table)))); |
114 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInC
omposedTree::lastPositionInNode(table)))); | 114 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInF
latTree::lastPositionInNode(table)))); |
115 | 115 |
116 EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(Position(
host, 2)))); | 116 EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(Position(
host, 2)))); |
117 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInC
omposedTree(host, 2)))); | 117 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInF
latTree(host, 2)))); |
118 | 118 |
119 EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(Position:
:afterNode(host)))); | 119 EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(Position:
:afterNode(host)))); |
120 EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(PositionI
nComposedTree::afterNode(host)))); | 120 EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(PositionI
nFlatTree::afterNode(host)))); |
121 | 121 |
122 EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(Position:
:lastPositionInNode(host)))); | 122 EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(Position:
:lastPositionInNode(host)))); |
123 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInC
omposedTree::lastPositionInNode(host)))); | 123 EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInF
latTree::lastPositionInNode(host)))); |
124 } | 124 } |
125 | 125 |
126 TEST_F(EditingUtilitiesTest, lastEditablePositionBeforePositionInRoot) | 126 TEST_F(EditingUtilitiesTest, lastEditablePositionBeforePositionInRoot) |
127 { | 127 { |
128 const char* bodyContent = "<p id='host' contenteditable><b id='one'>1</b><b
id='two'>22</b></p>"; | 128 const char* bodyContent = "<p id='host' contenteditable><b id='one'>1</b><b
id='two'>22</b></p>"; |
129 const char* shadowContent = "<content select=#two></content><content select=
#one></content><b id='three'>333</b>"; | 129 const char* shadowContent = "<content select=#two></content><content select=
#one></content><b id='three'>333</b>"; |
130 setBodyContent(bodyContent); | 130 setBodyContent(bodyContent); |
131 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent,
"host"); | 131 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent,
"host"); |
132 updateLayoutAndStyleForPainting(); | 132 updateLayoutAndStyleForPainting(); |
133 Element* host = document().getElementById("host"); | 133 Element* host = document().getElementById("host"); |
134 Node* one = document().getElementById("one"); | 134 Node* one = document().getElementById("one"); |
135 Node* two = document().getElementById("two"); | 135 Node* two = document().getElementById("two"); |
136 Node* three = shadowRoot->getElementById("three"); | 136 Node* three = shadowRoot->getElementById("three"); |
137 | 137 |
138 EXPECT_EQ(Position(one, 0), lastEditablePositionBeforePositionInRoot(Positio
n(one, 0), *host)); | 138 EXPECT_EQ(Position(one, 0), lastEditablePositionBeforePositionInRoot(Positio
n(one, 0), *host)); |
139 EXPECT_EQ(Position(one->firstChild(), 0), lastEditableVisiblePositionBeforeP
ositionInRoot(Position(one, 0), *host).deepEquivalent()); | 139 EXPECT_EQ(Position(one->firstChild(), 0), lastEditableVisiblePositionBeforeP
ositionInRoot(Position(one, 0), *host).deepEquivalent()); |
140 | 140 |
141 EXPECT_EQ(PositionInComposedTree(one, 0), lastEditablePositionBeforePosition
InRoot(PositionInComposedTree(one, 0), *host)); | 141 EXPECT_EQ(PositionInFlatTree(one, 0), lastEditablePositionBeforePositionInRo
ot(PositionInFlatTree(one, 0), *host)); |
142 EXPECT_EQ(PositionInComposedTree(two->firstChild(), 2), lastEditableVisibleP
ositionBeforePositionInRoot(PositionInComposedTree(one, 0), *host).deepEquivalen
t()); | 142 EXPECT_EQ(PositionInFlatTree(two->firstChild(), 2), lastEditableVisiblePosit
ionBeforePositionInRoot(PositionInFlatTree(one, 0), *host).deepEquivalent()); |
143 | 143 |
144 EXPECT_EQ(Position::firstPositionInNode(host), lastEditablePositionBeforePos
itionInRoot(Position(three, 0), *host)); | 144 EXPECT_EQ(Position::firstPositionInNode(host), lastEditablePositionBeforePos
itionInRoot(Position(three, 0), *host)); |
145 EXPECT_EQ(Position(one->firstChild(), 0), lastEditableVisiblePositionBeforeP
ositionInRoot(Position(three, 0), *host).deepEquivalent()); | 145 EXPECT_EQ(Position(one->firstChild(), 0), lastEditableVisiblePositionBeforeP
ositionInRoot(Position(three, 0), *host).deepEquivalent()); |
146 EXPECT_EQ(PositionInComposedTree::firstPositionInNode(host), lastEditablePos
itionBeforePositionInRoot(PositionInComposedTree(three, 0), *host)); | 146 EXPECT_EQ(PositionInFlatTree::firstPositionInNode(host), lastEditablePositio
nBeforePositionInRoot(PositionInFlatTree(three, 0), *host)); |
147 EXPECT_EQ(PositionInComposedTree(two->firstChild(), 0), lastEditableVisibleP
ositionBeforePositionInRoot(PositionInComposedTree(three, 0), *host).deepEquival
ent()); | 147 EXPECT_EQ(PositionInFlatTree(two->firstChild(), 0), lastEditableVisiblePosit
ionBeforePositionInRoot(PositionInFlatTree(three, 0), *host).deepEquivalent()); |
148 } | 148 } |
149 | 149 |
150 TEST_F(EditingUtilitiesTest, NextNodeIndex) | 150 TEST_F(EditingUtilitiesTest, NextNodeIndex) |
151 { | 151 { |
152 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</
b>33</p>"; | 152 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</
b>33</p>"; |
153 const char* shadowContent = "<content select=#two></content><content select=
#one></content>"; | 153 const char* shadowContent = "<content select=#two></content><content select=
#one></content>"; |
154 setBodyContent(bodyContent); | 154 setBodyContent(bodyContent); |
155 setShadowContent(shadowContent, "host"); | 155 setShadowContent(shadowContent, "host"); |
156 Node* host = document().getElementById("host"); | 156 Node* host = document().getElementById("host"); |
157 Node* two = document().getElementById("two"); | 157 Node* two = document().getElementById("two"); |
158 | 158 |
159 EXPECT_EQ(Position(host, 3), nextPositionOf(Position(two, 2), PositionMoveTy
pe::CodePoint)); | 159 EXPECT_EQ(Position(host, 3), nextPositionOf(Position(two, 2), PositionMoveTy
pe::CodePoint)); |
160 EXPECT_EQ(PositionInComposedTree(host, 1), nextPositionOf(PositionInComposed
Tree(two, 2), PositionMoveType::CodePoint)); | 160 EXPECT_EQ(PositionInFlatTree(host, 1), nextPositionOf(PositionInFlatTree(two
, 2), PositionMoveType::CodePoint)); |
161 } | 161 } |
162 | 162 |
163 TEST_F(EditingUtilitiesTest, NextVisuallyDistinctCandidate) | 163 TEST_F(EditingUtilitiesTest, NextVisuallyDistinctCandidate) |
164 { | 164 { |
165 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</
b><b id='three'>33</b></p>"; | 165 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</
b><b id='three'>33</b></p>"; |
166 const char* shadowContent = "<content select=#two></content><content select=
#one></content><content select=#three></content>"; | 166 const char* shadowContent = "<content select=#two></content><content select=
#one></content><content select=#three></content>"; |
167 setBodyContent(bodyContent); | 167 setBodyContent(bodyContent); |
168 setShadowContent(shadowContent, "host"); | 168 setShadowContent(shadowContent, "host"); |
169 updateLayoutAndStyleForPainting(); | 169 updateLayoutAndStyleForPainting(); |
170 Node* one = document().getElementById("one"); | 170 Node* one = document().getElementById("one"); |
171 Node* two = document().getElementById("two"); | 171 Node* two = document().getElementById("two"); |
172 Node* three = document().getElementById("three"); | 172 Node* three = document().getElementById("three"); |
173 | 173 |
174 EXPECT_EQ(Position(two->firstChild(), 1), nextVisuallyDistinctCandidate(Posi
tion(one, 1))); | 174 EXPECT_EQ(Position(two->firstChild(), 1), nextVisuallyDistinctCandidate(Posi
tion(one, 1))); |
175 EXPECT_EQ(PositionInComposedTree(three->firstChild(), 1), nextVisuallyDistin
ctCandidate(PositionInComposedTree(one, 1))); | 175 EXPECT_EQ(PositionInFlatTree(three->firstChild(), 1), nextVisuallyDistinctCa
ndidate(PositionInFlatTree(one, 1))); |
176 } | 176 } |
177 | 177 |
178 TEST_F(EditingUtilitiesTest, AreaIdenticalElements) | 178 TEST_F(EditingUtilitiesTest, AreaIdenticalElements) |
179 { | 179 { |
180 setBodyContent("<style>li:nth-child(even) { -webkit-user-modify: read-write;
}</style><ul><li>first item</li><li>second item</li><li class=foo>third</li><li
>fourth</li></ul>"); | 180 setBodyContent("<style>li:nth-child(even) { -webkit-user-modify: read-write;
}</style><ul><li>first item</li><li>second item</li><li class=foo>third</li><li
>fourth</li></ul>"); |
181 updateLayoutAndStyleForPainting(); | 181 updateLayoutAndStyleForPainting(); |
182 RefPtrWillBeRawPtr<StaticElementList> items = document().querySelectorAll("l
i", ASSERT_NO_EXCEPTION); | 182 RefPtrWillBeRawPtr<StaticElementList> items = document().querySelectorAll("l
i", ASSERT_NO_EXCEPTION); |
183 ASSERT(items->length() == 4); | 183 ASSERT(items->length() == 4); |
184 | 184 |
185 EXPECT_FALSE(areIdenticalElements(*items->item(0)->firstChild(), *items->ite
m(1)->firstChild())) | 185 EXPECT_FALSE(areIdenticalElements(*items->item(0)->firstChild(), *items->ite
m(1)->firstChild())) |
186 << "Can't merge non-elements. e.g. Text nodes"; | 186 << "Can't merge non-elements. e.g. Text nodes"; |
187 | 187 |
188 // Compare a LI and a UL. | 188 // Compare a LI and a UL. |
189 EXPECT_FALSE(areIdenticalElements(*items->item(0), *items->item(0)->parentNo
de())) | 189 EXPECT_FALSE(areIdenticalElements(*items->item(0), *items->item(0)->parentNo
de())) |
190 << "Can't merge different tag names."; | 190 << "Can't merge different tag names."; |
191 | 191 |
192 EXPECT_FALSE(areIdenticalElements(*items->item(0), *items->item(2))) | 192 EXPECT_FALSE(areIdenticalElements(*items->item(0), *items->item(2))) |
193 << "Can't merge a element with no attributes and another element with an
attribute."; | 193 << "Can't merge a element with no attributes and another element with an
attribute."; |
194 | 194 |
195 // We can't use contenteditable attribute to make editability difference | 195 // We can't use contenteditable attribute to make editability difference |
196 // because the hasEquivalentAttributes check is done earier. | 196 // because the hasEquivalentAttributes check is done earier. |
197 EXPECT_FALSE(areIdenticalElements(*items->item(0), *items->item(1))) | 197 EXPECT_FALSE(areIdenticalElements(*items->item(0), *items->item(1))) |
198 << "Can't merge non-editable nodes."; | 198 << "Can't merge non-editable nodes."; |
199 | 199 |
200 EXPECT_TRUE(areIdenticalElements(*items->item(1), *items->item(3))); | 200 EXPECT_TRUE(areIdenticalElements(*items->item(1), *items->item(3))); |
201 } | 201 } |
202 | 202 |
203 } // namespace blink | 203 } // namespace blink |
OLD | NEW |