Commit 579ce7ef authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Fix checkbox effects when using image insets

Adds View::GetMirroredContentsBounds() which takes view insets into
account.

Bug: 1150725
Change-Id: I2d07b90f6388790fdb442f172b72452a5401ea03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2551082Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829644}
parent df72c8d5
...@@ -163,8 +163,8 @@ std::unique_ptr<InkDrop> Checkbox::CreateInkDrop() { ...@@ -163,8 +163,8 @@ std::unique_ptr<InkDrop> Checkbox::CreateInkDrop() {
std::unique_ptr<InkDropRipple> Checkbox::CreateInkDropRipple() const { std::unique_ptr<InkDropRipple> Checkbox::CreateInkDropRipple() const {
// The "small" size is 21dp, the large size is 1.33 * 21dp = 28dp. // The "small" size is 21dp, the large size is 1.33 * 21dp = 28dp.
return CreateSquareInkDropRipple(image()->GetMirroredBounds().CenterPoint(), return CreateSquareInkDropRipple(
gfx::Size(21, 21)); image()->GetMirroredContentsBounds().CenterPoint(), gfx::Size(21, 21));
} }
SkColor Checkbox::GetInkDropBaseColor() const { SkColor Checkbox::GetInkDropBaseColor() const {
...@@ -175,7 +175,7 @@ SkColor Checkbox::GetInkDropBaseColor() const { ...@@ -175,7 +175,7 @@ SkColor Checkbox::GetInkDropBaseColor() const {
SkPath Checkbox::GetFocusRingPath() const { SkPath Checkbox::GetFocusRingPath() const {
SkPath path; SkPath path;
gfx::Rect bounds = image()->GetMirroredBounds(); gfx::Rect bounds = image()->GetMirroredContentsBounds();
bounds.Inset(1, 1); bounds.Inset(1, 1);
path.addRect(RectToSkRect(bounds)); path.addRect(RectToSkRect(bounds));
return path; return path;
......
...@@ -732,6 +732,13 @@ gfx::Rect View::GetMirroredBounds() const { ...@@ -732,6 +732,13 @@ gfx::Rect View::GetMirroredBounds() const {
return bounds; return bounds;
} }
gfx::Rect View::GetMirroredContentsBounds() const {
gfx::Rect bounds(bounds_);
bounds.Inset(GetInsets());
bounds.set_x(GetMirroredX());
return bounds;
}
gfx::Point View::GetMirroredPosition() const { gfx::Point View::GetMirroredPosition() const {
return gfx::Point(GetMirroredX(), y()); return gfx::Point(GetMirroredX(), y());
} }
......
...@@ -682,6 +682,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, ...@@ -682,6 +682,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// transparent to the View subclasses and therefore you should use the // transparent to the View subclasses and therefore you should use the
// bounds() accessor instead. // bounds() accessor instead.
gfx::Rect GetMirroredBounds() const; gfx::Rect GetMirroredBounds() const;
gfx::Rect GetMirroredContentsBounds() const;
gfx::Point GetMirroredPosition() const; gfx::Point GetMirroredPosition() const;
int GetMirroredX() const; int GetMirroredX() const;
......
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