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

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, 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/views/controls/label.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/label.cc
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
index 2086222e63f3c879d426a3d4509f7f2ec612a0d8..ada76779cfc7875a48d4f39dda80919f9bd11761 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -641,16 +641,31 @@ 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();
+ if (!render_text)
+ return false;
+
+ return render_text->GetDecoratedTextAndBaselineForRange(
+ render_text->selection(), decorated_text, baseline_point);
+}
+
gfx::RenderText* Label::GetRenderTextForSelectionController() {
return const_cast<gfx::RenderText*>(
static_cast<const Label*>(this)->GetRenderTextForSelectionController());
« no previous file with comments | « ui/views/controls/label.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698