Bug 1804812 - Allow authors to override listbox select overflow styles. r=jfkthame,layout-reviewers

This matches what Chromium does, and seems generally better.

Differential Revision: https://phabricator.services.mozilla.com/D165693
This commit is contained in:
Emilio Cobos Álvarez 2023-01-07 23:52:31 +00:00
parent d62c4c4d55
commit 5981f732db
6 changed files with 28 additions and 19 deletions

View file

@ -401,17 +401,6 @@ void nsListControlFrame::Reflow(nsPresContext* aPresContext,
nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
}
ScrollStyles nsListControlFrame::GetScrollStyles() const {
// TODO(emilio, bug 1750431): Set this in html.css and devirtualize
// GetScrollStyles().
auto style = StyleOverflow::Scroll;
if (GetWritingMode().IsVertical()) {
return ScrollStyles(style, StyleOverflow::Hidden);
} else {
return ScrollStyles(StyleOverflow::Hidden, style);
}
}
bool nsListControlFrame::ShouldPropagateComputedBSizeToScrolledContent() const {
return true;
}

View file

@ -7,14 +7,14 @@
#define nsListControlFrame_h___
#ifdef DEBUG_evaughan
//#define DEBUG_rods
// #define DEBUG_rods
#endif
#ifdef DEBUG_rods
//#define DO_REFLOW_DEBUG
//#define DO_REFLOW_COUNTER
//#define DO_UNCONSTRAINED_CHECK
//#define DO_PIXELS
// #define DO_REFLOW_DEBUG
// #define DO_REFLOW_COUNTER
// #define DO_UNCONSTRAINED_CHECK
// #define DO_PIXELS
#endif
#include "mozilla/Attributes.h"
@ -100,7 +100,6 @@ class nsListControlFrame final : public nsHTMLScrollFrame,
MOZ_CAN_RUN_SCRIPT_BOUNDARY
void SetFocus(bool aOn = true, bool aRepaint = false) final;
mozilla::ScrollStyles GetScrollStyles() const final;
bool ShouldPropagateComputedBSizeToScrolledContent() const final;
// for accessibility purposes

View file

@ -1034,7 +1034,7 @@ class nsHTMLScrollFrame : public nsContainerFrame,
nsIFrame* GetScrolledFrame() const final {
return mHelper.GetScrolledFrame();
}
mozilla::ScrollStyles GetScrollStyles() const override {
mozilla::ScrollStyles GetScrollStyles() const final {
return mHelper.GetScrollStylesFromFrame();
}
bool IsForTextControlWithNoScrollbars() const final {

View file

@ -247,7 +247,8 @@ select {
}
select:-moz-select-list-box {
overflow: auto;
overflow-inline: hidden;
overflow-block: scroll;
padding-inline: 0;
background-color: Field;
color: FieldText;

View file

@ -0,0 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<title>CSS Test Reference</title>
<select size=3 style="scrollbar-width: none">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</select>

View file

@ -0,0 +1,12 @@
<!doctype html>
<meta charset=utf-8>
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<link rel="author" href="https://mozilla.org" title="Mozilla">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1804812">
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#overflow-properties">
<link rel="match" href="select-size-overflow-001-ref.html">
<select size=3 style="overflow: hidden">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</select>