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

Unified Diff: third_party/WebKit/Source/core/layout/api/SelectionState.cpp

Issue 2916493002: Make SelectionState enum class (Closed)
Patch Set: Created 3 years, 7 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/layout/api/SelectionState.cpp
diff --git a/third_party/WebKit/Source/core/layout/api/SelectionState.cpp b/third_party/WebKit/Source/core/layout/api/SelectionState.cpp
index 8ab9db82040d255e73c15c73fca03ef48c5d820d..c492d7204804d46dbc8a1404e17cef469096a07b 100644
--- a/third_party/WebKit/Source/core/layout/api/SelectionState.cpp
+++ b/third_party/WebKit/Source/core/layout/api/SelectionState.cpp
@@ -9,16 +9,20 @@
namespace blink {
std::ostream& operator<<(std::ostream& out, const SelectionState state) {
- static const char* const kText[] = {
-#define V(state) #state,
- FOR_EACH_SELECTION_STATE(V)
-#undef V
- };
-
- const auto& it = std::begin(kText) + static_cast<size_t>(state);
- DCHECK_GE(it, std::begin(kText)) << "Unknown state value";
- DCHECK_LT(it, std::end(kText)) << "Unknown state value";
- return out << *it;
+ switch (state) {
+ case SelectionState::kNone:
+ return out << "None";
+ case SelectionState::kStart:
+ return out << "Start";
+ case SelectionState::kInside:
+ return out << "Inside";
+ case SelectionState::kEnd:
+ return out << "End";
+ case SelectionState::kStartAndEnd:
+ return out << "Both";
+ }
+ NOTREACHED();
+ return out;
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698