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

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

Issue 1321033002: Introduce {left,right}PositionOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T21:59:15 Rebase after merge failure 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
« no previous file with comments | « Source/core/editing/VisiblePosition.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 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.dee pEquivalent()); 369 TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.dee pEquivalent());
370 InlineBox* previouslyVisitedBox = 0; 370 InlineBox* previouslyVisitedBox = 0;
371 VisiblePosition current = visiblePosition; 371 VisiblePosition current = visiblePosition;
372 TextBreakIterator* iter = 0; 372 TextBreakIterator* iter = 0;
373 373
374 CachedLogicallyOrderedLeafBoxes leafBoxes; 374 CachedLogicallyOrderedLeafBoxes leafBoxes;
375 Vector<UChar, 1024> string; 375 Vector<UChar, 1024> string;
376 376
377 while (1) { 377 while (1) {
378 VisiblePosition adjacentCharacterPosition = direction == MoveRight ? cur rent.right() : current.left(); 378 VisiblePosition adjacentCharacterPosition = direction == MoveRight ? rig htPositionOf(current) : leftPositionOf(current);
379 if (adjacentCharacterPosition.deepEquivalent() == current.deepEquivalent () || adjacentCharacterPosition.isNull()) 379 if (adjacentCharacterPosition.deepEquivalent() == current.deepEquivalent () || adjacentCharacterPosition.isNull())
380 return VisiblePosition(); 380 return VisiblePosition();
381 381
382 InlineBoxPosition boxPosition = computeInlineBoxPosition(adjacentCharact erPosition.deepEquivalent(), TextAffinity::Upstream); 382 InlineBoxPosition boxPosition = computeInlineBoxPosition(adjacentCharact erPosition.deepEquivalent(), TextAffinity::Upstream);
383 InlineBox* box = boxPosition.inlineBox; 383 InlineBox* box = boxPosition.inlineBox;
384 int offsetInBox = boxPosition.offsetInBox; 384 int offsetInBox = boxPosition.offsetInBox;
385 385
386 if (!box) 386 if (!box)
387 break; 387 break;
388 if (!box->isInlineTextBox()) { 388 if (!box->isInlineTextBox()) {
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 { 2331 {
2332 return isVisuallyEquivalentCandidateAlgorithm<EditingStrategy>(position); 2332 return isVisuallyEquivalentCandidateAlgorithm<EditingStrategy>(position);
2333 } 2333 }
2334 2334
2335 bool isVisuallyEquivalentCandidate(const PositionInComposedTree& position) 2335 bool isVisuallyEquivalentCandidate(const PositionInComposedTree& position)
2336 { 2336 {
2337 return isVisuallyEquivalentCandidateAlgorithm<EditingInComposedTreeStrategy> (position); 2337 return isVisuallyEquivalentCandidateAlgorithm<EditingInComposedTreeStrategy> (position);
2338 } 2338 }
2339 2339
2340 } // namespace blink 2340 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/VisiblePosition.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698