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

Side by Side Diff: ui/gfx/selection_model.cc

Issue 854713003: More old files deletion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix tryjobs? Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/selection_model.h ('k') | ui/gfx/shadow_value.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/gfx/selection_model.h"
6
7 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h"
9
10 namespace gfx {
11
12 SelectionModel::SelectionModel()
13 : selection_(0),
14 caret_affinity_(CURSOR_BACKWARD) {}
15
16 SelectionModel::SelectionModel(size_t position, LogicalCursorDirection affinity)
17 : selection_(position),
18 caret_affinity_(affinity) {}
19
20 SelectionModel::SelectionModel(const Range& selection,
21 LogicalCursorDirection affinity)
22 : selection_(selection),
23 caret_affinity_(affinity) {}
24
25 bool SelectionModel::operator==(const SelectionModel& sel) const {
26 return selection_ == sel.selection() &&
27 caret_affinity_ == sel.caret_affinity();
28 }
29
30 std::string SelectionModel::ToString() const {
31 std::string str = "{";
32 if (selection().is_empty())
33 base::StringAppendF(&str, "%" PRIuS, caret_pos());
34 else
35 str += selection().ToString();
36 const bool backward = caret_affinity() == CURSOR_BACKWARD;
37 return str + (backward ? ",BACKWARD}" : ",FORWARD}");
38 }
39
40 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/selection_model.h ('k') | ui/gfx/shadow_value.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698