☠☠ backed out by bc2413bb322f ☠ ☠ | |
author | Emilio Cobos Álvarez <emilio@crisal.io> |
Tue, 10 Apr 2018 18:40:22 +0200 | |
changeset 412945 | 84fc374da5e3e01050664b3e3c34301a5eaea4c6 |
parent 412944 | 1376d3c78039467404cd7262987b3adaf407c8a0 |
child 412946 | 4966b5fef257fda94abb735c79634bd8fdd27817 |
push id | 33828 |
push user | archaeopteryx@coole-files.de |
push date | Thu, 12 Apr 2018 19:19:41 +0000 |
treeherder | mozilla-central@6e22c4a726c2 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | xidorn |
bugs | 1453148 |
milestone | 61.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -4203,18 +4203,19 @@ var gCSSProperties = { }, "overflow": { domProp: "overflow", inherited: false, type: CSS_TYPE_SHORTHAND_AND_LONGHAND, prerequisites: { "display": "block", "contain": "none" }, subproperties: [ "overflow-x", "overflow-y" ], initial_values: [ "visible" ], - other_values: [ "auto", "scroll", "hidden", "-moz-hidden-unscrollable", "-moz-scrollbars-none" ], - invalid_values: [] + other_values: [ "auto", "scroll", "hidden", "-moz-hidden-unscrollable", "-moz-scrollbars-none", + "auto auto", "auto scroll", "hidden scroll", "auto hidden" ], + invalid_values: [ "-moz-hidden-unscrollable -moz-hidden-unscrollable", "-moz-hidden-unscrollable -moz-scrollbars-none" ] }, "overflow-x": { domProp: "overflowX", inherited: false, type: CSS_TYPE_LONGHAND, // No applies_to_placeholder because we have a !important rule in forms.css. prerequisites: { "display": "block", "overflow-y": "visible", "contain": "none" }, initial_values: [ "visible" ],
--- a/servo/components/style/properties/shorthand/box.mako.rs +++ b/servo/components/style/properties/shorthand/box.mako.rs @@ -1,16 +1,19 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> -<%helpers:shorthand name="overflow" sub_properties="overflow-x overflow-y" - spec="https://drafts.csswg.org/css-overflow/#propdef-overflow"> +<%helpers:shorthand + name="overflow" + sub_properties="overflow-x overflow-y" + spec="https://drafts.csswg.org/css-overflow/#propdef-overflow" +> use properties::longhands::overflow_x::parse as parse_overflow; % if product == "gecko": use properties::longhands::overflow_x::SpecifiedValue; % endif pub fn parse_value<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, @@ -37,30 +40,33 @@ }) } } }); if moz_kw_found.is_ok() { return moz_kw_found } % endif - let overflow = parse_overflow(context, input)?; + let overflow_x = parse_overflow(context, input)?; + let overflow_y = + input.try(|i| parse_overflow(context, i)).unwrap_or(overflow_x); Ok(expanded! { - overflow_x: overflow, - overflow_y: overflow, + overflow_x: overflow_x, + overflow_y: overflow_y, }) } impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write { - if self.overflow_x == self.overflow_y { - self.overflow_x.to_css(dest) - } else { - Ok(()) + self.overflow_x.to_css(dest)?; + if self.overflow_x != self.overflow_y { + dest.write_char(' ')?; + self.overflow_y.to_css(dest)?; } + Ok(()) } } </%helpers:shorthand> <%helpers:shorthand name="overflow-clip-box" sub_properties="overflow-clip-box-block overflow-clip-box-inline" enabled_in="ua"
--- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -313618,16 +313618,22 @@ ] ], "css/css-multicol/multicol-gap-percentage-001.html": [ [ "/css/css-multicol/multicol-gap-percentage-001.html", {} ] ], + "css/css-overflow/overflow-shorthand-001.html": [ + [ + "/css/css-overflow/overflow-shorthand-001.html", + {} + ] + ], "css/css-position/position-sticky-bottom.html": [ [ "/css/css-position/position-sticky-bottom.html", {} ] ], "css/css-position/position-sticky-get-bounding-client-rect.html": [ [ @@ -503525,16 +503531,20 @@ "css/css-namespaces/syntax-016.xml": [ "0cba1aed016d08e4706bffb8a4f4169c9cfd2108", "visual" ], "css/css-overflow/input-scrollable-region-001.html": [ "f51bc673da28b0471018cdf945b4449ab00ce717", "reftest" ], + "css/css-overflow/overflow-shorthand-001.html": [ + "6409ee499d3e853d8f4933f1b532e12ed9ab406b", + "testharness" + ], "css/css-overflow/reference/input-scrollable-region-001-ref.html": [ "31e24bb1a2cb6f42703cc05e055fcb345c770a22", "support" ], "css/css-page/OWNERS": [ "d4ee6029cc9c064e0e8b2c76becf3b59c4f7b62b", "support" ],
new file mode 100644 --- /dev/null +++ b/testing/web-platform/tests/css/css-overflow/overflow-shorthand-001.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Overflow Test: Overflow longhand accepts two values</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="author" title="Emilio Cobos Álvarez <emilio@crisal.io>"> +<link rel="help" href="https://drafts.csswg.org/css-overflow/#propdef-overflow"> +<div id="test-div"></div> +<script> +let div = document.getElementById("test-div"); +function testOverflowShorthand(x, y) { + test(function() { + div.style.overflowX = x; + div.style.overflowY = y; + + let expectedX = getComputedStyle(div).overflowX; + let expectedY = getComputedStyle(div).overflowY; + let expectedSerialization = x == y ? x : `${x} ${y}`; + + assert_equals(div.style.overflow, expectedSerialization); + + div.style.overflowX = ""; + div.style.overflowY = ""; + assert_equals(div.style.overflow, ""); + + div.style.overflow = `${x} ${y}`; + assert_equals(div.style.overflow, expectedSerialization); + assert_equals(getComputedStyle(div).overflowX, expectedX); + assert_equals(getComputedStyle(div).overflowY, expectedY); + }, `overflow: ${x} ${y} works`); +} + +let OVERFLOW_VALUES = [ "auto", "hidden", "scroll" ]; +for (let x of OVERFLOW_VALUES) + for (let y of OVERFLOW_VALUES) + testOverflowShorthand(x, y); +</script>