mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: Make inline margins on <input type=button>
and friends apply
only to the button and not to the text inside. Improves the Google home page.
This commit is contained in:
parent
9fda72d60f
commit
8fe2f8930c
5 changed files with 47 additions and 5 deletions
|
@ -6518,6 +6518,19 @@ pub fn modify_style_for_text(style: &mut Arc<ComputedValues>) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Adjusts the `margin` property as necessary to account for the text of an `input` element.
|
||||
///
|
||||
/// Margins apply to the `input` element itself, so including them in the text will cause them to
|
||||
/// be double-counted.
|
||||
pub fn modify_style_for_input_text(style: &mut Arc<ComputedValues>) {
|
||||
let mut style = Arc::make_unique(style);
|
||||
let margin_style = Arc::make_unique(&mut style.margin);
|
||||
margin_style.margin_top = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
||||
margin_style.margin_right = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
||||
margin_style.margin_bottom = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
||||
margin_style.margin_left = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
||||
}
|
||||
|
||||
pub fn is_supported_property(property: &str) -> bool {
|
||||
match_ignore_ascii_case! { property,
|
||||
% for property in SHORTHANDS + LONGHANDS[:-1]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue