summaryrefslogtreecommitdiffstats
path: root/ui/gfx/selection_model.h
diff options
context:
space:
mode:
authorxji@google.com <xji@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 20:03:45 +0000
committerxji@google.com <xji@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 20:03:45 +0000
commit67e85519340234bbf3e3981caa8d68e4663aff07 (patch)
tree7cdffd782898ecc01232ac6f6c9406d9725690cf /ui/gfx/selection_model.h
parent679a41d1084397c7ca9cdd7956ed2edbf9aa0784 (diff)
downloadchromium_src-67e85519340234bbf3e3981caa8d68e4663aff07.zip
chromium_src-67e85519340234bbf3e3981caa8d68e4663aff07.tar.gz
chromium_src-67e85519340234bbf3e3981caa8d68e4663aff07.tar.bz2
1. change the setters of gfx::SelectionModel to be private. Set one alone might make SelectionModel into un-stable state, which should not be allowed.
2. Removing SelectionModel(size_t, size_t) constructor. Introduce RenderText::SelectRange(const ui::Range&) to handle range. 3. revert removal of SelectRange/GetSelectedRange in r103188. BUG=90426 TEST=view_unittests. Review URL: http://codereview.chromium.org/8044004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/selection_model.h')
-rw-r--r--ui/gfx/selection_model.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/ui/gfx/selection_model.h b/ui/gfx/selection_model.h
index 3e7cf9f..4ef3ca0 100644
--- a/ui/gfx/selection_model.h
+++ b/ui/gfx/selection_model.h
@@ -49,31 +49,30 @@ class UI_EXPORT SelectionModel {
SelectionModel();
explicit SelectionModel(size_t pos);
- SelectionModel(size_t start, size_t end);
SelectionModel(size_t end, size_t pos, CaretPlacement status);
SelectionModel(size_t start, size_t end, size_t pos, CaretPlacement status);
virtual ~SelectionModel();
size_t selection_start() const { return selection_start_; }
- void set_selection_start(size_t pos) { selection_start_ = pos; }
-
size_t selection_end() const { return selection_end_; }
- void set_selection_end(size_t pos) { selection_end_ = pos; }
-
size_t caret_pos() const { return caret_pos_; }
- void set_caret_pos(size_t pos) { caret_pos_ = pos; }
-
CaretPlacement caret_placement() const { return caret_placement_; }
- void set_caret_placement(CaretPlacement placement) {
- caret_placement_ = placement;
- }
bool Equals(const SelectionModel& sel) const;
private:
+ friend class RenderText;
+
void Init(size_t start, size_t end, size_t pos, CaretPlacement status);
+ void set_selection_start(size_t pos) { selection_start_ = pos; }
+ void set_selection_end(size_t pos) { selection_end_ = pos; }
+ void set_caret_pos(size_t pos) { caret_pos_ = pos; }
+ void set_caret_placement(CaretPlacement placement) {
+ caret_placement_ = placement;
+ }
+
// Logical selection start. If there is non-empty selection, if
// selection_start_ is less than selection_end_, the selection starts visually
// at the leading edge of the selection_start_. If selection_start_ is greater