Bug 1202940 part 2 - Remove layout.css.ruby.enabled pref. r=dbaron

--HG--
extra : source : bb1c73598b74195f9877b189f2e2e19fb1eb0fc0
This commit is contained in:
Xidorn Quan 2015-12-01 09:39:37 +11:00
parent 4b5a4691e5
commit 7b1f42e5c6
10 changed files with 92 additions and 190 deletions

View File

@ -132,7 +132,6 @@ 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 RUBY_ENABLED_PREF_NAME "layout.css.ruby.enabled"
#define STICKY_ENABLED_PREF_NAME "layout.css.sticky.enabled"
#define DISPLAY_CONTENTS_ENABLED_PREF_NAME "layout.css.display-contents.enabled"
#define TEXT_ALIGN_TRUE_ENABLED_PREF_NAME "layout.css.text-align-true-value.enabled"
@ -214,78 +213,6 @@ GridEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
}
}
static void
RubyEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
{
MOZ_ASSERT(strncmp(aPrefName, RUBY_ENABLED_PREF_NAME,
ArrayLength(RUBY_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 sIndexOfRubyInDisplayTable;
static int32_t sIndexOfRubyBaseInDisplayTable;
static int32_t sIndexOfRubyBaseContainerInDisplayTable;
static int32_t sIndexOfRubyTextInDisplayTable;
static int32_t sIndexOfRubyTextContainerInDisplayTable;
static bool sAreRubyKeywordIndicesInitialized; // initialized to false
bool isRubyEnabled =
Preferences::GetBool(RUBY_ENABLED_PREF_NAME, false);
if (!sAreRubyKeywordIndicesInitialized) {
// First run: find the position of the ruby display values in
// kDisplayKTable.
sIndexOfRubyInDisplayTable =
nsCSSProps::FindIndexOfKeyword(eCSSKeyword_ruby,
nsCSSProps::kDisplayKTable);
MOZ_ASSERT(sIndexOfRubyInDisplayTable >= 0,
"Couldn't find ruby in kDisplayKTable");
sIndexOfRubyBaseInDisplayTable =
nsCSSProps::FindIndexOfKeyword(eCSSKeyword_ruby_base,
nsCSSProps::kDisplayKTable);
MOZ_ASSERT(sIndexOfRubyBaseInDisplayTable >= 0,
"Couldn't find ruby-base in kDisplayKTable");
sIndexOfRubyBaseContainerInDisplayTable =
nsCSSProps::FindIndexOfKeyword(eCSSKeyword_ruby_base_container,
nsCSSProps::kDisplayKTable);
MOZ_ASSERT(sIndexOfRubyBaseContainerInDisplayTable >= 0,
"Couldn't find ruby-base-container in kDisplayKTable");
sIndexOfRubyTextInDisplayTable =
nsCSSProps::FindIndexOfKeyword(eCSSKeyword_ruby_text,
nsCSSProps::kDisplayKTable);
MOZ_ASSERT(sIndexOfRubyTextInDisplayTable >= 0,
"Couldn't find ruby-text in kDisplayKTable");
sIndexOfRubyTextContainerInDisplayTable =
nsCSSProps::FindIndexOfKeyword(eCSSKeyword_ruby_text_container,
nsCSSProps::kDisplayKTable);
MOZ_ASSERT(sIndexOfRubyTextContainerInDisplayTable >= 0,
"Couldn't find ruby-text-container in kDisplayKTable");
sAreRubyKeywordIndicesInitialized = true;
}
// OK -- now, stomp on or restore the "ruby" entries in kDisplayKTable,
// depending on whether the ruby pref is enabled vs. disabled.
if (sIndexOfRubyInDisplayTable >= 0) {
nsCSSProps::kDisplayKTable[sIndexOfRubyInDisplayTable].mKeyword =
isRubyEnabled ? eCSSKeyword_ruby : eCSSKeyword_UNKNOWN;
}
if (sIndexOfRubyBaseInDisplayTable >= 0) {
nsCSSProps::kDisplayKTable[sIndexOfRubyBaseInDisplayTable].mKeyword =
isRubyEnabled ? eCSSKeyword_ruby_base : eCSSKeyword_UNKNOWN;
}
if (sIndexOfRubyBaseContainerInDisplayTable >= 0) {
nsCSSProps::kDisplayKTable[sIndexOfRubyBaseContainerInDisplayTable].mKeyword =
isRubyEnabled ? eCSSKeyword_ruby_base_container : eCSSKeyword_UNKNOWN;
}
if (sIndexOfRubyTextInDisplayTable >= 0) {
nsCSSProps::kDisplayKTable[sIndexOfRubyTextInDisplayTable].mKeyword =
isRubyEnabled ? eCSSKeyword_ruby_text : eCSSKeyword_UNKNOWN;
}
if (sIndexOfRubyTextContainerInDisplayTable >= 0) {
nsCSSProps::kDisplayKTable[sIndexOfRubyTextContainerInDisplayTable].mKeyword =
isRubyEnabled ? eCSSKeyword_ruby_text_container : eCSSKeyword_UNKNOWN;
}
}
// When the pref "layout.css.sticky.enabled" changes, this function is invoked
// to let us update kPositionKTable, to selectively disable or restore the
// entry for "sticky" in that table.
@ -7427,9 +7354,6 @@ nsLayoutUtils::Initialize()
Preferences::RegisterCallback(GridEnabledPrefChangeCallback,
GRID_ENABLED_PREF_NAME);
GridEnabledPrefChangeCallback(GRID_ENABLED_PREF_NAME, nullptr);
Preferences::RegisterCallback(RubyEnabledPrefChangeCallback,
RUBY_ENABLED_PREF_NAME);
RubyEnabledPrefChangeCallback(RUBY_ENABLED_PREF_NAME, nullptr);
Preferences::RegisterCallback(StickyEnabledPrefChangeCallback,
STICKY_ENABLED_PREF_NAME);
StickyEnabledPrefChangeCallback(STICKY_ENABLED_PREF_NAME, nullptr);
@ -7460,8 +7384,6 @@ nsLayoutUtils::Shutdown()
Preferences::UnregisterCallback(GridEnabledPrefChangeCallback,
GRID_ENABLED_PREF_NAME);
Preferences::UnregisterCallback(RubyEnabledPrefChangeCallback,
RUBY_ENABLED_PREF_NAME);
Preferences::UnregisterCallback(StickyEnabledPrefChangeCallback,
STICKY_ENABLED_PREF_NAME);

View File

@ -1,5 +1,3 @@
default-preferences pref(layout.css.ruby.enabled,true)
== bidi-1.html bidi-1-ref.html
== bidi-2.html bidi-2-ref.html
== box-generation-1.html box-generation-1-ref.html

View File

@ -1,4 +1,3 @@
default-preferences pref(layout.css.ruby.enabled,true)
default-preferences pref(layout.css.vertical-text.enabled,true)
default-preferences pref(layout.css.text-emphasis.enabled,true)

View File

@ -790,51 +790,49 @@ marquee[direction="up"], marquee[direction="down"] {
/* Ruby */
@supports (display: ruby) {
ruby {
display: ruby;
}
rb {
display: ruby-base;
white-space: nowrap;
}
rp {
display: none;
}
rt {
display: ruby-text;
}
rtc {
display: ruby-text-container;
}
rtc, rt {
white-space: nowrap;
font-size: 50%;
-moz-min-font-size-ratio: 50%;
line-height: 1;
ruby {
display: ruby;
}
rb {
display: ruby-base;
white-space: nowrap;
}
rp {
display: none;
}
rt {
display: ruby-text;
}
rtc {
display: ruby-text-container;
}
rtc, rt {
white-space: nowrap;
font-size: 50%;
-moz-min-font-size-ratio: 50%;
line-height: 1;
%ifndef XP_WIN
/* The widely-used Windows font Meiryo doesn't work fine with this
* setting, so disable this on Windows. We should re-enable it once
* Microsoft fixes this issue. See bug 1164279. */
font-variant-east-asian: ruby;
/* The widely-used Windows font Meiryo doesn't work fine with this
* setting, so disable this on Windows. We should re-enable it once
* Microsoft fixes this issue. See bug 1164279. */
font-variant-east-asian: ruby;
%endif
}
@supports (text-emphasis: none) {
rtc, rt {
text-emphasis: none;
}
}
rtc:lang(zh), rt:lang(zh) {
ruby-align: center;
}
rtc:lang(zh-TW), rt:lang(zh-TW) {
font-size: 30%; /* bopomofo */
-moz-min-font-size-ratio: 30%;
}
rtc > rt {
font-size: inherit;
}
ruby, rb, rt, rtc {
unicode-bidi: -moz-isolate;
}
@supports (text-emphasis: none) {
rtc, rt {
text-emphasis: none;
}
}
rtc:lang(zh), rt:lang(zh) {
ruby-align: center;
}
rtc:lang(zh-TW), rt:lang(zh-TW) {
font-size: 30%; /* bopomofo */
-moz-min-font-size-ratio: 30%;
}
rtc > rt {
font-size: inherit;
}
ruby, rb, rt, rtc {
unicode-bidi: -moz-isolate;
}

View File

@ -3076,7 +3076,7 @@ CSS_PROP_TEXT(
ruby_align,
RubyAlign,
CSS_PROPERTY_PARSE_VALUE,
"layout.css.ruby.enabled",
"",
VARIANT_HK,
kRubyAlignKTable,
offsetof(nsStyleText, mRubyAlign),
@ -3086,7 +3086,7 @@ CSS_PROP_TEXT(
ruby_position,
RubyPosition,
CSS_PROPERTY_PARSE_VALUE,
"layout.css.ruby.enabled",
"",
VARIANT_HK,
kRubyPositionKTable,
offsetof(nsStyleText, mRubyPosition),

View File

@ -1224,15 +1224,14 @@ KTableEntry nsCSSProps::kDisplayKTable[] = {
#endif
{ eCSSKeyword_flex, NS_STYLE_DISPLAY_FLEX },
{ eCSSKeyword_inline_flex, NS_STYLE_DISPLAY_INLINE_FLEX },
// The next two entries are controlled by the layout.css.grid.enabled pref.
{ eCSSKeyword_grid, NS_STYLE_DISPLAY_GRID },
{ eCSSKeyword_inline_grid, NS_STYLE_DISPLAY_INLINE_GRID },
// The next five entries are controlled by the layout.css.ruby.enabled pref.
{ eCSSKeyword_ruby, NS_STYLE_DISPLAY_RUBY },
{ eCSSKeyword_ruby_base, NS_STYLE_DISPLAY_RUBY_BASE },
{ eCSSKeyword_ruby_base_container, NS_STYLE_DISPLAY_RUBY_BASE_CONTAINER },
{ eCSSKeyword_ruby_text, NS_STYLE_DISPLAY_RUBY_TEXT },
{ eCSSKeyword_ruby_text_container, NS_STYLE_DISPLAY_RUBY_TEXT_CONTAINER },
// The next two entries are controlled by the layout.css.grid.enabled pref.
{ eCSSKeyword_grid, NS_STYLE_DISPLAY_GRID },
{ eCSSKeyword_inline_grid, NS_STYLE_DISPLAY_INLINE_GRID },
// The next entry is controlled by the layout.css.display-contents.enabled
// pref.
{ eCSSKeyword_contents, NS_STYLE_DISPLAY_CONTENTS },

View File

@ -2746,6 +2746,11 @@ var gCSSProperties = {
"table-column",
"table-cell",
"table-caption",
"ruby",
"ruby-base",
"ruby-base-container",
"ruby-text",
"ruby-text-container",
"none"
],
invalid_values: []
@ -3551,6 +3556,27 @@ var gCSSProperties = {
invalid_values: [],
quirks_values: { "5": "5px" },
},
"ruby-align": {
domProp: "rubyAlign",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "space-around" ],
other_values: [ "start", "center", "space-between" ],
invalid_values: [
"end", "1", "10px", "50%", "start center"
]
},
"ruby-position": {
domProp: "rubyPosition",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "over" ],
other_values: [ "under" ],
invalid_values: [
"left", "right", "auto", "none", "not_a_position",
"over left", "right under", "0", "100px", "50%"
]
},
"table-layout": {
domProp: "tableLayout",
inherited: false,
@ -5831,38 +5857,6 @@ if (IsCSSPropertyPrefEnabled("layout.css.filters.enabled")) {
};
}
if (IsCSSPropertyPrefEnabled("layout.css.ruby.enabled")) {
// Using unshift to add these values at the beginning.
// Adding them to the end would trigger bug 1038905. The "unshift" should be
// changed to a "push" when this bug is resolved.
gCSSProperties["display"].other_values.unshift("ruby",
"ruby-base",
"ruby-base-container",
"ruby-text",
"ruby-text-container");
gCSSProperties["ruby-align"] = {
domProp: "rubyAlign",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "space-around" ],
other_values: [ "start", "center", "space-between" ],
invalid_values: [
"end", "1", "10px", "50%", "start center"
]
};
gCSSProperties["ruby-position"] = {
domProp: "rubyPosition",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "over" ],
other_values: [ "under" ],
invalid_values: [
"left", "right", "auto", "none", "not_a_position",
"over left", "right under", "0", "100px", "50%"
]
};
}
if (IsCSSPropertyPrefEnabled("layout.css.grid.enabled")) {
var isGridTemplateSubgridValueEnabled =
IsCSSPropertyPrefEnabled("layout.css.grid-template-subgrid-value.enabled");

View File

@ -74,27 +74,25 @@
}
/* Ruby */
@supports (display:ruby) {
*|*::-moz-ruby {
display: ruby;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-base {
display: ruby-base;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-text {
display: ruby-text;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-base-container {
display: ruby-base-container;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-text-container {
display: ruby-text-container;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby {
display: ruby;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-base {
display: ruby-base;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-text {
display: ruby-text;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-base-container {
display: ruby-base-container;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-text-container {
display: ruby-text-container;
unicode-bidi: -moz-isolate;
}
/* Lists */

View File

@ -2384,9 +2384,6 @@ pref("layout.css.grid-template-subgrid-value.enabled", false);
// Is support for CSS contain enabled?
pref("layout.css.contain.enabled", false);
// Is support for CSS Ruby enabled?
pref("layout.css.ruby.enabled", true);
// Is support for CSS display:contents enabled?
pref("layout.css.display-contents.enabled", true);

View File

@ -158,9 +158,6 @@ user_pref("layout.css.contain.enabled", true);
// Enable CSS object-fit & object-position for testing
user_pref("layout.css.object-fit-and-position.enabled", true);
// Enable CSS Ruby for testing
user_pref("layout.css.ruby.enabled", true);
// Enable webkit prefixed CSS features for testing
user_pref("layout.css.prefixes.webkit", true);