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

Unified Diff: third_party/WebKit/Source/core/editing/VisibleSelection.cpp

Issue 2964893002: Make VisibleSelection::AppendTrailingWhitespace() as const function (Closed)
Patch Set: 2017-07-04T15:32:18 Created 3 years, 5 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/VisibleSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
index c145886ea0bbc223994cd0fdea7489e15ea9aa9d..3edc4f56c8ea63d4799d50a537053658be09bfee 100644
--- a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
@@ -180,17 +180,20 @@ VisibleSelectionTemplate<Strategy>::ToNormalizedEphemeralRange() const {
}
template <typename Strategy>
-void VisibleSelectionTemplate<Strategy>::AppendTrailingWhitespace() {
+VisibleSelectionTemplate<Strategy>
+VisibleSelectionTemplate<Strategy>::AppendTrailingWhitespace() const {
if (IsNone())
- return;
+ return *this;
DCHECK_EQ(granularity_, kWordGranularity);
if (!IsRange())
- return;
+ return *this;
const PositionTemplate<Strategy>& new_end = SkipWhitespace(end_);
if (end_ == new_end)
- return;
- has_trailing_whitespace_ = true;
- end_ = new_end;
+ return *this;
+ VisibleSelectionTemplate<Strategy> result = *this;
+ result.has_trailing_whitespace_ = true;
+ result.end_ = new_end;
+ return result;
}
template <typename Strategy>
@@ -452,7 +455,7 @@ void VisibleSelectionTemplate<Strategy>::Validate(TextGranularity granularity) {
}
if (!has_trailing_whitespace_)
return;
- AppendTrailingWhitespace();
+ *this = AppendTrailingWhitespace();
}
template <typename Strategy>

Powered by Google App Engine
This is Rietveld 408576698