Chromium Code Reviews| 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 630 | 630 |
| 631 context_menu_runner_.reset( | 631 context_menu_runner_.reset( |
| 632 new MenuRunner(&context_menu_contents_, MenuRunner::HAS_MNEMONICS | | 632 new MenuRunner(&context_menu_contents_, MenuRunner::HAS_MNEMONICS | |
| 633 MenuRunner::CONTEXT_MENU | | 633 MenuRunner::CONTEXT_MENU | |
| 634 MenuRunner::ASYNC)); | 634 MenuRunner::ASYNC)); |
| 635 ignore_result(context_menu_runner_->RunMenuAt( | 635 ignore_result(context_menu_runner_->RunMenuAt( |
| 636 GetWidget(), nullptr, gfx::Rect(point, gfx::Size()), MENU_ANCHOR_TOPLEFT, | 636 GetWidget(), nullptr, gfx::Rect(point, gfx::Size()), MENU_ANCHOR_TOPLEFT, |
| 637 source_type)); | 637 source_type)); |
| 638 } | 638 } |
| 639 | 639 |
| 640 bool Label::GetDecoratedWordAtPoint(const gfx::Point& point, | 640 bool Label::GetDecoratedWordAndBaselineAtPoint( |
| 641 gfx::DecoratedText* decorated_word, | 641 const gfx::Point& point, |
| 642 gfx::Point* baseline_point) { | 642 gfx::DecoratedText* decorated_word, |
| 643 gfx::Point* baseline_point) { | |
| 643 gfx::RenderText* render_text = GetRenderTextForSelectionController(); | 644 gfx::RenderText* render_text = GetRenderTextForSelectionController(); |
| 644 return render_text | 645 return render_text |
| 645 ? render_text->GetDecoratedWordAtPoint(point, decorated_word, | 646 ? render_text->GetDecoratedWordAndBaselineAtPoint( |
| 646 baseline_point) | 647 point, decorated_word, baseline_point) |
| 647 : false; | 648 : false; |
| 648 } | 649 } |
| 649 | 650 |
| 651 bool Label::GetDecoratedTextAndBaselineFromSelection( | |
| 652 gfx::DecoratedText* decorated_text, | |
| 653 gfx::Point* baseline_point) { | |
| 654 return false; | |
|
msw
2017/01/26 20:59:16
Should this be implemented in this CL, or should y
spqchan
2017/02/01 00:32:38
Implemented
| |
| 655 } | |
| 656 | |
| 650 gfx::RenderText* Label::GetRenderTextForSelectionController() { | 657 gfx::RenderText* Label::GetRenderTextForSelectionController() { |
| 651 return const_cast<gfx::RenderText*>( | 658 return const_cast<gfx::RenderText*>( |
| 652 static_cast<const Label*>(this)->GetRenderTextForSelectionController()); | 659 static_cast<const Label*>(this)->GetRenderTextForSelectionController()); |
| 653 } | 660 } |
| 654 | 661 |
| 655 bool Label::IsReadOnly() const { | 662 bool Label::IsReadOnly() const { |
| 656 return true; | 663 return true; |
| 657 } | 664 } |
| 658 | 665 |
| 659 bool Label::SupportsDrag() const { | 666 bool Label::SupportsDrag() const { |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1028 .WriteText(GetSelectedText()); | 1035 .WriteText(GetSelectedText()); |
| 1029 } | 1036 } |
| 1030 | 1037 |
| 1031 void Label::BuildContextMenuContents() { | 1038 void Label::BuildContextMenuContents() { |
| 1032 context_menu_contents_.AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); | 1039 context_menu_contents_.AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); |
| 1033 context_menu_contents_.AddItemWithStringId(IDS_APP_SELECT_ALL, | 1040 context_menu_contents_.AddItemWithStringId(IDS_APP_SELECT_ALL, |
| 1034 IDS_APP_SELECT_ALL); | 1041 IDS_APP_SELECT_ALL); |
| 1035 } | 1042 } |
| 1036 | 1043 |
| 1037 } // namespace views | 1044 } // namespace views |
| OLD | NEW |