Issue #1838 - Part 1: Remove CSS grid preference

Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1398492
This commit is contained in:
FranklinDM
2022-04-02 00:49:25 +08:00
committed by roytam1
parent 15065117ff
commit 4f059d2c8b
15 changed files with 582 additions and 661 deletions
-3
View File
@@ -2,9 +2,6 @@
<html>
<head>
<meta charset="UTF-8">
<!--
user_pref("layout.css.grid.enabled", true);
-->
<script>
function boom()
+1 -1
View File
@@ -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
-48
View File
@@ -145,7 +145,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"
@@ -198,51 +197,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.
@@ -7575,8 +7529,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,
-4
View File
@@ -3,10 +3,6 @@
<head>
<script>
/*
user_pref("layout.css.grid.enabled", true);
*/
function boom()
{
document.getElementById("r").appendChild(document.createTextNode("B"));
-3
View File
@@ -2,9 +2,6 @@
<html>
<head>
<meta charset="UTF-8">
<!--
user_pref("layout.css.grid.enabled", true);
-->
<script>
function boom()
{
+5 -5
View File
@@ -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
+1 -1
View File
@@ -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
-2
View File
@@ -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
+1 -1
View File
@@ -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
+26 -34
View File
@@ -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,
-1
View File
@@ -1334,7 +1334,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.
+1 -3
View File
@@ -379,8 +379,6 @@ nsLayoutStylesheetCache::For(StyleBackendType aType)
// style sheets will be re-parsed.
// 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
File diff suppressed because it is too large Load Diff
@@ -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);
-3
View File
@@ -2541,9 +2541,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);