Auto merge of #16609 - nox:quirks, r=Manishearth,emilio

Implement unitless length quirk

The Gecko side doesn't propagate its quirks mode yet.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16609)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-27 22:32:24 -05:00 committed by GitHub
commit d8bcc0db1a
70 changed files with 2321 additions and 194 deletions

View file

@ -8,6 +8,7 @@ use servo_url::ServoUrl;
use std::borrow::ToOwned;
use std::sync::Arc;
use style::Atom;
use style::context::QuirksMode;
use style::error_reporting::ParseErrorReporter;
use style::media_queries::*;
use style::servo::media_queries::*;
@ -37,7 +38,7 @@ fn test_media_rule<F>(css: &str, callback: F)
let media_list = Arc::new(lock.wrap(MediaList::empty()));
let stylesheet = Stylesheet::from_str(
css, url, Origin::Author, media_list, lock,
None, &CSSErrorReporterTest, 0u64);
None, &CSSErrorReporterTest, QuirksMode::NoQuirks, 0u64);
let mut rule_count = 0;
let guard = stylesheet.shared_lock.read();
media_queries(&guard, &stylesheet.rules.read_with(&guard).0, &mut |mq| {
@ -66,7 +67,7 @@ fn media_query_test(device: &Device, css: &str, expected_rule_count: usize) {
let media_list = Arc::new(lock.wrap(MediaList::empty()));
let ss = Stylesheet::from_str(
css, url, Origin::Author, media_list, lock,
None, &CSSErrorReporterTest, 0u64);
None, &CSSErrorReporterTest, QuirksMode::NoQuirks, 0u64);
let mut rule_count = 0;
ss.effective_style_rules(device, &ss.shared_lock.read(), |_| rule_count += 1);
assert!(rule_count == expected_rule_count, css.to_owned());

View file

@ -5,6 +5,7 @@
use euclid::size::TypedSize2D;
use parsing::parse;
use std::f32::consts::PI;
use style::context::QuirksMode;
use style::font_metrics::ServoMetricsProvider;
use style::media_queries::{Device, MediaType};
use style::properties::ComputedValues;
@ -51,6 +52,7 @@ fn test_linear_gradient() {
style: initial_style.clone(),
font_metrics_provider: &ServoMetricsProvider,
in_media_query: false,
quirks_mode: QuirksMode::NoQuirks,
};
assert_eq!(specified::AngleOrCorner::None.to_computed_value(&specified_context),
computed::AngleOrCorner::Angle(Angle::from_radians(PI)));

View file

@ -5,6 +5,7 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use parsing::parse;
use style::context::QuirksMode;
use style::parser::{LengthParsingMode, Parse, ParserContext};
use style::stylesheets::{CssRuleType, Origin};
use style::values::specified::length::{AbsoluteLength, Length, NoCalcLength};
@ -38,7 +39,8 @@ fn test_length_parsing_modes() {
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
let reporter = CSSErrorReporterTest;
let context = ParserContext::new(Origin::Author, &url, &reporter,
Some(CssRuleType::Style), LengthParsingMode::SVG);
Some(CssRuleType::Style), LengthParsingMode::SVG,
QuirksMode::NoQuirks);
let mut parser = Parser::new("1");
let result = Length::parse(&context, &mut parser);
assert!(result.is_ok());

View file

@ -6,6 +6,7 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use style::context::QuirksMode;
use style::parser::{LengthParsingMode, ParserContext};
use style::stylesheets::{CssRuleType, Origin};
@ -13,7 +14,8 @@ fn parse<T, F: Fn(&ParserContext, &mut Parser) -> Result<T, ()>>(f: F, s: &str)
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
let reporter = CSSErrorReporterTest;
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Style),
LengthParsingMode::Default);
LengthParsingMode::Default,
QuirksMode::NoQuirks);
let mut parser = Parser::new(s);
f(&context, &mut parser)
}

View file

@ -4,6 +4,7 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use style::context::QuirksMode;
use style::parser::{LengthParsingMode, ParserContext};
use style::stylesheets::{CssRuleType, Origin};
@ -11,7 +12,8 @@ fn parse<T, F: Fn(&ParserContext, &mut Parser) -> Result<T, ()>>(f: F, s: &str)
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
let reporter = CSSErrorReporterTest;
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Style),
LengthParsingMode::Default);
LengthParsingMode::Default,
QuirksMode::NoQuirks);
let mut parser = Parser::new(s);
f(&context, &mut parser)
}

