From 2809ff7952cbaa26dfaf7edc89c105cdd8ec58fa Mon Sep 17 00:00:00 2001 From: kriswright Date: Tue, 13 Aug 2019 22:52:38 +0000 Subject: [PATCH] Bug 1573268 - Convert layout.css.ruby.intercharacter.enabled to static pref. r=njn Converts layout.css.ruby.intercharacter.enabled to a static pref and removes the associated function nsLayoutUtils::IsInterCharacterRubyEnabled(). Also removes the macro INTERCHARACTER_RUBY_ENABLED_PREF_NAME, since it was only being used to add the varcache pref. Differential Revision: https://phabricator.services.mozilla.com/D41653 --HG-- extra : moz-landing-system : lando --- layout/base/nsLayoutUtils.cpp | 16 ---------------- layout/base/nsLayoutUtils.h | 5 ----- layout/generic/nsRubyFrame.cpp | 3 ++- modules/libpref/init/StaticPrefList.yaml | 6 ++++++ modules/libpref/init/all.js | 3 --- 5 files changed, 8 insertions(+), 25 deletions(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 8f4c8b8aa44c..08125ba776f5 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -167,9 +167,6 @@ using namespace mozilla::gfx; using mozilla::dom::HTMLMediaElement_Binding::HAVE_METADATA; using mozilla::dom::HTMLMediaElement_Binding::HAVE_NOTHING; -#define INTERCHARACTER_RUBY_ENABLED_PREF_NAME \ - "layout.css.ruby.intercharacter.enabled" - // The time in number of frames that we estimate for a refresh driver // to be quiescent #define DEFAULT_QUIESCENT_FRAMES 2 @@ -557,19 +554,6 @@ bool nsLayoutUtils::GPUImageScalingEnabled() { return sGPUImageScalingEnabled; } -bool nsLayoutUtils::IsInterCharacterRubyEnabled() { - static bool sInterCharacterRubyEnabled; - static bool sInterCharacterRubyEnabledPrefCached = false; - - if (!sInterCharacterRubyEnabledPrefCached) { - sInterCharacterRubyEnabledPrefCached = true; - Preferences::AddBoolVarCache(&sInterCharacterRubyEnabled, - INTERCHARACTER_RUBY_ENABLED_PREF_NAME, false); - } - - return sInterCharacterRubyEnabled; -} - void nsLayoutUtils::UnionChildOverflow(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas, FrameChildListIDs aSkipChildLists) { diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index c9dc1032724a..40294509cea4 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2397,11 +2397,6 @@ class nsLayoutUtils { */ static bool GPUImageScalingEnabled(); - /** - * Checks whether support for inter-character ruby is enabled. - */ - static bool IsInterCharacterRubyEnabled(); - static bool InterruptibleReflowEnabled() { return sInterruptibleReflowEnabled; } diff --git a/layout/generic/nsRubyFrame.cpp b/layout/generic/nsRubyFrame.cpp index 7207cd7e13cd..a770df03e04f 100644 --- a/layout/generic/nsRubyFrame.cpp +++ b/layout/generic/nsRubyFrame.cpp @@ -12,6 +12,7 @@ #include "mozilla/ComputedStyle.h" #include "mozilla/Maybe.h" #include "mozilla/PresShell.h" +#include "mozilla/StaticPrefs_layout.h" #include "mozilla/WritingModes.h" #include "nsLineLayout.h" #include "nsPresContext.h" @@ -312,7 +313,7 @@ void nsRubyFrame::ReflowSegment(nsPresContext* aPresContext, LogicalPoint position(lineWM); if (side.isSome()) { - if (nsLayoutUtils::IsInterCharacterRubyEnabled() && + if (StaticPrefs::layout_css_ruby_intercharacter_enabled() && rtcWM.IsVerticalRL() && lineWM.GetInlineDir() == WritingMode::eInlineLTR) { // Inter-character ruby annotations are only supported for vertical-rl diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 72c7cca3d557..bd82af9afb7d 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -4329,6 +4329,12 @@ value: true mirror: always +# Are inter-character ruby annotations enabled? +- name: layout.css.ruby.intercharacter.enabled + type: bool + value: false + mirror: always + - name: layout.css.scroll-behavior.damping-ratio type: AtomicFloat value: 1.0f diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 62b8386c0057..7fa02290a8d4 100755 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2952,9 +2952,6 @@ pref("layout.css.scroll-behavior.spring-constant", "250.0"); // at the greatest speed without overshooting. pref("layout.css.scroll-behavior.damping-ratio", "1.0"); -// Are inter-character ruby annotations enabled? -pref("layout.css.ruby.intercharacter.enabled", false); - // pref for which side vertical scrollbars should be on // 0 = end-side in UI direction // 1 = end-side in document/content direction