Skip to content

Truly independent web browser

LibWeb: Paint rounded corners on form controls with native appearance

Andreas Kling17c9614c21ff
diff --git a/Libraries/LibWeb/HTML/HTMLElement.h b/Libraries/LibWeb/HTML/HTMLElement.h
index 75ab42e0f5c..679b8729179 100644
--- a/Libraries/LibWeb/HTML/HTMLElement.h
+++ b/Libraries/LibWeb/HTML/HTMLElement.h
@@ -198,6 +198,11 @@ public:
// https://html.spec.whatwg.org/multipage/rendering.html#button-layout
virtual bool uses_button_layout() const { return false; }
+ // https://drafts.csswg.org/css-ui/#devolvable
+ // https://html.spec.whatwg.org/multipage/rendering.html#button-layout
+ // When an element uses button layout, it is a devolvable widget [...]
+ virtual bool is_devolvable_widget() const { return uses_button_layout(); }
+
WebIDL::UnsignedLong computed_heading_level() const;
WebIDL::UnsignedLong computed_heading_offset() const;
diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 51abe5621ea..2ee7f95f290 100644
--- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -4304,6 +4304,39 @@ bool HTMLInputElement::uses_button_layout() const
TypeAttributeState::Button, TypeAttributeState::Color, TypeAttributeState::FileUpload);
}
+// https://drafts.csswg.org/css-ui/#devolvable
+bool HTMLInputElement::is_devolvable_widget() const
+{
+ switch (type_state()) {
+ // https://html.spec.whatwg.org/multipage/rendering.html#the-input-element-as-a-text-entry-widget
+ // An input element whose type attribute is in the Text, Telephone, URL, or Email state, is a devolvable widget.
+ case TypeAttributeState::Text:
+ case TypeAttributeState::Telephone:
+ case TypeAttributeState::URL:
+ case TypeAttributeState::Email:
+ // An input element whose type attribute is in the Search state is a devolvable widget.
+ case TypeAttributeState::Search:
+ // An input element whose type attribute is in the Password state is a devolvable widget.
+ case TypeAttributeState::Password:
+ // https://html.spec.whatwg.org/multipage/rendering.html#the-input-element-as-domain-specific-widgets
+ // An input element whose type attribute is in the Date state is a devolvable widget [...]
+ // An input element whose type attribute is in the Month state is a devolvable widget [...]
+ // An input element whose type attribute is in the Week state is a devolvable widget [...]
+ // An input element whose type attribute is in the Time state is a devolvable widget [...]
+ // An input element whose type attribute is in the Local Date and Time state is a devolvable widget [...]
+ // An input element whose type attribute is in the Number state is a devolvable widget [...]
+ case TypeAttributeState::Date:
+ case TypeAttributeState::Month:
+ case TypeAttributeState::Week:
+ case TypeAttributeState::Time:
+ case TypeAttributeState::LocalDateAndTime:
+ case TypeAttributeState::Number:
+ return true;
+ default:
+ return HTMLElement::is_devolvable_widget();
+ }
+}
+
Optional<Utf16String> HTMLInputElement::selected_text_for_stringifier() const
{
// https://w3c.github.io/selection-api/#dom-selection-stringifier
diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.h b/Libraries/LibWeb/HTML/HTMLInputElement.h
index 80ca019e082..6ee555200f4 100644
--- a/Libraries/LibWeb/HTML/HTMLInputElement.h
+++ b/Libraries/LibWeb/HTML/HTMLInputElement.h
@@ -290,6 +290,7 @@ public:
virtual bool is_mutable() const override;
virtual bool uses_button_layout() const override;
+ virtual bool is_devolvable_widget() const override;
bool is_allowed_to_be_readonly() const;
private:
diff --git a/Libraries/LibWeb/HTML/HTMLMeterElement.h b/Libraries/LibWeb/HTML/HTMLMeterElement.h
index 53502d78e1c..d5eae8eb04c 100644
--- a/Libraries/LibWeb/HTML/HTMLMeterElement.h
+++ b/Libraries/LibWeb/HTML/HTMLMeterElement.h
@@ -41,6 +41,10 @@ public:
// https://html.spec.whatwg.org/multipage/forms.html#category-label
virtual bool is_labelable() const override { return true; }
+ // https://html.spec.whatwg.org/multipage/rendering.html#the-meter-element-2
+ // The meter element is a devolvable widget.
+ virtual bool is_devolvable_widget() const override { return true; }
+
// https://www.w3.org/TR/html-aria/#el-meter
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::meter; }
diff --git a/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Libraries/LibWeb/HTML/HTMLProgressElement.h
index 12f3fcb0875..4cc77cbc28c 100644
--- a/Libraries/LibWeb/HTML/HTMLProgressElement.h
+++ b/Libraries/LibWeb/HTML/HTMLProgressElement.h
@@ -33,6 +33,10 @@ public:
// https://html.spec.whatwg.org/multipage/forms.html#category-label
virtual bool is_labelable() const override { return true; }
+ // https://html.spec.whatwg.org/multipage/rendering.html#the-progress-element-2
+ // The progress element is a devolvable widget.
+ virtual bool is_devolvable_widget() const override { return true; }
+
// https://www.w3.org/TR/html-aria/#el-progress
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::progressbar; }
diff --git a/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Libraries/LibWeb/HTML/HTMLSelectElement.h
index f44e1c3a139..ff0550486bd 100644
--- a/Libraries/LibWeb/HTML/HTMLSelectElement.h
+++ b/Libraries/LibWeb/HTML/HTMLSelectElement.h
@@ -88,6 +88,11 @@ public:
// https://html.spec.whatwg.org/multipage/forms.html#category-label
virtual bool is_labelable() const override { return true; }
+ // https://html.spec.whatwg.org/multipage/rendering.html#the-select-element-2
+ // When the element renders as a list box, it is a devolvable widget [...]
+ // When the element renders as a drop-down box, it is a devolvable widget [...]
+ virtual bool is_devolvable_widget() const override { return true; }
+
virtual void reset_algorithm() override;
Utf16FlyString type() const;
diff --git a/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
index cd37b388309..dfd0ba0f1a9 100644
--- a/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
+++ b/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
@@ -66,6 +66,10 @@ public:
// https://html.spec.whatwg.org/multipage/forms.html#category-label
virtual bool is_labelable() const override { return true; }
+ // https://html.spec.whatwg.org/multipage/rendering.html#the-textarea-element-2
+ // The textarea element is a devolvable widget [...]
+ virtual bool is_devolvable_widget() const override { return true; }
+
virtual void reset_algorithm() override;
virtual void clear_algorithm() override;
diff --git a/Libraries/LibWeb/Layout/Node.cpp b/Libraries/LibWeb/Layout/Node.cpp
index 26d174ea781..452a9e4bdee 100644
--- a/Libraries/LibWeb/Layout/Node.cpp
+++ b/Libraries/LibWeb/Layout/Node.cpp
@@ -53,6 +53,8 @@ u8 Node::dom_paint_facts_of(DOM::Node const* node)
facts |= static_cast<u8>(RustFFI::DomPaintFact::InsideBlockingWheelEventHandler);
if (auto const* navigable_container = as_if<HTML::NavigableContainer>(*node); navigable_container && navigable_container->content_navigable())
facts |= static_cast<u8>(RustFFI::DomPaintFact::NestedNavigableContainer);
+ if (auto const* html_element = as_if<HTML::HTMLElement>(*node); html_element && html_element->is_devolvable_widget())
+ facts |= static_cast<u8>(RustFFI::DomPaintFact::DevolvableWidget);
return facts;
}
diff --git a/Libraries/LibWeb/Rust/src/css/computed_longhand_table.rs b/Libraries/LibWeb/Rust/src/css/computed_longhand_table.rs
index 042a9c7e759..5b22796b209 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_longhand_table.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_longhand_table.rs
@@ -615,6 +615,10 @@ pub(crate) const HIGHLIGHT_COLORS_AUTHORED: u8 = 1 << 5;
/// computed value is the originating element's color, but painting draws the layer below instead.
/// https://drafts.csswg.org/css-pseudo-4/#highlight-text
pub(crate) const HIGHLIGHT_COLOR_IS_CURRENT_COLOR: u8 = 1 << 6;
+/// The dependency-flag bit of a record with a cascaded value from the author origin for any property that disables
+/// native appearance for widgets.
+/// https://drafts.csswg.org/css-ui/#appearance-disabling-properties
+pub(crate) const NATIVE_APPEARANCE_DISABLED: u8 = 1 << 7;
#[derive(Clone, Copy)]
#[repr(C)]
@@ -827,6 +831,14 @@ impl ComputedLonghandTable {
self.metadata.dependency_flags
}
+ pub(crate) fn set_native_appearance_disabled(&mut self, disabled: bool) {
+ if disabled {
+ self.metadata.dependency_flags |= NATIVE_APPEARANCE_DISABLED;
+ } else {
+ self.metadata.dependency_flags &= !NATIVE_APPEARANCE_DISABLED;
+ }
+ }
+
pub(crate) fn publication_dependency_flags(&self) -> u8 {
if self.metadata.in_display_none_subtree {
self.metadata.dependency_flags | IN_DISPLAY_NONE_SUBTREE
diff --git a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs b/Libraries/LibWeb/Rust/src/css/computed_value_types.rs
index 40b9f732e9b..dba431744d7 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_value_types.rs
@@ -339,6 +339,8 @@ pub struct MiscResetValues {
pub column_fill: u8,
pub appearance: u8,
pub computed_appearance: u8,
+ /// https://drafts.csswg.org/css-ui/#appearance-disabling-properties
+ pub native_appearance_disabled: bool,
pub outline_style: u8,
pub object_fit: u8,
pub column_height: ComputedSize,
diff --git a/Libraries/LibWeb/Rust/src/css/computed_value_views.rs b/Libraries/LibWeb/Rust/src/css/computed_value_views.rs
index e68590d54d1..4715fabd653 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_value_views.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_value_views.rs
@@ -445,6 +445,7 @@ scalar_accessors! {
}
misc_reset: {
appearance: u8 => appearance,
+ native_appearance_disabled: bool => native_appearance_disabled,
column_fill: u8 => column_fill,
column_span: u8 => column_span,
column_rule_style: u8 => column_rule_style,
diff --git a/Libraries/LibWeb/Rust/src/css/computed_values.rs b/Libraries/LibWeb/Rust/src/css/computed_values.rs
index cf0edd2b513..fff0f548dd6 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_values.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_values.rs
@@ -805,6 +805,7 @@ impl_computed_payload_clone_and_eq!(MiscResetValues {
column_fill,
appearance,
computed_appearance,
+ native_appearance_disabled,
outline_style,
object_fit,
column_height,
@@ -2519,6 +2520,11 @@ impl StyleGroupMasks {
// NB: The box group holds the used containment flags implied by hidden content visibility.
masks[index(crate::css::property_metadata::property_id::CONTENT_VISIBILITY)] |=
1 << crate::css::table_group_builder::group_index::BOX;
+ // NB: The misc reset group holds whether an author declaration disables native appearance, which these
+ // properties' winners decide.
+ for &property in crate::css::style_compute::PROPERTIES_DISABLING_NATIVE_APPEARANCE {
+ masks[index(property)] |= 1 << crate::css::table_group_builder::group_index::MISC_RESET;
+ }
Self { masks, output_masks }
}
@@ -3760,6 +3766,7 @@ impl MiscResetValues {
column_fill: crate::css::css_enums::column_fill::BALANCE,
appearance: 0,
computed_appearance: 7,
+ native_appearance_disabled: false,
outline_style: 1,
object_fit: 0,
column_height: ComputedSize::keyword(ComputedSizeKind::Auto),
diff --git a/Libraries/LibWeb/Rust/src/css/style/cascade.rs b/Libraries/LibWeb/Rust/src/css/style/cascade.rs
index 5160977c7f5..7c6c6516ecc 100644
--- a/Libraries/LibWeb/Rust/src/css/style/cascade.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/cascade.rs
@@ -220,6 +220,18 @@ impl CascadePriority {
}
}
+ /// The origin of the declaration this priority was built for.
+ #[must_use]
+ pub fn cascade_origin(&self) -> CascadeOrigin {
+ match self.origin_importance {
+ 0 | 8 => CascadeOrigin::UserAgent,
+ 1 | 7 => CascadeOrigin::User,
+ 2 | 6 => CascadeOrigin::AuthorPresentationalHint,
+ 3 | 5 => CascadeOrigin::Author,
+ rank => unreachable!("origin-importance rank {rank} names no origin"),
+ }
+ }
+
/// Where among an element's encapsulation contexts an author declaration's priority places it:
/// the `context_depth` it was built from. `None` for the other origins.
#[must_use]
diff --git a/Libraries/LibWeb/Rust/src/css/style/publication.rs b/Libraries/LibWeb/Rust/src/css/style/publication.rs
index e05f8748bbd..aff46778775 100644
--- a/Libraries/LibWeb/Rust/src/css/style/publication.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/publication.rs
@@ -3631,6 +3631,7 @@ impl RetainedState {
value: unset_value(),
source: declared_winner.source,
},
+ None,
),
Some(winner_store::RevertedDeclaration {
position: (declared_winner.priority, index),
@@ -3910,7 +3911,12 @@ impl RetainedState {
declarations.push((
winner.priority,
index,
- WinnerDeclaration::new(winner.property, winner.important, value),
+ WinnerDeclaration::new(
+ winner.property,
+ winner.important,
+ value,
+ Some(winner.priority.cascade_origin()),
+ ),
revert,
));
}
diff --git a/Libraries/LibWeb/Rust/src/css/style/publication/demand.rs b/Libraries/LibWeb/Rust/src/css/style/publication/demand.rs
index f867049474b..e7de354d889 100644
--- a/Libraries/LibWeb/Rust/src/css/style/publication/demand.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/publication/demand.rs
@@ -735,6 +735,11 @@ impl RetainedState {
value: invalid_as_unset(value),
source: WinnerSource::Element(kind),
},
+ Some(match kind {
+ ElementDeclarationKind::InlineStyle => CascadeOrigin::Author,
+ ElementDeclarationKind::PresentationalHint
+ | ElementDeclarationKind::SvgPresentationAttribute => CascadeOrigin::AuthorPresentationalHint,
+ }),
));
}
}
diff --git a/Libraries/LibWeb/Rust/src/css/style/publication/winner_store.rs b/Libraries/LibWeb/Rust/src/css/style/publication/winner_store.rs
index 66b95ae580e..f1a96a55317 100644
--- a/Libraries/LibWeb/Rust/src/css/style/publication/winner_store.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/publication/winner_store.rs
@@ -32,6 +32,9 @@ pub(super) struct WinnerDeclaration {
pub(super) property: u16,
pub(super) important: bool,
pub(super) value: WinnerValue,
+ /// The origin of the winning declaration, or none for a declaration that rolled back past every other one and
+ /// leaves the property without a cascaded value.
+ pub(super) origin: Option<CascadeOrigin>,
/// `external_value_dependencies(value)`, memoized, packed into one word with a bit saying
/// it has been computed. A `Cell` would do on one thread, but a winner store is on the read
/// side an evaluation step borrows, which has to be `Sync`. The memo is a pure function of
@@ -76,11 +79,12 @@ fn unpack_dependencies(bits: u32) -> ExternalValueDependencies {
}
impl WinnerDeclaration {
- pub(super) fn new(property: u16, important: bool, value: WinnerValue) -> Self {
+ pub(super) fn new(property: u16, important: bool, value: WinnerValue, origin: Option<CascadeOrigin>) -> Self {
Self {
property,
important,
value,
+ origin,
dependencies: AtomicU32::new(0),
}
}
@@ -429,7 +433,7 @@ impl CascadedValues for WinnerView<'_> {
}
fn winning_origin(&self, property: u16) -> Option<CascadeOrigin> {
- self.store.declaration(property).map(|_| CascadeOrigin::Author)
+ self.store.declaration(property)?.1.origin
}
fn property_with_higher_priority(&self, first: u16, second: u16) -> u16 {
@@ -472,6 +476,7 @@ mod tests {
value: RetainedStyleValueData::from_owned(StyleValueData::Length { value, unit }),
source: WinnerSource::Element(ElementDeclarationKind::InlineStyle),
},
+ Some(CascadeOrigin::Author),
)])
}
@@ -515,6 +520,7 @@ mod tests {
value: RetainedStyleValueData::from_owned(value),
source: WinnerSource::Element(ElementDeclarationKind::InlineStyle),
},
+ Some(CascadeOrigin::Author),
)])
};
let engine = StyleEngine::new();
@@ -609,6 +615,7 @@ mod tests {
source: WinnerSource::Element(kind),
index,
},
+ Some(CascadeOrigin::Author),
)
})
.collect(),
diff --git a/Libraries/LibWeb/Rust/src/css/style_compute.rs b/Libraries/LibWeb/Rust/src/css/style_compute.rs
index 585391858da..1b4e205fd36 100644
--- a/Libraries/LibWeb/Rust/src/css/style_compute.rs
+++ b/Libraries/LibWeb/Rust/src/css/style_compute.rs
@@ -3701,6 +3701,73 @@ impl DriveZoom {
}
}
+// https://drafts.csswg.org/css-ui/#appearance-disabling-properties
+pub(crate) const PROPERTIES_DISABLING_NATIVE_APPEARANCE: &[u16] = {
+ use crate::css::property_metadata::property_id as prop;
+ &[
+ prop::BACKGROUND_COLOR,
+ prop::BORDER_TOP_COLOR,
+ prop::BORDER_TOP_STYLE,
+ prop::BORDER_TOP_WIDTH,
+ prop::BORDER_RIGHT_COLOR,
+ prop::BORDER_RIGHT_STYLE,
+ prop::BORDER_RIGHT_WIDTH,
+ prop::BORDER_BOTTOM_COLOR,
+ prop::BORDER_BOTTOM_STYLE,
+ prop::BORDER_BOTTOM_WIDTH,
+ prop::BORDER_LEFT_COLOR,
+ prop::BORDER_LEFT_STYLE,
+ prop::BORDER_LEFT_WIDTH,
+ prop::BORDER_BLOCK_START_COLOR,
+ prop::BORDER_BLOCK_END_COLOR,
+ prop::BORDER_INLINE_START_COLOR,
+ prop::BORDER_INLINE_END_COLOR,
+ prop::BORDER_BLOCK_START_STYLE,
+ prop::BORDER_BLOCK_END_STYLE,
+ prop::BORDER_INLINE_START_STYLE,
+ prop::BORDER_INLINE_END_STYLE,
+ prop::BORDER_BLOCK_START_WIDTH,
+ prop::BORDER_BLOCK_END_WIDTH,
+ prop::BORDER_INLINE_START_WIDTH,
+ prop::BORDER_INLINE_END_WIDTH,
+ prop::BACKGROUND_IMAGE,
+ prop::BACKGROUND_ATTACHMENT,
+ // NB: The spec lists background-position, which is a shorthand for these two here.
+ prop::BACKGROUND_POSITION_X,
+ prop::BACKGROUND_POSITION_Y,
+ prop::BACKGROUND_CLIP,
+ prop::BACKGROUND_ORIGIN,
+ prop::BACKGROUND_SIZE,
+ prop::BORDER_IMAGE_SOURCE,
+ prop::BORDER_IMAGE_SLICE,
+ prop::BORDER_IMAGE_WIDTH,
+ prop::BORDER_IMAGE_OUTSET,
+ prop::BORDER_IMAGE_REPEAT,
+ prop::BORDER_TOP_LEFT_RADIUS,
+ prop::BORDER_TOP_RIGHT_RADIUS,
+ prop::BORDER_BOTTOM_RIGHT_RADIUS,
+ prop::BORDER_BOTTOM_LEFT_RADIUS,
+ prop::BORDER_START_START_RADIUS,
+ prop::BORDER_START_END_RADIUS,
+ prop::BORDER_END_START_RADIUS,
+ prop::BORDER_END_END_RADIUS,
+ ]
+};
+
+// https://drafts.csswg.org/css-ui/#appearance-disabling-properties
+// Certain properties, when declared in the Author Origin, will disable the native appearance of certain widgets.
+// Specifically, if all the declarations of the Author Origin pertaining to such a widget are cascaded and a cascaded
+// value exists--after having rolled back any number revert or revert-layer values--for any property that disables
+// native appearance for widgets, then that widget is rendered as a devolved widget.
+fn has_author_value_disabling_native_appearance(store: &impl crate::css::cascaded_properties::CascadedValues) -> bool {
+ PROPERTIES_DISABLING_NATIVE_APPEARANCE.iter().any(|&property_id| {
+ matches!(
+ store.winning_origin(property_id),
+ Some(CascadeOrigin::Author | CascadeOrigin::AuthorPresentationalHint)
+ )
+ })
+}
+
/// Drives the property computation loop: iterates every longhand in
/// computation order, resolves logical pairing, reads the winning cascaded
/// declarations straight from the store, selects between the cascaded,
@@ -5022,6 +5089,16 @@ pub(crate) unsafe fn drive_property_computation(
results.highlight_colors_authored,
results.highlight_color_is_current_color,
);
+ if phase == LONGHAND_DRIVE_PHASE_REMAINING {
+ // NB: Only an element whose appearance is not none can have a native appearance to disable. Leaving the flag
+ // clear for every other element keeps their author backgrounds and borders from splitting style groups.
+ let appearance_is_none = matches!(
+ longhand_table.get(prop::APPEARANCE).map(RetainedStyleValueData::data),
+ Some(StyleValueData::Keyword { keyword }) if *keyword == keyword::NONE
+ );
+ longhand_table
+ .set_native_appearance_disabled(!appearance_is_none && has_author_value_disabling_native_appearance(store));
+ }
if pending_effective_color_scheme >= 0 {
longhand_table.set_effective_color_scheme(pending_effective_color_scheme);
}
diff --git a/Libraries/LibWeb/Rust/src/css/table_group_builder.rs b/Libraries/LibWeb/Rust/src/css/table_group_builder.rs
index fcb18608052..602aea37df9 100644
--- a/Libraries/LibWeb/Rust/src/css/table_group_builder.rs
+++ b/Libraries/LibWeb/Rust/src/css/table_group_builder.rs
@@ -2321,8 +2321,11 @@ fn build_misc_reset_group(
let implicit_will_change = values
.animated_overlay
.map_or(&[][..], |overlay| overlay.implicit_will_change.as_slice());
+ let native_appearance_disabled =
+ values.table.dependency_flags() & crate::css::computed_longhand_table::NATIVE_APPEARANCE_DISABLED != 0;
- if implicit_will_change.is_empty() {
+ // NB: The generic builder only decodes property values, which leaves native_appearance_disabled at its default.
+ if implicit_will_change.is_empty() && !native_appearance_disabled {
let generic = build_generic_group(group_index::MISC_RESET, values, input, used_color_scheme, parent);
if !generic.is_null() {
return generic;
@@ -2495,6 +2498,7 @@ fn build_misc_reset_group(
};
payload.appearance = normalized_appearance;
payload.computed_appearance = computed_appearance;
+ payload.native_appearance_disabled = native_appearance_disabled;
payload.column_height = ComputedSize::from_data(values.handle(property_id::COLUMN_HEIGHT));
payload.outline_color = outline_color;
payload.object_position_x = position_offset(edge_x);
diff --git a/Libraries/LibWeb/Rust/src/layout/node_data.rs b/Libraries/LibWeb/Rust/src/layout/node_data.rs
index 25359c03d34..bf599bfc421 100644
--- a/Libraries/LibWeb/Rust/src/layout/node_data.rs
+++ b/Libraries/LibWeb/Rust/src/layout/node_data.rs
@@ -247,6 +247,9 @@ pub enum DomPaintFact {
EditableOrEditingHost = 1 << 1,
InsideBlockingWheelEventHandler = 1 << 2,
NestedNavigableContainer = 1 << 3,
+ /// The node is an element HTML classifies as a devolvable widget.
+ /// https://drafts.csswg.org/css-ui/#devolvable
+ DevolvableWidget = 1 << 4,
}
#[cfg(test)]
diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs
index cf63eeb88ca..de51c1da43e 100644
--- a/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs
+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs
@@ -371,6 +371,17 @@ fn border_radius_is_initial(handle: &ComputedStyleValueHandle) -> bool {
is_zero_px(horizontal_radius.data()) && is_zero_px(vertical_radius.data())
}
+const NATIVE_APPEARANCE_CORNER_RADIUS_PX: i64 = 4;
+
+/// Whether the node is a devolvable widget rendered with its native appearance: its appearance is not none, and no
+/// author declaration disables native appearance for it.
+/// https://drafts.csswg.org/css-ui/#appearance-disabling-properties
+fn has_native_appearance(style: ComputedValuesView<'_>, layout_arena: &impl PaintRead, slot: NodeSlotId) -> bool {
+ layout_arena.node_has_dom_paint_fact(slot, crate::layout::node_data::DomPaintFact::DevolvableWidget)
+ && style.appearance() != css_enums::appearance::NONE
+ && !style.native_appearance_disabled()
+}
+
pub(crate) fn border_radii_data(
style: ComputedValuesView<'_>,
layout_arena: &impl PaintRead,
@@ -387,7 +398,8 @@ pub(crate) fn border_radii_data(
|| !border_radius_is_initial(&border.border_bottom_right_radius)
|| !border_radius_is_initial(&border.border_top_left_radius)
|| !border_radius_is_initial(&border.border_top_right_radius);
- if !has_noninitial_radii {
+ let has_native_appearance = has_native_appearance(style, layout_arena, slot);
+ if !has_noninitial_radii && !has_native_appearance {
return BorderRadii::default();
}
let border_box = paintable_geometry::absolute_border_box_rect(layout_arena, slot);
@@ -397,6 +409,16 @@ pub(crate) fn border_radii_data(
border_box.width,
border_box.height,
);
+ if !has_noninitial_radii {
+ // NB: The native appearance of a devolvable widget has slightly rounded corners. Its computed border-radius
+ // stays zero, and an author border-radius devolves the widget.
+ return crate::painting::border_radii::scale_radii_to_fit(
+ border_rect,
+ BorderRadii {
+ values: [CssPixels::from_integer(NATIVE_APPEARANCE_CORNER_RADIUS_PX); 8],
+ },
+ );
+ }
crate::painting::border_radii::normalize_border_radii_data(
border_rect,
border_rect,
diff --git a/Tests/LibWeb/Ref/expected/input-background.html b/Tests/LibWeb/Ref/expected/input-background.html
index bfead6a5b8a..1ed32536c67 100644
--- a/Tests/LibWeb/Ref/expected/input-background.html
+++ b/Tests/LibWeb/Ref/expected/input-background.html
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<div style="background-color: blue">
- <input type="text" style="background-color: Field" />
+ <input type="text" style="background-color: Field; border-radius: 0" />
</div>
diff --git a/Tests/LibWeb/Ref/input/input-background.html b/Tests/LibWeb/Ref/input/input-background.html
index 346e24c2a2e..a5ecc2ea22b 100644
--- a/Tests/LibWeb/Ref/input/input-background.html
+++ b/Tests/LibWeb/Ref/input/input-background.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<link rel="match" href="../expected/input-background.html" />
<div style="background-color: blue">
- <input type="text" />
+ <input type="text" style="border-radius: 0" />
</div>
diff --git a/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png b/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png
index 5898055e98b..ef680723b48 100644
Binary files a/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png and b/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/input-placeholder.png b/Tests/LibWeb/Screenshot/expected/input-placeholder.png
index 58787aa7b67..e9f8c32f4a2 100644
Binary files a/Tests/LibWeb/Screenshot/expected/input-placeholder.png and b/Tests/LibWeb/Screenshot/expected/input-placeholder.png differ
diff --git a/Tests/LibWeb/Text/expected/display_list/button-with-text-decoration.txt b/Tests/LibWeb/Text/expected/display_list/button-with-text-decoration.txt
index a47b1c8e62f..aa8586b65d7 100644
--- a/Tests/LibWeb/Text/expected/display_list/button-with-text-decoration.txt
+++ b/Tests/LibWeb/Text/expected/display_list/button-with-text-decoration.txt
@@ -6,8 +6,8 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[8,8 106x20] color=rgb(239, 239, 239)
-FillRoundedRectRing@s1/e0 rect=[8,8 106x20] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[8,8 106x20] color=rgb(239, 239, 239)
+FillRoundedRectRing@s1/e0 rect=[8,8 106x20] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/e0 rect=[13,10 96x16] translation=[13,22.796875] color=rgb(0, 0, 0)
DrawLine@s1/e0 from=[13,26] to=[109,26] color=rgb(0, 0, 0) thickness=2 style=Solid
diff --git a/Tests/LibWeb/Text/expected/display_list/form-control-native-appearance-corners.txt b/Tests/LibWeb/Text/expected/display_list/form-control-native-appearance-corners.txt
new file mode 100644
index 00000000000..63fa049130f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/display_list/form-control-native-appearance-corners.txt
@@ -0,0 +1,38 @@
+AccumulatedVisualContext Tree:
+ spatial:
+ [s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
+ [s1] scroll (Viewport<#document>)
+ clips:
+ [c0 in s1] clip=[1,181 196x18] radii=(3,3,3,3) (TextInputBox<INPUT>)
+ [c1 in s1] clip=[3,182 192x16] (BlockContainer<DIV>)
+ [c2 in s1] clip=[3,213 196x18] (TextInputBox<INPUT>)
+ [c3 in s1] clip=[5,214 192x16] (BlockContainer<DIV>)
+ effects:
+ [e0 in s0] effects=[]
+
+DisplayList:
+FillRectWithRoundedCorners@s1/e0 rect=[0,0 58x20] color=rgb(239, 239, 239)
+FillRoundedRectRing@s1/e0 rect=[0,0 58x20] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
+DrawGlyphRun@s1/e0 rect=[5,2 48x16] translation=[5,14.796875] color=rgb(0, 0, 0)
+FillRectWithRoundedCorners@s1/e0 rect=[0,30 152x24] color=rgb(239, 239, 239)
+FillRoundedRectRing@s1/e0 rect=[0,30 152x24] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
+DrawGlyphRun@s1/e0 rect=[4,34 144x16] translation=[4,46.796875] color=rgb(0, 128, 0)
+FillRectWithRoundedCorners@s1/e0 rect=[0,60 144x20] color=rgb(239, 239, 239)
+FillRoundedRectRing@s1/e0 rect=[0,60 144x20] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
+DrawGlyphRun@s1/e0 rect=[5,62 134x16] translation=[5,74.796875] color=rgb(0, 0, 0)
+FillRect@s1/e0 rect=[0,90 99x20] color=rgb(0, 255, 0)
+FillRoundedRectRing@s1/e0 rect=[0,90 99x20] widths=[1,1,1,1] color=rgb(118, 118, 118)
+DrawGlyphRun@s1/e0 rect=[5,92 90x16] translation=[5,104.796875] color=rgb(0, 0, 0)
+FillRect@s1/e0 rect=[0,120 64x20] color=rgb(239, 239, 239)
+FillRoundedRectRing@s1/e0 rect=[0,120 64x20] widths=[1,1,1,1] color=rgb(255, 0, 0)
+DrawGlyphRun@s1/e0 rect=[5,122 54x16] translation=[5,134.79688] color=rgb(0, 0, 0)
+FillRect@s1/e0 rect=[0,150 153x20] color=rgb(239, 239, 239)
+FillRoundedRectRing@s1/e0 rect=[0,150 153x20] widths=[1,1,1,1] color=rgb(118, 118, 118)
+DrawGlyphRun@s1/e0 rect=[5,152 143x16] translation=[5,164.79688] color=rgb(0, 0, 0)
+FillRectWithRoundedCorners@s1/e0 rect=[0,180 198x20] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[0,180 198x20] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
+DrawGlyphRun@s1/c1/e0 rect=[3,182 38x16] translation=[3,194.79688] color=rgb(0, 0, 0)
+FillRect@s1/e0 rect=[0,210 202x24] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[0,210 202x24] widths=[3,3,3,3] color=rgb(118, 118, 118)
+DrawGlyphRun@s1/c3/e0 rect=[5,214 71x16] translation=[5,226.79688] color=rgb(0, 0, 0)
+
diff --git a/Tests/LibWeb/Text/expected/display_list/input-caret.txt b/Tests/LibWeb/Text/expected/display_list/input-caret.txt
index 4d2288da3d8..24ea3910257 100644
--- a/Tests/LibWeb/Text/expected/display_list/input-caret.txt
+++ b/Tests/LibWeb/Text/expected/display_list/input-caret.txt
@@ -3,15 +3,15 @@ AccumulatedVisualContext Tree:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
[s1] scroll (Viewport<#document>)
clips:
- [c0 in s1] clip=[9,9 104x18] (TextInputBox<INPUT>)
+ [c0 in s1] clip=[9,9 104x18] radii=(3,3,3,3) (TextInputBox<INPUT>)
[c1 in s1] clip=[11,10 100x16] (BlockContainer<DIV>)
effects:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[8,8 106x20] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[8,8 106x20] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[8,8 106x20] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[8,8 106x20] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c1/e0 rect=[11,10 37x16] translation=[11,22.796875] color=rgb(0, 0, 0)
PaintCaret@s1/c1/e0 rect=[11,10 1x16] color=rgb(0, 0, 0) should_blink=false
-FillRoundedRectRing@s1/e0 rect=[6,6 110x24] widths=[2,2,2,2] color=rgb(61, 174, 233)
+FillRoundedRectRing@s1/e0 rect=[6,6 110x24] corner_radii=[6x6,6x6,6x6,6x6] widths=[2,2,2,2] color=rgb(61, 174, 233)
diff --git a/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt b/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt
index 9cfca929ba1..54bf164f057 100644
--- a/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt
+++ b/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt
@@ -3,21 +3,21 @@ AccumulatedVisualContext Tree:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
[s1] scroll (Viewport<#document>)
clips:
- [c0 in s1] clip=[9,9 196x18] (TextInputBox<INPUT>#foo)
+ [c0 in s1] clip=[9,9 196x18] radii=(3,3,3,3) (TextInputBox<INPUT>#foo)
[c1 in s1] clip=[11,10 192x16] (BlockContainer<DIV>)
- [c2 in s1] clip=[215,9 196x18] (TextInputBox<INPUT>#bar)
+ [c2 in s1] clip=[215,9 196x18] radii=(3,3,3,3) (TextInputBox<INPUT>#bar)
[c3 in s1] clip=[217,10 192x16] (BlockContainer<DIV>)
effects:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[8,8 198x20] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[8,8 198x20] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[8,8 198x20] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[8,8 198x20] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c1/e0 rect=[11,10 28x16] translation=[11,22.796875] color=rgb(0, 0, 0)
DrawGlyphRun@s1/e0 rect=[205,10 8x16] translation=[205.875,22.796875] color=rgb(0, 0, 0)
-FillRect@s1/e0 rect=[214,8 198x20] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[214,8 198x20] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[214,8 198x20] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[214,8 198x20] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c3/e0 rect=[216,10 28x16] translation=[216.875,22.796875] color=rgb(0, 0, 0)
PaintCaret@s1/c3/e0 rect=[217,10 1x16] color=rgb(0, 0, 0) should_blink=false
-FillRoundedRectRing@s1/e0 rect=[212,6 202x24] widths=[2,2,2,2] color=rgb(61, 174, 233)
+FillRoundedRectRing@s1/e0 rect=[212,6 202x24] corner_radii=[6x6,6x6,6x6,6x6] widths=[2,2,2,2] color=rgb(61, 174, 233)
diff --git a/Tests/LibWeb/Text/expected/display_list/page-focus-rendering.txt b/Tests/LibWeb/Text/expected/display_list/page-focus-rendering.txt
index 456996f50d2..d3437f1166b 100644
--- a/Tests/LibWeb/Text/expected/display_list/page-focus-rendering.txt
+++ b/Tests/LibWeb/Text/expected/display_list/page-focus-rendering.txt
@@ -4,17 +4,17 @@ AccumulatedVisualContext Tree:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
[s1] scroll (Viewport<#document>)
clips:
- [c0 in s1] clip=[1,1 81x20] (TextAreaBox<TEXTAREA>#ta)
+ [c0 in s1] clip=[1,1 81x20] radii=(3,3,3,3) (TextAreaBox<TEXTAREA>#ta)
effects:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[0,0 83x22] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[0,0 83x22] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c0/e0 rect=[3,3 28x16] translation=[3,15.796875] color=rgb(0, 0, 0) inline_clips=[clip=[3,3 9x15]]
FillRect@s1/c0/e0 rect=[12,3 19x16] color=rgba(101, 2, 0, 0.8)
DrawGlyphRun@s1/c0/e0 rect=[3,3 28x16] translation=[3,15.796875] color=rgb(0, 0, 0) inline_clips=[clip=[12,3 19x15]]
-FillRoundedRectRing@s1/e0 rect=[-2,-2 87x26] widths=[2,2,2,2] color=rgb(61, 174, 233)
+FillRoundedRectRing@s1/e0 rect=[-2,-2 87x26] corner_radii=[6x6,6x6,6x6,6x6] widths=[2,2,2,2] color=rgb(61, 174, 233)
DrawLine@s1/e0 from=[78,19] to=[80,17] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[77,19] to=[80,16] color=rgba(0, 0, 0, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[75,19] to=[80,14] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
@@ -30,13 +30,13 @@ AccumulatedVisualContext Tree:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
[s1] scroll (Viewport<#document>)
clips:
- [c0 in s1] clip=[1,1 81x20] (TextAreaBox<TEXTAREA>#ta)
+ [c0 in s1] clip=[1,1 81x20] radii=(3,3,3,3) (TextAreaBox<TEXTAREA>#ta)
effects:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[0,0 83x22] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[0,0 83x22] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c0/e0 rect=[3,3 28x16] translation=[3,15.796875] color=rgb(0, 0, 0) inline_clips=[clip=[3,3 9x15]]
FillRect@s1/c0/e0 rect=[12,3 19x16] color=rgba(16, 16, 16, 0.667)
DrawGlyphRun@s1/c0/e0 rect=[3,3 28x16] translation=[3,15.796875] color=rgb(0, 0, 0) inline_clips=[clip=[12,3 19x15]]
@@ -55,17 +55,17 @@ AccumulatedVisualContext Tree:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
[s1] scroll (Viewport<#document>)
clips:
- [c0 in s1] clip=[1,1 81x20] (TextAreaBox<TEXTAREA>#ta)
+ [c0 in s1] clip=[1,1 81x20] radii=(3,3,3,3) (TextAreaBox<TEXTAREA>#ta)
effects:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[0,0 83x22] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[0,0 83x22] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c0/e0 rect=[3,3 28x16] translation=[3,15.796875] color=rgb(0, 0, 0) inline_clips=[clip=[3,3 9x15]]
FillRect@s1/c0/e0 rect=[12,3 19x16] color=rgba(101, 2, 0, 0.8)
DrawGlyphRun@s1/c0/e0 rect=[3,3 28x16] translation=[3,15.796875] color=rgb(0, 0, 0) inline_clips=[clip=[12,3 19x15]]
-FillRoundedRectRing@s1/e0 rect=[-2,-2 87x26] widths=[2,2,2,2] color=rgb(61, 174, 233)
+FillRoundedRectRing@s1/e0 rect=[-2,-2 87x26] corner_radii=[6x6,6x6,6x6,6x6] widths=[2,2,2,2] color=rgb(61, 174, 233)
DrawLine@s1/e0 from=[78,19] to=[80,17] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[77,19] to=[80,16] color=rgba(0, 0, 0, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[75,19] to=[80,14] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
@@ -81,16 +81,16 @@ AccumulatedVisualContext Tree:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
[s1] scroll (Viewport<#document>)
clips:
- [c0 in s1] clip=[1,1 81x20] (TextAreaBox<TEXTAREA>#ta)
+ [c0 in s1] clip=[1,1 81x20] radii=(3,3,3,3) (TextAreaBox<TEXTAREA>#ta)
effects:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[0,0 83x22] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[0,0 83x22] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c0/e0 rect=[3,3 28x16] translation=[3,15.796875] color=rgb(0, 0, 0)
PaintCaret@s1/c0/e0 rect=[22,3 1x16] color=rgb(0, 0, 0) should_blink=false
-FillRoundedRectRing@s1/e0 rect=[-2,-2 87x26] widths=[2,2,2,2] color=rgb(61, 174, 233)
+FillRoundedRectRing@s1/e0 rect=[-2,-2 87x26] corner_radii=[6x6,6x6,6x6,6x6] widths=[2,2,2,2] color=rgb(61, 174, 233)
DrawLine@s1/e0 from=[78,19] to=[80,17] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[77,19] to=[80,16] color=rgba(0, 0, 0, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[75,19] to=[80,14] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
@@ -105,13 +105,13 @@ AccumulatedVisualContext Tree:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
[s1] scroll (Viewport<#document>)
clips:
- [c0 in s1] clip=[1,1 81x20] (TextAreaBox<TEXTAREA>#ta)
+ [c0 in s1] clip=[1,1 81x20] radii=(3,3,3,3) (TextAreaBox<TEXTAREA>#ta)
effects:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[0,0 83x22] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[0,0 83x22] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c0/e0 rect=[3,3 28x16] translation=[3,15.796875] color=rgb(0, 0, 0)
DrawLine@s1/e0 from=[78,19] to=[80,17] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[77,19] to=[80,16] color=rgba(0, 0, 0, 0.392) thickness=1 style=Solid
@@ -127,16 +127,16 @@ AccumulatedVisualContext Tree:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
[s1] scroll (Viewport<#document>)
clips:
- [c0 in s1] clip=[1,1 81x20] (TextAreaBox<TEXTAREA>#ta)
+ [c0 in s1] clip=[1,1 81x20] radii=(3,3,3,3) (TextAreaBox<TEXTAREA>#ta)
effects:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[0,0 83x22] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[0,0 83x22] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[0,0 83x22] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c0/e0 rect=[3,3 28x16] translation=[3,15.796875] color=rgb(0, 0, 0)
PaintCaret@s1/c0/e0 rect=[22,3 1x16] color=rgb(0, 0, 0) should_blink=false
-FillRoundedRectRing@s1/e0 rect=[-2,-2 87x26] widths=[2,2,2,2] color=rgb(61, 174, 233)
+FillRoundedRectRing@s1/e0 rect=[-2,-2 87x26] corner_radii=[6x6,6x6,6x6,6x6] widths=[2,2,2,2] color=rgb(61, 174, 233)
DrawLine@s1/e0 from=[78,19] to=[80,17] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[77,19] to=[80,16] color=rgba(0, 0, 0, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[75,19] to=[80,14] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
diff --git a/Tests/LibWeb/Text/expected/display_list/textarea-caret.txt b/Tests/LibWeb/Text/expected/display_list/textarea-caret.txt
index f6ea32c92e1..7993b1c8243 100644
--- a/Tests/LibWeb/Text/expected/display_list/textarea-caret.txt
+++ b/Tests/LibWeb/Text/expected/display_list/textarea-caret.txt
@@ -3,16 +3,16 @@ AccumulatedVisualContext Tree:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
[s1] scroll (Viewport<#document>)
clips:
- [c0 in s1] clip=[9,9 104x30] (TextAreaBox<TEXTAREA>)
+ [c0 in s1] clip=[9,9 104x30] radii=(3,3,3,3) (TextAreaBox<TEXTAREA>)
effects:
[e0 in s0] effects=[]
DisplayList:
-FillRect@s1/e0 rect=[8,8 106x32] color=rgb(255, 255, 255)
-FillRoundedRectRing@s1/e0 rect=[8,8 106x32] widths=[1,1,1,1] color=rgb(118, 118, 118)
+FillRectWithRoundedCorners@s1/e0 rect=[8,8 106x32] color=rgb(255, 255, 255)
+FillRoundedRectRing@s1/e0 rect=[8,8 106x32] corner_radii=[4x4,4x4,4x4,4x4] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c0/e0 rect=[11,11 30x13] translation=[11,21.390625] color=rgb(0, 0, 0)
PaintCaret@s1/c0/e0 rect=[11,11 1x13] color=rgb(0, 0, 0) should_blink=false
-FillRoundedRectRing@s1/e0 rect=[6,6 110x36] widths=[2,2,2,2] color=rgb(61, 174, 233)
+FillRoundedRectRing@s1/e0 rect=[6,6 110x36] corner_radii=[6x6,6x6,6x6,6x6] widths=[2,2,2,2] color=rgb(61, 174, 233)
DrawLine@s1/e0 from=[109,37] to=[111,35] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[108,37] to=[111,34] color=rgba(0, 0, 0, 0.392) thickness=1 style=Solid
DrawLine@s1/e0 from=[106,37] to=[111,32] color=rgba(255, 255, 255, 0.392) thickness=1 style=Solid
diff --git a/Tests/LibWeb/Text/input/display_list/form-control-native-appearance-corners.html b/Tests/LibWeb/Text/input/display_list/form-control-native-appearance-corners.html
new file mode 100644
index 00000000000..c0f86afae0f
--- /dev/null
+++ b/Tests/LibWeb/Text/input/display_list/form-control-native-appearance-corners.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<script src="../include.js"></script>
+<style>
+ body {
+ margin: 0;
+ }
+ div {
+ height: 30px;
+ }
+ #revert {
+ border: 3px solid red;
+ }
+ #revert {
+ border: revert;
+ }
+</style>
+<div><button id="native">Native</button></div>
+<div><button style="color: green; padding: 3px">Padding and color</button></div>
+<div><button id="revert">Reverted border</button></div>
+<div><button style="background-color: lime">Background</button></div>
+<div><button style="border-color: red">Border</button></div>
+<div><button style="appearance: none">Appearance none</button></div>
+<div><input value="Text"></div>
+<div><input value="Bordered" style="border-width: 3px"></div>
+<script>
+ test(() => {
+ println(internals.dumpDisplayList());
+ });
+</script>