From 834b6de5d565c51073e851483e82c0c106fd128f Mon Sep 17 00:00:00 2001 From: Felipe Erias Date: Fri, 23 Apr 2021 10:16:46 +0000 Subject: [PATCH] Bug 1701666 [wpt PR 28280] - Initial implementation of scrollbar-width, a=testonly Automatic update from web-platform-tests Initial implementation of scrollbar-width ComputedStyle::HasCustomScrollbarStyle() returns true if a custom style for the scrollbar has been set via ::-webkit-scrollbar and the value of scrollbar-width has not been changed from the default. This replaces HasPseudoElementStyle(kPseudoIdScrollbar) so the standard properties for styling scrollbars take precedence over the non-standard method. For convenience, the method Scrollbar::CSSScrollbarWidth() returns the value of the scrollbar-width property in that scrollbar's style. Scrollbar themes take scrollbar-width into account when calculating a scrollbar's thickness, margin, etc. When scrollbar-width is "none", scrollbar themes simply return a thickness of 0 to hide the scrollbar. WebThemeEngine::ScrollbarStyle includes the thickness and margin values for the thin variant. ScrollbarThemeMac uses NSRegularControlSize and NSSmallControlSize to size and display the appropriate type of scrollbar for the default and thin variants. ScrollbarThemeOverlay stores the thickness and margin for the thin variant, although at the moment these values are the same as the default (pending changes to WebThemeEngine). The same applies to the ScrollbarThemeOverlayMobile subclass. ScrollbarThemeAura simply scales the default scrollbar by a 2/3 ratio to paint the thin variant. In the future, the theme should include specific width values for this variant. Perhaps it would also be desirable to use a different set of graphic elements. WPT tests are included. Bug: 891944 Change-Id: I2d451f07de5a16e6cada8a68ae01da7358e8652a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2681340 Reviewed-by: Xianzhu Wang Reviewed-by: Philip Rogers Reviewed-by: Rune Lillesveen Reviewed-by: Kentaro Hara Commit-Queue: Felipe Erias Cr-Commit-Position: refs/heads/master@{#872500} -- wpt-commits: f68f2e6bbe1c50a30e690243b64906f2a490e515 wpt-pr: 28280 --- .../css-scrollbars/scrollbar-width-001.html | 175 ++++++++++++++++++ .../css-scrollbars/scrollbar-width-002.html | 168 +++++++++++++++++ .../css-scrollbars/scrollbar-width-003.html | 155 ++++++++++++++++ .../css-scrollbars/scrollbar-width-004.html | 155 ++++++++++++++++ .../css-scrollbars/scrollbar-width-005.html | 61 ++++++ .../css-scrollbars/scrollbar-width-006.html | 61 ++++++ .../css-scrollbars/scrollbar-width-007.html | 61 ++++++ .../css-scrollbars/scrollbar-width-008.html | 66 +++++++ .../scrollbar-width-paint-001-ref.html | 62 +++++++ .../scrollbar-width-paint-001.html | 80 ++++++++ .../scrollbar-width-paint-002-ref.html | 62 +++++++ .../scrollbar-width-paint-002.html | 80 ++++++++ 12 files changed, 1186 insertions(+) create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-001.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-002.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-003.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-004.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-005.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-006.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-007.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-008.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-001-ref.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-001.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-002-ref.html create mode 100644 testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-002.html diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-001.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-001.html new file mode 100644 index 000000000000..af50cd25215d --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-001.html @@ -0,0 +1,175 @@ + + +CSS Scrollbars: scrollbar-width with horizontal text and vertical scrollbar + + + + + + + + + + + Test scrollbar-width: vertical scrollbar, ltr direction + +
+
auto
+
+ +
+
thin
+
+ +
+
none
+
+ + Test scrollbar-width: vertical scrollbar, rtl direction + +
+
auto
+
+ +
+
thin
+
+ +
+
none
+
+ + diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-002.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-002.html new file mode 100644 index 000000000000..89a5d772182d --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-002.html @@ -0,0 +1,168 @@ + + +CSS Scrollbars: scrollbar-width with vertical text and horizontal scrollbar + + + + + + + + + + + Test scrollbar-width: horizontal scrollbar, vertical-lr direction + +
+
auto
+
+ +
+
thin
+
+ +
+
none
+
+ + Test scrollbar-width: horizontal scrollbar, vertical-rl direction + +
+
auto
+
+ +
+
thin
+
+ +
+
none
+
+ + diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-003.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-003.html new file mode 100644 index 000000000000..e0c1e59d051f --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-003.html @@ -0,0 +1,155 @@ + + +CSS Scrollbars: scrollbar-width with horizontal text, and vertical and horizontal scrollbars + + + + + + + + + + + Test scrollbar-width: both scrollbars, horizontal ltr + +
+
auto
+
+ +
+
thin
+
+ +
+
none
+
+ + Test scrollbar-width: both scrollbars, horizontal rtl + +
+
auto
+
+ +
+
thin
+
+ +
+
none
+
+ + diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-004.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-004.html new file mode 100644 index 000000000000..ee8bab0f0066 --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-004.html @@ -0,0 +1,155 @@ + + +CSS Scrollbars: scrollbar-width with vertical text, and vertical and horizontal scrollbars + + + + + + + + + + + Test scrollbar-width: both scrollbars, vertical-lr + +
+
auto
+
+ +
+
thin
+
+ +
+
none
+
+ + Test scrollbar-width: both scrollbars, vertical-rl + +
+
auto
+
+ +
+
thin
+
+ +
+
none
+
+ + diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-005.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-005.html new file mode 100644 index 000000000000..ea5f77afad0f --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-005.html @@ -0,0 +1,61 @@ + + +CSS Scrollbars: scrollbar-width:auto on the root element + + + + + + + + + +
+ +
+ + + diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-006.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-006.html new file mode 100644 index 000000000000..3b1cc0ba59d4 --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-006.html @@ -0,0 +1,61 @@ + + +CSS Scrollbars: scrollbar-width:thin on the root element + + + + + + + + + +
+ +
+ + + diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-007.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-007.html new file mode 100644 index 000000000000..c40a7a8e99ac --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-007.html @@ -0,0 +1,61 @@ + + +CSS Scrollbars: scrollbar-width:none on the root element + + + + + + + + + +
+ +
+ + + diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-008.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-008.html new file mode 100644 index 000000000000..91e2cc7f0640 --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-008.html @@ -0,0 +1,66 @@ + + +CSS Scrollbars: scrollbar-width on the body is not propagated + + + + + + + + + +
+ +
+ + + diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-001-ref.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-001-ref.html new file mode 100644 index 000000000000..2e7d40d9a35f --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-001-ref.html @@ -0,0 +1,62 @@ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-001.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-001.html new file mode 100644 index 000000000000..5318a24fb159 --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-001.html @@ -0,0 +1,80 @@ + + +CSS Scrollbars: paint test when updating scrollbar-width, with scrolling content + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-002-ref.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-002-ref.html new file mode 100644 index 000000000000..2d00629e6129 --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-002-ref.html @@ -0,0 +1,62 @@ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-002.html b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-002.html new file mode 100644 index 000000000000..4a18977a7e4e --- /dev/null +++ b/testing/web-platform/tests/css/css-scrollbars/scrollbar-width-paint-002.html @@ -0,0 +1,80 @@ + + +CSS Scrollbars: paint test when updating scrollbar-width, with overflow:auto + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+