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

Unified Diff: ui/gfx/render_text.h

Issue 2639493002: MacViews: Enable word lookup for selectable views::Labels and multi-line text. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.h
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index 44ec07708ff3c2fafe2ddcfc5e63b09545ff490d..0076635b877111a445703f0401ecf30e06da6cf4 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -682,6 +682,20 @@ class GFX_EXPORT RenderText {
// Adjust ranged styles to accommodate a new text length.
void UpdateStyleLengths();
+ // Returns the line index for the given argument. |text_y| is relative to
+ // the text bounds. Returns -1 if |text_y| is above the text and
+ // lines().size() if |text_y| is below it.
+ int GetLineContainingYCoord(float text_y);
+
+ // Returns the line segment index for the |line|, |text_x| pair. |text_x| is
+ // relative to text in the given line. Returns -1 if |text_x| is to the left
+ // of text in the line and |line|.segments.size() if it's to the right.
+ // |offset_relative_segment| will contain the offset of |text_x| relative to
+ // the start of the segment it is contained in.
+ int GetLineSegmentContainingXCoord(const internal::Line& line,
+ float text_x,
+ float* offset_relative_segment);
+
// A convenience function to check whether the glyph attached to the caret
// is within the given range.
static bool RangeContainsCaret(const Range& range,
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698