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

Unified Diff: ui/gfx/render_text.cc

Issue 2164483006: [MacViews] Implemented text context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 3 years, 10 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.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index d849c88b0df21de7a1b0442a74fe62815a38e0cc..69c7c0b1b9bbdc73bec61ca6c7d77f8bd177645c 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -1031,9 +1031,10 @@ Vector2d RenderText::GetLineOffset(size_t line_number) {
return offset;
}
-bool RenderText::GetDecoratedWordAtPoint(const Point& point,
- DecoratedText* decorated_word,
- Point* baseline_point) {
+bool RenderText::GetDecoratedWordAndBaselineAtPoint(
+ const Point& point,
+ DecoratedText* decorated_word,
+ Point* baseline_point) {
if (obscured())
return false;
@@ -1048,9 +1049,19 @@ bool RenderText::GetDecoratedWordAtPoint(const Point& point,
DCHECK(!word_range.is_reversed());
DCHECK(!word_range.is_empty());
+ return GetDecoratedTextAndBaselineForRange(word_range, decorated_word,
+ baseline_point);
+}
+
+bool RenderText::GetDecoratedTextAndBaselineForRange(
+ const Range& word_range,
+ DecoratedText* decorated_text,
+ Point* baseline_point) {
+ EnsureLayout();
+
const std::vector<Rect> word_bounds = GetSubstringBounds(word_range);
if (word_bounds.empty() ||
- !GetDecoratedTextForRange(word_range, decorated_word)) {
+ !GetDecoratedTextForRange(word_range, decorated_text)) {
return false;
}
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698