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

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

Issue 2875933004: Utilize Position::IsEquivalent() in {Up,Down}streamIgnoringEditingBoundaries() (Closed)
Patch Set: 2017-05-15T13:22:30 Created 3 years, 7 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 | third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp » ('j') | 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 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 return match; 2365 return match;
2366 } 2366 }
2367 } 2367 }
2368 return 0; 2368 return 0;
2369 } 2369 }
2370 2370
2371 template <typename Strategy> 2371 template <typename Strategy>
2372 PositionTemplate<Strategy> DownstreamIgnoringEditingBoundaries( 2372 PositionTemplate<Strategy> DownstreamIgnoringEditingBoundaries(
2373 PositionTemplate<Strategy> position) { 2373 PositionTemplate<Strategy> position) {
2374 PositionTemplate<Strategy> last_position; 2374 PositionTemplate<Strategy> last_position;
2375 while (position != last_position) { 2375 while (!position.IsEquivalent(last_position)) {
2376 last_position = position; 2376 last_position = position;
2377 position = MostForwardCaretPosition(position, kCanCrossEditingBoundary); 2377 position = MostForwardCaretPosition(position, kCanCrossEditingBoundary);
2378 } 2378 }
2379 return position; 2379 return position;
2380 } 2380 }
2381 2381
2382 template <typename Strategy> 2382 template <typename Strategy>
2383 PositionTemplate<Strategy> UpstreamIgnoringEditingBoundaries( 2383 PositionTemplate<Strategy> UpstreamIgnoringEditingBoundaries(
2384 PositionTemplate<Strategy> position) { 2384 PositionTemplate<Strategy> position) {
2385 PositionTemplate<Strategy> last_position; 2385 PositionTemplate<Strategy> last_position;
2386 while (position != last_position) { 2386 while (!position.IsEquivalent(last_position)) {
2387 last_position = position; 2387 last_position = position;
2388 position = MostBackwardCaretPosition(position, kCanCrossEditingBoundary); 2388 position = MostBackwardCaretPosition(position, kCanCrossEditingBoundary);
2389 } 2389 }
2390 return position; 2390 return position;
2391 } 2391 }
2392 2392
2393 // Returns true if |inlineBox| starts different direction of embedded text ru. 2393 // Returns true if |inlineBox| starts different direction of embedded text ru.
2394 // See [1] for details. 2394 // See [1] for details.
2395 // [1] UNICODE BIDIRECTIONAL ALGORITHM, http://unicode.org/reports/tr9/ 2395 // [1] UNICODE BIDIRECTIONAL ALGORITHM, http://unicode.org/reports/tr9/
2396 static bool IsStartOfDifferentDirection(const InlineBox* inline_box) { 2396 static bool IsStartOfDifferentDirection(const InlineBox* inline_box) {
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
4099 4099
4100 Position SkipWhitespace(const Position& position) { 4100 Position SkipWhitespace(const Position& position) {
4101 return SkipWhitespaceAlgorithm(position); 4101 return SkipWhitespaceAlgorithm(position);
4102 } 4102 }
4103 4103
4104 PositionInFlatTree SkipWhitespace(const PositionInFlatTree& position) { 4104 PositionInFlatTree SkipWhitespace(const PositionInFlatTree& position) {
4105 return SkipWhitespaceAlgorithm(position); 4105 return SkipWhitespaceAlgorithm(position);
4106 } 4106 }
4107 4107
4108 } // namespace blink 4108 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698