Commit 159524df authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

Ink drops: set clip rect to the enclosing (instead of nearest) rect

Reading the code and its comments, it seems like calling the
|ToEnclosingRect| method is more suitable than |ToNearestRect| for
setting the ink drop's clip rectangle. |ToNearestRect| isn't the right
method for arbitrary RectFs.

Change-Id: If9d4befcd88be4d7ade4d5df043127a7ec3a9dd0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2071041
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744393}
parent c93f15a9
...@@ -186,7 +186,7 @@ bool InkDropHostView::AddInkDropClip(ui::Layer* ink_drop_layer) { ...@@ -186,7 +186,7 @@ bool InkDropHostView::AddInkDropClip(ui::Layer* ink_drop_layer) {
HighlightPathGenerator::GetRoundRectForView(this); HighlightPathGenerator::GetRoundRectForView(this);
if (!clipping_data) if (!clipping_data)
return false; return false;
ink_drop_layer->SetClipRect(gfx::ToNearestRect(clipping_data->bounds)); ink_drop_layer->SetClipRect(gfx::ToEnclosingRect(clipping_data->bounds));
ink_drop_layer->SetRoundedCornerRadius( ink_drop_layer->SetRoundedCornerRadius(
gfx::RoundedCornersF(clipping_data->corner_radius)); gfx::RoundedCornersF(clipping_data->corner_radius));
ink_drop_layer->SetIsFastRoundedCorner(true); ink_drop_layer->SetIsFastRoundedCorner(true);
......
...@@ -42,8 +42,8 @@ SkPath HighlightPathGenerator::GetHighlightPath(const View* view) { ...@@ -42,8 +42,8 @@ SkPath HighlightPathGenerator::GetHighlightPath(const View* view) {
const float corner_radius = round_rect->corner_radius; const float corner_radius = round_rect->corner_radius;
return SkPath().addRoundRect( return SkPath().addRoundRect(
gfx::RectToSkRect(gfx::ToNearestRect(round_rect->bounds)), corner_radius, gfx::RectToSkRect(gfx::ToEnclosingRect(round_rect->bounds)),
corner_radius); corner_radius, corner_radius);
} }
base::Optional<HighlightPathGenerator::RoundRect> base::Optional<HighlightPathGenerator::RoundRect>
......
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