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

Unified Diff: third_party/WebKit/Source/core/editing/InputMethodController.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
Index: third_party/WebKit/Source/core/editing/InputMethodController.cpp
diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
index 5b46a96cc3e4b46234b9885ed4e2c95a28259f69..c64c0dc3716cc6c401fb5c2ca4eb8f8214422b33 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -543,32 +543,6 @@ void InputMethodController::cancelComposition() {
dispatchCompositionEndEvent(frame(), emptyString);
}
-// If current position is at grapheme boundary, return 0; otherwise, return the
-// distance to its nearest left grapheme boundary.
-static 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());
-}
-
-// If current position is at grapheme boundary, return 0; otherwise, return the
-// distance to its nearest right grapheme boundary.
-static 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());
-}
-
void InputMethodController::setComposition(
const String& text,
const Vector<CompositionUnderline>& underlines,

Powered by Google App Engine
This is Rietveld 408576698