CSS highlight painting: split originating and ::selection decorations

This patch builds on /c/2902289 by splitting the paints for unselected
and selection text, which means that for the first time, all of these
properties should hold true regardless of whether text is selected:

P1. underlines and overlines are never painted over text
P2. lines-through are always painted over text
P3. decorations on any unselected parts are in originating td-color
P4. selected part decorations paint over ::selection background
P5. ::selection background always paints over unselected text

Here’s a comparison of how these properties have evolved:

• pre-M90 ensured P1 + P4, but violated P2 + P3 + P5
• /c/2647046 ensured P1 + P5, but violated P2 + P3 + P4
• /c/2902289 ensured P2 + P4 + P5, but violated P1 + P3
• this patch ensures P1 + P2 + P3 + P4 + P5

To test the properties more effectively, I’ve replaced one of my
highlight painting tests with two more effective tests, and added
smaller tests for properties P1 through P4.

<https://wpt.live/css/css-pseudo/highlight-painting-003.html> now
tests solid decorations with ::selection underline and originating
line-through, plus an originating background.

• https://bucket.daz.cat/ee288ed9a20b1a2f.png = pre-M90
• https://bucket.daz.cat/e689c7ada0c05594.png = /c/2647046
• https://bucket.daz.cat/42d48433dfc51e15.png = /c/2902289
• https://bucket.daz.cat/1658767a17294d93.png = this patch

<https://wpt.live/css/css-pseudo/highlight-painting-004.html> tests
wavy decorations, but with originating underline and ::selection
line-through, and no originating background:

• https://bucket.daz.cat/5e28cd46a5972359.png = pre-M90
• https://bucket.daz.cat/b44c05422d47a0b3.png = /c/2647046
• https://bucket.daz.cat/5e28cd46a5972359.png = /c/2902289
• https://bucket.daz.cat/6647e4443a92cec5.png = this patch

For reference, here are the refs:

• https://bucket.daz.cat/439df4145d54fede.png = 003-ref
• https://bucket.daz.cat/05b20f2ec3675e7e.png = 004-ref1
• https://bucket.daz.cat/c898a37e256b3e44.png = 004-ref2
• https://bucket.daz.cat/bd4b272d1bcdf932.png = 004-ref3

This brings us closer to passing those tests, but not quite there.
Next up, we need to recolor the decorations lifted from originating
style to the ::selection overlay to ::selection’s color, not its
text-decoration-color as done in <https://crrev.com/c/2383212>.

Bug: 1147859
Change-Id: I011323db9b481175fb750ab810b6741239522087
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2903387
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#915543}
24 files changed
tree: 01460b13a0f058fdbabc131f89c53dad6ca2c364
  1. android_webview/
  2. apps/
  3. ash/
  4. base/
  5. build/
  6. build_overrides/
  7. buildtools/
  8. cc/
  9. chrome/
  10. chromecast/
  11. chromeos/
  12. cloud_print/
  13. codelabs/
  14. components/
  15. content/
  16. courgette/
  17. crypto/
  18. dbus/
  19. device/
  20. docs/
  21. extensions/
  22. fuchsia/
  23. gin/
  24. google_apis/
  25. google_update/
  26. gpu/
  27. headless/
  28. infra/
  29. ios/
  30. ipc/
  31. jingle/
  32. media/
  33. mojo/
  34. native_client_sdk/
  35. net/
  36. pdf/
  37. ppapi/
  38. printing/
  39. remoting/
  40. rlz/
  41. sandbox/
  42. services/
  43. skia/
  44. sql/
  45. storage/
  46. styleguide/
  47. testing/
  48. third_party/
  49. tools/
  50. ui/
  51. url/
  52. weblayer/
  53. .clang-format
  54. .clang-tidy
  55. .eslintrc.js
  56. .git-blame-ignore-revs
  57. .gitattributes
  58. .gitignore
  59. .gn
  60. .mailmap
  61. .vpython
  62. .vpython3
  63. .yapfignore
  64. AUTHORS
  65. BUILD.gn
  66. CODE_OF_CONDUCT.md
  67. codereview.settings
  68. DEPS
  69. DIR_METADATA
  70. ENG_REVIEW_OWNERS
  71. LICENSE
  72. LICENSE.chromium_os
  73. OWNERS
  74. PRESUBMIT.py
  75. PRESUBMIT_test.py
  76. PRESUBMIT_test_mocks.py
  77. README.md
  78. WATCHLISTS
README.md

Logo Chromium

Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.

The project's web site is https://www.chromium.org.

To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.

Documentation in the source is rooted in docs/README.md.

Learn how to Get Around the Chromium Source Code Directory Structure .

For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.

If you found a bug, please file it at https://crbug.com/new.