Commit 5e71a6de authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Draw debug rects for content bounds inside views.

Exposes GetContentsBounds() alongside GetLocalBounds() when they are
different. This visualizes inset usage inside views and can show why
some content may be clipped.

Bug: None
Change-Id: I2f1269fc2b2f93c8c4ba3fd5455fd7f070fffc5a
Reviewed-on: https://chromium-review.googlesource.com/741687Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512643}
parent a678fc19
......@@ -2064,6 +2064,13 @@ void View::PaintDebugRects(const PaintInfo& parent_paint_info) {
gfx::Canvas* canvas = recorder.canvas();
const float scale = canvas->UndoDeviceScaleFactor();
gfx::RectF outline_rect(ScaleToEnclosedRect(GetLocalBounds(), scale));
gfx::RectF content_outline_rect(
ScaleToEnclosedRect(GetContentsBounds(), scale));
if (content_outline_rect != outline_rect) {
content_outline_rect.Inset(0.5f, 0.5f);
const SkColor content_color = SkColorSetARGB(0x30, 0, 0, 0xff);
canvas->DrawRect(content_outline_rect, content_color);
}
outline_rect.Inset(0.5f, 0.5f);
const SkColor color = SkColorSetARGB(0x30, 0xff, 0, 0);
canvas->DrawRect(outline_rect, color);
......
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