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

Unified Diff: ui/views/controls/label.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, 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
Index: ui/views/controls/label.cc
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
index 2086222e63f3c879d426a3d4509f7f2ec612a0d8..ac5020921e477ea64c935a3deb102880dbe6bf95 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -641,13 +641,27 @@ void Label::ShowContextMenuForView(View* source,
source_type));
}
-bool Label::GetDecoratedWordAtPoint(const gfx::Point& point,
- gfx::DecoratedText* decorated_word,
- gfx::Point* baseline_point) {
+bool Label::GetDecoratedWordAndBaselineAtPoint(
+ const gfx::Point& point,
+ gfx::DecoratedText* decorated_word,
+ gfx::Point* baseline_point) {
gfx::RenderText* render_text = GetRenderTextForSelectionController();
return render_text
- ? render_text->GetDecoratedWordAtPoint(point, decorated_word,
- baseline_point)
+ ? render_text->GetDecoratedWordAndBaselineAtPoint(
+ point, decorated_word, baseline_point)
+ : false;
+}
+
+bool Label::GetDecoratedTextAndBaselineFromSelection(
+ gfx::DecoratedText* decorated_text,
+ gfx::Point* baseline_point) {
+ if (!selectable())
+ return false;
+
+ gfx::RenderText* render_text = GetRenderTextForSelectionController();
+ return render_text
+ ? render_text->GetDecoratedTextAndBaselineForRange(
+ render_text->selection(), decorated_text, baseline_point)
: false;
Alexei Svitkine (slow) 2017/02/01 19:12:37 Nit: This looks pretty ugly. Suggest a separate "i
spqchan 2017/02/02 20:35:06 Done.
}

Powered by Google App Engine
This is Rietveld 408576698