| 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/VisibleUnits.h" | 5 #include "core/editing/VisibleUnits.h" |
| 6 | 6 |
| 7 #include "core/dom/Text.h" | 7 #include "core/dom/Text.h" |
| 8 #include "core/editing/EditingTestBase.h" | 8 #include "core/editing/EditingTestBase.h" |
| 9 #include "core/editing/VisiblePosition.h" | 9 #include "core/editing/VisiblePosition.h" |
| 10 #include "core/html/HTMLTextFormControlElement.h" | 10 #include "core/html/HTMLTextFormControlElement.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 { | 34 { |
| 35 return createVisiblePosition(PositionInComposedTree(&anchor, offset), affini
ty); | 35 return createVisiblePosition(PositionInComposedTree(&anchor, offset), affini
ty); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 std::ostream& operator<<(std::ostream& ostream, const InlineBoxPosition& inlineB
oxPosition) | 40 std::ostream& operator<<(std::ostream& ostream, const InlineBoxPosition& inlineB
oxPosition) |
| 41 { | 41 { |
| 42 if (!inlineBoxPosition.inlineBox) | 42 if (!inlineBoxPosition.inlineBox) |
| 43 return ostream << "null"; | 43 return ostream << "null"; |
| 44 return ostream << inlineBoxPosition.inlineBox->layoutObject().node() << "@"
<< inlineBoxPosition.offsetInBox; | 44 return ostream << inlineBoxPosition.inlineBox->lineLayoutItem().node() << "@
" << inlineBoxPosition.offsetInBox; |
| 45 } | 45 } |
| 46 | 46 |
| 47 class VisibleUnitsTest : public EditingTestBase { | 47 class VisibleUnitsTest : public EditingTestBase { |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 TEST_F(VisibleUnitsTest, absoluteCaretBoundsOf) | 50 TEST_F(VisibleUnitsTest, absoluteCaretBoundsOf) |
| 51 { | 51 { |
| 52 const char* bodyContent = "<p id='host'><b id='one'>11</b><b id='two'>22</b>
</p>"; | 52 const char* bodyContent = "<p id='host'><b id='one'>11</b><b id='two'>22</b>
</p>"; |
| 53 const char* shadowContent = "<div><content select=#two></content><content se
lect=#one></content></div>"; | 53 const char* shadowContent = "<div><content select=#two></content><content se
lect=#one></content></div>"; |
| 54 setBodyContent(bodyContent); | 54 setBodyContent(bodyContent); |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 EXPECT_EQ(PositionInComposedTree(space, 1), startOfWord(createVisiblePositio
nInComposedTree(*three, 1)).deepEquivalent()); | 1143 EXPECT_EQ(PositionInComposedTree(space, 1), startOfWord(createVisiblePositio
nInComposedTree(*three, 1)).deepEquivalent()); |
| 1144 | 1144 |
| 1145 EXPECT_EQ(Position(four, 0), startOfWord(createVisiblePositionInDOMTree(*fou
r, 1)).deepEquivalent()); | 1145 EXPECT_EQ(Position(four, 0), startOfWord(createVisiblePositionInDOMTree(*fou
r, 1)).deepEquivalent()); |
| 1146 EXPECT_EQ(PositionInComposedTree(four, 0), startOfWord(createVisiblePosition
InComposedTree(*four, 1)).deepEquivalent()); | 1146 EXPECT_EQ(PositionInComposedTree(four, 0), startOfWord(createVisiblePosition
InComposedTree(*four, 1)).deepEquivalent()); |
| 1147 | 1147 |
| 1148 EXPECT_EQ(Position(space, 1), startOfWord(createVisiblePositionInDOMTree(*fi
ve, 1)).deepEquivalent()); | 1148 EXPECT_EQ(Position(space, 1), startOfWord(createVisiblePositionInDOMTree(*fi
ve, 1)).deepEquivalent()); |
| 1149 EXPECT_EQ(PositionInComposedTree(space, 1), startOfWord(createVisiblePositio
nInComposedTree(*five, 1)).deepEquivalent()); | 1149 EXPECT_EQ(PositionInComposedTree(space, 1), startOfWord(createVisiblePositio
nInComposedTree(*five, 1)).deepEquivalent()); |
| 1150 } | 1150 } |
| 1151 | 1151 |
| 1152 } // namespace blink | 1152 } // namespace blink |
| OLD | NEW |