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

Unified Diff: third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp

Issue 2802953002: Avoid duplicate functions/code in core/editing: computeDistance (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/InputMethodController.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp
index d0dd77ed19d88503e4b70e480b6f60f395ea602d..375c0fe59b10cb091d3e21552d5c19cfde4e4f60 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp
@@ -45,19 +45,6 @@ size_t computeCommonSuffixLength(const String& str1, const String& str2) {
return maxCommonSuffixLength;
}
-// If current position is at grapheme boundary, return 0; otherwise, return the
-// distance to its nearest left grapheme boundary.
-size_t computeDistanceToLeftGraphemeBoundary(const Position& position) {
- const Position& adjustedPosition = previousPositionOf(
- nextPositionOf(position, PositionMoveType::GraphemeCluster),
- PositionMoveType::GraphemeCluster);
- DCHECK_EQ(position.anchorNode(), adjustedPosition.anchorNode());
- DCHECK_GE(position.computeOffsetInContainerNode(),
- adjustedPosition.computeOffsetInContainerNode());
- return static_cast<size_t>(position.computeOffsetInContainerNode() -
- adjustedPosition.computeOffsetInContainerNode());
-}
-
size_t computeCommonGraphemeClusterPrefixLength(const Position& selectionStart,
const String& oldText,
const String& newText) {
@@ -78,19 +65,6 @@ size_t computeCommonGraphemeClusterPrefixLength(const Position& selectionStart,
return commonPrefixLength - diff;
}
-// If current position is at grapheme boundary, return 0; otherwise, return the
-// distance to its nearest right grapheme boundary.
-size_t computeDistanceToRightGraphemeBoundary(const Position& position) {
- const Position& adjustedPosition = nextPositionOf(
- previousPositionOf(position, PositionMoveType::GraphemeCluster),
- PositionMoveType::GraphemeCluster);
- DCHECK_EQ(position.anchorNode(), adjustedPosition.anchorNode());
- DCHECK_GE(adjustedPosition.computeOffsetInContainerNode(),
- position.computeOffsetInContainerNode());
- return static_cast<size_t>(adjustedPosition.computeOffsetInContainerNode() -
- position.computeOffsetInContainerNode());
-}
-
size_t computeCommonGraphemeClusterSuffixLength(const Position& selectionStart,
const String& oldText,
const String& newText) {
« no previous file with comments | « third_party/WebKit/Source/core/editing/InputMethodController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698