mirror of
https://github.com/servo/servo.git
synced 2025-06-20 23:28:59 +01:00
Implement the unitless length quirk for border-*-width
This commit is contained in:
parent
03d24e8361
commit
b5a558e592
4 changed files with 20 additions and 52 deletions
|
@ -8,11 +8,13 @@
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<%def name="predefined_type(name, type, initial_value, parse_method='parse',
|
<%def name="predefined_type(name, type, initial_value, parse_method='parse',
|
||||||
needs_context=True, vector=False, computed_type=None, initial_specified_value=None, **kwargs)">
|
needs_context=True, vector=False, computed_type=None, initial_specified_value=None,
|
||||||
|
allow_quirks=False, **kwargs)">
|
||||||
<%def name="predefined_type_inner(name, type, initial_value, parse_method)">
|
<%def name="predefined_type_inner(name, type, initial_value, parse_method)">
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use cssparser::{Color as CSSParserColor, RGBA};
|
use cssparser::{Color as CSSParserColor, RGBA};
|
||||||
|
use values::specified::AllowQuirks;
|
||||||
pub use values::specified::${type} as SpecifiedValue;
|
pub use values::specified::${type} as SpecifiedValue;
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
% if computed_type:
|
% if computed_type:
|
||||||
|
@ -30,7 +32,9 @@
|
||||||
pub fn parse(context: &ParserContext,
|
pub fn parse(context: &ParserContext,
|
||||||
input: &mut Parser)
|
input: &mut Parser)
|
||||||
-> Result<SpecifiedValue, ()> {
|
-> Result<SpecifiedValue, ()> {
|
||||||
% if needs_context:
|
% if allow_quirks:
|
||||||
|
specified::${type}::${parse_method}_quirky(context, input, AllowQuirks::Yes)
|
||||||
|
% elif needs_context:
|
||||||
specified::${type}::${parse_method}(context, input)
|
specified::${type}::${parse_method}(context, input)
|
||||||
% else:
|
% else:
|
||||||
specified::${type}::${parse_method}(input)
|
specified::${type}::${parse_method}(input)
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
computed_type="::app_units::Au",
|
computed_type="::app_units::Au",
|
||||||
alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-width"),
|
alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-width"),
|
||||||
spec=maybe_logical_spec(side, "width"),
|
spec=maybe_logical_spec(side, "width"),
|
||||||
animation_value_type="ComputedValue", logical=side[1])}
|
animation_value_type="ComputedValue",
|
||||||
|
logical=side[1],
|
||||||
|
allow_quirks=not side[1])}
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
${helpers.gecko_keyword_conversion(Keyword('border-style',
|
${helpers.gecko_keyword_conversion(Keyword('border-style',
|
||||||
|
|
|
@ -491,7 +491,17 @@ pub enum BorderWidth {
|
||||||
|
|
||||||
impl Parse for BorderWidth {
|
impl Parse for BorderWidth {
|
||||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<BorderWidth, ()> {
|
fn parse(context: &ParserContext, input: &mut Parser) -> Result<BorderWidth, ()> {
|
||||||
match input.try(|i| Length::parse_non_negative(context, i)) {
|
Self::parse_quirky(context, input, AllowQuirks::No)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BorderWidth {
|
||||||
|
/// Parses a border width, allowing quirks.
|
||||||
|
pub fn parse_quirky(context: &ParserContext,
|
||||||
|
input: &mut Parser,
|
||||||
|
allow_quirks: AllowQuirks)
|
||||||
|
-> Result<BorderWidth, ()> {
|
||||||
|
match input.try(|i| Length::parse_non_negative_quirky(context, i, allow_quirks)) {
|
||||||
Ok(length) => Ok(BorderWidth::Width(length)),
|
Ok(length) => Ok(BorderWidth::Width(length)),
|
||||||
Err(_) => match_ignore_ascii_case! { &try!(input.expect_ident()),
|
Err(_) => match_ignore_ascii_case! { &try!(input.expect_ident()),
|
||||||
"thin" => Ok(BorderWidth::Thin),
|
"thin" => Ok(BorderWidth::Thin),
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
[unitless-length.html]
|
[unitless-length.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
[border-top-width: 1 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-right-width: 1 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-bottom-width: 1 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-left-width: 1 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-width: 1 (quirks)]
|
[border-width: 1 (quirks)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -99,18 +87,6 @@
|
||||||
[word-spacing: 1 (quirks)]
|
[word-spacing: 1 (quirks)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[border-top-width: +1 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-right-width: +1 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-bottom-width: +1 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-left-width: +1 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-width: +1 (quirks)]
|
[border-width: +1 (quirks)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -249,18 +225,6 @@
|
||||||
[word-spacing: -1 (quirks)]
|
[word-spacing: -1 (quirks)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[border-top-width: 1.5 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-right-width: 1.5 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-bottom-width: 1.5 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-left-width: 1.5 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-width: 1.5 (quirks)]
|
[border-width: 1.5 (quirks)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -348,18 +312,6 @@
|
||||||
[word-spacing: 1.5 (quirks)]
|
[word-spacing: 1.5 (quirks)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[border-top-width: +1.5 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-right-width: +1.5 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-bottom-width: +1.5 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-left-width: +1.5 (quirks)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[border-width: +1.5 (quirks)]
|
[border-width: +1.5 (quirks)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue