Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp

Issue 1652853002: Editing: isVisuallyEquivalentCandidate() should return false for Position with Document. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 EXPECT_TRUE(isVisuallyEquivalentCandidate(Position(one->firstChild(), 1))); 683 EXPECT_TRUE(isVisuallyEquivalentCandidate(Position(one->firstChild(), 1)));
684 684
685 EXPECT_TRUE(isVisuallyEquivalentCandidate(Position(html.get(), 0))); 685 EXPECT_TRUE(isVisuallyEquivalentCandidate(Position(html.get(), 0)));
686 EXPECT_TRUE(isVisuallyEquivalentCandidate(Position(html.get(), 1))); 686 EXPECT_TRUE(isVisuallyEquivalentCandidate(Position(html.get(), 1)));
687 EXPECT_TRUE(isVisuallyEquivalentCandidate(Position(html.get(), 2))); 687 EXPECT_TRUE(isVisuallyEquivalentCandidate(Position(html.get(), 2)));
688 688
689 EXPECT_FALSE(isVisuallyEquivalentCandidate(Position(two.get(), 0))); 689 EXPECT_FALSE(isVisuallyEquivalentCandidate(Position(two.get(), 0)));
690 EXPECT_FALSE(isVisuallyEquivalentCandidate(Position(two.get(), 1))); 690 EXPECT_FALSE(isVisuallyEquivalentCandidate(Position(two.get(), 1)));
691 } 691 }
692 692
693 TEST_F(VisibleUnitsTest, isVisuallyEquivalentCandidateWithDocument)
694 {
695 updateLayoutAndStyleForPainting();
696
697 EXPECT_FALSE(isVisuallyEquivalentCandidate(Position(&document(), 0)));
698 }
699
693 TEST_F(VisibleUnitsTest, leftPositionOf) 700 TEST_F(VisibleUnitsTest, leftPositionOf)
694 { 701 {
695 const char* bodyContent = "<b id=zero>0</b><p id=host><b id=one>1</b><b id=t wo>22</b></p><b id=three>333</b>"; 702 const char* bodyContent = "<b id=zero>0</b><p id=host><b id=one>1</b><b id=t wo>22</b></p><b id=three>333</b>";
696 const char* shadowContent = "<b id=four>4444</b><content select=#two></conte nt><content select=#one></content><b id=five>55555</b>"; 703 const char* shadowContent = "<b id=four>4444</b><content select=#two></conte nt><content select=#one></content><b id=five>55555</b>";
697 setBodyContent(bodyContent); 704 setBodyContent(bodyContent);
698 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host"); 705 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
699 updateLayoutAndStyleForPainting(); 706 updateLayoutAndStyleForPainting();
700 707
701 Element* one = document().getElementById("one"); 708 Element* one = document().getElementById("one");
702 Element* two = document().getElementById("two"); 709 Element* two = document().getElementById("two");
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 EXPECT_EQ(PositionInComposedTree(space, 1), startOfWord(createVisiblePositio nInComposedTree(*three, 1)).deepEquivalent()); 1232 EXPECT_EQ(PositionInComposedTree(space, 1), startOfWord(createVisiblePositio nInComposedTree(*three, 1)).deepEquivalent());
1226 1233
1227 EXPECT_EQ(Position(four, 0), startOfWord(createVisiblePositionInDOMTree(*fou r, 1)).deepEquivalent()); 1234 EXPECT_EQ(Position(four, 0), startOfWord(createVisiblePositionInDOMTree(*fou r, 1)).deepEquivalent());
1228 EXPECT_EQ(PositionInComposedTree(four, 0), startOfWord(createVisiblePosition InComposedTree(*four, 1)).deepEquivalent()); 1235 EXPECT_EQ(PositionInComposedTree(four, 0), startOfWord(createVisiblePosition InComposedTree(*four, 1)).deepEquivalent());
1229 1236
1230 EXPECT_EQ(Position(space, 1), startOfWord(createVisiblePositionInDOMTree(*fi ve, 1)).deepEquivalent()); 1237 EXPECT_EQ(Position(space, 1), startOfWord(createVisiblePositionInDOMTree(*fi ve, 1)).deepEquivalent());
1231 EXPECT_EQ(PositionInComposedTree(space, 1), startOfWord(createVisiblePositio nInComposedTree(*five, 1)).deepEquivalent()); 1238 EXPECT_EQ(PositionInComposedTree(space, 1), startOfWord(createVisiblePositio nInComposedTree(*five, 1)).deepEquivalent());
1232 } 1239 }
1233 1240
1234 } // namespace blink 1241 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698