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

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

Issue 2675983003: views::Separator cleanup. (Closed)
Patch Set: update docs 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
Index: ui/views/controls/separator.h
diff --git a/ui/views/controls/separator.h b/ui/views/controls/separator.h
index d4689fe209748b9241bebf63b616d9227a4ccf91..d231d3a22308e1794118475543058caa96a9769a 100644
--- a/ui/views/controls/separator.h
+++ b/ui/views/controls/separator.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/macros.h"
+#include "base/optional.h"
#include "ui/views/view.h"
namespace views {
@@ -18,38 +19,39 @@ namespace views {
class VIEWS_EXPORT Separator : public View {
public:
enum Orientation {
+ // The separator is a horizontal line that distinguishes vertically stacked
+ // elements.
HORIZONTAL,
- VERTICAL
+ // The separator is a vertical line that distinguishes a row of elements.
+ VERTICAL,
};
// The separator's class name.
static const char kViewClassName[];
+ // The separator's thickness in dip.
+ static const int kThickness;
sky 2017/02/03 23:49:45 constexpr?
Evan Stade 2017/02/06 16:31:27 I don't understand this completely but this is the
+
explicit Separator(Orientation orientation);
~Separator() override;
- SkColor color() const { return color_; }
void SetColor(SkColor color);
- int size() const { return size_; }
- // Preferred size of one axis: height for horizontal separator
- // and width for vertical separator
- void SetPreferredSize(int size);
+ // Preferred length: width for horizontal separator and height for vertical
+ // separator.
+ void SetPreferredLength(int length);
sky 2017/02/03 23:49:45 Is there a reason you prefer length here? I like s
Evan Stade 2017/02/06 16:31:27 That's exactly why I don't like size. Which dimens
sky 2017/02/06 17:59:21 I don't think there is a right answer here. I pref
Evan Stade 2017/02/06 19:03:29 size is used to describe a multi-dimensional value
sky 2017/02/06 22:42:55 'size' is used not inheritantly a multi-dimensiona
Evan Stade 2017/02/07 16:57:54 ok, but before this cl, this "size" actually meant
// Overridden from View:
gfx::Size GetPreferredSize() const override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
void OnPaint(gfx::Canvas* canvas) override;
- void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
const char* GetClassName() const override;
private:
- void SetColorFromNativeTheme();
-
const Orientation orientation_;
- SkColor color_;
- bool color_overridden_;
- int size_;
+ base::Optional<SkColor> overridden_color_;
+ // The length to request in GetPreferredSize().
+ int length_ = 1;
DISALLOW_COPY_AND_ASSIGN(Separator);
};

Powered by Google App Engine
This is Rietveld 408576698