| Index: ui/gfx/render_text.cc
|
| diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
|
| index 1fcf18cede44fce180c344fe8bef925595ee935e..25e0027e20ef2d1c5d2a92a376c4b2735cd685f5 100644
|
| --- a/ui/gfx/render_text.cc
|
| +++ b/ui/gfx/render_text.cc
|
| @@ -288,8 +288,8 @@ StyleIterator::StyleIterator(const BreakList<SkColor>& colors,
|
|
|
| StyleIterator::~StyleIterator() {}
|
|
|
| -ui::Range StyleIterator::GetRange() const {
|
| - ui::Range range(colors_.GetRange(color_));
|
| +gfx::Range StyleIterator::GetRange() const {
|
| + gfx::Range range(colors_.GetRange(color_));
|
| for (size_t i = 0; i < NUM_TEXT_STYLES; ++i)
|
| range = range.Intersect(styles_[i].GetRange(style_[i]));
|
| return range;
|
| @@ -431,7 +431,7 @@ void RenderText::MoveCursor(BreakType break_type,
|
| bool RenderText::MoveCursorTo(const SelectionModel& model) {
|
| // Enforce valid selection model components.
|
| size_t text_length = text().length();
|
| - ui::Range range(std::min(model.selection().start(), text_length),
|
| + gfx::Range range(std::min(model.selection().start(), text_length),
|
| std::min(model.caret_pos(), text_length));
|
| // The current model only supports caret positions at valid character indices.
|
| if (!IsCursorablePosition(range.start()) ||
|
| @@ -450,8 +450,8 @@ bool RenderText::MoveCursorTo(const Point& point, bool select) {
|
| return MoveCursorTo(position);
|
| }
|
|
|
| -bool RenderText::SelectRange(const ui::Range& range) {
|
| - ui::Range sel(std::min(range.start(), text().length()),
|
| +bool RenderText::SelectRange(const gfx::Range& range) {
|
| + gfx::Range sel(std::min(range.start(), text().length()),
|
| std::min(range.end(), text().length()));
|
| if (!IsCursorablePosition(sel.start()) || !IsCursorablePosition(sel.end()))
|
| return false;
|
| @@ -476,7 +476,8 @@ void RenderText::ClearSelection() {
|
|
|
| void RenderText::SelectAll(bool reversed) {
|
| const size_t length = text().length();
|
| - const ui::Range all = reversed ? ui::Range(length, 0) : ui::Range(0, length);
|
| + const gfx::Range all = reversed ? gfx::Range(length, 0) :
|
| + gfx::Range(0, length);
|
| const bool success = SelectRange(all);
|
| DCHECK(success);
|
| }
|
| @@ -517,13 +518,13 @@ void RenderText::SelectWord() {
|
| MoveCursorTo(reversed ? selection_min : selection_max, true);
|
| }
|
|
|
| -const ui::Range& RenderText::GetCompositionRange() const {
|
| +const gfx::Range& RenderText::GetCompositionRange() const {
|
| return composition_range_;
|
| }
|
|
|
| -void RenderText::SetCompositionRange(const ui::Range& composition_range) {
|
| +void RenderText::SetCompositionRange(const gfx::Range& composition_range) {
|
| CHECK(!composition_range.IsValid() ||
|
| - ui::Range(0, text_.length()).Contains(composition_range));
|
| + gfx::Range(0, text_.length()).Contains(composition_range));
|
| composition_range_.set_end(composition_range.end());
|
| composition_range_.set_start(composition_range.start());
|
| ResetLayout();
|
| @@ -539,7 +540,7 @@ void RenderText::SetColor(SkColor value) {
|
| #endif
|
| }
|
|
|
| -void RenderText::ApplyColor(SkColor value, const ui::Range& range) {
|
| +void RenderText::ApplyColor(SkColor value, const gfx::Range& range) {
|
| colors_.ApplyValue(value, range);
|
|
|
| #if defined(OS_WIN)
|
| @@ -566,7 +567,7 @@ void RenderText::SetStyle(TextStyle style, bool value) {
|
|
|
| void RenderText::ApplyStyle(TextStyle style,
|
| bool value,
|
| - const ui::Range& range) {
|
| + const gfx::Range& range) {
|
| styles_[style].ApplyValue(value, range);
|
|
|
| // Only invalidate the layout on font changes; not for colors or decorations.
|
| @@ -704,7 +705,7 @@ Rect RenderText::GetCursorBounds(const SelectionModel& caret,
|
| } else {
|
| size_t grapheme_start = (caret_affinity == CURSOR_FORWARD) ?
|
| caret_pos : IndexOfAdjacentGrapheme(caret_pos, CURSOR_BACKWARD);
|
| - ui::Range xspan(GetGlyphBounds(grapheme_start));
|
| + gfx::Range xspan(GetGlyphBounds(grapheme_start));
|
| if (insert_mode) {
|
| x = (caret_affinity == CURSOR_BACKWARD) ? xspan.end() : xspan.start();
|
| } else { // overtype mode
|
| @@ -745,7 +746,7 @@ size_t RenderText::IndexOfAdjacentGrapheme(size_t index,
|
| }
|
|
|
| SelectionModel RenderText::GetSelectionModelForSelectionStart() {
|
| - const ui::Range& sel = selection();
|
| + const gfx::Range& sel = selection();
|
| if (sel.is_empty())
|
| return selection_model_;
|
| return SelectionModel(sel.start(),
|
| @@ -768,7 +769,7 @@ RenderText::RenderText()
|
| selection_color_(kDefaultColor),
|
| selection_background_focused_color_(kDefaultSelectionBackgroundColor),
|
| focused_(false),
|
| - composition_range_(ui::Range::InvalidRange()),
|
| + composition_range_(gfx::Range::InvalidRange()),
|
| colors_(kDefaultColor),
|
| styles_(NUM_TEXT_STYLES),
|
| composition_and_selection_styles_applied_(false),
|
| @@ -830,7 +831,7 @@ void RenderText::ApplyCompositionAndSelectionStyles() {
|
|
|
| // Apply the selected text color to the [un-reversed] selection range.
|
| if (!selection().is_empty()) {
|
| - const ui::Range range(selection().GetMin(), selection().GetMax());
|
| + const gfx::Range range(selection().GetMin(), selection().GetMax());
|
| colors_.ApplyValue(selection_color_, range);
|
| }
|
| composition_and_selection_styles_applied_ = true;
|
| @@ -929,20 +930,20 @@ void RenderText::ApplyTextShadows(internal::SkiaTextRenderer* renderer) {
|
| }
|
|
|
| // static
|
| -bool RenderText::RangeContainsCaret(const ui::Range& range,
|
| +bool RenderText::RangeContainsCaret(const gfx::Range& range,
|
| size_t caret_pos,
|
| LogicalCursorDirection caret_affinity) {
|
| // NB: exploits unsigned wraparound (WG14/N1124 section 6.2.5 paragraph 9).
|
| size_t adjacent = (caret_affinity == CURSOR_BACKWARD) ?
|
| caret_pos - 1 : caret_pos + 1;
|
| - return range.Contains(ui::Range(caret_pos, adjacent));
|
| + return range.Contains(gfx::Range(caret_pos, adjacent));
|
| }
|
|
|
| void RenderText::MoveCursorTo(size_t position, bool select) {
|
| size_t cursor = std::min(position, text().length());
|
| if (IsCursorablePosition(cursor))
|
| SetSelectionModel(SelectionModel(
|
| - ui::Range(select ? selection().start() : cursor, cursor),
|
| + gfx::Range(select ? selection().start() : cursor, cursor),
|
| (cursor == 0) ? CURSOR_FORWARD : CURSOR_BACKWARD));
|
| }
|
|
|
|
|