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

Unified Diff: ui/gfx/render_text_linux.cc

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 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
« no previous file with comments | « ui/gfx/render_text_linux.h ('k') | ui/gfx/render_text_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_linux.cc
diff --git a/ui/gfx/render_text_linux.cc b/ui/gfx/render_text_linux.cc
index 0178cf8368ba12f75d7f27d1f3266a1735f07020..c6cf4f22375585b8b2632a2d3bc40e29700a1c2a 100644
--- a/ui/gfx/render_text_linux.cc
+++ b/ui/gfx/render_text_linux.cc
@@ -40,9 +40,9 @@ bool IsForwardMotion(VisualCursorDirection direction, const PangoItem* item) {
}
// Checks whether |range| contains |index|. This is not the same as calling
-// |range.Contains(ui::Range(index))| - as that would return true when
+// |range.Contains(gfx::Range(index))| - as that would return true when
// |index| == |range.end()|.
-bool IndexInRange(const ui::Range& range, size_t index) {
+bool IndexInRange(const gfx::Range& range, size_t index) {
return index >= range.start() && index < range.end();
}
@@ -137,7 +137,7 @@ std::vector<RenderText::FontSpan> RenderTextLinux::GetFontSpansForTesting() {
PangoItem* item = reinterpret_cast<PangoLayoutRun*>(it->data)->item;
const int start = LayoutIndexToTextIndex(item->offset);
const int end = LayoutIndexToTextIndex(item->offset + item->length);
- const ui::Range range(start, end);
+ const gfx::Range range(start, end);
ScopedPangoFontDescription desc(pango_font_describe(item->analysis.font));
spans.push_back(RenderText::FontSpan(Font(desc.get()), range));
@@ -214,14 +214,14 @@ SelectionModel RenderTextLinux::AdjacentWordSelectionModel(
return cur;
}
-ui::Range RenderTextLinux::GetGlyphBounds(size_t index) {
+gfx::Range RenderTextLinux::GetGlyphBounds(size_t index) {
PangoRectangle pos;
pango_layout_index_to_pos(layout_, TextIndexToLayoutIndex(index), &pos);
// TODO(derat): Support fractional ranges for subpixel positioning?
- return ui::Range(PANGO_PIXELS(pos.x), PANGO_PIXELS(pos.x + pos.width));
+ return gfx::Range(PANGO_PIXELS(pos.x), PANGO_PIXELS(pos.x + pos.width));
}
-std::vector<Rect> RenderTextLinux::GetSubstringBounds(const ui::Range& range) {
+std::vector<Rect> RenderTextLinux::GetSubstringBounds(const gfx::Range& range) {
DCHECK_LE(range.GetMax(), text().length());
if (range.is_empty())
return std::vector<Rect>();
@@ -428,7 +428,7 @@ void RenderTextLinux::DrawVisualText(Canvas* canvas) {
// Track the current style and its text (not layout) index range.
style.UpdatePosition(GetGlyphTextIndex(run, style_start_glyph_index));
- ui::Range style_range = style.GetRange();
+ gfx::Range style_range = style.GetRange();
do {
const PangoGlyphInfo& glyph = run->glyphs->glyphs[glyph_index];
@@ -478,7 +478,7 @@ GSList* RenderTextLinux::GetRunContainingCaret(
GSList* run = current_line_->runs;
while (run) {
PangoItem* item = reinterpret_cast<PangoLayoutRun*>(run->data)->item;
- ui::Range item_range(item->offset, item->offset + item->length);
+ gfx::Range item_range(item->offset, item->offset + item->length);
if (RangeContainsCaret(item_range, position, affinity))
return run;
run = run->next;
« no previous file with comments | « ui/gfx/render_text_linux.h ('k') | ui/gfx/render_text_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698