diff options
author | FranklinDM <mrmineshafter17@gmail.com> | 2022-04-02 00:49:25 +0800 |
---|---|---|
committer | FranklinDM <mrmineshafter17@gmail.com> | 2022-04-02 23:13:54 +0800 |
commit | 121ee9438ce8b4ce19f718a38d49307b483097fa (patch) | |
tree | c9d974108192422b838504eba1173fb240ecb61a | |
parent | ba4eba034f726bbafe1fea841b2613d4e37e6cad (diff) | |
download | uxp-121ee9438ce8b4ce19f718a38d49307b483097fa.tar.gz |
Issue #1838 - Part 1: Remove CSS grid preference
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1398492
-rw-r--r-- | layout/base/crashtests/1156588.html | 3 | ||||
-rw-r--r-- | layout/base/crashtests/crashtests.list | 2 | ||||
-rw-r--r-- | layout/base/nsLayoutUtils.cpp | 48 | ||||
-rw-r--r-- | layout/generic/crashtests/1015562.html | 4 | ||||
-rw-r--r-- | layout/generic/crashtests/1156257.html | 3 | ||||
-rw-r--r-- | layout/generic/crashtests/crashtests.list | 10 | ||||
-rw-r--r-- | layout/reftests/bugs/reftest.list | 2 | ||||
-rw-r--r-- | layout/reftests/css-grid/reftest.list | 2 | ||||
-rw-r--r-- | layout/reftests/list-item/reftest.list | 2 | ||||
-rw-r--r-- | layout/style/nsCSSPropList.h | 60 | ||||
-rw-r--r-- | layout/style/nsCSSProps.cpp | 1 | ||||
-rw-r--r-- | layout/style/nsLayoutStylesheetCache.cpp | 4 | ||||
-rw-r--r-- | layout/style/test/property_database.js | 1102 | ||||
-rw-r--r-- | layout/style/test/test_transitions_per_property.html | 3 | ||||
-rw-r--r-- | modules/libpref/init/all.js | 3 |
15 files changed, 585 insertions, 664 deletions
diff --git a/layout/base/crashtests/1156588.html b/layout/base/crashtests/1156588.html index ed0098f79a..b48bc3af25 100644 --- a/layout/base/crashtests/1156588.html +++ b/layout/base/crashtests/1156588.html @@ -2,9 +2,6 @@ <html> <head> <meta charset="UTF-8"> -<!-- -user_pref("layout.css.grid.enabled", true); ---> <script> function boom() diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 1a3bf667ba..1c8e2713ac 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -467,7 +467,7 @@ load 1116104.html load 1127198-1.html load 1140198.html load 1143535.html -pref(layout.css.grid.enabled,true) load 1156588.html +load 1156588.html load 1162813.xul load 1163583.html load 1234622-1.html diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 6c73db7e2e..bf215d1be9 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -141,7 +141,6 @@ using namespace mozilla::layers; using namespace mozilla::layout; using namespace mozilla::gfx; -#define GRID_ENABLED_PREF_NAME "layout.css.grid.enabled" #define GRID_TEMPLATE_SUBGRID_ENABLED_PREF_NAME "layout.css.grid-template-subgrid-value.enabled" #define WEBKIT_PREFIXES_ENABLED_PREF_NAME "layout.css.prefixes.webkit" #define DISPLAY_FLOW_ROOT_ENABLED_PREF_NAME "layout.css.display-flow-root.enabled" @@ -194,51 +193,6 @@ static ContentMap& GetContentMap() { return *sContentMap; } -// When the pref "layout.css.grid.enabled" changes, this function is invoked -// to let us update kDisplayKTable, to selectively disable or restore the -// entries for "grid" and "inline-grid" in that table. -static void -GridEnabledPrefChangeCallback(const char* aPrefName, void* aClosure) -{ - MOZ_ASSERT(strncmp(aPrefName, GRID_ENABLED_PREF_NAME, - ArrayLength(GRID_ENABLED_PREF_NAME)) == 0, - "We only registered this callback for a single pref, so it " - "should only be called for that pref"); - - static int32_t sIndexOfGridInDisplayTable; - static int32_t sIndexOfInlineGridInDisplayTable; - static bool sAreGridKeywordIndicesInitialized; // initialized to false - - bool isGridEnabled = - Preferences::GetBool(GRID_ENABLED_PREF_NAME, false); - if (!sAreGridKeywordIndicesInitialized) { - // First run: find the position of "grid" and "inline-grid" in - // kDisplayKTable. - sIndexOfGridInDisplayTable = - nsCSSProps::FindIndexOfKeyword(eCSSKeyword_grid, - nsCSSProps::kDisplayKTable); - MOZ_ASSERT(sIndexOfGridInDisplayTable >= 0, - "Couldn't find grid in kDisplayKTable"); - sIndexOfInlineGridInDisplayTable = - nsCSSProps::FindIndexOfKeyword(eCSSKeyword_inline_grid, - nsCSSProps::kDisplayKTable); - MOZ_ASSERT(sIndexOfInlineGridInDisplayTable >= 0, - "Couldn't find inline-grid in kDisplayKTable"); - sAreGridKeywordIndicesInitialized = true; - } - - // OK -- now, stomp on or restore the "grid" entries in kDisplayKTable, - // depending on whether the grid pref is enabled vs. disabled. - if (sIndexOfGridInDisplayTable >= 0) { - nsCSSProps::kDisplayKTable[sIndexOfGridInDisplayTable].mKeyword = - isGridEnabled ? eCSSKeyword_grid : eCSSKeyword_UNKNOWN; - } - if (sIndexOfInlineGridInDisplayTable >= 0) { - nsCSSProps::kDisplayKTable[sIndexOfInlineGridInDisplayTable].mKeyword = - isGridEnabled ? eCSSKeyword_inline_grid : eCSSKeyword_UNKNOWN; - } -} - // When the pref "layout.css.prefixes.webkit" changes, this function is invoked // to let us update kDisplayKTable, to selectively disable or restore the // entries for "-webkit-box" and "-webkit-inline-box" in that table. @@ -7567,8 +7521,6 @@ struct PrefCallbacks PrefChangedFunc func; }; static const PrefCallbacks kPrefCallbacks[] = { - { GRID_ENABLED_PREF_NAME, - GridEnabledPrefChangeCallback }, { WEBKIT_PREFIXES_ENABLED_PREF_NAME, WebkitPrefixEnabledPrefChangeCallback }, { TEXT_ALIGN_UNSAFE_ENABLED_PREF_NAME, diff --git a/layout/generic/crashtests/1015562.html b/layout/generic/crashtests/1015562.html index 8975e64f2a..353ae40e35 100644 --- a/layout/generic/crashtests/1015562.html +++ b/layout/generic/crashtests/1015562.html @@ -3,10 +3,6 @@ <head> <script> -/* -user_pref("layout.css.grid.enabled", true); -*/ - function boom() { document.getElementById("r").appendChild(document.createTextNode("B")); diff --git a/layout/generic/crashtests/1156257.html b/layout/generic/crashtests/1156257.html index e58c1ba5db..4799926299 100644 --- a/layout/generic/crashtests/1156257.html +++ b/layout/generic/crashtests/1156257.html @@ -2,9 +2,6 @@ <html> <head> <meta charset="UTF-8"> -<!-- -user_pref("layout.css.grid.enabled", true); ---> <script> function boom() { diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index c8fb84feb9..4d9a5de0f8 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -566,7 +566,7 @@ load 986899.html load 1001233.html load 1001258-1.html load 1003441.xul -pref(layout.css.grid.enabled,true) load 1015562.html +load 1015562.html asserts(1-2) load 1015563-1.html asserts(1-2) load 1015563-2.html asserts(0-300) load 1015844.html # bug 574889 @@ -589,7 +589,7 @@ load 1146107.html load 1146114.html load 1153695.html load 1156222.html -pref(layout.css.grid.enabled,true) load 1156257.html +load 1156257.html load 1157011.html load 1169420-1.html load 1169420-2.html @@ -601,9 +601,9 @@ load 1222783.xhtml load 1223568-1.html load 1223568-2.html load 1224230-1.html -pref(layout.css.grid.enabled,true) load 1225118.html -pref(layout.css.grid.enabled,true) load 1225376.html -pref(layout.css.grid.enabled,true) load 1225592.html +load 1225118.html +load 1225376.html +load 1225592.html load 1229437-1.html load 1229437-2.html pref(dom.details_element.enabled,true) load details-containing-only-text.html diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 4fb75edab3..e6cc895d94 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1841,7 +1841,7 @@ fuzzy-if(skiaContent,1,24000) == 1025914-1.html 1025914-1-ref.html == 1050493-1.html 1050493-1-ref.html == 1050788-1.html about:blank == 1053035-1-flex.html 1053035-1-ref.html -test-pref(layout.css.grid.enabled,true) == 1053035-1-grid.html 1053035-1-ref.html +== 1053035-1-grid.html 1053035-1-ref.html == 1059167-1.html 1059167-1-ref.html == 1059498-1.html 1059498-1-ref.html == 1059498-2.html 1059498-1-ref.html diff --git a/layout/reftests/css-grid/reftest.list b/layout/reftests/css-grid/reftest.list index 35e3140a85..62a397b540 100644 --- a/layout/reftests/css-grid/reftest.list +++ b/layout/reftests/css-grid/reftest.list @@ -1,5 +1,3 @@ -default-preferences pref(layout.css.grid.enabled,true) - fails == grid-whitespace-handling-1a.xhtml grid-whitespace-handling-1-ref.xhtml fails == grid-whitespace-handling-1b.xhtml grid-whitespace-handling-1-ref.xhtml == grid-whitespace-handling-2.xhtml grid-whitespace-handling-2-ref.xhtml diff --git a/layout/reftests/list-item/reftest.list b/layout/reftests/list-item/reftest.list index c47473d0b2..a795dfdf4e 100644 --- a/layout/reftests/list-item/reftest.list +++ b/layout/reftests/list-item/reftest.list @@ -1,6 +1,6 @@ fuzzy-if(OSX>=1008,55,4) == numbering-1.html numbering-1-ref.html == numbering-2.html numbering-2-ref.html -pref(layout.css.grid.enabled,true) fuzzy-if(OSX>=1008,8,1) == numbering-3.html numbering-3-ref.html +fuzzy-if(OSX>=1008,8,1) == numbering-3.html numbering-3-ref.html fuzzy-if(OSX>=1008,72,2) == numbering-4.html numbering-4-ref.html == ol-reversed-1a.html ol-reversed-1-ref.html asserts(1) == ol-reversed-1b.html ol-reversed-1-ref.html # bug 478135 diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 45e919d4f8..e90686a3bf 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2104,21 +2104,20 @@ CSS_PROP_SHORTHAND( grid, Grid, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled") + "") CSS_PROP_SHORTHAND( grid-area, grid_area, GridArea, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled") + "") CSS_PROP_POSITION( grid-auto-columns, grid_auto_columns, GridAutoColumns, CSS_PROPERTY_PARSE_FUNCTION | - CSS_PROPERTY_STORES_CALC | - CSS_PROPERTY_ENABLED_IN_UA_SHEETS, - "layout.css.grid.enabled", + CSS_PROPERTY_STORES_CALC, + "", 0, kGridTrackBreadthKTable, CSS_PROP_NO_OFFSET, @@ -2127,9 +2126,8 @@ CSS_PROP_POSITION( grid-auto-flow, grid_auto_flow, GridAutoFlow, - CSS_PROPERTY_PARSE_FUNCTION | - CSS_PROPERTY_ENABLED_IN_UA_SHEETS, - "layout.css.grid.enabled", + CSS_PROPERTY_PARSE_FUNCTION, + "", 0, kGridAutoFlowKTable, CSS_PROP_NO_OFFSET, @@ -2139,9 +2137,8 @@ CSS_PROP_POSITION( grid_auto_rows, GridAutoRows, CSS_PROPERTY_PARSE_FUNCTION | - CSS_PROPERTY_STORES_CALC | - CSS_PROPERTY_ENABLED_IN_UA_SHEETS, - "layout.css.grid.enabled", + CSS_PROPERTY_STORES_CALC, + "", 0, kGridTrackBreadthKTable, CSS_PROP_NO_OFFSET, @@ -2151,13 +2148,13 @@ CSS_PROP_SHORTHAND( grid_column, GridColumn, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled") + "") CSS_PROP_POSITION( grid-column-end, grid_column_end, GridColumnEnd, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled", + "", 0, nullptr, CSS_PROP_NO_OFFSET, @@ -2167,9 +2164,8 @@ CSS_PROP_POSITION( grid_column_gap, GridColumnGap, CSS_PROPERTY_PARSE_VALUE | - CSS_PROPERTY_VALUE_NONNEGATIVE | - CSS_PROPERTY_ENABLED_IN_UA_SHEETS, - "layout.css.grid.enabled", + CSS_PROPERTY_VALUE_NONNEGATIVE, + "", VARIANT_HLP | VARIANT_CALC, nullptr, offsetof(nsStylePosition, mGridColumnGap), @@ -2179,7 +2175,7 @@ CSS_PROP_POSITION( grid_column_start, GridColumnStart, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled", + "", 0, nullptr, CSS_PROP_NO_OFFSET, @@ -2189,19 +2185,19 @@ CSS_PROP_SHORTHAND( grid_gap, GridGap, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled") + "") CSS_PROP_SHORTHAND( grid-row, grid_row, GridRow, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled") + "") CSS_PROP_POSITION( grid-row-end, grid_row_end, GridRowEnd, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled", + "", 0, nullptr, CSS_PROP_NO_OFFSET, @@ -2211,9 +2207,8 @@ CSS_PROP_POSITION( grid_row_gap, GridRowGap, CSS_PROPERTY_PARSE_VALUE | - CSS_PROPERTY_VALUE_NONNEGATIVE | - CSS_PROPERTY_ENABLED_IN_UA_SHEETS, - "layout.css.grid.enabled", + CSS_PROPERTY_VALUE_NONNEGATIVE, + "", VARIANT_HLP | VARIANT_CALC, nullptr, offsetof(nsStylePosition, mGridRowGap), @@ -2223,7 +2218,7 @@ CSS_PROP_POSITION( grid_row_start, GridRowStart, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled", + "", 0, nullptr, CSS_PROP_NO_OFFSET, @@ -2233,14 +2228,13 @@ CSS_PROP_SHORTHAND( grid_template, GridTemplate, CSS_PROPERTY_PARSE_FUNCTION, - "layout.css.grid.enabled") + "") CSS_PROP_POSITION( grid-template-areas, grid_template_areas, GridTemplateAreas, - CSS_PROPERTY_PARSE_FUNCTION | - CSS_PROPERTY_ENABLED_IN_UA_SHEETS, - "layout.css.grid.enabled", + CSS_PROPERTY_PARSE_FUNCTION, + "", 0, nullptr, CSS_PROP_NO_OFFSET, @@ -2251,9 +2245,8 @@ CSS_PROP_POSITION( GridTemplateColumns, CSS_PROPERTY_PARSE_FUNCTION | CSS_PROPERTY_STORES_CALC | - CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH | - CSS_PROPERTY_ENABLED_IN_UA_SHEETS, - "layout.css.grid.enabled", + CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH, + "", 0, kGridTrackBreadthKTable, CSS_PROP_NO_OFFSET, @@ -2264,9 +2257,8 @@ CSS_PROP_POSITION( GridTemplateRows, CSS_PROPERTY_PARSE_FUNCTION | CSS_PROPERTY_STORES_CALC | - CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH | - CSS_PROPERTY_ENABLED_IN_UA_SHEETS, - "layout.css.grid.enabled", + CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH, + "", 0, kGridTrackBreadthKTable, CSS_PROP_NO_OFFSET, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 756e3eb25c..4fa83bb204 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -1332,7 +1332,6 @@ KTableEntry nsCSSProps::kDisplayKTable[] = { { eCSSKeyword_ruby_base_container, StyleDisplay::RubyBaseContainer }, { eCSSKeyword_ruby_text, StyleDisplay::RubyText }, { eCSSKeyword_ruby_text_container, StyleDisplay::RubyTextContainer }, - // The next two entries are controlled by the layout.css.grid.enabled pref. { eCSSKeyword_grid, StyleDisplay::Grid }, { eCSSKeyword_inline_grid, StyleDisplay::InlineGrid }, // The next 4 entries are controlled by the layout.css.prefixes.webkit pref. diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index 1905d8c5cd..7c09202e6a 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -380,8 +380,6 @@ nsLayoutStylesheetCache::For(StyleBackendType aType) // Preferences::RegisterCallback(&DependentPrefChanged, // "layout.css.example-pref.enabled"); Preferences::RegisterCallback(&DependentPrefChanged, - "layout.css.grid.enabled"); - Preferences::RegisterCallback(&DependentPrefChanged, "dom.details_element.enabled"); } @@ -553,7 +551,7 @@ nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData) InvalidateSheet(gStyleCache_Gecko ? &gStyleCache_Gecko->sheet_ : nullptr, \ gStyleCache_Servo ? &gStyleCache_Servo->sheet_ : nullptr); - INVALIDATE(mUASheet); // for layout.css.grid.enabled + // INVALIDATE(mUASheet); // for layout.css.example-pref.enabled INVALIDATE(mHTMLSheet); // for dom.details_element.enabled #undef INVALIDATE diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 1d5dc989f5..13a70faa6a 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -6187,561 +6187,559 @@ if (IsCSSPropertyPrefEnabled("layout.css.filters.enabled")) { }; } -if (IsCSSPropertyPrefEnabled("layout.css.grid.enabled")) { - var isGridTemplateSubgridValueEnabled = - IsCSSPropertyPrefEnabled("layout.css.grid-template-subgrid-value.enabled"); - - gCSSProperties["display"].other_values.push("grid", "inline-grid"); - gCSSProperties["grid-auto-flow"] = { - domProp: "gridAutoFlow", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "row" ], - other_values: [ - "column", - "column dense", - "row dense", - "dense column", - "dense row", - "dense", - ], - invalid_values: [ - "", - "auto", - "none", - "10px", - "column row", - "dense row dense", - ] - }; - - gCSSProperties["grid-auto-columns"] = { - domProp: "gridAutoColumns", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "auto" ], - other_values: [ - "40px", - "2em", - "2.5fr", - "12%", - "min-content", - "max-content", - "calc(2px - 99%)", - "minmax(20px, max-content)", - "minmax(min-content, auto)", - "minmax(auto, max-content)", - "m\\69nmax(20px, 4Fr)", - "MinMax(min-content, calc(20px + 10%))", - "fit-content(1px)", - "fit-content(calc(1px - 99%))", - "fit-content(10%)", - ], - invalid_values: [ - "", - "normal", - "40ms", - "-40px", - "-12%", - "-2em", - "-2.5fr", - "minmax()", - "minmax(20px)", - "mİnmax(20px, 100px)", - "minmax(20px, 100px, 200px)", - "maxmin(100px, 20px)", - "minmax(min-content, minmax(30px, max-content))", - "fit-content(-1px)", - "fit-content(auto)", - "fit-content(min-content)", - ] - }; - gCSSProperties["grid-auto-rows"] = { - domProp: "gridAutoRows", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: gCSSProperties["grid-auto-columns"].initial_values, - other_values: gCSSProperties["grid-auto-columns"].other_values, - invalid_values: gCSSProperties["grid-auto-columns"].invalid_values - }; - - gCSSProperties["grid-template-columns"] = { - domProp: "gridTemplateColumns", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "none" ], - other_values: [ - "auto", - "40px", - "2.5fr", - "[normal] 40px [] auto [ ] 12%", - "[foo] 40px min-content [ bar ] calc(2px - 99%) max-content", - "40px min-content calc(20px + 10%) max-content", - "minmax(min-content, auto)", - "minmax(auto, max-content)", - "m\\69nmax(20px, 4Fr)", - "40px MinMax(min-content, calc(20px + 10%)) max-content", - "40px 2em", - "[] 40px [-foo] 2em [bar baz This\ is\ one\ ident]", - // TODO bug 978478: "[a] repeat(3, [b] 20px [c] 40px [d]) [e]", - "repeat(1, 20px)", - "repeat(1, [a] 20px)", - "[a] Repeat(4, [a] 20px [] auto [b c]) [d]", - "[a] 2.5fr Repeat(4, [a] 20px [] auto [b c]) [d]", - "[a] 2.5fr [z] Repeat(4, [a] 20px [] auto [b c]) [d]", - "[a] 2.5fr [z] Repeat(4, [a] 20px [] auto) [d]", - "[a] 2.5fr [z] Repeat(4, 20px [b c] auto [b c]) [d]", - "[a] 2.5fr [z] Repeat(4, 20px auto) [d]", - "repeat(auto-fill, 0)", - "[a] repeat( Auto-fill,1%)", - "minmax(auto,0) [a] repeat(Auto-fit, 0) minmax(0,auto)", - "minmax(calc(1% + 1px),auto) repeat(Auto-fit,[] 1%) minmax(auto,1%)", - "[a] repeat( auto-fit,[a b] minmax(0,0) )", - "[a] 40px repeat(auto-fit,[a b] minmax(1px, 0) [])", - "[a] calc(1px - 99%) [b] repeat(auto-fit,[a b] minmax(1mm, 1%) [c]) [c]", - "repeat(auto-fill,minmax(1%,auto))", - "repeat(auto-fill,minmax(1em,min-content)) minmax(min-content,0)", - "repeat(auto-fill,minmax(max-content,1mm))", - "repeat(2, fit-content(1px))", - "fit-content(1px) 1fr", - "[a] fit-content(calc(1px - 99%)) [b]", - "[a] fit-content(10%) [b c] fit-content(1em)", - ], - invalid_values: [ - "", - "normal", - "40ms", - "-40px", - "-12%", - "-2fr", - "[foo]", - "[inherit] 40px", - "[initial] 40px", - "[unset] 40px", - "[default] 40px", - "[span] 40px", - "[6%] 40px", - "[5th] 40px", - "[foo[] bar] 40px", - "[foo]] 40px", - "(foo) 40px", - "[foo] [bar] 40px", - "40px [foo] [bar]", - "minmax()", - "minmax(20px)", - "mİnmax(20px, 100px)", - "minmax(20px, 100px, 200px)", - "maxmin(100px, 20px)", - "minmax(min-content, minmax(30px, max-content))", - "repeat(0, 20px)", - "repeat(-3, 20px)", - "rêpeat(1, 20px)", - "repeat(1)", - "repeat(1, )", - "repeat(3px, 20px)", - "repeat(2.0, 20px)", - "repeat(2.5, 20px)", - "repeat(2, (foo))", - "repeat(2, foo)", - "40px calc(0px + rubbish)", - "repeat(1, repeat(1, 20px))", - "repeat(auto-fill, auto)", - "repeat(auto-fit,auto)", - "repeat(auto-fill, fit-content(1px))", - "repeat(auto-fit, fit-content(1px))", - "repeat(auto-fit,[])", - "repeat(auto-fill, 0) repeat(auto-fit, 0) ", - "repeat(auto-fit, 0) repeat(auto-fill, 0) ", - "[a] repeat(auto-fit, 0) repeat(auto-fit, 0) ", - "[a] repeat(auto-fill, 0) [a] repeat(auto-fill, 0) ", - "repeat(auto-fill, 0 0)", - "repeat(auto-fill, 0 [] 0)", - "repeat(auto-fill, min-content)", - "repeat(auto-fit,max-content)", - "repeat(auto-fit,1fr)", - "repeat(auto-fit,minmax(auto,auto))", - "repeat(auto-fit,minmax(min-content,1fr))", - "repeat(auto-fit,minmax(1fr,auto))", - "repeat(auto-fill,minmax(1fr,1em))", - "repeat(auto-fill, 10px) auto", - "auto repeat(auto-fit, 10px)", - "minmax(min-content,max-content) repeat(auto-fit, 0)", - "10px [a] 10px [b a] 1fr [b] repeat(auto-fill, 0)", - "fit-content(-1px)", - "fit-content(auto)", - "fit-content(min-content)", - "fit-content(1px) repeat(auto-fit, 1px)", - "fit-content(1px) repeat(auto-fill, 1px)", - ], - unbalanced_values: [ - "(foo] 40px", - ] - }; - if (isGridTemplateSubgridValueEnabled) { - gCSSProperties["grid-template-columns"].other_values.push( - // See https://bugzilla.mozilla.org/show_bug.cgi?id=981300 - "[none auto subgrid min-content max-content foo] 40px", - - "subgrid", - "subgrid [] [foo bar]", - "subgrid repeat(1, [])", - "subgrid Repeat(4, [a] [b c] [] [d])", - "subgrid repeat(auto-fill, [])", - "subgrid [x] repeat( Auto-fill, [a b c]) []", - "subgrid [x] repeat(auto-fill, []) [y z]" - ); - gCSSProperties["grid-template-columns"].invalid_values.push( - "subgrid [inherit]", - "subgrid [initial]", - "subgrid [unset]", - "subgrid [default]", - "subgrid [span]", - "subgrid [foo] 40px", - "subgrid [foo 40px]", - "[foo] subgrid", - "subgrid rêpeat(1, [])", - "subgrid repeat(0, [])", - "subgrid repeat(-3, [])", - "subgrid repeat(2.0, [])", - "subgrid repeat(2.5, [])", - "subgrid repeat(3px, [])", - "subgrid repeat(1)", - "subgrid repeat(1, )", - "subgrid repeat(2, [40px])", - "subgrid repeat(2, foo)", - "subgrid repeat(1, repeat(1, []))", - "subgrid repeat(auto-fit,[])", - "subgrid [] repeat(auto-fit,[])", - "subgrid [a] repeat(auto-fit,[])", - "subgrid repeat(auto-fill, 1px)", - "subgrid repeat(auto-fill, 1px [])", - "subgrid repeat(Auto-fill, [a] [b c] [] [d])", - "subgrid repeat(auto-fill, []) repeat(auto-fill, [])" - ); - } - gCSSProperties["grid-template-rows"] = { - domProp: "gridTemplateRows", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: gCSSProperties["grid-template-columns"].initial_values, - other_values: gCSSProperties["grid-template-columns"].other_values, - invalid_values: gCSSProperties["grid-template-columns"].invalid_values - }; - gCSSProperties["grid-template-areas"] = { - domProp: "gridTemplateAreas", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "none" ], - other_values: [ - "''", - "'' ''", - "'1a-é_ .' \"b .\"", - "' Z\t\\aZ' 'Z Z'", - " '. . a b' '. .a b' ", - "'a.b' '. . .'", - "'.' '..'", - "'...' '.'", - "'...-blah' '. .'", - "'.. ..' '.. ...'", - ], - invalid_values: [ - "'a b' 'a/b'", - "'a . a'", - "'. a a' 'a a a'", - "'a a .' 'a a a'", - "'a a' 'a .'", - "'a a'\n'..'\n'a a'", - ] - }; - - gCSSProperties["grid-template"] = { - domProp: "gridTemplate", - inherited: false, - type: CSS_TYPE_TRUE_SHORTHAND, - subproperties: [ - "grid-template-areas", - "grid-template-rows", - "grid-template-columns", - ], - initial_values: [ - "none", - "none / none", - ], - other_values: [ - // <'grid-template-rows'> / <'grid-template-columns'> - "40px / 100px", - "[foo] 40px [bar] / [baz] repeat(auto-fill,100px) [fizz]", - " none/100px", - "40px/none", - // [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]? - "'fizz'", - "[bar] 'fizz'", - "'fizz' / [foo] 40px", - "[bar] 'fizz' / [foo] 40px", - "'fizz' 100px / [foo] 40px", - "[bar] 'fizz' 100px / [foo] 40px", - "[bar] 'fizz' 100px [buzz] / [foo] 40px", - "[bar] 'fizz' 100px [buzz] \n [a] '.' 200px [b] / [foo] 40px", - ], - invalid_values: [ - "'fizz' / repeat(1, 100px)", - "'fizz' repeat(1, 100px) / 0px", - "[foo] [bar] 40px / 100px", - "[fizz] [buzz] 100px / 40px", - "[fizz] [buzz] 'foo' / 40px", - "'foo' / none" - ] - }; - if (isGridTemplateSubgridValueEnabled) { - gCSSProperties["grid-template"].other_values.push( - "subgrid", - "subgrid/40px 20px", - "subgrid [foo] [] [bar baz] / 40px 20px", - "40px 20px/subgrid", - "40px 20px/subgrid [foo] [] repeat(3, [a] [b]) [bar baz]", - "subgrid/subgrid", - "subgrid [foo] [] [bar baz]/subgrid [foo] [] [bar baz]" - ); - gCSSProperties["grid-template"].invalid_values.push( - "subgrid []", - "subgrid [] / 'fizz'", - "subgrid / 'fizz'" - ); - } - - gCSSProperties["grid"] = { - domProp: "grid", - inherited: false, - type: CSS_TYPE_TRUE_SHORTHAND, - subproperties: [ - "grid-template-areas", - "grid-template-rows", - "grid-template-columns", - "grid-auto-flow", - "grid-auto-rows", - "grid-auto-columns", - "grid-column-gap", - "grid-row-gap", - ], - initial_values: [ - "none", - "none / none", - ], - other_values: [ - "auto-flow 40px / none", - "auto-flow / 40px", - "auto-flow dense auto / auto", - "dense auto-flow minmax(min-content, 2fr) / auto", - "dense auto-flow / 100px", - "none / auto-flow 40px", - "40px / auto-flow", - "none / dense auto-flow auto", - ].concat( - gCSSProperties["grid-template"].other_values - ), - invalid_values: [ - "auto-flow", - " / auto-flow", - "dense 0 / 0", - "dense dense 40px / 0", - "auto-flow / auto-flow", - "auto-flow / dense", - "auto-flow [a] 0 / 0", - "0 / auto-flow [a] 0", - "auto-flow -20px / 0", - "auto-flow 200ms / 0", - "auto-flow 40px 100px / 0", - ].concat( - gCSSProperties["grid-template"].invalid_values, - gCSSProperties["grid-auto-flow"].other_values, - gCSSProperties["grid-auto-flow"].invalid_values - .filter((v) => v != 'none') - ) - }; - - var gridLineOtherValues = [ - "foo", - "2", - "2 foo", - "foo 2", - "-3", - "-3 bar", - "bar -3", - "span 2", - "2 span", - "span foo", - "foo span", - "span 2 foo", - "span foo 2", - "2 foo span", - "foo 2 span", - ]; - var gridLineInvalidValues = [ +var isGridTemplateSubgridValueEnabled = + IsCSSPropertyPrefEnabled("layout.css.grid-template-subgrid-value.enabled"); + +gCSSProperties["display"].other_values.push("grid", "inline-grid"); +gCSSProperties["grid-auto-flow"] = { + domProp: "gridAutoFlow", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "row" ], + other_values: [ + "column", + "column dense", + "row dense", + "dense column", + "dense row", + "dense", + ], + invalid_values: [ "", - "4th", - "span", - "inherit 2", - "2 inherit", - "20px", - "2 3", - "2.5", - "2.0", - "0", - "0 foo", - "span 0", - "2 foo 3", - "foo 2 foo", - "2 span foo", - "foo span 2", - "span -3", - "span -3 bar", - "span 2 span", - "span foo span", - "span 2 foo span", - ]; - - gCSSProperties["grid-column-start"] = { - domProp: "gridColumnStart", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "auto" ], - other_values: gridLineOtherValues, - invalid_values: gridLineInvalidValues - }; - gCSSProperties["grid-column-end"] = { - domProp: "gridColumnEnd", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "auto" ], - other_values: gridLineOtherValues, - invalid_values: gridLineInvalidValues - }; - gCSSProperties["grid-row-start"] = { - domProp: "gridRowStart", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "auto" ], - other_values: gridLineOtherValues, - invalid_values: gridLineInvalidValues - }; - gCSSProperties["grid-row-end"] = { - domProp: "gridRowEnd", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "auto" ], - other_values: gridLineOtherValues, - invalid_values: gridLineInvalidValues - }; - - // The grid-column and grid-row shorthands take values of the form - // <grid-line> [ / <grid-line> ]? - var gridColumnRowOtherValues = [].concat(gridLineOtherValues); - gridLineOtherValues.concat([ "auto" ]).forEach(function(val) { - gridColumnRowOtherValues.push(" foo / " + val); - gridColumnRowOtherValues.push(val + "/2"); - }); - var gridColumnRowInvalidValues = [ - "foo, bar", - "foo / bar / baz", - ].concat(gridLineInvalidValues); - gridLineInvalidValues.forEach(function(val) { - gridColumnRowInvalidValues.push("span 3 / " + val); - gridColumnRowInvalidValues.push(val + " / foo"); - }); - gCSSProperties["grid-column"] = { - domProp: "gridColumn", - inherited: false, - type: CSS_TYPE_TRUE_SHORTHAND, - subproperties: [ - "grid-column-start", - "grid-column-end" - ], - initial_values: [ "auto", "auto / auto" ], - other_values: gridColumnRowOtherValues, - invalid_values: gridColumnRowInvalidValues - }; - gCSSProperties["grid-row"] = { - domProp: "gridRow", - inherited: false, - type: CSS_TYPE_TRUE_SHORTHAND, - subproperties: [ - "grid-row-start", - "grid-row-end" - ], - initial_values: [ "auto", "auto / auto" ], - other_values: gridColumnRowOtherValues, - invalid_values: gridColumnRowInvalidValues - }; + "auto", + "none", + "10px", + "column row", + "dense row dense", + ] +}; + +gCSSProperties["grid-auto-columns"] = { + domProp: "gridAutoColumns", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "auto" ], + other_values: [ + "40px", + "2em", + "2.5fr", + "12%", + "min-content", + "max-content", + "calc(2px - 99%)", + "minmax(20px, max-content)", + "minmax(min-content, auto)", + "minmax(auto, max-content)", + "m\\69nmax(20px, 4Fr)", + "MinMax(min-content, calc(20px + 10%))", + "fit-content(1px)", + "fit-content(calc(1px - 99%))", + "fit-content(10%)", + ], + invalid_values: [ + "", + "normal", + "40ms", + "-40px", + "-12%", + "-2em", + "-2.5fr", + "minmax()", + "minmax(20px)", + "mİnmax(20px, 100px)", + "minmax(20px, 100px, 200px)", + "maxmin(100px, 20px)", + "minmax(min-content, minmax(30px, max-content))", + "fit-content(-1px)", + "fit-content(auto)", + "fit-content(min-content)", + ] +}; +gCSSProperties["grid-auto-rows"] = { + domProp: "gridAutoRows", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: gCSSProperties["grid-auto-columns"].initial_values, + other_values: gCSSProperties["grid-auto-columns"].other_values, + invalid_values: gCSSProperties["grid-auto-columns"].invalid_values +}; + +gCSSProperties["grid-template-columns"] = { + domProp: "gridTemplateColumns", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "none" ], + other_values: [ + "auto", + "40px", + "2.5fr", + "[normal] 40px [] auto [ ] 12%", + "[foo] 40px min-content [ bar ] calc(2px - 99%) max-content", + "40px min-content calc(20px + 10%) max-content", + "minmax(min-content, auto)", + "minmax(auto, max-content)", + "m\\69nmax(20px, 4Fr)", + "40px MinMax(min-content, calc(20px + 10%)) max-content", + "40px 2em", + "[] 40px [-foo] 2em [bar baz This\ is\ one\ ident]", + // TODO bug 978478: "[a] repeat(3, [b] 20px [c] 40px [d]) [e]", + "repeat(1, 20px)", + "repeat(1, [a] 20px)", + "[a] Repeat(4, [a] 20px [] auto [b c]) [d]", + "[a] 2.5fr Repeat(4, [a] 20px [] auto [b c]) [d]", + "[a] 2.5fr [z] Repeat(4, [a] 20px [] auto [b c]) [d]", + "[a] 2.5fr [z] Repeat(4, [a] 20px [] auto) [d]", + "[a] 2.5fr [z] Repeat(4, 20px [b c] auto [b c]) [d]", + "[a] 2.5fr [z] Repeat(4, 20px auto) [d]", + "repeat(auto-fill, 0)", + "[a] repeat( Auto-fill,1%)", + "minmax(auto,0) [a] repeat(Auto-fit, 0) minmax(0,auto)", + "minmax(calc(1% + 1px),auto) repeat(Auto-fit,[] 1%) minmax(auto,1%)", + "[a] repeat( auto-fit,[a b] minmax(0,0) )", + "[a] 40px repeat(auto-fit,[a b] minmax(1px, 0) [])", + "[a] calc(1px - 99%) [b] repeat(auto-fit,[a b] minmax(1mm, 1%) [c]) [c]", + "repeat(auto-fill,minmax(1%,auto))", + "repeat(auto-fill,minmax(1em,min-content)) minmax(min-content,0)", + "repeat(auto-fill,minmax(max-content,1mm))", + "repeat(2, fit-content(1px))", + "fit-content(1px) 1fr", + "[a] fit-content(calc(1px - 99%)) [b]", + "[a] fit-content(10%) [b c] fit-content(1em)", + ], + invalid_values: [ + "", + "normal", + "40ms", + "-40px", + "-12%", + "-2fr", + "[foo]", + "[inherit] 40px", + "[initial] 40px", + "[unset] 40px", + "[default] 40px", + "[span] 40px", + "[6%] 40px", + "[5th] 40px", + "[foo[] bar] 40px", + "[foo]] 40px", + "(foo) 40px", + "[foo] [bar] 40px", + "40px [foo] [bar]", + "minmax()", + "minmax(20px)", + "mİnmax(20px, 100px)", + "minmax(20px, 100px, 200px)", + "maxmin(100px, 20px)", + "minmax(min-content, minmax(30px, max-content))", + "repeat(0, 20px)", + "repeat(-3, 20px)", + "rêpeat(1, 20px)", + "repeat(1)", + "repeat(1, )", + "repeat(3px, 20px)", + "repeat(2.0, 20px)", + "repeat(2.5, 20px)", + "repeat(2, (foo))", + "repeat(2, foo)", + "40px calc(0px + rubbish)", + "repeat(1, repeat(1, 20px))", + "repeat(auto-fill, auto)", + "repeat(auto-fit,auto)", + "repeat(auto-fill, fit-content(1px))", + "repeat(auto-fit, fit-content(1px))", + "repeat(auto-fit,[])", + "repeat(auto-fill, 0) repeat(auto-fit, 0) ", + "repeat(auto-fit, 0) repeat(auto-fill, 0) ", + "[a] repeat(auto-fit, 0) repeat(auto-fit, 0) ", + "[a] repeat(auto-fill, 0) [a] repeat(auto-fill, 0) ", + "repeat(auto-fill, 0 0)", + "repeat(auto-fill, 0 [] 0)", + "repeat(auto-fill, min-content)", + "repeat(auto-fit,max-content)", + "repeat(auto-fit,1fr)", + "repeat(auto-fit,minmax(auto,auto))", + "repeat(auto-fit,minmax(min-content,1fr))", + "repeat(auto-fit,minmax(1fr,auto))", + "repeat(auto-fill,minmax(1fr,1em))", + "repeat(auto-fill, 10px) auto", + "auto repeat(auto-fit, 10px)", + "minmax(min-content,max-content) repeat(auto-fit, 0)", + "10px [a] 10px [b a] 1fr [b] repeat(auto-fill, 0)", + "fit-content(-1px)", + "fit-content(auto)", + "fit-content(min-content)", + "fit-content(1px) repeat(auto-fit, 1px)", + "fit-content(1px) repeat(auto-fill, 1px)", + ], + unbalanced_values: [ + "(foo] 40px", + ] +}; +if (isGridTemplateSubgridValueEnabled) { + gCSSProperties["grid-template-columns"].other_values.push( + // See https://bugzilla.mozilla.org/show_bug.cgi?id=981300 + "[none auto subgrid min-content max-content foo] 40px", + + "subgrid", + "subgrid [] [foo bar]", + "subgrid repeat(1, [])", + "subgrid Repeat(4, [a] [b c] [] [d])", + "subgrid repeat(auto-fill, [])", + "subgrid [x] repeat( Auto-fill, [a b c]) []", + "subgrid [x] repeat(auto-fill, []) [y z]" + ); + gCSSProperties["grid-template-columns"].invalid_values.push( + "subgrid [inherit]", + "subgrid [initial]", + "subgrid [unset]", + "subgrid [default]", + "subgrid [span]", + "subgrid [foo] 40px", + "subgrid [foo 40px]", + "[foo] subgrid", + "subgrid rêpeat(1, [])", + "subgrid repeat(0, [])", + "subgrid repeat(-3, [])", + "subgrid repeat(2.0, [])", + "subgrid repeat(2.5, [])", + "subgrid repeat(3px, [])", + "subgrid repeat(1)", + "subgrid repeat(1, )", + "subgrid repeat(2, [40px])", + "subgrid repeat(2, foo)", + "subgrid repeat(1, repeat(1, []))", + "subgrid repeat(auto-fit,[])", + "subgrid [] repeat(auto-fit,[])", + "subgrid [a] repeat(auto-fit,[])", + "subgrid repeat(auto-fill, 1px)", + "subgrid repeat(auto-fill, 1px [])", + "subgrid repeat(Auto-fill, [a] [b c] [] [d])", + "subgrid repeat(auto-fill, []) repeat(auto-fill, [])" + ); +} +gCSSProperties["grid-template-rows"] = { + domProp: "gridTemplateRows", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: gCSSProperties["grid-template-columns"].initial_values, + other_values: gCSSProperties["grid-template-columns"].other_values, + invalid_values: gCSSProperties["grid-template-columns"].invalid_values +}; +gCSSProperties["grid-template-areas"] = { + domProp: "gridTemplateAreas", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "none" ], + other_values: [ + "''", + "'' ''", + "'1a-é_ .' \"b .\"", + "' Z\t\\aZ' 'Z Z'", + " '. . a b' '. .a b' ", + "'a.b' '. . .'", + "'.' '..'", + "'...' '.'", + "'...-blah' '. .'", + "'.. ..' '.. ...'", + ], + invalid_values: [ + "'a b' 'a/b'", + "'a . a'", + "'. a a' 'a a a'", + "'a a .' 'a a a'", + "'a a' 'a .'", + "'a a'\n'..'\n'a a'", + ] +}; + +gCSSProperties["grid-template"] = { + domProp: "gridTemplate", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ + "grid-template-areas", + "grid-template-rows", + "grid-template-columns", + ], + initial_values: [ + "none", + "none / none", + ], + other_values: [ + // <'grid-template-rows'> / <'grid-template-columns'> + "40px / 100px", + "[foo] 40px [bar] / [baz] repeat(auto-fill,100px) [fizz]", + " none/100px", + "40px/none", + // [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]? + "'fizz'", + "[bar] 'fizz'", + "'fizz' / [foo] 40px", + "[bar] 'fizz' / [foo] 40px", + "'fizz' 100px / [foo] 40px", + "[bar] 'fizz' 100px / [foo] 40px", + "[bar] 'fizz' 100px [buzz] / [foo] 40px", + "[bar] 'fizz' 100px [buzz] \n [a] '.' 200px [b] / [foo] 40px", + ], + invalid_values: [ + "'fizz' / repeat(1, 100px)", + "'fizz' repeat(1, 100px) / 0px", + "[foo] [bar] 40px / 100px", + "[fizz] [buzz] 100px / 40px", + "[fizz] [buzz] 'foo' / 40px", + "'foo' / none" + ] +}; +if (isGridTemplateSubgridValueEnabled) { + gCSSProperties["grid-template"].other_values.push( + "subgrid", + "subgrid/40px 20px", + "subgrid [foo] [] [bar baz] / 40px 20px", + "40px 20px/subgrid", + "40px 20px/subgrid [foo] [] repeat(3, [a] [b]) [bar baz]", + "subgrid/subgrid", + "subgrid [foo] [] [bar baz]/subgrid [foo] [] [bar baz]" + ); + gCSSProperties["grid-template"].invalid_values.push( + "subgrid []", + "subgrid [] / 'fizz'", + "subgrid / 'fizz'" + ); +} - var gridAreaOtherValues = gridLineOtherValues.slice(); - gridLineOtherValues.forEach(function(val) { - gridAreaOtherValues.push("foo / " + val); - gridAreaOtherValues.push(val + "/2/3"); - gridAreaOtherValues.push("foo / bar / " + val + " / baz"); - }); - var gridAreaInvalidValues = [ - "foo, bar", - "foo / bar / baz / fizz / buzz", - "default / foo / bar / baz", - "foo / initial / bar / baz", - "foo / bar / inherit / baz", - "foo / bar / baz / unset", - ].concat(gridLineInvalidValues); - gridLineInvalidValues.forEach(function(val) { - gridAreaInvalidValues.push("foo / " + val); - gridAreaInvalidValues.push("foo / bar / " + val); - gridAreaInvalidValues.push("foo / 4 / bar / " + val); - }); - - gCSSProperties["grid-area"] = { - domProp: "gridArea", - inherited: false, - type: CSS_TYPE_TRUE_SHORTHAND, - subproperties: [ - "grid-row-start", - "grid-column-start", - "grid-row-end", - "grid-column-end" - ], - initial_values: [ - "auto", - "auto / auto", - "auto / auto / auto", - "auto / auto / auto / auto" - ], - other_values: gridAreaOtherValues, - invalid_values: gridAreaInvalidValues - }; +gCSSProperties["grid"] = { + domProp: "grid", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ + "grid-template-areas", + "grid-template-rows", + "grid-template-columns", + "grid-auto-flow", + "grid-auto-rows", + "grid-auto-columns", + "grid-column-gap", + "grid-row-gap", + ], + initial_values: [ + "none", + "none / none", + ], + other_values: [ + "auto-flow 40px / none", + "auto-flow / 40px", + "auto-flow dense auto / auto", + "dense auto-flow minmax(min-content, 2fr) / auto", + "dense auto-flow / 100px", + "none / auto-flow 40px", + "40px / auto-flow", + "none / dense auto-flow auto", + ].concat( + gCSSProperties["grid-template"].other_values + ), + invalid_values: [ + "auto-flow", + " / auto-flow", + "dense 0 / 0", + "dense dense 40px / 0", + "auto-flow / auto-flow", + "auto-flow / dense", + "auto-flow [a] 0 / 0", + "0 / auto-flow [a] 0", + "auto-flow -20px / 0", + "auto-flow 200ms / 0", + "auto-flow 40px 100px / 0", + ].concat( + gCSSProperties["grid-template"].invalid_values, + gCSSProperties["grid-auto-flow"].other_values, + gCSSProperties["grid-auto-flow"].invalid_values + .filter((v) => v != 'none') + ) +}; + +var gridLineOtherValues = [ + "foo", + "2", + "2 foo", + "foo 2", + "-3", + "-3 bar", + "bar -3", + "span 2", + "2 span", + "span foo", + "foo span", + "span 2 foo", + "span foo 2", + "2 foo span", + "foo 2 span", +]; +var gridLineInvalidValues = [ + "", + "4th", + "span", + "inherit 2", + "2 inherit", + "20px", + "2 3", + "2.5", + "2.0", + "0", + "0 foo", + "span 0", + "2 foo 3", + "foo 2 foo", + "2 span foo", + "foo span 2", + "span -3", + "span -3 bar", + "span 2 span", + "span foo span", + "span 2 foo span", +]; - gCSSProperties["grid-column-gap"] = { - domProp: "gridColumnGap", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "0" ], - other_values: [ "2px", "2%", "1em", "calc(1px + 1em)", "calc(1%)", - "calc(1% + 1ch)" , "calc(1px - 99%)" ], - invalid_values: [ "-1px", "auto", "none", "1px 1px", "-1%", "fit-content(1px)" ], - }; - gCSSProperties["grid-row-gap"] = { - domProp: "gridRowGap", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "0" ], - other_values: [ "2px", "2%", "1em", "calc(1px + 1em)", "calc(1%)", - "calc(1% + 1ch)" , "calc(1px - 99%)" ], - invalid_values: [ "-1px", "auto", "none", "1px 1px", "-1%", "min-content" ], - }; - gCSSProperties["grid-gap"] = { - domProp: "gridGap", - inherited: false, - type: CSS_TYPE_TRUE_SHORTHAND, - subproperties: [ "grid-column-gap", "grid-row-gap" ], - initial_values: [ "0", "0 0" ], - other_values: [ "1ch 0", "1px 1%", "1em 1px", "calc(1px) calc(1%)" ], - invalid_values: [ "-1px", "1px -1px", "1px 1px 1px", "inherit 1px", - "1px auto" ] - }; -} +gCSSProperties["grid-column-start"] = { + domProp: "gridColumnStart", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "auto" ], + other_values: gridLineOtherValues, + invalid_values: gridLineInvalidValues +}; +gCSSProperties["grid-column-end"] = { + domProp: "gridColumnEnd", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "auto" ], + other_values: gridLineOtherValues, + invalid_values: gridLineInvalidValues +}; +gCSSProperties["grid-row-start"] = { + domProp: "gridRowStart", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "auto" ], + other_values: gridLineOtherValues, + invalid_values: gridLineInvalidValues +}; +gCSSProperties["grid-row-end"] = { + domProp: "gridRowEnd", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "auto" ], + other_values: gridLineOtherValues, + invalid_values: gridLineInvalidValues +}; + +// The grid-column and grid-row shorthands take values of the form +// <grid-line> [ / <grid-line> ]? +var gridColumnRowOtherValues = [].concat(gridLineOtherValues); +gridLineOtherValues.concat([ "auto" ]).forEach(function(val) { + gridColumnRowOtherValues.push(" foo / " + val); + gridColumnRowOtherValues.push(val + "/2"); +}); +var gridColumnRowInvalidValues = [ + "foo, bar", + "foo / bar / baz", +].concat(gridLineInvalidValues); +gridLineInvalidValues.forEach(function(val) { + gridColumnRowInvalidValues.push("span 3 / " + val); + gridColumnRowInvalidValues.push(val + " / foo"); +}); +gCSSProperties["grid-column"] = { + domProp: "gridColumn", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ + "grid-column-start", + "grid-column-end" + ], + initial_values: [ "auto", "auto / auto" ], + other_values: gridColumnRowOtherValues, + invalid_values: gridColumnRowInvalidValues +}; +gCSSProperties["grid-row"] = { + domProp: "gridRow", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ + "grid-row-start", + "grid-row-end" + ], + initial_values: [ "auto", "auto / auto" ], + other_values: gridColumnRowOtherValues, + invalid_values: gridColumnRowInvalidValues +}; + +var gridAreaOtherValues = gridLineOtherValues.slice(); +gridLineOtherValues.forEach(function(val) { + gridAreaOtherValues.push("foo / " + val); + gridAreaOtherValues.push(val + "/2/3"); + gridAreaOtherValues.push("foo / bar / " + val + " / baz"); +}); +var gridAreaInvalidValues = [ + "foo, bar", + "foo / bar / baz / fizz / buzz", + "default / foo / bar / baz", + "foo / initial / bar / baz", + "foo / bar / inherit / baz", + "foo / bar / baz / unset", +].concat(gridLineInvalidValues); +gridLineInvalidValues.forEach(function(val) { + gridAreaInvalidValues.push("foo / " + val); + gridAreaInvalidValues.push("foo / bar / " + val); + gridAreaInvalidValues.push("foo / 4 / bar / " + val); +}); + +gCSSProperties["grid-area"] = { + domProp: "gridArea", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ + "grid-row-start", + "grid-column-start", + "grid-row-end", + "grid-column-end" + ], + initial_values: [ + "auto", + "auto / auto", + "auto / auto / auto", + "auto / auto / auto / auto" + ], + other_values: gridAreaOtherValues, + invalid_values: gridAreaInvalidValues +}; + +gCSSProperties["grid-column-gap"] = { + domProp: "gridColumnGap", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "0" ], + other_values: [ "2px", "2%", "1em", "calc(1px + 1em)", "calc(1%)", + "calc(1% + 1ch)" , "calc(1px - 99%)" ], + invalid_values: [ "-1px", "auto", "none", "1px 1px", "-1%", "fit-content(1px)" ], +}; +gCSSProperties["grid-row-gap"] = { + domProp: "gridRowGap", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "0" ], + other_values: [ "2px", "2%", "1em", "calc(1px + 1em)", "calc(1%)", + "calc(1% + 1ch)" , "calc(1px - 99%)" ], + invalid_values: [ "-1px", "auto", "none", "1px 1px", "-1%", "min-content" ], +}; +gCSSProperties["grid-gap"] = { + domProp: "gridGap", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "grid-column-gap", "grid-row-gap" ], + initial_values: [ "0", "0 0" ], + other_values: [ "1ch 0", "1px 1%", "1em 1px", "calc(1px) calc(1%)" ], + invalid_values: [ "-1px", "1px -1px", "1px 1px 1px", "inherit 1px", + "1px auto" ] +}; if (IsCSSPropertyPrefEnabled("layout.css.display-contents.enabled")) { gCSSProperties["display"].other_values.push("contents"); diff --git a/layout/style/test/test_transitions_per_property.html b/layout/style/test/test_transitions_per_property.html index 83524b60d9..934d8828fe 100644 --- a/layout/style/test/test_transitions_per_property.html +++ b/layout/style/test/test_transitions_per_property.html @@ -1923,9 +1923,6 @@ function test_font_weight(prop) { } function test_grid_gap(prop) { - if (!SpecialPowers.getBoolPref("layout.css.grid.enabled")) { - return; - } test_length_transition(prop); test_length_clamped(prop); test_percent_transition(prop); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 9e0fdac5da..8e7c5eea01 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2524,9 +2524,6 @@ pref("layout.css.variables.enabled", true); // Is support for CSS overflow-clip-box enabled for non-UA sheets? pref("layout.css.overflow-clip-box.enabled", false); -// Is support for CSS grid enabled? -pref("layout.css.grid.enabled", true); - // Is support for CSS "grid-template-{columns,rows}: subgrid X" enabled? pref("layout.css.grid-template-subgrid-value.enabled", false); |