| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/controls/label.h" | 5 #include "ui/views/controls/label.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 ClearRenderTextLines(); | 667 ClearRenderTextLines(); |
| 668 } | 668 } |
| 669 | 669 |
| 670 void Label::ShowContextMenuForView(View* source, | 670 void Label::ShowContextMenuForView(View* source, |
| 671 const gfx::Point& point, | 671 const gfx::Point& point, |
| 672 ui::MenuSourceType source_type) { | 672 ui::MenuSourceType source_type) { |
| 673 if (!GetRenderTextForSelectionController()) | 673 if (!GetRenderTextForSelectionController()) |
| 674 return; | 674 return; |
| 675 | 675 |
| 676 context_menu_runner_.reset( | 676 context_menu_runner_.reset( |
| 677 new MenuRunner(&context_menu_contents_, MenuRunner::HAS_MNEMONICS | | 677 new MenuRunner(&context_menu_contents_, |
| 678 MenuRunner::CONTEXT_MENU | | 678 MenuRunner::HAS_MNEMONICS | MenuRunner::CONTEXT_MENU)); |
| 679 MenuRunner::ASYNC)); | 679 context_menu_runner_->RunMenuAt(GetWidget(), nullptr, |
| 680 ignore_result(context_menu_runner_->RunMenuAt( | 680 gfx::Rect(point, gfx::Size()), |
| 681 GetWidget(), nullptr, gfx::Rect(point, gfx::Size()), MENU_ANCHOR_TOPLEFT, | 681 MENU_ANCHOR_TOPLEFT, source_type); |
| 682 source_type)); | |
| 683 } | 682 } |
| 684 | 683 |
| 685 bool Label::GetDecoratedWordAtPoint(const gfx::Point& point, | 684 bool Label::GetDecoratedWordAtPoint(const gfx::Point& point, |
| 686 gfx::DecoratedText* decorated_word, | 685 gfx::DecoratedText* decorated_word, |
| 687 gfx::Point* baseline_point) { | 686 gfx::Point* baseline_point) { |
| 688 gfx::RenderText* render_text = GetRenderTextForSelectionController(); | 687 gfx::RenderText* render_text = GetRenderTextForSelectionController(); |
| 689 return render_text | 688 return render_text |
| 690 ? render_text->GetDecoratedWordAtPoint(point, decorated_word, | 689 ? render_text->GetDecoratedWordAtPoint(point, decorated_word, |
| 691 baseline_point) | 690 baseline_point) |
| 692 : false; | 691 : false; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 .WriteText(GetSelectedText()); | 1054 .WriteText(GetSelectedText()); |
| 1056 } | 1055 } |
| 1057 | 1056 |
| 1058 void Label::BuildContextMenuContents() { | 1057 void Label::BuildContextMenuContents() { |
| 1059 context_menu_contents_.AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); | 1058 context_menu_contents_.AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); |
| 1060 context_menu_contents_.AddItemWithStringId(IDS_APP_SELECT_ALL, | 1059 context_menu_contents_.AddItemWithStringId(IDS_APP_SELECT_ALL, |
| 1061 IDS_APP_SELECT_ALL); | 1060 IDS_APP_SELECT_ALL); |
| 1062 } | 1061 } |
| 1063 | 1062 |
| 1064 } // namespace views | 1063 } // namespace views |
| OLD | NEW |