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

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

Issue 2939023003: Reduce indentation in TraverseInternalAlgorithm() for {Left,Right}PositionOf() (Closed)
Patch Set: 2017-06-16T18:40:17 Created 3 years, 6 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 | « no previous file | 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 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 line_layout_item = box->GetLineLayoutItem(); 335 line_layout_item = box->GetLineLayoutItem();
336 offset = Traversal::CaretEndOffsetOf(*box); 336 offset = Traversal::CaretEndOffsetOf(*box);
337 if (box->BidiLevel() > level) { 337 if (box->BidiLevel() > level) {
338 do { 338 do {
339 prev_box = Traversal::ForwardLeafChildOf(*prev_box); 339 prev_box = Traversal::ForwardLeafChildOf(*prev_box);
340 } while (prev_box && prev_box->BidiLevel() > level); 340 } while (prev_box && prev_box->BidiLevel() > level);
341 341
342 if (!prev_box || prev_box->BidiLevel() < level) 342 if (!prev_box || prev_box->BidiLevel() < level)
343 continue; 343 continue;
344 } 344 }
345 } else { 345 break;
346 // Trailing edge of a secondary run. Set to the leading edge of
347 // the entire run.
348 while (true) {
349 box = Traversal::FindBackwardBoundaryOfEntireBidiRun(*box, level);
350 if (box->BidiLevel() == level)
351 break;
352 level = box->BidiLevel();
353 box = Traversal::FindForwardBoundaryOfEntireBidiRun(*box, level);
354 if (box->BidiLevel() == level)
355 break;
356 level = box->BidiLevel();
357 }
358 line_layout_item = box->GetLineLayoutItem();
359 offset = Traversal::CaretMinOffsetOf(primary_direction, *box);
360 } 346 }
347 // Trailing edge of a secondary run. Set to the leading edge of
348 // the entire run.
349 while (true) {
350 box = Traversal::FindBackwardBoundaryOfEntireBidiRun(*box, level);
351 if (box->BidiLevel() == level)
352 break;
353 level = box->BidiLevel();
354 box = Traversal::FindForwardBoundaryOfEntireBidiRun(*box, level);
355 if (box->BidiLevel() == level)
356 break;
357 level = box->BidiLevel();
358 }
359 line_layout_item = box->GetLineLayoutItem();
360 offset = Traversal::CaretMinOffsetOf(primary_direction, *box);
361 break; 361 break;
362 } 362 }
363 363
364 p = PositionTemplate<Strategy>::EditingPositionOf( 364 p = PositionTemplate<Strategy>::EditingPositionOf(
365 line_layout_item.GetNode(), offset); 365 line_layout_item.GetNode(), offset);
366 366
367 if ((IsVisuallyEquivalentCandidate(p) && 367 if ((IsVisuallyEquivalentCandidate(p) &&
368 MostForwardCaretPosition(p) != downstream_start) || 368 MostForwardCaretPosition(p) != downstream_start) ||
369 p.AtStartOfTree() || p.AtEndOfTree()) 369 p.AtStartOfTree() || p.AtEndOfTree())
370 return p; 370 return p;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 411 }
412 412
413 VisiblePositionInFlatTree RightPositionOf( 413 VisiblePositionInFlatTree RightPositionOf(
414 const VisiblePositionInFlatTree& visible_position) { 414 const VisiblePositionInFlatTree& visible_position) {
415 return TraverseAlgorithm<EditingInFlatTreeStrategy, 415 return TraverseAlgorithm<EditingInFlatTreeStrategy,
416 TraversalRight<EditingInFlatTreeStrategy>>( 416 TraversalRight<EditingInFlatTreeStrategy>>(
417 visible_position); 417 visible_position);
418 } 418 }
419 419
420 } // namespace blink 420 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698