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

Unified Diff: ui/views/controls/link.h

Issue 2810403002: Views: Don't add insets for views::Link focus rings under MD. (Closed)
Patch Set: Add missing // namespace comments Created 3 years, 8 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_unittest.cc ('k') | ui/views/controls/link.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/link.h
diff --git a/ui/views/controls/link.h b/ui/views/controls/link.h
index 928a727664d7377fc3b6ac0bc359279bb4f9db13..448adc5536125644679f51930ce13b583348bb90 100644
--- a/ui/views/controls/link.h
+++ b/ui/views/controls/link.h
@@ -25,14 +25,35 @@ class LinkListener;
////////////////////////////////////////////////////////////////////////////////
class VIEWS_EXPORT Link : public Label {
public:
+ static const char kViewClassName[];
+
+ // The padding for the focus ring border when rendering a focused Link with
+ // FocusStyle::RING.
+ static constexpr int kFocusBorderPadding = 1;
+
+ // How the Link is styled when focused.
+ enum class FocusStyle {
+ UNDERLINE, // An underline style is added to the text only when focused.
+ RING, // A focus ring is drawn around the View.
+ };
+
Link();
explicit Link(const base::string16& title);
~Link() override;
+ // Returns the default FocusStyle for a views::Link. Calling SetUnderline()
+ // may change it: E.g. SetUnderline(true) forces FocusStyle::RING.
+ static FocusStyle GetDefaultFocusStyle();
+
+ // Returns the current FocusStyle of this Link.
+ FocusStyle GetFocusStyle() const;
+
const LinkListener* listener() { return listener_; }
void set_listener(LinkListener* listener) { listener_ = listener; }
// Label:
+ void PaintFocusRing(gfx::Canvas* canvas) const override;
+ gfx::Insets GetInsets() const override;
const char* GetClassName() const override;
gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override;
bool CanProcessEventsWithinSubtree() const override;
@@ -55,10 +76,10 @@ class VIEWS_EXPORT Link : public Label {
// TODO(estade): almost all the places that call this pass false. With
// Harmony, false is already the default so those callsites can be removed.
+ // TODO(tapted): Then remove all callsites when client code sets a correct
+ // typography style and derives this from style::GetFont(STYLE_LINK).
void SetUnderline(bool underline);
- static const char kViewClassName[];
-
private:
void Init();
« no previous file with comments | « ui/views/controls/label_unittest.cc ('k') | ui/views/controls/link.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698