Commit 2e62194f authored by rnasri's avatar rnasri Committed by Commit Bot

Add a flag to show layout shift regions

Add a bool in layer_tree_debug_state. And update the methods
where needed in the cc file.

Declare the flag and its definition in content_switches.

Finally, add the flag in the render_process_host_impl and use it in
the initialization of layer tree settings in render_widget.

Bug: 961846

Change-Id: Ia82da07d65dc5ea829824a077e971b7102e754bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1603404Reviewed-by: default avatarenne <enne@chromium.org>
Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Reviewed-by: default avatarNicolás Peña Moreno <npm@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Rasha Nasri <rnasri@google.com>
Cr-Commit-Position: refs/heads/master@{#659660}
parent f87bec89
......@@ -12,6 +12,7 @@ namespace cc {
LayerTreeDebugState::LayerTreeDebugState()
: show_fps_counter(false),
show_debug_borders(false),
show_layout_shift_regions(false),
show_paint_rects(false),
show_property_changed_rects(false),
show_surface_damage_rects(false),
......@@ -49,7 +50,7 @@ bool LayerTreeDebugState::ShowHudRects() const {
show_surface_damage_rects || show_screen_space_rects ||
show_touch_event_handler_rects || show_wheel_event_handler_rects ||
show_scroll_event_handler_rects || show_non_fast_scrollable_rects ||
show_layer_animation_bounds_rects;
show_layer_animation_bounds_rects || show_layout_shift_regions;
}
bool LayerTreeDebugState::ShowMemoryStats() const {
......@@ -61,6 +62,7 @@ bool LayerTreeDebugState::Equal(const LayerTreeDebugState& a,
return (
a.show_fps_counter == b.show_fps_counter &&
a.show_debug_borders == b.show_debug_borders &&
a.show_layout_shift_regions == b.show_layout_shift_regions &&
a.show_paint_rects == b.show_paint_rects &&
a.show_property_changed_rects == b.show_property_changed_rects &&
a.show_surface_damage_rects == b.show_surface_damage_rects &&
......@@ -85,6 +87,7 @@ LayerTreeDebugState LayerTreeDebugState::Unite(const LayerTreeDebugState& a,
r.show_fps_counter |= b.show_fps_counter;
r.show_debug_borders |= b.show_debug_borders;
r.show_layout_shift_regions |= b.show_layout_shift_regions;
r.show_paint_rects |= b.show_paint_rects;
r.show_property_changed_rects |= b.show_property_changed_rects;
r.show_surface_damage_rects |= b.show_surface_damage_rects;
......
......@@ -32,6 +32,7 @@ class CC_DEBUG_EXPORT LayerTreeDebugState {
bool show_fps_counter;
DebugBorderTypes show_debug_borders;
bool show_layout_shift_regions;
bool show_paint_rects;
bool show_property_changed_rects;
bool show_surface_damage_rects;
......
......@@ -3018,6 +3018,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kRegisterPepperPlugins,
switches::kRendererStartupDialog,
switches::kReportVp9AsAnUnsupportedMimeType,
switches::kShowLayoutShiftRegions,
switches::kShowPaintRects,
switches::kStatsCollectionController,
switches::kSkiaFontCacheLimitMb,
......
......@@ -711,6 +711,10 @@ const char kRendererStartupDialog[] = "renderer-startup-dialog";
// Causes the process to run as a sandbox IPC subprocess.
const char kSandboxIPCProcess[] = "sandbox-ipc";
// Visibly render a border around layout shift rects in the web page to help
// debug and study layout shifts.
const char kShowLayoutShiftRegions[] = "show-layout-shift-regions";
// Visibly render a border around paint rects in the web page to help debug
// and study painting behavior.
const char kShowPaintRects[] = "show-paint-rects";
......
......@@ -207,6 +207,7 @@ CONTENT_EXPORT extern const char kRendererProcess[];
CONTENT_EXPORT extern const char kRendererProcessLimit[];
CONTENT_EXPORT extern const char kRendererStartupDialog[];
extern const char kSandboxIPCProcess[];
extern const char kShowLayoutShiftRegions[];
extern const char kShowPaintRects[];
CONTENT_EXPORT extern const char kSingleProcess[];
CONTENT_EXPORT extern const char kSitePerProcess[];
......
......@@ -2953,6 +2953,8 @@ cc::LayerTreeSettings RenderWidget::GenerateLayerTreeSettings(
cmd.HasSwitch(cc::switches::kShowLayerAnimationBounds);
settings.initial_debug_state.show_paint_rects =
cmd.HasSwitch(switches::kShowPaintRects);
settings.initial_debug_state.show_layout_shift_regions =
cmd.HasSwitch(switches::kShowLayoutShiftRegions);
settings.initial_debug_state.show_property_changed_rects =
cmd.HasSwitch(cc::switches::kShowPropertyChangedRects);
settings.initial_debug_state.show_surface_damage_rects =
......
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