| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/editing/VisibleUnits.h" | 6 #include "core/editing/VisibleUnits.h" |
| 7 | 7 |
| 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 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 PositionWithAffinity positionWithAffinityInDOMTree(Node& anchor, int offset, EAf
finity affinity = DOWNSTREAM) | 15 PositionWithAffinity positionWithAffinityInDOMTree(Node& anchor, int offset, Tex
tAffinity affinity = TextAffinity::Downstream) |
| 16 { | 16 { |
| 17 return PositionWithAffinity(canonicalPositionOf(Position(&anchor, offset)),
affinity); | 17 return PositionWithAffinity(canonicalPositionOf(Position(&anchor, offset)),
affinity); |
| 18 } | 18 } |
| 19 | 19 |
| 20 PositionInComposedTreeWithAffinity positionWithAffinityInComposedTree(Node& anch
or, int offset, EAffinity affinity = DOWNSTREAM) | 20 PositionInComposedTreeWithAffinity positionWithAffinityInComposedTree(Node& anch
or, int offset, TextAffinity affinity = TextAffinity::Downstream) |
| 21 { | 21 { |
| 22 return PositionInComposedTreeWithAffinity(canonicalPositionOf(PositionInComp
osedTree(&anchor, offset)), affinity); | 22 return PositionInComposedTreeWithAffinity(canonicalPositionOf(PositionInComp
osedTree(&anchor, offset)), affinity); |
| 23 } | 23 } |
| 24 | 24 |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 class VisibleUnitsTest : public EditingTestBase { | 27 class VisibleUnitsTest : public EditingTestBase { |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 TEST_F(VisibleUnitsTest, inSameLine) | 30 TEST_F(VisibleUnitsTest, inSameLine) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 setBodyContent(bodyContent); | 69 setBodyContent(bodyContent); |
| 70 updateLayoutAndStyleForPainting(); | 70 updateLayoutAndStyleForPainting(); |
| 71 RefPtrWillBeRawPtr<Element> sample1 = document().getElementById("sample1"); | 71 RefPtrWillBeRawPtr<Element> sample1 = document().getElementById("sample1"); |
| 72 RefPtrWillBeRawPtr<Element> sample2 = document().getElementById("sample2"); | 72 RefPtrWillBeRawPtr<Element> sample2 = document().getElementById("sample2"); |
| 73 | 73 |
| 74 EXPECT_FALSE(rendersInDifferentPosition(Position::afterNode(sample1->firstCh
ild()), Position(sample2->firstChild(), 0))); | 74 EXPECT_FALSE(rendersInDifferentPosition(Position::afterNode(sample1->firstCh
ild()), Position(sample2->firstChild(), 0))); |
| 75 EXPECT_FALSE(rendersInDifferentPosition(Position::lastPositionInNode(sample1
->firstChild()), Position(sample2->firstChild(), 0))); | 75 EXPECT_FALSE(rendersInDifferentPosition(Position::lastPositionInNode(sample1
->firstChild()), Position(sample2->firstChild(), 0))); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace blink | 78 } // namespace blink |
| OLD | NEW |