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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/VisibleSelection.h" 5 #include "core/editing/VisibleSelection.h"
6 6
7 #include "core/dom/Range.h" 7 #include "core/dom/Range.h"
8 #include "core/editing/EditingTestBase.h" 8 #include "core/editing/EditingTestBase.h"
9 9
10 #define LOREM_IPSUM \ 10 #define LOREM_IPSUM \
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 EXPECT_EQ(selection.end(), toPositionInDOMTree(selectionInFlatTree.end())); 45 EXPECT_EQ(selection.end(), toPositionInDOMTree(selectionInFlatTree.end()));
46 EXPECT_EQ(selection.base(), toPositionInDOMTree(selectionInFlatTree.base())) ; 46 EXPECT_EQ(selection.base(), toPositionInDOMTree(selectionInFlatTree.base())) ;
47 EXPECT_EQ(selection.extent(), toPositionInDOMTree(selectionInFlatTree.extent ())); 47 EXPECT_EQ(selection.extent(), toPositionInDOMTree(selectionInFlatTree.extent ()));
48 } 48 }
49 49
50 TEST_F(VisibleSelectionTest, expandUsingGranularity) 50 TEST_F(VisibleSelectionTest, expandUsingGranularity)
51 { 51 {
52 const char* bodyContent = "<span id=host><a id=one>1</a><a id=two>22</a></sp an>"; 52 const char* bodyContent = "<span id=host><a id=one>1</a><a id=two>22</a></sp an>";
53 const char* shadowContent = "<p><b id=three>333</b><content select=#two></co ntent><b id=four>4444</b><span id=space> </span><content select=#one></content> <b id=five>55555</b></p>"; 53 const char* shadowContent = "<p><b id=three>333</b><content select=#two></co ntent><b id=four>4444</b><span id=space> </span><content select=#one></content> <b id=five>55555</b></p>";
54 setBodyContent(bodyContent); 54 setBodyContent(bodyContent);
55 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host"); 55 RawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
56 updateLayoutAndStyleForPainting(); 56 updateLayoutAndStyleForPainting();
57 57
58 Node* one = document().getElementById("one")->firstChild(); 58 Node* one = document().getElementById("one")->firstChild();
59 Node* two = document().getElementById("two")->firstChild(); 59 Node* two = document().getElementById("two")->firstChild();
60 Node* three = shadowRoot->getElementById("three")->firstChild(); 60 Node* three = shadowRoot->getElementById("three")->firstChild();
61 Node* four = shadowRoot->getElementById("four")->firstChild(); 61 Node* four = shadowRoot->getElementById("four")->firstChild();
62 Node* five = shadowRoot->getElementById("five")->firstChild(); 62 Node* five = shadowRoot->getElementById("five")->firstChild();
63 63
64 VisibleSelection selection; 64 VisibleSelection selection;
65 VisibleSelectionInFlatTree selectionInFlatTree; 65 VisibleSelectionInFlatTree selectionInFlatTree;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 VisibleSelection selection; 152 VisibleSelection selection;
153 VisibleSelectionInFlatTree selectionInFlatTree; 153 VisibleSelectionInFlatTree selectionInFlatTree;
154 setSelection(selection, 0); 154 setSelection(selection, 0);
155 setSelection(selectionInFlatTree, 0); 155 setSelection(selectionInFlatTree, 0);
156 156
157 EXPECT_FALSE(selection.isNone()); 157 EXPECT_FALSE(selection.isNone());
158 EXPECT_FALSE(selectionInFlatTree.isNone()); 158 EXPECT_FALSE(selectionInFlatTree.isNone());
159 EXPECT_TRUE(selection.isCaret()); 159 EXPECT_TRUE(selection.isCaret());
160 EXPECT_TRUE(selectionInFlatTree.isCaret()); 160 EXPECT_TRUE(selectionInFlatTree.isCaret());
161 161
162 RefPtrWillBeRawPtr<Range> range = firstRangeOf(selection); 162 RawPtr<Range> range = firstRangeOf(selection);
163 EXPECT_EQ(0, range->startOffset()); 163 EXPECT_EQ(0, range->startOffset());
164 EXPECT_EQ(0, range->endOffset()); 164 EXPECT_EQ(0, range->endOffset());
165 EXPECT_EQ("", range->text()); 165 EXPECT_EQ("", range->text());
166 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFlatTre e); 166 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFlatTre e);
167 } 167 }
168 168
169 TEST_F(VisibleSelectionTest, ShadowCrossing) 169 TEST_F(VisibleSelectionTest, ShadowCrossing)
170 { 170 {
171 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>"; 171 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>";
172 const char* shadowContent = "<a><span id='s4'>44</span><content select=#two> </content><span id='s5'>55</span><content select=#one></content><span id='s6'>66 </span></a>"; 172 const char* shadowContent = "<a><span id='s4'>44</span><content select=#two> </content><span id='s5'>55</span><content select=#one></content><span id='s6'>66 </span></a>";
173 setBodyContent(bodyContent); 173 setBodyContent(bodyContent);
174 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host"); 174 RawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
175 175
176 RefPtrWillBeRawPtr<Element> body = document().body(); 176 RawPtr<Element> body = document().body();
177 RefPtrWillBeRawPtr<Element> host = body->querySelector("#host", ASSERT_NO_EX CEPTION); 177 RawPtr<Element> host = body->querySelector("#host", ASSERT_NO_EXCEPTION);
178 RefPtrWillBeRawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCE PTION); 178 RawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCEPTION);
179 RefPtrWillBeRawPtr<Element> six = shadowRoot->querySelector("#s6", ASSERT_NO _EXCEPTION); 179 RawPtr<Element> six = shadowRoot->querySelector("#s6", ASSERT_NO_EXCEPTION);
180 180
181 VisibleSelection selection(Position::firstPositionInNode(one.get()), Positio n::lastPositionInNode(shadowRoot.get())); 181 VisibleSelection selection(Position::firstPositionInNode(one.get()), Positio n::lastPositionInNode(shadowRoot.get()));
182 VisibleSelectionInFlatTree selectionInFlatTree(PositionInFlatTree::firstPosi tionInNode(one.get()), PositionInFlatTree::lastPositionInNode(host.get())); 182 VisibleSelectionInFlatTree selectionInFlatTree(PositionInFlatTree::firstPosi tionInNode(one.get()), PositionInFlatTree::lastPositionInNode(host.get()));
183 183
184 EXPECT_EQ(Position(host.get(), PositionAnchorType::BeforeAnchor), selection. start()); 184 EXPECT_EQ(Position(host.get(), PositionAnchorType::BeforeAnchor), selection. start());
185 EXPECT_EQ(Position(one->firstChild(), 0), selection.end()); 185 EXPECT_EQ(Position(one->firstChild(), 0), selection.end());
186 EXPECT_EQ(PositionInFlatTree(one->firstChild(), 0), selectionInFlatTree.star t()); 186 EXPECT_EQ(PositionInFlatTree(one->firstChild(), 0), selectionInFlatTree.star t());
187 EXPECT_EQ(PositionInFlatTree(six->firstChild(), 2), selectionInFlatTree.end( )); 187 EXPECT_EQ(PositionInFlatTree(six->firstChild(), 2), selectionInFlatTree.end( ));
188 } 188 }
189 189
190 TEST_F(VisibleSelectionTest, ShadowV0DistributedNodes) 190 TEST_F(VisibleSelectionTest, ShadowV0DistributedNodes)
191 { 191 {
192 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>"; 192 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>";
193 const char* shadowContent = "<a><span id='s4'>44</span><content select=#two> </content><span id='s5'>55</span><content select=#one></content><span id='s6'>66 </span></a>"; 193 const char* shadowContent = "<a><span id='s4'>44</span><content select=#two> </content><span id='s5'>55</span><content select=#one></content><span id='s6'>66 </span></a>";
194 setBodyContent(bodyContent); 194 setBodyContent(bodyContent);
195 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host"); 195 RawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
196 196
197 RefPtrWillBeRawPtr<Element> body = document().body(); 197 RawPtr<Element> body = document().body();
198 RefPtrWillBeRawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCE PTION); 198 RawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCEPTION);
199 RefPtrWillBeRawPtr<Element> two = body->querySelector("#two", ASSERT_NO_EXCE PTION); 199 RawPtr<Element> two = body->querySelector("#two", ASSERT_NO_EXCEPTION);
200 RefPtrWillBeRawPtr<Element> five = shadowRoot->querySelector("#s5", ASSERT_N O_EXCEPTION); 200 RawPtr<Element> five = shadowRoot->querySelector("#s5", ASSERT_NO_EXCEPTION) ;
201 201
202 VisibleSelection selection(Position::firstPositionInNode(one.get()), Positio n::lastPositionInNode(two.get())); 202 VisibleSelection selection(Position::firstPositionInNode(one.get()), Positio n::lastPositionInNode(two.get()));
203 VisibleSelectionInFlatTree selectionInFlatTree(PositionInFlatTree::firstPosi tionInNode(one.get()), PositionInFlatTree::lastPositionInNode(two.get())); 203 VisibleSelectionInFlatTree selectionInFlatTree(PositionInFlatTree::firstPosi tionInNode(one.get()), PositionInFlatTree::lastPositionInNode(two.get()));
204 204
205 EXPECT_EQ(Position(one->firstChild(), 0), selection.start()); 205 EXPECT_EQ(Position(one->firstChild(), 0), selection.start());
206 EXPECT_EQ(Position(two->firstChild(), 2), selection.end()); 206 EXPECT_EQ(Position(two->firstChild(), 2), selection.end());
207 EXPECT_EQ(PositionInFlatTree(five->firstChild(), 0), selectionInFlatTree.sta rt()); 207 EXPECT_EQ(PositionInFlatTree(five->firstChild(), 0), selectionInFlatTree.sta rt());
208 EXPECT_EQ(PositionInFlatTree(five->firstChild(), 2), selectionInFlatTree.end ()); 208 EXPECT_EQ(PositionInFlatTree(five->firstChild(), 2), selectionInFlatTree.end ());
209 } 209 }
210 210
211 TEST_F(VisibleSelectionTest, ShadowNested) 211 TEST_F(VisibleSelectionTest, ShadowNested)
212 { 212 {
213 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>"; 213 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>";
214 const char* shadowContent = "<a><span id='s4'>44</span><content select=#two> </content><span id='s5'>55</span><content select=#one></content><span id='s6'>66 </span></a>"; 214 const char* shadowContent = "<a><span id='s4'>44</span><content select=#two> </content><span id='s5'>55</span><content select=#one></content><span id='s6'>66 </span></a>";
215 const char* shadowContent2 = "<span id='s7'>77</span><content></content><spa n id='s8'>88</span>"; 215 const char* shadowContent2 = "<span id='s7'>77</span><content></content><spa n id='s8'>88</span>";
216 setBodyContent(bodyContent); 216 setBodyContent(bodyContent);
217 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host"); 217 RawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
218 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot2 = createShadowRootForElementWithI DAndSetInnerHTML(*shadowRoot, "s5", shadowContent2); 218 RawPtr<ShadowRoot> shadowRoot2 = createShadowRootForElementWithIDAndSetInner HTML(*shadowRoot, "s5", shadowContent2);
219 219
220 // Flat tree is something like below: 220 // Flat tree is something like below:
221 // <p id="host"> 221 // <p id="host">
222 // <span id="s4">44</span> 222 // <span id="s4">44</span>
223 // <b id="two">22</b> 223 // <b id="two">22</b>
224 // <span id="s5"><span id="s7">77>55</span id="s8">88</span> 224 // <span id="s5"><span id="s7">77>55</span id="s8">88</span>
225 // <b id="one">11</b> 225 // <b id="one">11</b>
226 // <span id="s6">66</span> 226 // <span id="s6">66</span>
227 // </p> 227 // </p>
228 RefPtrWillBeRawPtr<Element> body = document().body(); 228 RawPtr<Element> body = document().body();
229 RefPtrWillBeRawPtr<Element> host = body->querySelector("#host", ASSERT_NO_EX CEPTION); 229 RawPtr<Element> host = body->querySelector("#host", ASSERT_NO_EXCEPTION);
230 RefPtrWillBeRawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCE PTION); 230 RawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCEPTION);
231 RefPtrWillBeRawPtr<Element> eight = shadowRoot2->querySelector("#s8", ASSERT _NO_EXCEPTION); 231 RawPtr<Element> eight = shadowRoot2->querySelector("#s8", ASSERT_NO_EXCEPTIO N);
232 232
233 VisibleSelection selection(Position::firstPositionInNode(one.get()), Positio n::lastPositionInNode(shadowRoot2.get())); 233 VisibleSelection selection(Position::firstPositionInNode(one.get()), Positio n::lastPositionInNode(shadowRoot2.get()));
234 VisibleSelectionInFlatTree selectionInFlatTree(PositionInFlatTree::firstPosi tionInNode(one.get()), PositionInFlatTree::afterNode(eight.get())); 234 VisibleSelectionInFlatTree selectionInFlatTree(PositionInFlatTree::firstPosi tionInNode(one.get()), PositionInFlatTree::afterNode(eight.get()));
235 235
236 EXPECT_EQ(Position(host.get(), PositionAnchorType::BeforeAnchor), selection. start()); 236 EXPECT_EQ(Position(host.get(), PositionAnchorType::BeforeAnchor), selection. start());
237 EXPECT_EQ(Position(one->firstChild(), 0), selection.end()); 237 EXPECT_EQ(Position(one->firstChild(), 0), selection.end());
238 EXPECT_EQ(PositionInFlatTree(eight->firstChild(), 2), selectionInFlatTree.st art()); 238 EXPECT_EQ(PositionInFlatTree(eight->firstChild(), 2), selectionInFlatTree.st art());
239 EXPECT_EQ(PositionInFlatTree(eight->firstChild(), 2), selectionInFlatTree.en d()); 239 EXPECT_EQ(PositionInFlatTree(eight->firstChild(), 2), selectionInFlatTree.en d());
240 } 240 }
241 241
242 TEST_F(VisibleSelectionTest, WordGranularity) 242 TEST_F(VisibleSelectionTest, WordGranularity)
243 { 243 {
244 setBodyContent(LOREM_IPSUM); 244 setBodyContent(LOREM_IPSUM);
245 245
246 VisibleSelection selection; 246 VisibleSelection selection;
247 VisibleSelectionInFlatTree selectionInFlatTree; 247 VisibleSelectionInFlatTree selectionInFlatTree;
248 248
249 // Beginning of a word. 249 // Beginning of a word.
250 { 250 {
251 setSelection(selection, 0); 251 setSelection(selection, 0);
252 setSelection(selectionInFlatTree, 0); 252 setSelection(selectionInFlatTree, 0);
253 selection.expandUsingGranularity(WordGranularity); 253 selection.expandUsingGranularity(WordGranularity);
254 selectionInFlatTree.expandUsingGranularity(WordGranularity); 254 selectionInFlatTree.expandUsingGranularity(WordGranularity);
255 255
256 RefPtrWillBeRawPtr<Range> range = firstRangeOf(selection); 256 RawPtr<Range> range = firstRangeOf(selection);
257 EXPECT_EQ(0, range->startOffset()); 257 EXPECT_EQ(0, range->startOffset());
258 EXPECT_EQ(5, range->endOffset()); 258 EXPECT_EQ(5, range->endOffset());
259 EXPECT_EQ("Lorem", range->text()); 259 EXPECT_EQ("Lorem", range->text());
260 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree); 260 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree);
261 261
262 } 262 }
263 263
264 // Middle of a word. 264 // Middle of a word.
265 { 265 {
266 setSelection(selection, 8); 266 setSelection(selection, 8);
267 setSelection(selectionInFlatTree, 8); 267 setSelection(selectionInFlatTree, 8);
268 selection.expandUsingGranularity(WordGranularity); 268 selection.expandUsingGranularity(WordGranularity);
269 selectionInFlatTree.expandUsingGranularity(WordGranularity); 269 selectionInFlatTree.expandUsingGranularity(WordGranularity);
270 270
271 RefPtrWillBeRawPtr<Range> range = firstRangeOf(selection); 271 RawPtr<Range> range = firstRangeOf(selection);
272 EXPECT_EQ(6, range->startOffset()); 272 EXPECT_EQ(6, range->startOffset());
273 EXPECT_EQ(11, range->endOffset()); 273 EXPECT_EQ(11, range->endOffset());
274 EXPECT_EQ("ipsum", range->text()); 274 EXPECT_EQ("ipsum", range->text());
275 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree); 275 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree);
276 276
277 } 277 }
278 278
279 // End of a word. 279 // End of a word.
280 // FIXME: that sounds buggy, we might want to select the word _before_ inste ad 280 // FIXME: that sounds buggy, we might want to select the word _before_ inste ad
281 // of the space... 281 // of the space...
282 { 282 {
283 setSelection(selection, 5); 283 setSelection(selection, 5);
284 setSelection(selectionInFlatTree, 5); 284 setSelection(selectionInFlatTree, 5);
285 selection.expandUsingGranularity(WordGranularity); 285 selection.expandUsingGranularity(WordGranularity);
286 selectionInFlatTree.expandUsingGranularity(WordGranularity); 286 selectionInFlatTree.expandUsingGranularity(WordGranularity);
287 287
288 RefPtrWillBeRawPtr<Range> range = firstRangeOf(selection); 288 RawPtr<Range> range = firstRangeOf(selection);
289 EXPECT_EQ(5, range->startOffset()); 289 EXPECT_EQ(5, range->startOffset());
290 EXPECT_EQ(6, range->endOffset()); 290 EXPECT_EQ(6, range->endOffset());
291 EXPECT_EQ(" ", range->text()); 291 EXPECT_EQ(" ", range->text());
292 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree); 292 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree);
293 } 293 }
294 294
295 // Before comma. 295 // Before comma.
296 // FIXME: that sounds buggy, we might want to select the word _before_ inste ad 296 // FIXME: that sounds buggy, we might want to select the word _before_ inste ad
297 // of the comma. 297 // of the comma.
298 { 298 {
299 setSelection(selection, 26); 299 setSelection(selection, 26);
300 setSelection(selectionInFlatTree, 26); 300 setSelection(selectionInFlatTree, 26);
301 selection.expandUsingGranularity(WordGranularity); 301 selection.expandUsingGranularity(WordGranularity);
302 selectionInFlatTree.expandUsingGranularity(WordGranularity); 302 selectionInFlatTree.expandUsingGranularity(WordGranularity);
303 303
304 RefPtrWillBeRawPtr<Range> range = firstRangeOf(selection); 304 RawPtr<Range> range = firstRangeOf(selection);
305 EXPECT_EQ(26, range->startOffset()); 305 EXPECT_EQ(26, range->startOffset());
306 EXPECT_EQ(27, range->endOffset()); 306 EXPECT_EQ(27, range->endOffset());
307 EXPECT_EQ(",", range->text()); 307 EXPECT_EQ(",", range->text());
308 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree); 308 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree);
309 } 309 }
310 310
311 // After comma. 311 // After comma.
312 { 312 {
313 setSelection(selection, 27); 313 setSelection(selection, 27);
314 setSelection(selectionInFlatTree, 27); 314 setSelection(selectionInFlatTree, 27);
315 selection.expandUsingGranularity(WordGranularity); 315 selection.expandUsingGranularity(WordGranularity);
316 selectionInFlatTree.expandUsingGranularity(WordGranularity); 316 selectionInFlatTree.expandUsingGranularity(WordGranularity);
317 317
318 RefPtrWillBeRawPtr<Range> range = firstRangeOf(selection); 318 RawPtr<Range> range = firstRangeOf(selection);
319 EXPECT_EQ(27, range->startOffset()); 319 EXPECT_EQ(27, range->startOffset());
320 EXPECT_EQ(28, range->endOffset()); 320 EXPECT_EQ(28, range->endOffset());
321 EXPECT_EQ(" ", range->text()); 321 EXPECT_EQ(" ", range->text());
322 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree); 322 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree);
323 } 323 }
324 324
325 // When selecting part of a word. 325 // When selecting part of a word.
326 { 326 {
327 setSelection(selection, 0, 1); 327 setSelection(selection, 0, 1);
328 setSelection(selectionInFlatTree, 0, 1); 328 setSelection(selectionInFlatTree, 0, 1);
329 selection.expandUsingGranularity(WordGranularity); 329 selection.expandUsingGranularity(WordGranularity);
330 selectionInFlatTree.expandUsingGranularity(WordGranularity); 330 selectionInFlatTree.expandUsingGranularity(WordGranularity);
331 331
332 RefPtrWillBeRawPtr<Range> range = firstRangeOf(selection); 332 RawPtr<Range> range = firstRangeOf(selection);
333 EXPECT_EQ(0, range->startOffset()); 333 EXPECT_EQ(0, range->startOffset());
334 EXPECT_EQ(5, range->endOffset()); 334 EXPECT_EQ(5, range->endOffset());
335 EXPECT_EQ("Lorem", range->text()); 335 EXPECT_EQ("Lorem", range->text());
336 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree); 336 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree);
337 } 337 }
338 338
339 // When selecting part of two words. 339 // When selecting part of two words.
340 { 340 {
341 setSelection(selection, 2, 8); 341 setSelection(selection, 2, 8);
342 setSelection(selectionInFlatTree, 2, 8); 342 setSelection(selectionInFlatTree, 2, 8);
343 selection.expandUsingGranularity(WordGranularity); 343 selection.expandUsingGranularity(WordGranularity);
344 selectionInFlatTree.expandUsingGranularity(WordGranularity); 344 selectionInFlatTree.expandUsingGranularity(WordGranularity);
345 345
346 RefPtrWillBeRawPtr<Range> range = firstRangeOf(selection); 346 RawPtr<Range> range = firstRangeOf(selection);
347 EXPECT_EQ(0, range->startOffset()); 347 EXPECT_EQ(0, range->startOffset());
348 EXPECT_EQ(11, range->endOffset()); 348 EXPECT_EQ(11, range->endOffset());
349 EXPECT_EQ("Lorem ipsum", range->text()); 349 EXPECT_EQ("Lorem ipsum", range->text());
350 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree); 350 testFlatTreePositionsToEqualToDOMTreePositions(selection, selectionInFla tTree);
351 } 351 }
352 } 352 }
353 353
354 } // namespace blink 354 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698