| 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 { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(PositionInFlatTree(three->firstChild(), 1), nextVisuallyDistinctCa
ndidate(PositionInFlatTree(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 StaticElementList* items = document().querySelectorAll("li", ASSERT_NO_EXCEP
TION); | 182 StaticElementList* items = document().querySelectorAll("li", ASSERT_NO_EXCEP
TION); |
| 183 ASSERT(items->length() == 4); | 183 DCHECK_EQ(items->length(), 4u); |
| 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."; |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 | 724 |
| 725 // Edge case: specify middle of surrogate pairs. | 725 // Edge case: specify middle of surrogate pairs. |
| 726 setBodyContent("<p id='target'>👁👁👁</p>"); | 726 setBodyContent("<p id='target'>👁👁👁</p>"); |
| 727 node = document().getElementById("target")->firstChild(); | 727 node = document().getElementById("target")->firstChild(); |
| 728 EXPECT_EQ(Position(node, 4), previousPositionOf(Position(node, 5), PositionM
oveType::BackwardDeletion)); | 728 EXPECT_EQ(Position(node, 4), previousPositionOf(Position(node, 5), PositionM
oveType::BackwardDeletion)); |
| 729 EXPECT_EQ(Position(node, 2), previousPositionOf(Position(node, 3), PositionM
oveType::BackwardDeletion)); | 729 EXPECT_EQ(Position(node, 2), previousPositionOf(Position(node, 3), PositionM
oveType::BackwardDeletion)); |
| 730 EXPECT_EQ(Position(node, 0), previousPositionOf(Position(node, 1), PositionM
oveType::BackwardDeletion)); | 730 EXPECT_EQ(Position(node, 0), previousPositionOf(Position(node, 1), PositionM
oveType::BackwardDeletion)); |
| 731 } | 731 } |
| 732 | 732 |
| 733 } // namespace blink | 733 } // namespace blink |
| OLD | NEW |