View file

@ -6,6 +6,7 @@ use cssparser::{Parser, SourcePosition};
use rayon;
use servo_url::ServoUrl;
use std::sync::Arc;
use style::context::QuirksMode;
use style::error_reporting::ParseErrorReporter;
use style::media_queries::MediaList;
use style::properties::{longhands, Importance, PropertyDeclaration, PropertyDeclarationBlock};
@ -58,6 +59,7 @@ fn parse_rules(css: &str) -> Vec<(StyleSource, CascadeLevel)> {
lock,
None,
&ErrorringErrorReporter,
QuirksMode::NoQuirks,
0u64);
let guard = s.shared_lock.read();
let rules = s.rules.read_with(&guard);

View file

@ -13,6 +13,7 @@ use std::borrow::ToOwned;
use std::sync::Arc;
use std::sync::Mutex;
use std::sync::atomic::AtomicBool;
use style::context::QuirksMode;
use style::error_reporting::ParseErrorReporter;
use style::keyframes::{Keyframe, KeyframeSelector, KeyframePercentage};
use style::media_queries::MediaList;
@ -66,7 +67,7 @@ fn test_parse_stylesheet() {
let lock = SharedRwLock::new();
let media = Arc::new(lock.wrap(MediaList::empty()));
let stylesheet = Stylesheet::from_str(css, url.clone(), Origin::UserAgent, media, lock,
None, &CSSErrorReporterTest, 0u64);
None, &CSSErrorReporterTest, QuirksMode::NoQuirks, 0u64);
let mut namespaces = Namespaces::default();
namespaces.default = Some(ns!(html));
let expected = Stylesheet {
@ -77,6 +78,7 @@ fn test_parse_stylesheet() {
url_data: url,
dirty_on_viewport_size_change: AtomicBool::new(false),
disabled: AtomicBool::new(false),
quirks_mode: QuirksMode::NoQuirks,
rules: CssRules::new(vec![
CssRule::Namespace(Arc::new(stylesheet.shared_lock.wrap(NamespaceRule {
prefix: None,
@ -316,7 +318,7 @@ fn test_report_error_stylesheet() {
let lock = SharedRwLock::new();
let media = Arc::new(lock.wrap(MediaList::empty()));
Stylesheet::from_str(css, url.clone(), Origin::UserAgent, media, lock,
None, &error_reporter, 5u64);
None, &error_reporter, QuirksMode::NoQuirks, 5u64);
let mut errors = errors.lock().unwrap();

View file

@ -8,6 +8,7 @@ use media_queries::CSSErrorReporterTest;
use servo_config::prefs::{PREFS, PrefValue};
use servo_url::ServoUrl;
use std::sync::Arc;
use style::context::QuirksMode;
use style::media_queries::{Device, MediaList, MediaType};
use style::parser::{LengthParsingMode, Parse, ParserContext};
use style::shared_lock::SharedRwLock;
@ -32,6 +33,7 @@ macro_rules! stylesheet {
$shared_lock,
None,
&$error_reporter,
QuirksMode::NoQuirks,
0u64
))
}
@ -293,7 +295,8 @@ fn constrain_viewport() {
let url = ServoUrl::parse("http://localhost").unwrap();
let reporter = CSSErrorReporterTest;
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Viewport),
LengthParsingMode::Default);
LengthParsingMode::Default,
QuirksMode::NoQuirks);
macro_rules! from_css {
($css:expr) => {
@ -303,9 +306,9 @@ fn constrain_viewport() {
let initial_viewport = TypedSize2D::new(800., 600.);
let device = Device::new(MediaType::Screen, initial_viewport);
assert_eq!(ViewportConstraints::maybe_new(&device, from_css!("")), None);
assert_eq!(ViewportConstraints::maybe_new(&device, from_css!(""), QuirksMode::NoQuirks), None);
assert_eq!(ViewportConstraints::maybe_new(&device, from_css!("width: 320px auto")),
assert_eq!(ViewportConstraints::maybe_new(&device, from_css!("width: 320px auto"), QuirksMode::NoQuirks),
Some(ViewportConstraints {
size: initial_viewport,
@ -317,7 +320,7 @@ fn constrain_viewport() {
orientation: Orientation::Auto
}));
assert_eq!(ViewportConstraints::maybe_new(&device, from_css!("width: 320px auto")),
assert_eq!(ViewportConstraints::maybe_new(&device, from_css!("width: 320px auto"), QuirksMode::NoQuirks),
Some(ViewportConstraints {
size: initial_viewport,
@ -329,10 +332,12 @@ fn constrain_viewport() {
orientation: Orientation::Auto
}));
assert_eq!(ViewportConstraints::maybe_new(&device, from_css!("width: 800px; height: 600px;\
zoom: 1;\
user-zoom: zoom;\
orientation: auto;")),
assert_eq!(ViewportConstraints::maybe_new(&device,
from_css!("width: 800px; height: 600px;\
zoom: 1;\
user-zoom: zoom;\
orientation: auto;"),
QuirksMode::NoQuirks),
Some(ViewportConstraints {
size: initial_viewport,
@ -346,7 +351,7 @@ fn constrain_viewport() {
let initial_viewport = TypedSize2D::new(200., 150.);
let device = Device::new(MediaType::Screen, initial_viewport);
assert_eq!(ViewportConstraints::maybe_new(&device, from_css!("width: 320px auto")),
assert_eq!(ViewportConstraints::maybe_new(&device, from_css!("width: 320px auto"), QuirksMode::NoQuirks),
Some(ViewportConstraints {
size: TypedSize2D::new(320., 240.),

View file

@ -43,6 +43,8 @@ skip: true
skip: true
[script_scheduling]
skip: false
[quirks-mode]
skip: false
[referrer-policy]
skip: false
[subresource-integrity]

View file

@ -586960,7 +586960,7 @@
"testharness"
],
"quirks-mode/unitless-length.html": [
"1e896cad5c89bfe1756af5db60b61bc9fa93f61b",
"578d2aed4afa7cd6739610d353aebc591d832418",
"testharness"
],
"referrer-policy/OWNERS": [

View file

@ -0,0 +1,11 @@
[blocks-ignore-line-height.html]
type: testharness
[The blocks ignore line-height quirk, #ref { display:block }<div id=test><font size=1>x</font></div><font id=ref size=1>x</font><div id=s_ref>x</div>]
expected: FAIL
[The blocks ignore line-height quirk, #ref { display:block }<div id=test><font size=1>x</font><br><font size=1>x</font></div><font id=ref size=1>x<br>x</font><div id=s_ref>x<br>x</div>]
expected: FAIL
[The blocks ignore line-height quirk, #ref { display:block } div, #ref { line-height:2 } span { font-size:50% }<div id=test><span>x</span></div><span id=ref>x</span><div id=s_ref>x</div>]
expected: FAIL

View file

@ -0,0 +1,233 @@
[hashless-hex-color.html]
type: testharness
[123 (quirks)]
expected: FAIL
[023 (quirks)]
expected: FAIL
[003 (quirks)]
expected: FAIL
[000 (quirks)]
expected: FAIL
[abc (quirks)]
expected: FAIL
[ABC (quirks)]
expected: FAIL
[1ab (quirks)]
expected: FAIL
[1AB (quirks)]
expected: FAIL
[112233 (quirks)]
expected: FAIL
[012233 (quirks)]
expected: FAIL
[002233 (quirks)]
expected: FAIL
[000233 (quirks)]
expected: FAIL
[000033 (quirks)]
expected: FAIL
[000003 (quirks)]
expected: FAIL
[000000 (quirks)]
expected: FAIL
[aabbcc (quirks)]
expected: FAIL
[AABBCC (quirks)]
expected: FAIL
[11aabb (quirks)]
expected: FAIL
[11AABB (quirks)]
expected: FAIL
[\\31 23 (quirks)]
expected: FAIL
[\\61 bc (quirks)]
expected: FAIL
[\\41 BC (quirks)]
expected: FAIL
[\\31 ab (quirks)]
expected: FAIL
[\\31 AB (quirks)]
expected: FAIL
[\\31 12233 (quirks)]
expected: FAIL
[\\61 abbcc (quirks)]
expected: FAIL
[\\41 ABBCC (quirks)]
expected: FAIL
[\\31 1aabb (quirks)]
expected: FAIL
[\\31 1AABB (quirks)]
expected: FAIL
[12\\33 (quirks)]
expected: FAIL
[1 (quirks)]
expected: FAIL
[12 (quirks)]
expected: FAIL
[1234 (quirks)]
expected: FAIL
[12345 (quirks)]
expected: FAIL
[1a (quirks)]
expected: FAIL
[1abc (quirks)]
expected: FAIL
[1abcd (quirks)]
expected: FAIL
[+1 (quirks)]
expected: FAIL
[+12 (quirks)]
expected: FAIL
[+123 (quirks)]
expected: FAIL
[+1234 (quirks)]
expected: FAIL
[+12345 (quirks)]
expected: FAIL
[+123456 (quirks)]
expected: FAIL
[+1a (quirks)]
expected: FAIL
[+12a (quirks)]
expected: FAIL
[+123a (quirks)]
expected: FAIL
[+1234a (quirks)]
expected: FAIL
[+12345a (quirks)]
expected: FAIL
[+1A (quirks)]
expected: FAIL
[+12A (quirks)]
expected: FAIL
[+123A (quirks)]
expected: FAIL
[+1234A (quirks)]
expected: FAIL
[+12345A (quirks)]
expected: FAIL
[rgb(calc(100 + 155), 255, 255) (quirks)]
expected: FAIL
[rgb(calc(100 + 155), 255, 255) (almost standards)]
expected: FAIL
[rgb(calc(100 + 155), 255, 255) (standards)]
expected: FAIL
[rgba(calc(100 + 155), 255, 255, 001) (quirks)]
expected: FAIL
[rgba(calc(100 + 155), 255, 255, 001) (almost standards)]
expected: FAIL
[rgba(calc(100 + 155), 255, 255, 001) (standards)]
expected: FAIL
[hsl(calc(050 + 050), 100%, 100%) (quirks)]
expected: FAIL
[hsl(calc(050 + 050), 100%, 100%) (almost standards)]
expected: FAIL
[hsl(calc(050 + 050), 100%, 100%) (standards)]
expected: FAIL
[hsla(calc(050 + 050), 100%, 100%, 001) (quirks)]
expected: FAIL
[hsla(calc(050 + 050), 100%, 100%, 001) (almost standards)]
expected: FAIL
[hsla(calc(050 + 050), 100%, 100%, 001) (standards)]
expected: FAIL
[rgb(calc(/**/100/**/ + /**/155/**/), 255, 255) (quirks)]
expected: FAIL
[rgb(calc(/**/100/**/ + /**/155/**/), 255, 255) (almost standards)]
expected: FAIL
[rgb(calc(/**/100/**/ + /**/155/**/), 255, 255) (standards)]
expected: FAIL
[#123 123 abc 12a (quirks)]
expected: FAIL
[#123 123 abc 12a (almost standards)]
expected: FAIL
[#123 123 abc 12a (standards)]
expected: FAIL
[rgb(119, 255, 255) 123 (quirks)]
expected: FAIL
[rgb(119, 255, 255) 123 (almost standards)]
expected: FAIL
[rgb(119, 255, 255) 123 (standards)]
expected: FAIL
[123 rgb(119, 255, 255) (quirks)]
expected: FAIL
[123 rgb(119, 255, 255) (almost standards)]
expected: FAIL
[123 rgb(119, 255, 255) (standards)]
expected: FAIL

View file

@ -0,0 +1,50 @@
[line-height-calculation.html]
type: testharness
[The line height calculation quirk, <div id=test><img src="{png}"></div><img id=ref src="{png}"><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, <table><tr><td id=test><img src="{png}"><tr><td><img id=ref src="{png}"><tr><td id=s_ref>x</table>]
expected: FAIL
[The line height calculation quirk, <pre id=test><img src="{png}"></pre><img id=ref src="{png}"><pre id=s_ref>x</pre>]
expected: FAIL
[The line height calculation quirk, span { margin:1px }<div id=test><span></span></div><div id=ref></div><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, span { margin:0 1px }<div id=test><span></span></div><div id=ref></div><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, span { margin:0 1px; padding:1px 0 }<div id=test><span></span></div><div id=ref></div><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, span { border-right:1px solid }<div id=test><span></span></div><div id=ref>x</div><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, span { border-left:1px solid }<div id=test><span></span></div><div id=ref>x</div><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, span { padding-right:1px }<div id=test><span></span></div><div id=ref>x</div><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, span { padding-left:1px }<div id=test><span></span></div><div id=ref>x</div><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, span { display:inline-block; height:1px }<div id=test><i><span></span> </i></div><span id=ref></span><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, <div id=test><img src="{png}" border=1></div><img id=ref src="{png}" height=3><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, #test img { padding:1px }<div id=test><img src="{png}"></div><img id=ref src="{png}" height=3><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, iframe { height:1px }<div id=test><iframe></iframe></div><img id=ref src="{png}" height=5><div id=s_ref>x</div>]
expected: FAIL
[The line height calculation quirk, #test::before { content:"" } #test::before, span { border:solid }<div id=test></div><div id=ref><span>x</span></div><div id=s_ref><span>x</span></div>]
expected: FAIL
[The line height calculation quirk, div { line-height: 0;} span { margin:0 1px; line-height: normal; }<div id=test>x<span></span></div><div id=ref>x</div><div id=s_ref>x<span>x</span></div>]
expected: FAIL

View file

@ -0,0 +1,122 @@
[percentage-height-calculation.html]
type: testharness
[The percentage height calculation quirk, #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, #test { height:50% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, #test { height:25% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, #test { height:12.5% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, #test { height:100% }<div><div id=test></div></div>]
expected: FAIL
[The percentage height calculation quirk, <img id=test src="{png}" height=100%>]
expected: FAIL
[The percentage height calculation quirk, <img id=test src="{png}" height=100% border=10>]
expected: FAIL
[The percentage height calculation quirk, <table id=test height=100%><tr><td></table>]
expected: FAIL
[The percentage height calculation quirk, #foo { height:100px } #test { height:100% }<div id=foo><div><div id=test></div></div></div>]
expected: FAIL
[The percentage height calculation quirk, #foo { position:relative } #test { height:100% }<div id=foo><div><div id=test></div></div></div>]
expected: FAIL
[The percentage height calculation quirk, #foo { height:100px } #test { height:100%; position:relative }<div id=foo><div><div id=test></div></div></div>]
expected: FAIL
[The percentage height calculation quirk, html { display:inline } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { margin:10px } body { display:inline } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, body { margin:0 } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, body { margin:0; padding:10px } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, body { margin:0; border:10px solid } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { margin:10px } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { padding:10px } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { border:10px solid } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { height:100%; margin:10px } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { height:100%; padding:10px } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { height:100%; border:10px solid } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, body { height:100%; margin:10px } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, body { height:100%; padding:10px } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, body { height:100%; border:10px solid } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { position:absolute; height:100%; margin:10px } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { position:absolute; height:100%; padding:10px } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html { position:absolute; height:100%; border:10px solid } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, body { margin:99px 0 } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html, body { border:10px none } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, html, body { border:10px hidden } #test { height:100% }<div id=test></div>]
expected: FAIL
[The percentage height calculation quirk, <html xmlns="{html}"><head><style>#test { height:100% }</style></head><body><div id="test"/></body></html>]
expected: FAIL
[The percentage height calculation quirk, <html xmlns="{html}"><head><style>#test { height:100% }</style></head><body/><div id="test"/></html>]
expected: FAIL
[The percentage height calculation quirk, <html xmlns="{html}"><head><style>#test { height:100% }</style></head><span><body><div id="test"/></body></span></html>]
expected: FAIL
[The percentage height calculation quirk, <html xmlns="{html}"><head><style>#test { height:100% }</style></head><body><body><div id="test"/></body></body></html>]
expected: FAIL
[The percentage height calculation quirk, <html><head xmlns="{html}"><style>#test { height:100% }</style></head><body xmlns="{html}"><div id="test"/></body></html>]
expected: FAIL
[The percentage height calculation quirk, <div xmlns="{html}"><head><style>#test { height:100% }</style></head><body><div id="test"/></body></div>]
expected: FAIL
[The percentage height calculation quirk, <html xmlns="{html}"><head><style>#test { height:100% }</style></head><body xmlns=""><div xmlns="{html}" id="test"/></body></html>]
expected: FAIL
[The percentage height calculation quirk, <HTML xmlns="{html}"><head><style>#test { height:100% }</style></head><body><div id="test"/></body></HTML>]
expected: FAIL
[The percentage height calculation quirk, <html xmlns="{html}"><head><style>#test { height:100% }</style></head><BODY><div id="test"/></BODY></html>]
expected: FAIL

View file

@ -0,0 +1,8 @@
[supports.html]
type: testharness
[@supports quirky color]
expected: FAIL
[Sanity check @supports length]
expected: FAIL

View file

@ -0,0 +1,5 @@
[table-cell-nowrap-minimum-width-calculation.html]
type: testharness
[The table cell nowrap minimum width calculation quirk, basic]
expected: FAIL

View file

@ -0,0 +1,26 @@
[table-cell-width-calculation.html]
type: testharness
[The table cell width calculation quirk, basic]
expected: FAIL
[The table cell width calculation quirk, inline-block]
expected: FAIL
[The table cell width calculation quirk, img in span]
expected: FAIL
[The table cell width calculation quirk, the don't-wrap rule is only for the purpose of calculating the width of the cell]
expected: FAIL
[The table cell width calculation quirk, the quirk shouldn't apply for <input>]
expected: FAIL
[The table cell width calculation quirk, non-auto width on cell]
expected: FAIL
[The table cell width calculation quirk, display:table-cell on span]
expected: FAIL
[The table cell width calculation quirk, display:table-cell on span, wbr]
expected: FAIL

File diff suppressed because it is too large Load diff

View file

@ -19874,6 +19874,12 @@
{}
]
],
"mozilla/unitless-length.html": [
[
"/_mozilla/mozilla/unitless-length.html",
{}
]
],
"mozilla/variadic-interface.html": [
[
"/_mozilla/mozilla/variadic-interface.html",
@ -31497,6 +31503,10 @@
"47ee847e660eb907a7bd916cf37cf3ceba68ea7d",
"testharness"
],
"mozilla/unitless-length.html": [
"dfb31d3f9c4f24913055924c375f08b990b63e49",
"testharness"
],
"mozilla/variadic-interface.html": [
"9edd5150d36fabae42077a034655a8457eb75bff",
"testharness"

View file

@ -0,0 +1,219 @@
<!doctype html>
<html>
<head>
<title>The unitless length quirk</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style> iframe { width:20px; height:20px; } </style>
</head>
<body>
<div id=log></div>
<iframe id=quirks></iframe>
<iframe id=almost></iframe>
<iframe id=standards></iframe>
<script>
setup({explicit_done:true});
onload = function() {
var html = "<style id=style></style><div id=test></div><div id=ref></div>";
var a_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
var s_doctype = '<!DOCTYPE HTML>';
var q = document.getElementById('quirks').contentWindow;
var a = document.getElementById('almost').contentWindow;
var s = document.getElementById('standards').contentWindow;
q.document.open();
q.document.write(html);
q.document.close();
a.document.open();
a.document.write(a_doctype + html);
a.document.close();
s.document.open();
s.document.write(s_doctype + html);
s.document.close();
[q, a, s].forEach(function(win) {
['style', 'test', 'ref'].forEach(function(id) {
win[id] = win.document.getElementById(id);
});
});
var tests = [
{input:"1", q:"1px"},
{input:"+1", q:"1px"},
{input:"-1", q:"-1px"},
{input:"1.5", q:"1.5px"},
{input:"+1.5", q:"1.5px"},
{input:"-1.5", q:"-1.5px"},
{input:"\\31 "},
{input:"+\\31 "},
{input:"-\\31 "},
{input:"\\31 .5"},
{input:"+\\31 .5"},
{input:"-\\31 .5"},
{input:"1\\31 "},
{input:"+1\\31 "},
{input:"-1\\31 "},
{input:"1\\31 .5"},
{input:"+1\\31 .5"},
{input:"-1\\31 .5"},
{input:"a"},
{input:"A"},
{input:"1a"},
{input:"+1a"},
{input:"-1a"},
{input:"+1A"},
{input:"-1A"},
{input:"+a"},
{input:"-a"},
{input:"+A"},
{input:"-A"},
{input:"@a"},
{input:"@1"},
{input:"@1a"},
{input:'"a"'},
{input:'"1"'},
{input:'"1a"'},
{input:"url(1)"},
{input:"url('1')"},
{input:"#1"},
{input:"#01"},
{input:"#001"},
{input:"#0001"},
{input:"#00001"},
{input:"#000001"},
{input:"+/**/1"},
{input:"-/**/1"},
{input:"calc(1)"},
{input:"calc(2 * 2px)", q:"4px", s:"4px"},
{input:"1px 2", q:"1px 2px", shorthand:true},
{input:"1 2px", q:"1px 2px", shorthand:true},
{input:"1px calc(2)", shorthand:true},
{input:"calc(1) 2px", shorthand:true},
{input:"1 +2", q:"1px 2px", shorthand:true},
{input:"1 -2", q:"1px -2px", shorthand:true},
];
var props = [
{prop:'background-position', check:'background-position', check_also:[]},
{prop:'border-spacing', check:'border-spacing', check_also:[]},
{prop:'border-top-width', check:'border-top-width'},
{prop:'border-right-width', check:'border-right-width'},
{prop:'border-bottom-width', check:'border-bottom-width'},
{prop:'border-left-width', check:'border-left-width'},
{prop:'border-width', check:'border-top-width', check_also:['border-right-width', 'border-bottom-width', 'border-left-width']},
// {prop:'bottom', check:'bottom'},
{prop:'clip', check:'clip'},
{prop:'font-size', check:'font-size'},
{prop:'height', check:'height'},
{prop:'left', check:'left'},
{prop:'letter-spacing', check:'letter-spacing'},
{prop:'margin-right', check:'margin-right'},
{prop:'margin-left', check:'margin-left'},
{prop:'margin-top', check:'margin-top'},
{prop:'margin-bottom', check:'margin-bottom'},
{prop:'margin', check:'margin-top', check_also:['margin-right', 'margin-bottom', 'margin-left']},
{prop:'max-height', check:'max-height'},
{prop:'max-width', check:'max-width'},
{prop:'min-height', check:'min-height'},
{prop:'min-width', check:'min-width'},
{prop:'padding-top', check:'padding-top'},
{prop:'padding-right', check:'padding-right'},
{prop:'padding-bottom', check:'padding-bottom'},
{prop:'padding-left', check:'padding-left'},
{prop:'padding', check:'padding-top', check_also:['padding-right', 'padding-bottom', 'padding-left']},
{prop:'right', check:'right'},
{prop:'text-indent', check:'text-indent'},
// {prop:'top', check:'top'},
{prop:'vertical-align', check:'vertical-align'},
{prop:'width', check:'width'},
{prop:'word-spacing', check:'word-spacing'},
];
var style_template = '#test{border-style:solid;position:relative;{prop}:{test};}' +
'#ref{border-style:solid;position:relative;{prop}:{ref};}';
tests.forEach(function(t) {
for (var i in props) {
if (t.shorthand && !(props[i].check_also)) {
continue;
}
test(function() {
q.style.textContent = style_template.replace('{test}', t.input)
.replace('{ref}', t.q).replace(/\{prop\}/g, props[i].prop)
.replace(/clip:[^;]+/g, function(match) {
return 'clip:rect(auto, auto, auto, ' + match.substr(5) + ')';
});
assert_equals(q.getComputedStyle(q.test).getPropertyValue(props[i].check),
q.getComputedStyle(q.ref).getPropertyValue(props[i].check),
props[i].prop);
if (t.shorthand && props[i].check_also) {
for (var j in props[i].check_also) {
assert_equals(q.getComputedStyle(q.test).getPropertyValue(props[i].check_also[j]),
q.getComputedStyle(q.ref).getPropertyValue(props[i].check_also[j]),
props[i].prop + ', checking ' + props[i].check_also[j]);
}
}
}, props[i].prop + ": " + t.input + ' (quirks)');
test(function() {
a.style.textContent = style_template.replace('{test}', t.input)
.replace('{ref}', t.s).replace(/\{prop\}/g, props[i].prop)
.replace(/clip:[^;]+/g, function(match) {
return 'clip:rect(auto, auto, auto, ' + match.substr(5) + ')';
});
assert_equals(a.getComputedStyle(a.test).getPropertyValue(props[i].check),
a.getComputedStyle(a.ref).getPropertyValue(props[i].check),
props[i].prop + ' in almost standards mode');
if (t.shorthand && props[i].check_also) {
for (var j in props[i].check_also) {
assert_equals(a.getComputedStyle(a.test).getPropertyValue(props[i].check_also[j]),
a.getComputedStyle(a.ref).getPropertyValue(props[i].check_also[j]),
props[i].prop + ', checking ' + props[i].check_also[j]);
}
}
}, props[i].prop + ": " + t.input + ' (almost standards)');
test(function() {
s.style.textContent = style_template.replace('{test}', t.input)
.replace('{ref}', t.s).replace(/\{prop\}/g, props[i].prop)
.replace(/clip:[^;]+/g, function(match) {
return 'clip:rect(auto, auto, auto, ' + match.substr(5) + ')';
});
assert_equals(s.getComputedStyle(s.test).getPropertyValue(props[i].check),
s.getComputedStyle(s.ref).getPropertyValue(props[i].check),
props[i].prop + ' in standards mode');
if (t.shorthand && props[i].check_also) {
for (var j in props[i].check_also) {
assert_equals(s.getComputedStyle(s.test).getPropertyValue(props[i].check_also[j]),
s.getComputedStyle(s.ref).getPropertyValue(props[i].check_also[j]),
props[i].prop + ', checking ' + props[i].check_also[j]);
}
}
}, props[i].prop + ": " + t.input + ' (standards)');
}
});
var other_tests = [
{input:'background:1 1', prop:'background-position'},
{input:'border-top:red solid 1', prop:'border-top-width'},
{input:'border-right:red solid 1', prop:'border-right-width'},
{input:'border-bottom:red solid 1', prop:'border-bottom-width'},
{input:'border-left:red solid 1', prop:'border-left-width'},
{input:'border:red solid 1', prop:'border-top-width'},
{input:'font:normal normal normal 40 sans-serif', prop:'font-size'},
{input:'outline:red solid 1', prop:'outline-width'},
{input:'outline-width:1', prop:'outline-width'},
];
var other_template = "#test{position:relative;outline-style:solid;{test}}" +
"#ref{outline-style:solid}";
other_tests.forEach(function(t) {
test(function() {
q.style.textContent = other_template.replace('{test}', t.input);
assert_equals(q.getComputedStyle(q.test).getPropertyValue(t.prop),
q.getComputedStyle(q.ref).getPropertyValue(t.prop),
'quirk was supported');
}, 'Excluded property '+t.input);
});
done();
}
</script>
</body>
</html>

View file

@ -130,14 +130,11 @@
'#ref{border-style:solid;position:relative;{prop}:{ref};}';
tests.forEach(function(t) {
var test_q = async_test(t.input + ' (quirks)');
var test_a = async_test(t.input + ' (almost standards)');
var test_s = async_test(t.input + ' (standards)');
for (var i in props) {
if (t.shorthand && !(props[i].check_also)) {
continue;
}
test_q.step(function() {
test(function() {
q.style.textContent = style_template.replace('{test}', t.input)
.replace('{ref}', t.q).replace(/\{prop\}/g, props[i].prop)
.replace(/clip:[^;]+/g, function(match) {
@ -153,8 +150,8 @@
props[i].prop + ', checking ' + props[i].check_also[j]);
}
}
});
test_a.step(function() {
}, props[i].prop + ": " + t.input + ' (quirks)');
test(function() {
a.style.textContent = style_template.replace('{test}', t.input)
.replace('{ref}', t.s).replace(/\{prop\}/g, props[i].prop)
.replace(/clip:[^;]+/g, function(match) {
@ -170,8 +167,8 @@
props[i].prop + ', checking ' + props[i].check_also[j]);
}
}
});
test_s.step(function() {
}, props[i].prop + ": " + t.input + ' (almost standards)');
test(function() {
s.style.textContent = style_template.replace('{test}', t.input)
.replace('{ref}', t.s).replace(/\{prop\}/g, props[i].prop)
.replace(/clip:[^;]+/g, function(match) {
@ -187,12 +184,8 @@
props[i].prop + ', checking ' + props[i].check_also[j]);
}
}
});
}, props[i].prop + ": " + t.input + ' (standards)');
}
test_q.done();
test_a.done();
test_s.done();
});
var other_tests = [