ui: Reduce virtual canvas redraws and provide more axis control

A bit of background about VirtualCanvas:

The VirtualCanvas class takes a large element contained within a
scrolling container element, and places a canvas on top of this large
element and moves it around so that it stays covering the viewport of
the scrolling container. Thus it makes it seem that the entire large
element is on big canvas, but avoids the canvas size limits imposed by
most systems.

Because the browser can scroll more quickly than onscroll events are
fired, the overlay canvas is oversized a little to provide a bit of
leeway if onscroll events are delayed. However, the canvas is moved
and needs to be redrawn on every onscroll event.

This CL introduces two new options to VirtualCanvas:

1. tolerancePx: Reduce canvas redraws using a tolerance factor.

This setting allows us to be more lazy when it comes to moving and
redrawing the canvas. This setting defines the minimum distance the
edge of the canvas can get to the viewport before being redrawn.

This, combined with the overdrawPx setting, control how frequently the
canvas is redrawn.

2. overdrawAxes: Control which axes are overdrawn

Currently VirtualCanvas overdraws in both x and y axes as it allows for
scrolling in both axes. The reality is that usually only one axis is
scrolled. This setting allows users to control which axes are overdrawn
which means that it can be disabled in the x axis e.g. if the container
is only scrolled vertically.

Change-Id: I7191f190fc557f9cc73ab67b94bca3105a8d16af
4 files changed
tree: b957de9e907ec7f85929a5c2077a1ebc7a2580ba
  1. .github/
  2. bazel/
  3. build_overrides/
  4. buildtools/
  5. debian/
  6. docs/
  7. examples/
  8. gn/
  9. include/
  10. infra/
  11. protos/
  12. python/
  13. src/
  14. test/
  15. third_party/
  16. tools/
  17. ui/
  18. .bazelignore
  19. .bazelrc
  20. .clang-format
  21. .clang-tidy
  22. .git-blame-ignore-revs
  23. .gitattributes
  24. .gitignore
  25. .gn
  26. .style.yapf
  27. Android.bp
  28. Android.bp.extras
  29. BUILD
  30. BUILD.extras
  31. BUILD.gn
  32. CHANGELOG
  33. codereview.settings
  34. DIR_METADATA
  35. heapprofd.rc
  36. LICENSE
  37. meson.build
  38. METADATA
  39. MODULE_LICENSE_APACHE2
  40. OWNERS
  41. perfetto.rc
  42. PerfettoIntegrationTests.xml
  43. persistent_cfg.pbtxt
  44. PRESUBMIT.py
  45. README.chromium
  46. README.md
  47. TEST_MAPPING
  48. traced_perf.rc
  49. WATCHLISTS
  50. WORKSPACE
README.md

Perfetto - System profiling, app tracing and trace analysis

Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.

See https://perfetto.dev/docs or the /docs/ directory for documentation.