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

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

Issue 1868473002: Use PositionMoveType::GraphemeBoundary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove PositionMoveType::CodePoint 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 1223
1224 RawPtr<Range> rangeObject = Range::create(resultRange.document(), toPosi tionInDOMTree(resultRange.startPosition()), toPositionInDOMTree(resultRange.endP osition())); 1224 RawPtr<Range> rangeObject = Range::create(resultRange.document(), toPosi tionInDOMTree(resultRange.startPosition()), toPositionInDOMTree(resultRange.endP osition()));
1225 if (!rangeObject->collapsed()) 1225 if (!rangeObject->collapsed())
1226 return rangeObject.release(); 1226 return rangeObject.release();
1227 1227
1228 // Found text spans over multiple TreeScopes. Since it's impossible to 1228 // Found text spans over multiple TreeScopes. Since it's impossible to
1229 // return such section as a Range, we skip this match and seek for the 1229 // return such section as a Range, we skip this match and seek for the
1230 // next occurrence. 1230 // next occurrence.
1231 // TODO(yosin) Handle this case. 1231 // TODO(yosin) Handle this case.
1232 if (forward) { 1232 if (forward) {
1233 // TODO(yosin) We should use |PositionMoveType::Character| 1233 searchRange = EphemeralRangeTemplate<Strategy>(nextPositionOf(result Range.startPosition(), PositionMoveType::GraphemeCluster), searchRange.endPositi on());
1234 // for |nextPositionOf()|.
1235 searchRange = EphemeralRangeTemplate<Strategy>(nextPositionOf(result Range.startPosition(), PositionMoveType::CodePoint), searchRange.endPosition());
1236 } else { 1234 } else {
1237 // TODO(yosin) We should use |PositionMoveType::Character| 1235 searchRange = EphemeralRangeTemplate<Strategy>(searchRange.startPosi tion(), previousPositionOf(resultRange.endPosition(), PositionMoveType::Grapheme Cluster));
1238 // for |previousPositionOf()|.
1239 searchRange = EphemeralRangeTemplate<Strategy>(searchRange.startPosi tion(), previousPositionOf(resultRange.endPosition(), PositionMoveType::CodePoin t));
1240 } 1236 }
1241 } 1237 }
1242 1238
1243 ASSERT_NOT_REACHED(); 1239 ASSERT_NOT_REACHED();
1244 return nullptr; 1240 return nullptr;
1245 } 1241 }
1246 1242
1247 template <typename Strategy> 1243 template <typename Strategy>
1248 static RawPtr<Range> findRangeOfStringAlgorithm(Document& document, const String & target, const EphemeralRangeTemplate<Strategy>& referenceRange, FindOptions op tions) 1244 static RawPtr<Range> findRangeOfStringAlgorithm(Document& document, const String & target, const EphemeralRangeTemplate<Strategy>& referenceRange, FindOptions op tions)
1249 { 1245 {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 } 1367 }
1372 1368
1373 DEFINE_TRACE(Editor) 1369 DEFINE_TRACE(Editor)
1374 { 1370 {
1375 visitor->trace(m_frame); 1371 visitor->trace(m_frame);
1376 visitor->trace(m_lastEditCommand); 1372 visitor->trace(m_lastEditCommand);
1377 visitor->trace(m_mark); 1373 visitor->trace(m_mark);
1378 } 1374 }
1379 1375
1380 } // namespace blink 1376 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698