Commit dfbb1944 authored by danakj's avatar danakj Committed by Commit bot

message center: Make BoundedLabel override OnPaint instead of Paint.

This makes the BoundedLabel override View::OnPaint, allowing us to make
View::Paint non-virtual.

The functional difference is that Paint() calls PaintCommon() which:
 - Early outs if not visible
 - Paints any children

The BoundedLabel is used by NotificationView, but no children are ever
added to it and it's not exposed outside the class. So it's safe to
convert it to use OnPaint() and remove the visible early out.

R=dewittj@chromium.org, mukai@chromium.org, stevenjb@chromium.org
BUG=466426

Review URL: https://codereview.chromium.org/1035553002

Cr-Commit-Position: refs/heads/master@{#322082}
parent c88701ac
......@@ -45,11 +45,11 @@ class InnerBoundedLabel : public views::Label {
// Overridden from views::Label.
void SetText(const base::string16& text) override;
void OnPaint(gfx::Canvas* canvas) override;
protected:
// Overridden from views::Label.
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
void OnPaint(gfx::Canvas* canvas) override;
private:
int GetTextFlags();
......@@ -319,9 +319,8 @@ int BoundedLabel::GetHeightForWidth(int width) const {
label_->GetSizeForWidthAndLines(width, line_limit_).height() : 0;
}
void BoundedLabel::Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) {
if (visible())
label_->Paint(canvas, cull_set);
void BoundedLabel::OnPaint(gfx::Canvas* canvas) {
label_->OnPaint(canvas);
}
bool BoundedLabel::CanProcessEventsWithinSubtree() const {
......
......@@ -53,7 +53,7 @@ class MESSAGE_CENTER_EXPORT BoundedLabel : public views::View {
int GetBaseline() const override;
gfx::Size GetPreferredSize() const override;
int GetHeightForWidth(int width) const override;
void Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) override;
void OnPaint(gfx::Canvas* canvas) override;
bool CanProcessEventsWithinSubtree() const override;
void GetAccessibleState(ui::AXViewState* state) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment