зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1876811: Remove nsPresContext's cache for about:config pref "layout.scrollbar.side". r=TYLin
Instead, just directly use the StaticPrefs getter for this pref at the one usage-site, and remove the now-unnecessary GetCachedIntPref getter and enum-parameter-type that was previously used to query the value. This patch doesn't change behavior. Differential Revision: https://phabricator.services.mozilla.com/D199782
This commit is contained in:
Родитель
663228aa2d
Коммит
07de26de17
|
@ -274,7 +274,6 @@ nsPresContext::nsPresContext(dom::Document* aDocument, nsPresContextType aType)
|
|||
mCanPaginatedScroll(false),
|
||||
mDoScaledTwips(true),
|
||||
mIsRootPaginatedDocument(false),
|
||||
mPrefScrollbarSide(0),
|
||||
mPendingThemeChanged(false),
|
||||
mPendingThemeChangeKind(0),
|
||||
mPendingUIResolutionChanged(false),
|
||||
|
@ -432,8 +431,6 @@ void nsPresContext::GetUserPreferences() {
|
|||
|
||||
PreferenceSheet::EnsureInitialized();
|
||||
|
||||
mPrefScrollbarSide = StaticPrefs::layout_scrollbar_side();
|
||||
|
||||
Document()->SetMayNeedFontPrefsUpdate();
|
||||
|
||||
// * image animation
|
||||
|
|
|
@ -101,9 +101,6 @@ class PaletteCache;
|
|||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
|
||||
// supported values for cached integer pref types
|
||||
enum nsPresContext_CachedIntPrefType { kPresContext_ScrollbarSide = 1 };
|
||||
|
||||
// IDs for the default variable and fixed fonts (not to be changed, see
|
||||
// nsFont.h) To be used for Get/SetDefaultFont(). The other IDs in nsFont.h are
|
||||
// also supported.
|
||||
|
@ -376,21 +373,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr {
|
|||
*/
|
||||
void EmulateMedium(nsAtom* aMediaType);
|
||||
|
||||
/** Get a cached integer pref, by its type */
|
||||
// * - initially created for bugs 30910, 61883, 74186, 84398
|
||||
int32_t GetCachedIntPref(nsPresContext_CachedIntPrefType aPrefType) const {
|
||||
// If called with a constant parameter, the compiler should optimize
|
||||
// this switch statement away.
|
||||
switch (aPrefType) {
|
||||
case kPresContext_ScrollbarSide:
|
||||
return mPrefScrollbarSide;
|
||||
default:
|
||||
NS_ERROR("invalid arg passed to GetCachedIntPref");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const mozilla::PreferenceSheet::Prefs& PrefSheetPrefs() const {
|
||||
return mozilla::PreferenceSheet::PrefsFor(*mDocument);
|
||||
}
|
||||
|
@ -1352,7 +1334,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr {
|
|||
unsigned mCanPaginatedScroll : 1;
|
||||
unsigned mDoScaledTwips : 1;
|
||||
unsigned mIsRootPaginatedDocument : 1;
|
||||
unsigned mPrefScrollbarSide : 2;
|
||||
unsigned mPendingThemeChanged : 1;
|
||||
// widget::ThemeChangeKind
|
||||
unsigned mPendingThemeChangeKind : kThemeChangeKindBits;
|
||||
|
|
|
@ -6018,15 +6018,13 @@ nsSize nsHTMLScrollFrame::GetSnapportSize() const {
|
|||
}
|
||||
|
||||
bool nsHTMLScrollFrame::IsScrollbarOnRight() const {
|
||||
nsPresContext* presContext = PresContext();
|
||||
|
||||
// The position of the scrollbar in top-level windows depends on the pref
|
||||
// layout.scrollbar.side. For non-top-level elements, it depends only on the
|
||||
// directionaliy of the element (equivalent to a value of "1" for the pref).
|
||||
if (!mIsRoot) {
|
||||
return IsPhysicalLTR();
|
||||
}
|
||||
switch (presContext->GetCachedIntPref(kPresContext_ScrollbarSide)) {
|
||||
switch (StaticPrefs::layout_scrollbar_side()) {
|
||||
default:
|
||||
case 0: // UI directionality
|
||||
return StaticPrefs::bidi_direction() == IBMBIDI_TEXTDIRECTION_LTR;
|
||||
|
|
Загрузка…
Ссылка в новой задаче