| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 EXPECT_EQ(three, | 100 EXPECT_EQ(three, |
| 101 enclosingNodeOfType(PositionInFlatTree(one, 0), isEnclosingBlock)); | 101 enclosingNodeOfType(PositionInFlatTree(one, 0), isEnclosingBlock)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 TEST_F(EditingUtilitiesTest, isEditablePositionWithTable) { | 104 TEST_F(EditingUtilitiesTest, isEditablePositionWithTable) { |
| 105 // We would like to have below DOM tree without HTML, HEAD and BODY element. | 105 // We would like to have below DOM tree without HTML, HEAD and BODY element. |
| 106 // <table id=table><caption>foo</caption></table> | 106 // <table id=table><caption>foo</caption></table> |
| 107 // However, |setBodyContent()| automatically creates HTML, HEAD and BODY | 107 // However, |setBodyContent()| automatically creates HTML, HEAD and BODY |
| 108 // element. So, we build DOM tree manually. | 108 // element. So, we build DOM tree manually. |
| 109 // Note: This is unusual HTML taken from http://crbug.com/574230 | 109 // Note: This is unusual HTML taken from http://crbug.com/574230 |
| 110 Element* table = document().createElement("table", ASSERT_NO_EXCEPTION); | 110 Element* table = document().createElement("table"); |
| 111 table->setInnerHTML("<caption>foo</caption>", ASSERT_NO_EXCEPTION); | 111 table->setInnerHTML("<caption>foo</caption>", ASSERT_NO_EXCEPTION); |
| 112 while (document().firstChild()) | 112 while (document().firstChild()) |
| 113 document().firstChild()->remove(); | 113 document().firstChild()->remove(); |
| 114 document().appendChild(table); | 114 document().appendChild(table); |
| 115 document().setDesignMode("on"); | 115 document().setDesignMode("on"); |
| 116 updateAllLifecyclePhases(); | 116 updateAllLifecyclePhases(); |
| 117 | 117 |
| 118 EXPECT_FALSE(isEditablePosition(Position(table, 0))); | 118 EXPECT_FALSE(isEditablePosition(Position(table, 0))); |
| 119 } | 119 } |
| 120 | 120 |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 PositionMoveType::BackwardDeletion)); | 897 PositionMoveType::BackwardDeletion)); |
| 898 EXPECT_EQ(Position(node, 2), | 898 EXPECT_EQ(Position(node, 2), |
| 899 previousPositionOf(Position(node, 3), | 899 previousPositionOf(Position(node, 3), |
| 900 PositionMoveType::BackwardDeletion)); | 900 PositionMoveType::BackwardDeletion)); |
| 901 EXPECT_EQ(Position(node, 0), | 901 EXPECT_EQ(Position(node, 0), |
| 902 previousPositionOf(Position(node, 1), | 902 previousPositionOf(Position(node, 1), |
| 903 PositionMoveType::BackwardDeletion)); | 903 PositionMoveType::BackwardDeletion)); |
| 904 } | 904 } |
| 905 | 905 |
| 906 } // namespace blink | 906 } // namespace blink |
| OLD | NEW |