mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1688695 - Hide non-standard values of caption-side. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D104321
This commit is contained in:
parent
5a6d8228c8
commit
cc28f15d09
@ -32,52 +32,60 @@ function isEqualRect(r1, r2, r1border, s) {
|
||||
is(r1.bottom - r1border, r2.bottom, s + " (bottom)");
|
||||
}
|
||||
|
||||
var table = document.getElementById("table");
|
||||
var cell = document.getElementById("cell");
|
||||
var caption = document.getElementById("caption");
|
||||
var tableRects = table.getClientRects();
|
||||
var tableBoundingRect = table.getBoundingClientRect();
|
||||
var cellBoundingRect = cell.getBoundingClientRect();
|
||||
var captionBoundingRect = caption.getBoundingClientRect();
|
||||
function runTest() {
|
||||
var table = document.getElementById("table");
|
||||
var cell = document.getElementById("cell");
|
||||
var caption = document.getElementById("caption");
|
||||
var tableRects = table.getClientRects();
|
||||
var tableBoundingRect = table.getBoundingClientRect();
|
||||
var cellBoundingRect = cell.getBoundingClientRect();
|
||||
var captionBoundingRect = caption.getBoundingClientRect();
|
||||
|
||||
is(tableRects.length, 2, "Table should have rects for body and caption");
|
||||
isEqualRect(tableRects[0], cellBoundingRect, 10,
|
||||
"Table first rect should be cell rect");
|
||||
isEqualRect(tableRects[1], captionBoundingRect, 0,
|
||||
"Table second rect should be caption rect");
|
||||
is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width");
|
||||
is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height");
|
||||
is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width");
|
||||
is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height");
|
||||
is(captionBoundingRect.top, cellBoundingRect.bottom + 10, "Discontiguous vertical geometry");
|
||||
|
||||
is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error");
|
||||
is(tableBoundingRect.left, cellBoundingRect.left - 10, "Table left error");
|
||||
is(tableBoundingRect.bottom, captionBoundingRect.bottom, "Table bottom error");
|
||||
is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error");
|
||||
|
||||
caption.style.captionSide = "left";
|
||||
|
||||
tableRects = table.getClientRects();
|
||||
tableBoundingRect = table.getBoundingClientRect();
|
||||
cellBoundingRect = cell.getBoundingClientRect();
|
||||
captionBoundingRect = caption.getBoundingClientRect();
|
||||
|
||||
is(tableRects.length, 2, "Table should have rects for body and caption");
|
||||
isEqualRect(tableRects[0], cellBoundingRect, 10,
|
||||
"Table first rect should be cell rect plus border");
|
||||
isEqualRect(tableRects[1], captionBoundingRect, 0,
|
||||
"Table second rect should be caption rect");
|
||||
is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width");
|
||||
is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height");
|
||||
is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width");
|
||||
is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height");
|
||||
is(captionBoundingRect.right + 10, cellBoundingRect.left, "Discontiguous horizontal geometry");
|
||||
is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error");
|
||||
is(tableBoundingRect.left, captionBoundingRect.left, "Table left error");
|
||||
is(tableBoundingRect.bottom, cellBoundingRect.bottom + 10, "Table bottom error");
|
||||
is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
is(tableRects.length, 2, "Table should have rects for body and caption");
|
||||
isEqualRect(tableRects[0], cellBoundingRect, 10,
|
||||
"Table first rect should be cell rect");
|
||||
isEqualRect(tableRects[1], captionBoundingRect, 0,
|
||||
"Table second rect should be caption rect");
|
||||
is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width");
|
||||
is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height");
|
||||
is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width");
|
||||
is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height");
|
||||
is(captionBoundingRect.top, cellBoundingRect.bottom + 10, "Discontiguous vertical geometry");
|
||||
|
||||
is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error");
|
||||
is(tableBoundingRect.left, cellBoundingRect.left - 10, "Table left error");
|
||||
is(tableBoundingRect.bottom, captionBoundingRect.bottom, "Table bottom error");
|
||||
is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error");
|
||||
|
||||
caption.style.captionSide = "left";
|
||||
|
||||
tableRects = table.getClientRects();
|
||||
tableBoundingRect = table.getBoundingClientRect();
|
||||
cellBoundingRect = cell.getBoundingClientRect();
|
||||
captionBoundingRect = caption.getBoundingClientRect();
|
||||
|
||||
is(tableRects.length, 2, "Table should have rects for body and caption");
|
||||
isEqualRect(tableRects[0], cellBoundingRect, 10,
|
||||
"Table first rect should be cell rect plus border");
|
||||
isEqualRect(tableRects[1], captionBoundingRect, 0,
|
||||
"Table second rect should be caption rect");
|
||||
is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width");
|
||||
is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height");
|
||||
is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width");
|
||||
is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height");
|
||||
is(captionBoundingRect.right + 10, cellBoundingRect.left, "Discontiguous horizontal geometry");
|
||||
is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error");
|
||||
is(tableBoundingRect.left, captionBoundingRect.left, "Table left error");
|
||||
is(tableBoundingRect.bottom, cellBoundingRect.bottom + 10, "Table bottom error");
|
||||
is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error");
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["layout.css.caption-side-non-standard.enabled", true]]}, runTest);
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -143,8 +143,8 @@ random == 99850-1b.html 99850-1-ref.html # bug 471629
|
||||
== 134706-4.html 134706-4-ref.html
|
||||
== 134706-5.html 134706-5-ref.html
|
||||
== 134706-6.html 134706-6-ref.html
|
||||
== 134706-6b.html 134706-6b-ref.html
|
||||
== 134706-6c.html 134706-6c-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == 134706-6b.html 134706-6b-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == 134706-6c.html 134706-6c-ref.html
|
||||
== 134706-7.html 134706-7-ref.html
|
||||
== 139550-1a.html 139550-1-ref.html
|
||||
== 139550-1b.html 139550-1-ref.html
|
||||
@ -1032,7 +1032,7 @@ asserts(3) != 427017-1.xhtml about:blank # crash test (needs reftest-paged). exi
|
||||
== 427129-scrollframe.html 427129-ref.html
|
||||
== 427129-table.html 427129-ref.html
|
||||
== 427129-image.html 427129-ref.html
|
||||
== 427129-table-caption.html 427129-table-caption-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == 427129-table-caption.html 427129-table-caption-ref.html
|
||||
fuzzy-if(skiaContent,0-1,0-60) == 427370-1.html 427370-1-ref.html
|
||||
== 427730-1.html 427730-1-ref.html
|
||||
== 428278.html 428278-ref.html
|
||||
@ -1267,8 +1267,8 @@ random-if(d2d) == chrome://reftest/content/bugs/478377-1.xhtml chrome://reftest/
|
||||
== 478614-3.html 478614-3-ref.html
|
||||
== 478614-4.html 478614-4-ref.html
|
||||
== 478614-5.html 478614-5-ref.html
|
||||
== 478614-6.html 478614-6-ref.html
|
||||
== 478614-7.html 478614-7-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == 478614-6.html 478614-6-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == 478614-7.html 478614-7-ref.html
|
||||
== 478811-1.html 478811-1-ref.html
|
||||
== 478811-2.html 478811-2-ref.html
|
||||
== 478811-3.html 478811-3-ref.html
|
||||
@ -1823,7 +1823,7 @@ fails-if(webrender) == 1059498-2.html 1059498-1-ref.html # WebRender: see bug 15
|
||||
fails-if(webrender) == 1059498-3.html 1059498-1-ref.html # WebRender: see bug 1499113
|
||||
== 1062108-1.html 1062108-1-ref.html
|
||||
== 1062792-1.html 1062792-1-ref.html
|
||||
== 1062963-floatmanager-reflow.html 1062963-floatmanager-reflow-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == 1062963-floatmanager-reflow.html 1062963-floatmanager-reflow-ref.html
|
||||
== 1066554-1.html 1066554-1-ref.html
|
||||
== 1069716-1.html 1069716-1-ref.html
|
||||
skip-if(geckoview&&!webrender) == 1078262-1.html about:blank # bug 1656792
|
||||
|
@ -125,7 +125,7 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == grid-item-auto-min-size-
|
||||
== grid-item-button-001.html grid-item-button-001-ref.html
|
||||
== grid-item-table-stretch-001.html grid-item-table-stretch-001-ref.html
|
||||
== grid-item-table-stretch-002.html grid-item-table-stretch-002-ref.html
|
||||
== grid-item-table-stretch-003.html grid-item-table-stretch-003-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == grid-item-table-stretch-003.html grid-item-table-stretch-003-ref.html
|
||||
== grid-item-table-stretch-004.html grid-item-table-stretch-004-ref.html
|
||||
== grid-item-fieldset-stretch-001.html grid-item-fieldset-stretch-001-ref.html
|
||||
skip-if(Android) == grid-item-video-stretch-001.html grid-item-video-stretch-001-ref.html # Huh, Android doesn't have webm support?
|
||||
|
@ -669,20 +669,20 @@ fuzzy-if(winWidget&&!nativeThemePref,0-4,0-36) == block-overflow-5c-dyn.html blo
|
||||
# alias for the CSS 2.1 values 'top' and 'bottom' respectively.
|
||||
== table-caption-top-1.html table-caption-top-1-ref.html
|
||||
== table-caption-top-2.html table-caption-top-2-ref.html
|
||||
== table-caption-top-outside-1.html table-caption-top-1-ref.html
|
||||
== table-caption-top-outside-2.html table-caption-top-1-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-top-outside-1.html table-caption-top-1-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-top-outside-2.html table-caption-top-1-ref.html
|
||||
== table-caption-bottom-1.html table-caption-bottom-1-ref.html
|
||||
== table-caption-bottom-2.html table-caption-bottom-2-ref.html
|
||||
== table-caption-bottom-outside-1.html table-caption-bottom-1-ref.html
|
||||
== table-caption-bottom-outside-2.html table-caption-bottom-1-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-bottom-outside-1.html table-caption-bottom-1-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-bottom-outside-2.html table-caption-bottom-1-ref.html
|
||||
== table-caption-top-1-dyn.html table-caption-top-1-ref.html
|
||||
== table-caption-top-2-dyn.html table-caption-top-1-ref.html
|
||||
== table-caption-top-outside-1-dyn.html table-caption-top-1-ref.html
|
||||
== table-caption-top-outside-2-dyn.html table-caption-top-2-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-top-outside-1-dyn.html table-caption-top-1-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-top-outside-2-dyn.html table-caption-top-2-ref.html
|
||||
== table-caption-bottom-1-dyn.html table-caption-bottom-1-ref.html
|
||||
== table-caption-bottom-2-dyn.html table-caption-bottom-1-ref.html
|
||||
== table-caption-bottom-outside-1-dyn.html table-caption-bottom-1-ref.html
|
||||
== table-caption-bottom-outside-2-dyn.html table-caption-bottom-1-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-bottom-outside-1-dyn.html table-caption-bottom-1-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-bottom-outside-2-dyn.html table-caption-bottom-1-ref.html
|
||||
fails == caption-sibling-1a.html caption-sibling-1-ref.html # Bug 144517
|
||||
!= caption-sibling-1a.html caption-sibling-1-noref.html
|
||||
fails == caption-sibling-1b.html caption-sibling-1-ref.html # Bug 144517
|
||||
|
@ -63,12 +63,12 @@ fuzzy-if(skiaContent,0-1,0-23) == resize-reflow-001.html resize-reflow-001.ref.h
|
||||
== table-caption-splitaftercaption-3.html table-caption-splitaftercaption-3-ref.html
|
||||
== table-caption-splitaftercaption-4.html table-caption-splitaftercaption-4-ref.html
|
||||
== table-caption-splitaftercaption-5.html table-caption-splitaftercaption-5-ref.html
|
||||
== table-caption-splitaftercaption-6.html table-caption-splitaftercaption-6-ref.html
|
||||
== table-caption-splitaftercaption-7.html table-caption-splitaftercaption-7-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-splitaftercaption-6.html table-caption-splitaftercaption-6-ref.html
|
||||
pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-splitaftercaption-7.html table-caption-splitaftercaption-7-ref.html
|
||||
# == table-caption-splitaftercaption-8.html blank.html # bug 672654
|
||||
# == table-caption-splitaftercaption-9.html blank.html # bug 672654
|
||||
# == table-caption-splitaftercaption-10.html blank.html # bug 672654
|
||||
# == table-caption-splitaftercaption-11.html blank.html # bug 672654
|
||||
# pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-splitaftercaption-10.html blank.html # bug 672654
|
||||
# pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-splitaftercaption-11.html blank.html # bug 672654
|
||||
== table-cell-breaking-1a.html table-cell-breaking-1-ref.html
|
||||
== table-cell-breaking-1b.html table-cell-breaking-1-ref.html
|
||||
== table-cell-breaking-2a.html table-cell-breaking-2-ref.html
|
||||
|
@ -75,9 +75,9 @@ fuzzy-if(winWidget,0-48,0-600) fuzzy-if(cocoaWidget,0-19,0-97) == wm-row-progres
|
||||
fuzzy-if(winWidget,0-48,0-600) fuzzy-if(cocoaWidget,0-19,0-97) == wm-row-progression-007.xht multicol-count-002-ref.xht
|
||||
|
||||
fuzzy-if(Android,0-255,0-38) == table-caption-top-1.html table-caption-top-1-ref.html
|
||||
fuzzy-if(Android,0-255,0-38) == table-caption-bottom-1.html table-caption-bottom-1-ref.html
|
||||
fuzzy-if(Android,0-244,0-27) == table-caption-left-1.html table-caption-left-1-ref.html
|
||||
fuzzy-if(Android,0-244,0-27) == table-caption-right-1.html table-caption-right-1-ref.html
|
||||
fuzzy-if(Android,0-255,0-38) pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-bottom-1.html table-caption-bottom-1-ref.html
|
||||
fuzzy-if(Android,0-244,0-27) pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-left-1.html table-caption-left-1-ref.html
|
||||
fuzzy-if(Android,0-244,0-27) pref(layout.css.caption-side-non-standard.enabled,true) == table-caption-right-1.html table-caption-right-1-ref.html
|
||||
|
||||
== border-collapse-bevels-1a.html border-collapse-bevels-1-ref.html
|
||||
fuzzy-if(cocoaWidget,0-23,0-162) == border-collapse-bevels-1b.html border-collapse-bevels-1-ref.html
|
||||
|
@ -5276,7 +5276,7 @@ var gCSSProperties = {
|
||||
inherited: true,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: ["top"],
|
||||
other_values: ["bottom", "left", "right", "top-outside", "bottom-outside"],
|
||||
other_values: ["bottom"],
|
||||
invalid_values: [],
|
||||
},
|
||||
"caret-color": {
|
||||
@ -11693,6 +11693,22 @@ function get_computed_value(cs, property) {
|
||||
return cs.getPropertyValue(property);
|
||||
}
|
||||
|
||||
const kNonStandardCaptionSideValues = [
|
||||
"right",
|
||||
"left",
|
||||
"top-outside",
|
||||
"bottom-outside",
|
||||
];
|
||||
if (IsCSSPropertyPrefEnabled("layout.css.caption-side-non-standard.enabled")) {
|
||||
gCSSProperties["caption-side"].other_values.push(
|
||||
...kNonStandardCaptionSideValues
|
||||
);
|
||||
} else {
|
||||
gCSSProperties["caption-side"].invalid_values.push(
|
||||
...kNonStandardCaptionSideValues
|
||||
);
|
||||
}
|
||||
|
||||
if (IsCSSPropertyPrefEnabled("layout.css.individual-transform.enabled")) {
|
||||
gCSSProperties.rotate = {
|
||||
domProp: "rotate",
|
||||
|
@ -6004,6 +6004,13 @@
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Whether non-standard caption-side values are enabled
|
||||
- name: layout.css.caption-side-non-standard.enabled
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
# Whether Constructable Stylesheets are enabled in script.
|
||||
- name: layout.css.constructable-stylesheets.enabled
|
||||
type: bool
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
//! Specified types for CSS values related to tables.
|
||||
|
||||
use crate::parser::ParserContext;
|
||||
|
||||
/// Specified values for the `caption-side` property.
|
||||
///
|
||||
/// Note that despite having "physical" names, these are actually interpreted
|
||||
@ -12,6 +14,11 @@
|
||||
/// line-start and -end.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-tables/#propdef-caption-side
|
||||
#[cfg(feature = "gecko")]
|
||||
fn caption_side_non_standard_enabled(_context: &ParserContext) -> bool {
|
||||
static_prefs::pref!("layout.css.caption-side-non-standard.enabled")
|
||||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[derive(
|
||||
Clone,
|
||||
@ -35,11 +42,15 @@ pub enum CaptionSide {
|
||||
Top,
|
||||
Bottom,
|
||||
#[cfg(feature = "gecko")]
|
||||
#[parse(condition = "caption_side_non_standard_enabled")]
|
||||
Right,
|
||||
#[cfg(feature = "gecko")]
|
||||
#[parse(condition = "caption_side_non_standard_enabled")]
|
||||
Left,
|
||||
#[cfg(feature = "gecko")]
|
||||
#[parse(condition = "caption_side_non_standard_enabled")]
|
||||
TopOutside,
|
||||
#[cfg(feature = "gecko")]
|
||||
#[parse(condition = "caption_side_non_standard_enabled")]
|
||||
BottomOutside,
|
||||
}
|
||||
|
@ -0,0 +1,2 @@
|
||||
[floats-wrap-bfc-006b.xht]
|
||||
prefs: [layout.css.caption-side-non-standard.enabled:true]
|
@ -0,0 +1,2 @@
|
||||
[floats-wrap-bfc-006c.xht]
|
||||
prefs: [layout.css.caption-side-non-standard.enabled:true]
|
@ -1,7 +0,0 @@
|
||||
[caption-side-invalid.html]
|
||||
[e.style['caption-side'\] = "left" should not set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['caption-side'\] = "right" should not set the property value]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user