From b1521c643f8f3f5a1aa614162af5e124e02583c7 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Fri, 22 Apr 2016 09:18:41 +1000 Subject: [PATCH] Bug 1097499 part 1 - Control support of 'text-combine-upright: digits' via a separate pref. r=heycam MozReview-Commit-ID: JerTsxaQCL4 --HG-- extra : source : 999d1d2997591935fa1259fa42a91658da8ee078 --- layout/base/nsLayoutUtils.cpp | 3 +++ layout/base/nsLayoutUtils.h | 5 +++++ layout/style/nsCSSParser.cpp | 3 +++ layout/style/test/property_database.js | 6 +++++- modules/libpref/init/all.js | 2 ++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 25ab4055fbfe..4a9e9b1ff07e 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -167,6 +167,7 @@ typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox; /* static */ bool nsLayoutUtils::sCSSVariablesEnabled; /* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled; /* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled; +/* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled; static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID; @@ -7716,6 +7717,8 @@ nsLayoutUtils::Initialize() "layout.interruptible-reflow.enabled"); Preferences::AddBoolVarCache(&sSVGTransformBoxEnabled, "svg.transform-box.enabled"); + Preferences::AddBoolVarCache(&sTextCombineUprightDigitsEnabled, + "layout.css.text-combine-upright-digits.enabled"); for (auto& callback : kPrefCallbacks) { Preferences::RegisterCallbackAndCall(callback.func, callback.name); diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 9e3ac9fc40b3..b8a176ffcded 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2411,6 +2411,10 @@ public: return sSVGTransformBoxEnabled; } + static bool TextCombineUprightDigitsEnabled() { + return sTextCombineUprightDigitsEnabled; + } + /** * See comment above "font.size.inflation.mappingIntercept" in * modules/libpref/src/init/all.js . @@ -2824,6 +2828,7 @@ private: static bool sCSSVariablesEnabled; static bool sInterruptibleReflowEnabled; static bool sSVGTransformBoxEnabled; + static bool sTextCombineUprightDigitsEnabled; /** * Helper function for LogTestDataForPaint(). diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 165e3ee27e56..ccfacc8ae4d2 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -15165,6 +15165,9 @@ CSSParserImpl::ParseTextCombineUpright(nsCSSValue& aValue) // if 'digits', need to check for an explicit number [2, 3, 4] if (eCSSUnit_Enumerated == aValue.GetUnit() && aValue.GetIntValue() == NS_STYLE_TEXT_COMBINE_UPRIGHT_DIGITS_2) { + if (!nsLayoutUtils::TextCombineUprightDigitsEnabled()) { + return false; + } if (!GetToken(true)) { return true; } diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index c225b6866292..5236b28544d6 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -5426,11 +5426,15 @@ if (IsCSSPropertyPrefEnabled("layout.css.text-combine-upright.enabled")) { inherited: true, type: CSS_TYPE_LONGHAND, initial_values: [ "none" ], - other_values: [ "all", "digits", "digits 2", "digits 3", "digits 4", "digits 3" ], + other_values: [ "all" ], invalid_values: [ "auto", "all 2", "none all", "digits -3", "digits 0", "digits 12", "none 3", "digits 3.1415", "digits3", "digits 1", "digits 3 all", "digits foo", "digits all", "digits 3.0" ] }; + if (IsCSSPropertyPrefEnabled("layout.css.text-combine-upright-digits.enabled")) { + gCSSProperties["text-combine-upright"].other_values.push( + "digits", "digits 2", "digits 3", "digits 4", "digits 3"); + } } if (IsCSSPropertyPrefEnabled("layout.css.masking.enabled")) { diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 009e5994c09f..1a5d3fe664e3 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2432,6 +2432,8 @@ pref("layout.css.vertical-text.enabled", true); // Is support for CSS text-combine-upright (tate-chu-yoko) enabled? pref("layout.css.text-combine-upright.enabled", false); +// Is support for CSS text-combine-upright: digits 2-4 enabled? +pref("layout.css.text-combine-upright-digits.enabled", false); // Is support for object-fit and object-position enabled? pref("layout.css.object-fit-and-position.enabled", true);