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

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

Issue 2455083003: Reduce usage of VisibleSelection::setBase() and setExtent() (Closed)
Patch Set: 2016-10-31T10:31:10 Created 4 years, 2 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 04527dafb5f0fbe0f1a08f0301217b13ff6895e5..5395c83d2229f71b7ad5552b005d9f0b641b6844 100644
--- a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
@@ -128,6 +128,19 @@ operator=(const VisibleSelectionTemplate<Strategy>& other) {
}
template <typename Strategy>
+SelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::asSelection()
+ const {
+ typename SelectionTemplate<Strategy>::Builder builder;
+ if (m_base.isNotNull())
+ builder.setBaseAndExtent(m_base, m_extent);
+ return builder.setAffinity(m_affinity)
+ .setGranularity(m_granularity)
+ .setIsDirectional(m_isDirectional)
+ .setHasTrailingWhitespace(m_hasTrailingWhitespace)
+ .build();
+}
+
+template <typename Strategy>
void VisibleSelectionTemplate<Strategy>::setBase(
const PositionTemplate<Strategy>& position) {
DCHECK(!needsLayoutTreeUpdate(position));

Powered by Google App Engine
This is Rietveld 408576698