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

Side by Side Diff: Source/core/editing/EditingUtilitiesTest.cpp

Issue 1303163006: Introduce composed tree version of directionOfEnclosingBlock() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T10:50:05 Created 5 years, 3 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
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 "config.h" 5 #include "config.h"
6 #include "core/editing/EditingUtilities.h" 6 #include "core/editing/EditingUtilities.h"
7 7
8 #include "core/editing/EditingTestBase.h" 8 #include "core/editing/EditingTestBase.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 class EditingUtilitiesTest : public EditingTestBase { 12 class EditingUtilitiesTest : public EditingTestBase {
13 }; 13 };
14 14
15 TEST_F(EditingUtilitiesTest, directionOfEnclosingBlock)
16 {
17 const char* bodyContent = "<p id='host'><b id='one'></b><b id='two'>22</b></ p>";
18 const char* shadowContent = "<content select=#two></content><p dir=rtl><cont ent select=#one></content><p>";
19 setBodyContent(bodyContent);
20 setShadowContent(shadowContent);
21 updateLayoutAndStyleForPainting();
22 Node* one = document().getElementById("one");
23
24 EXPECT_EQ(LTR, directionOfEnclosingBlock(Position(one, 0)));
25 EXPECT_EQ(RTL, directionOfEnclosingBlock(PositionInComposedTree(one, 0)));
26 }
27
15 TEST_F(EditingUtilitiesTest, firstEditablePositionAfterPositionInRoot) 28 TEST_F(EditingUtilitiesTest, firstEditablePositionAfterPositionInRoot)
16 { 29 {
17 const char* bodyContent = "<p id='host' contenteditable><b id='one'></b><b i d='two'>22</b></p>"; 30 const char* bodyContent = "<p id='host' contenteditable><b id='one'></b><b i d='two'>22</b></p>";
18 const char* shadowContent = "<content select=#two></content><content select= #one></content><b id='three'>333</b>"; 31 const char* shadowContent = "<content select=#two></content><content select= #one></content><b id='three'>333</b>";
19 setBodyContent(bodyContent); 32 setBodyContent(bodyContent);
20 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent); 33 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
21 updateLayoutAndStyleForPainting(); 34 updateLayoutAndStyleForPainting();
22 Node* host = document().getElementById("host"); 35 Node* host = document().getElementById("host");
23 Node* one = document().getElementById("one"); 36 Node* one = document().getElementById("one");
24 Node* three = shadowRoot->getElementById("three"); 37 Node* three = shadowRoot->getElementById("three");
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 updateLayoutAndStyleForPainting(); 96 updateLayoutAndStyleForPainting();
84 Node* one = document().getElementById("one"); 97 Node* one = document().getElementById("one");
85 Node* two = document().getElementById("two"); 98 Node* two = document().getElementById("two");
86 Node* three = document().getElementById("three"); 99 Node* three = document().getElementById("three");
87 100
88 EXPECT_EQ(Position(two->firstChild(), 1), nextVisuallyDistinctCandidate(Posi tion(one, 1))); 101 EXPECT_EQ(Position(two->firstChild(), 1), nextVisuallyDistinctCandidate(Posi tion(one, 1)));
89 EXPECT_EQ(PositionInComposedTree(three->firstChild(), 1), nextVisuallyDistin ctCandidate(PositionInComposedTree(one, 1))); 102 EXPECT_EQ(PositionInComposedTree(three->firstChild(), 1), nextVisuallyDistin ctCandidate(PositionInComposedTree(one, 1)));
90 } 103 }
91 104
92 } // namespace blink 105 } // namespace blink
OLDNEW
« Source/core/editing/EditingUtilities.cpp ('K') | « Source/core/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698