Closed Bug 1573268 Opened 3 months ago Closed 3 months ago

Convert the varcache prefs in nsLayoutUtils.cpp to static prefs

Categories

(Core :: Preferences: Backend, task)

task
Not set

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: KrisWright, Assigned: KrisWright)

References

(Blocks 1 open bug)

Details

Attachments

(14 files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

For the most part, the prefs in nsLayoutUtils follow this pattern:

  static bool sShouldLog;
  static bool sShouldLogPrefCached;

  if (!sShouldLogPrefCached) {
    sShouldLogPrefCached = true;
    Preferences::AddBoolVarCache(
        &sShouldLog, "layers.offmainthreadcomposition.log-animations");
  }

  return sShouldLog;

Or, they're declared in nsLayoutUtils::Initialize(). They look mostly straightforward and could be converted to use static prefs, with these add-pref-and-return-value functions removed.

Converts layers.offmainthreadcomposition.async-animations and layers.offmainthreadcomposition.log-animations to their respective static prefs. Since all IsAnimationLoggingEnabled() did was create a pref and return the variable sShouldLog, this function is removed and replaced with the static pref.

Converts layout.animated-image-layers.enabled to a static pref and removes the nsLayoutUtils::AnimatedImageLayersEnabled() function, replacing it with the static pref.

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.

Creates the new 'font' category in StaticPrefList.yaml and adds font.size.inflation.maxRatio to the category. Removes the old static uint in nsLayoutUtils and the function that returns it.

Converts font.size.inflation.minTwips, font.size.inflation.emPerLine, and font.size.inflation.mappingIntercept to static prefs and removes their associated functions from nsLayoutUtils. There are associated member variables in PressShell, but since documentation specified that these variables are set specifically to prevent changes to the cache from being read until page reload, I made the decision to leave these and set them to the static prefs.

Converts font.size.inflation.lineThreshold varcache pref to a static pref. Like previous revisions, this retains the member variable in PresShell.

Converts font.size.inflation.forceEnabled and font.size.inflation.disabledInMasterProcess to static prefs. Like previous revisions, I retained the member variables in PresShell and set them to the static prefs.

Converts font.size.systemFontScale to a static pref. Removes the function in nsLayoutUtils and does the float division directly in PresShell.

Converts zoom.maxPercent and zoom.minPercent to static prefs, which creates a new "zoom" category on StaticPrefList.yaml.

Converts nglayout.debug.invalidation to a static pref. Retains the old getter function from the old static bool, because it makes an additional comparison.

Converts layout.interruptible-reflow.enabled to a static pref and updates its usage.

svg.transform-box.enabled is already a static pref, so I removed the varcache definition of it in nsLayoutUtils.

Converts layout.idle_period.required_quiescent_frames and layout.idle_period.time_limit to static prefs. These are the last prefs in nsLayoutUtils::initialize(), but since the function still calls nsComputedDOMStyle::RegisterPrefChangeCallbacks() the commit retains it.

Converts layout.css.outline-style-auto.enabled to a static pref and removes nsLayoutUtils::isOutlineStyleAutoEnabled().

Pushed by kwright@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0b74cfbb22fd
Convert two layers.offmainthreadcomposition.* prefs to static prefs. r=njn
https://hg.mozilla.org/integration/autoland/rev/aa9e64f35d08
Convert layout.animated-image-layers.enabled to static pref. r=njn
https://hg.mozilla.org/integration/autoland/rev/43cbfaf3e97e
Convert layout.css.ruby.intercharacter.enabled to static pref. r=njn
https://hg.mozilla.org/integration/autoland/rev/5028fca248cc
Convert font.size.inflation.maxRatio to static pref. r=njn
https://hg.mozilla.org/integration/autoland/rev/cd573e89e3a8
Convert 3 font.size.inflation.* prefs to static prefs. r=njn
https://hg.mozilla.org/integration/autoland/rev/266c9ff0255f
Convert font.size.inflation.lineThreshold to a static pref. r=njn
https://hg.mozilla.org/integration/autoland/rev/c84c8016d09e
Convert two font.size.inflation.* prefs to static prefs. r=njn
https://hg.mozilla.org/integration/autoland/rev/2bfed8cd65e8
Convert font.size.systemFontScale to static pref. r=njn
https://hg.mozilla.org/integration/autoland/rev/eb90a1fef7e9
Convert zoom.maxPercent and zoom.minPercent to static prefs. r=njn
https://hg.mozilla.org/integration/autoland/rev/b7bef0d94937
Convert nglayout.debug.invalidation to static pref. r=njn
https://hg.mozilla.org/integration/autoland/rev/33dd94200b51
Convert layout.interruptible-reflow.enabled to static pref. r=njn
https://hg.mozilla.org/integration/autoland/rev/c657ac21f56a
remove the varcache definition for svg.transform-box.enabled. r=njn
https://hg.mozilla.org/integration/autoland/rev/def3d7b5c636
Convert two layout.idle-period.* prefs to static prefs. r=njn
https://hg.mozilla.org/integration/autoland/rev/45e0edd03be0
Convert layout.css.outline-style-auto.enabled to static pref. r=njn
Assignee: nobody → kwright
You need to log in before you can comment on or make changes to this bug.