| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  128       "<content select=#two></content><content select=#table></content>"; |  128       "<content select=#two></content><content select=#table></content>"; | 
|  129   SetBodyContent(body_content); |  129   SetBodyContent(body_content); | 
|  130   SetShadowContent(shadow_content, "host"); |  130   SetShadowContent(shadow_content, "host"); | 
|  131   Node* host = GetDocument().getElementById("host"); |  131   Node* host = GetDocument().getElementById("host"); | 
|  132   Node* table = GetDocument().getElementById("table"); |  132   Node* table = GetDocument().getElementById("table"); | 
|  133  |  133  | 
|  134   EXPECT_EQ(table, TableElementJustBefore(VisiblePosition::AfterNode(*table))); |  134   EXPECT_EQ(table, TableElementJustBefore(VisiblePosition::AfterNode(*table))); | 
|  135   EXPECT_EQ(table, TableElementJustBefore( |  135   EXPECT_EQ(table, TableElementJustBefore( | 
|  136                        VisiblePositionInFlatTree::AfterNode(*table))); |  136                        VisiblePositionInFlatTree::AfterNode(*table))); | 
|  137  |  137  | 
|  138   EXPECT_EQ(table, |  138   EXPECT_EQ(table, TableElementJustBefore( | 
|  139             TableElementJustBefore(VisiblePosition::LastPositionInNode(table))); |  139                        VisiblePosition::LastPositionInNode(*table))); | 
|  140   EXPECT_EQ(table, TableElementJustBefore(CreateVisiblePosition( |  140   EXPECT_EQ(table, TableElementJustBefore(CreateVisiblePosition( | 
|  141                        PositionInFlatTree::LastPositionInNode(*table)))); |  141                        PositionInFlatTree::LastPositionInNode(*table)))); | 
|  142  |  142  | 
|  143   EXPECT_EQ(nullptr, |  143   EXPECT_EQ(nullptr, | 
|  144             TableElementJustBefore(CreateVisiblePosition(Position(host, 2)))); |  144             TableElementJustBefore(CreateVisiblePosition(Position(host, 2)))); | 
|  145   EXPECT_EQ(table, TableElementJustBefore( |  145   EXPECT_EQ(table, TableElementJustBefore( | 
|  146                        CreateVisiblePosition(PositionInFlatTree(host, 2)))); |  146                        CreateVisiblePosition(PositionInFlatTree(host, 2)))); | 
|  147  |  147  | 
|  148   EXPECT_EQ(nullptr, TableElementJustBefore(VisiblePosition::AfterNode(*host))); |  148   EXPECT_EQ(nullptr, TableElementJustBefore(VisiblePosition::AfterNode(*host))); | 
|  149   EXPECT_EQ(nullptr, TableElementJustBefore( |  149   EXPECT_EQ(nullptr, TableElementJustBefore( | 
|  150                          VisiblePositionInFlatTree::AfterNode(*host))); |  150                          VisiblePositionInFlatTree::AfterNode(*host))); | 
|  151  |  151  | 
|  152   EXPECT_EQ(nullptr, |  152   EXPECT_EQ(nullptr, | 
|  153             TableElementJustBefore(VisiblePosition::LastPositionInNode(host))); |  153             TableElementJustBefore(VisiblePosition::LastPositionInNode(*host))); | 
|  154   EXPECT_EQ(table, TableElementJustBefore(CreateVisiblePosition( |  154   EXPECT_EQ(table, TableElementJustBefore(CreateVisiblePosition( | 
|  155                        PositionInFlatTree::LastPositionInNode(*host)))); |  155                        PositionInFlatTree::LastPositionInNode(*host)))); | 
|  156 } |  156 } | 
|  157  |  157  | 
|  158 TEST_F(EditingUtilitiesTest, lastEditablePositionBeforePositionInRoot) { |  158 TEST_F(EditingUtilitiesTest, lastEditablePositionBeforePositionInRoot) { | 
|  159   const char* body_content = |  159   const char* body_content = | 
|  160       "<p id='host' contenteditable><b id='one'>1</b><b id='two'>22</b></p>"; |  160       "<p id='host' contenteditable><b id='one'>1</b><b id='two'>22</b></p>"; | 
|  161   const char* shadow_content = |  161   const char* shadow_content = | 
|  162       "<content select=#two></content><content select=#one></content><b " |  162       "<content select=#two></content><content select=#one></content><b " | 
|  163       "id='three'>333</b>"; |  163       "id='three'>333</b>"; | 
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  899                                PositionMoveType::kBackwardDeletion)); |  899                                PositionMoveType::kBackwardDeletion)); | 
|  900   EXPECT_EQ(Position(node, 2), |  900   EXPECT_EQ(Position(node, 2), | 
|  901             PreviousPositionOf(Position(node, 3), |  901             PreviousPositionOf(Position(node, 3), | 
|  902                                PositionMoveType::kBackwardDeletion)); |  902                                PositionMoveType::kBackwardDeletion)); | 
|  903   EXPECT_EQ(Position(node, 0), |  903   EXPECT_EQ(Position(node, 0), | 
|  904             PreviousPositionOf(Position(node, 1), |  904             PreviousPositionOf(Position(node, 1), | 
|  905                                PositionMoveType::kBackwardDeletion)); |  905                                PositionMoveType::kBackwardDeletion)); | 
|  906 } |  906 } | 
|  907  |  907  | 
|  908 }  // namespace blink |  908 }  // namespace blink | 
| OLD | NEW |