Bug 1657401 - Change LookAndFeel IPC to use IPDL structs. r=spohl

Aside from automating boilerplate, this will allow reusing some of these
structs for full LookAndFeel remoting in bug 1470983.

Differential Revision: https://phabricator.services.mozilla.com/D94531
This commit is contained in:
Jed Davis 2020-11-11 23:26:51 +00:00
Родитель a68b63cdb3
Коммит 96f7c5cf5c
12 изменённых файлов: 163 добавлений и 195 удалений

Просмотреть файл

@ -63,6 +63,7 @@ include HangTypes;
include PrefsTypes;
include NeckoChannelParams;
include PSMIPCTypes;
include LookAndFeelTypes;
#if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
include protocol PSandboxTesting;
@ -84,7 +85,6 @@ using mozilla::gfx::IntSize from "mozilla/gfx/2D.h";
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using struct LookAndFeelCache from "mozilla/widget/WidgetMessageUtils.h";
using mozilla::widget::ThemeChangeKind from "mozilla/widget/WidgetMessageUtils.h";
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";

Просмотреть файл

@ -1402,7 +1402,7 @@ void nsPresContext::ThemeChangedInternal() {
if (XRE_IsParentProcess()) {
nsTArray<ContentParent*> cp;
ContentParent::GetAll(cp);
LookAndFeelCache lnfCache = LookAndFeel::GetCache();
widget::LookAndFeelCache lnfCache = LookAndFeel::GetCache();
for (ContentParent* c : cp) {
Unused << c->SendThemeChanged(lnfCache, kind);
}

Просмотреть файл

@ -18,10 +18,12 @@
struct gfxFontStyle;
struct LookAndFeelCache;
namespace mozilla {
namespace widget {
class LookAndFeelCache;
} // namespace widget
enum class StyleSystemColor : uint8_t;
class LookAndFeel {
@ -331,6 +333,11 @@ class LookAndFeel {
* 3 and 5.
*/
GTKCSDMaximizeButtonPosition,
/*
* Not an ID; used to define the range of valid IDs. Must be last.
*/
End,
};
/**
@ -546,42 +553,13 @@ class LookAndFeel {
* If the implementation is caching values, these accessors allow the
* cache to be exported and imported.
*/
static LookAndFeelCache GetCache();
static void SetCache(const LookAndFeelCache& aCache);
static widget::LookAndFeelCache GetCache();
static void SetCache(const widget::LookAndFeelCache& aCache);
static void NotifyChangedAllWindows(widget::ThemeChangeKind);
};
} // namespace mozilla
struct LookAndFeelInt {
mozilla::LookAndFeel::IntID id;
int32_t value;
};
struct LookAndFeelFont {
bool haveFont;
nsString fontName;
float pixelHeight;
bool italic;
bool bold;
};
struct LookAndFeelColor {
mozilla::LookAndFeel::ColorID id;
nscolor color;
};
struct LookAndFeelCache {
void Clear() {
mInts.Clear();
mFonts.Clear();
mColors.Clear();
}
nsTArray<LookAndFeelInt> mInts;
nsTArray<LookAndFeelFont> mFonts;
nsTArray<LookAndFeelColor> mColors;
};
// On the Mac, GetColor(ColorID::TextSelectForeground, color) returns this
// constant to specify that the foreground color should not be changed
// (ie. a colored text keeps its colors when selected).

Просмотреть файл

@ -0,0 +1,39 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
using mozilla::LookAndFeel::IntID from "mozilla/widget/WidgetMessageUtils.h";
using mozilla::LookAndFeel::ColorID from "mozilla/widget/WidgetMessageUtils.h";
using nscolor from "nsColor.h";
namespace mozilla {
namespace widget {
struct LookAndFeelInt {
IntID id;
int32_t value;
};
struct LookAndFeelFont {
bool haveFont;
nsString name;
float size;
float weight;
bool italic;
};
struct LookAndFeelColor {
ColorID id;
nscolor color;
};
struct LookAndFeelCache {
LookAndFeelInt[] mInts;
LookAndFeelFont[] mFonts;
LookAndFeelColor[] mColors;
};
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -9,30 +9,10 @@
#include "mozilla/LookAndFeel.h"
#include "mozilla/widget/ThemeChangeKind.h"
#include "nsIWidget.h"
#include "nsStyleConsts.h"
namespace IPC {
template <>
struct ParamTraits<LookAndFeelInt> {
typedef LookAndFeelInt paramType;
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, static_cast<int32_t>(aParam.id));
WriteParam(aMsg, aParam.value);
}
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
int32_t id, value;
if (ReadParam(aMsg, aIter, &id) && ReadParam(aMsg, aIter, &value)) {
aResult->id = static_cast<mozilla::LookAndFeel::IntID>(id);
aResult->value = value;
return true;
}
return false;
}
};
template <>
struct ParamTraits<mozilla::widget::ThemeChangeKind>
: public BitFlagsEnumSerializer<mozilla::widget::ThemeChangeKind,
@ -40,78 +20,34 @@ struct ParamTraits<mozilla::widget::ThemeChangeKind>
};
template <>
struct ParamTraits<LookAndFeelFont> {
typedef LookAndFeelFont paramType;
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.haveFont);
WriteParam(aMsg, aParam.fontName);
WriteParam(aMsg, aParam.pixelHeight);
WriteParam(aMsg, aParam.italic);
WriteParam(aMsg, aParam.bold);
}
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
return ReadParam(aMsg, aIter, &aResult->haveFont) &&
ReadParam(aMsg, aIter, &aResult->fontName) &&
ReadParam(aMsg, aIter, &aResult->pixelHeight) &&
ReadParam(aMsg, aIter, &aResult->italic) &&
ReadParam(aMsg, aIter, &aResult->bold);
}
struct ParamTraits<mozilla::LookAndFeel::IntID>
: ContiguousEnumSerializer<mozilla::LookAndFeel::IntID,
mozilla::LookAndFeel::IntID::CaretBlinkTime,
mozilla::LookAndFeel::IntID::End> {
using IdType = std::underlying_type_t<mozilla::LookAndFeel::IntID>;
static_assert(static_cast<IdType>(
mozilla::LookAndFeel::IntID::CaretBlinkTime) == IdType(0));
};
template <>
struct ParamTraits<LookAndFeelColor> {
using paramType = LookAndFeelColor;
using idType = std::underlying_type<mozilla::LookAndFeel::ColorID>::type;
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, static_cast<idType>(aParam.id));
WriteParam(aMsg, aParam.color);
}
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
idType id;
nscolor color;
if (ReadParam(aMsg, aIter, &id) && ReadParam(aMsg, aIter, &color)) {
aResult->id = static_cast<mozilla::LookAndFeel::ColorID>(id);
aResult->color = color;
return true;
}
return false;
}
};
template <>
struct ParamTraits<LookAndFeelCache> {
typedef LookAndFeelCache paramType;
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.mInts);
WriteParam(aMsg, aParam.mFonts);
WriteParam(aMsg, aParam.mColors);
}
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
return ReadParam(aMsg, aIter, &aResult->mInts) &&
ReadParam(aMsg, aIter, &aResult->mFonts) &&
ReadParam(aMsg, aIter, &aResult->mColors);
}
struct ParamTraits<mozilla::LookAndFeel::ColorID>
: ContiguousEnumSerializer<mozilla::LookAndFeel::ColorID,
mozilla::LookAndFeel::ColorID::WindowBackground,
mozilla::LookAndFeel::ColorID::End> {
using IdType = std::underlying_type_t<mozilla::LookAndFeel::ColorID>;
static_assert(
static_cast<IdType>(mozilla::LookAndFeel::ColorID::WindowBackground) ==
IdType(0));
};
template <>
struct ParamTraits<nsTransparencyMode>
: public ContiguousEnumSerializerInclusive<nsTransparencyMode,
eTransparencyOpaque,
eTransparencyBorderlessGlass> {};
: ContiguousEnumSerializerInclusive<nsTransparencyMode, eTransparencyOpaque,
eTransparencyBorderlessGlass> {};
template <>
struct ParamTraits<nsCursor>
: public ContiguousEnumSerializer<nsCursor, eCursor_standard,
eCursorCount> {};
: ContiguousEnumSerializer<nsCursor, eCursor_standard, eCursorCount> {};
} // namespace IPC

Просмотреть файл

@ -487,28 +487,28 @@ void nsLookAndFeel::EnsureInitShowPassword() {
}
}
LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
widget::LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
LookAndFeelCache cache = nsXPLookAndFeel::GetCacheImpl();
const IntID kIdsToCache[] = {IntID::PrefersReducedMotion,
IntID::SystemUsesDarkTheme};
for (IntID id : kIdsToCache) {
cache.mInts.AppendElement(LookAndFeelInt{.id = id, .value = GetInt(id)});
cache.mInts().AppendElement(LookAndFeelInt(id, GetInt(id)));
}
return cache;
}
void nsLookAndFeel::SetCacheImpl(const LookAndFeelCache& aCache) {
for (const auto& entry : aCache.mInts) {
switch (entry.id) {
for (const auto& entry : aCache.mInts()) {
switch (entry.id()) {
case IntID::PrefersReducedMotion:
mPrefersReducedMotion = entry.value;
mPrefersReducedMotion = entry.value();
mPrefersReducedMotionCached = true;
break;
case IntID::SystemUsesDarkTheme:
mSystemUsesDarkTheme = !!entry.value;
mSystemUsesDarkTheme = !!entry.value();
mSystemUsesDarkThemeCached = true;
break;
default:

Просмотреть файл

@ -642,49 +642,49 @@ bool nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName, gfxFontStyle& a
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
}
LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
mozilla::widget::LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
LookAndFeelCache cache = nsXPLookAndFeel::GetCacheImpl();
LookAndFeelInt useOverlayScrollbars;
useOverlayScrollbars.id = IntID::UseOverlayScrollbars;
useOverlayScrollbars.value = GetInt(IntID::UseOverlayScrollbars);
cache.mInts.AppendElement(useOverlayScrollbars);
useOverlayScrollbars.id() = IntID::UseOverlayScrollbars;
useOverlayScrollbars.value() = GetInt(IntID::UseOverlayScrollbars);
cache.mInts().AppendElement(useOverlayScrollbars);
LookAndFeelInt allowOverlayScrollbarsOverlap;
allowOverlayScrollbarsOverlap.id = IntID::AllowOverlayScrollbarsOverlap;
allowOverlayScrollbarsOverlap.value = GetInt(IntID::AllowOverlayScrollbarsOverlap);
cache.mInts.AppendElement(allowOverlayScrollbarsOverlap);
allowOverlayScrollbarsOverlap.id() = IntID::AllowOverlayScrollbarsOverlap;
allowOverlayScrollbarsOverlap.value() = GetInt(IntID::AllowOverlayScrollbarsOverlap);
cache.mInts().AppendElement(allowOverlayScrollbarsOverlap);
LookAndFeelInt prefersReducedMotion;
prefersReducedMotion.id = IntID::PrefersReducedMotion;
prefersReducedMotion.value = GetInt(IntID::PrefersReducedMotion);
cache.mInts.AppendElement(prefersReducedMotion);
prefersReducedMotion.id() = IntID::PrefersReducedMotion;
prefersReducedMotion.value() = GetInt(IntID::PrefersReducedMotion);
cache.mInts().AppendElement(prefersReducedMotion);
LookAndFeelInt systemUsesDarkTheme;
systemUsesDarkTheme.id = IntID::SystemUsesDarkTheme;
systemUsesDarkTheme.value = GetInt(IntID::SystemUsesDarkTheme);
cache.mInts.AppendElement(systemUsesDarkTheme);
systemUsesDarkTheme.id() = IntID::SystemUsesDarkTheme;
systemUsesDarkTheme.value() = GetInt(IntID::SystemUsesDarkTheme);
cache.mInts().AppendElement(systemUsesDarkTheme);
return cache;
}
void nsLookAndFeel::SetCacheImpl(const LookAndFeelCache& aCache) {
for (auto entry : aCache.mInts) {
switch (entry.id) {
for (auto entry : aCache.mInts()) {
switch (entry.id()) {
case IntID::UseOverlayScrollbars:
mUseOverlayScrollbars = entry.value;
mUseOverlayScrollbars = entry.value();
mUseOverlayScrollbarsCached = true;
break;
case IntID::AllowOverlayScrollbarsOverlap:
mAllowOverlayScrollbarsOverlap = entry.value;
mAllowOverlayScrollbarsOverlap = entry.value();
mAllowOverlayScrollbarsOverlapCached = true;
break;
case IntID::SystemUsesDarkTheme:
mSystemUsesDarkTheme = entry.value;
mSystemUsesDarkTheme = entry.value();
mSystemUsesDarkThemeCached = true;
break;
case IntID::PrefersReducedMotion:
mPrefersReducedMotion = entry.value;
mPrefersReducedMotion = entry.value();
mPrefersReducedMotionCached = true;
break;
default:

Просмотреть файл

@ -268,12 +268,13 @@ void nsLookAndFeel::RefreshImpl() {
mInitialized = false;
}
LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
widget::LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
LookAndFeelCache cache = nsXPLookAndFeel::GetCacheImpl();
constexpr IntID kIntIdsToCache[] = {IntID::SystemUsesDarkTheme,
IntID::PrefersReducedMotion,
IntID::UseAccessibilityTheme};
constexpr ColorID kColorIdsToCache[] = {
ColorID::ThemedScrollbar,
ColorID::ThemedScrollbarInactive,
@ -283,52 +284,52 @@ LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
ColorID::ThemedScrollbarThumbInactive};
for (IntID id : kIntIdsToCache) {
cache.mInts.AppendElement(LookAndFeelInt{.id = id, .value = GetInt(id)});
cache.mInts().AppendElement(LookAndFeelInt(id, GetInt(id)));
}
for (ColorID id : kColorIdsToCache) {
cache.mColors.AppendElement(
LookAndFeelColor{.id = id, .color = GetColor(id)});
cache.mColors().AppendElement(LookAndFeelColor(id, GetColor(id)));
}
return cache;
}
void nsLookAndFeel::SetCacheImpl(const LookAndFeelCache& aCache) {
for (const auto& entry : aCache.mInts) {
switch (entry.id) {
for (const auto& entry : aCache.mInts()) {
switch (entry.id()) {
case IntID::SystemUsesDarkTheme:
mSystemUsesDarkTheme = entry.value;
mSystemUsesDarkTheme = entry.value();
break;
case IntID::PrefersReducedMotion:
mPrefersReducedMotion = entry.value;
mPrefersReducedMotion = entry.value();
break;
case IntID::UseAccessibilityTheme:
mHighContrast = entry.value;
mHighContrast = entry.value();
break;
default:
MOZ_ASSERT_UNREACHABLE("Bogus Int ID in cache");
break;
}
}
for (const auto& entry : aCache.mColors) {
switch (entry.id) {
for (const auto& entry : aCache.mColors()) {
switch (entry.id()) {
case ColorID::ThemedScrollbar:
mThemedScrollbar = entry.color;
mThemedScrollbar = entry.color();
break;
case ColorID::ThemedScrollbarInactive:
mThemedScrollbarInactive = entry.color;
mThemedScrollbarInactive = entry.color();
break;
case ColorID::ThemedScrollbarThumb:
mThemedScrollbarThumb = entry.color;
mThemedScrollbarThumb = entry.color();
break;
case ColorID::ThemedScrollbarThumbHover:
mThemedScrollbarThumbHover = entry.color;
mThemedScrollbarThumbHover = entry.color();
break;
case ColorID::ThemedScrollbarThumbActive:
mThemedScrollbarThumbActive = entry.color;
mThemedScrollbarThumbActive = entry.color();
break;
case ColorID::ThemedScrollbarThumbInactive:
mThemedScrollbarThumbInactive = entry.color;
mThemedScrollbarThumbInactive = entry.color();
break;
default:
MOZ_ASSERT_UNREACHABLE("Bogus Color ID in cache");

Просмотреть файл

@ -343,6 +343,10 @@ else:
"headless/HeadlessWidgetTypes.ipdlh",
]
IPDL_SOURCES += [
"LookAndFeelTypes.ipdlh",
]
LOCAL_INCLUDES += [
"/widget/%s" % toolkit,
]

Просмотреть файл

@ -468,7 +468,7 @@ void nsXPLookAndFeel::Init() {
LookAndFeel::SetCache(cc->BorrowLookAndFeelCache());
// This is only ever used once during initialization, and can be cleared
// now.
cc->BorrowLookAndFeelCache().Clear();
cc->BorrowLookAndFeelCache() = LookAndFeelCache{};
}
}
@ -1009,7 +1009,9 @@ void nsXPLookAndFeel::RefreshImpl() {
}
}
LookAndFeelCache nsXPLookAndFeel::GetCacheImpl() { return LookAndFeelCache{}; }
widget::LookAndFeelCache nsXPLookAndFeel::GetCacheImpl() {
return LookAndFeelCache{};
}
static bool sRecordedLookAndFeelTelemetry = false;
@ -1097,12 +1099,12 @@ void LookAndFeel::Refresh() { nsLookAndFeel::GetInstance()->RefreshImpl(); }
void LookAndFeel::NativeInit() { nsLookAndFeel::GetInstance()->NativeInit(); }
// static
LookAndFeelCache LookAndFeel::GetCache() {
widget::LookAndFeelCache LookAndFeel::GetCache() {
return nsLookAndFeel::GetInstance()->GetCacheImpl();
}
// static
void LookAndFeel::SetCache(const LookAndFeelCache& aCache) {
void LookAndFeel::SetCache(const widget::LookAndFeelCache& aCache) {
nsLookAndFeel::GetInstance()->SetCacheImpl(aCache);
}

Просмотреть файл

@ -8,6 +8,7 @@
#include "mozilla/LookAndFeel.h"
#include "mozilla/ServoStyleConsts.h"
#include "mozilla/widget/LookAndFeelTypes.h"
#include "nsTArray.h"
class nsLookAndFeel;
@ -72,6 +73,11 @@ class nsXPLookAndFeel : public mozilla::LookAndFeel {
virtual uint32_t GetPasswordMaskDelayImpl() { return 600; }
using LookAndFeelCache = mozilla::widget::LookAndFeelCache;
using LookAndFeelInt = mozilla::widget::LookAndFeelInt;
using LookAndFeelFont = mozilla::widget::LookAndFeelFont;
using LookAndFeelColor = mozilla::widget::LookAndFeelColor;
virtual LookAndFeelCache GetCacheImpl();
virtual void SetCacheImpl(const LookAndFeelCache& aCache) {}

Просмотреть файл

@ -634,7 +634,7 @@ LookAndFeelFont nsLookAndFeel::GetLookAndFeelFontInternal(
const LOGFONTW& aLogFont, bool aUseShellDlg) {
LookAndFeelFont result{};
result.haveFont = false;
result.haveFont() = false;
// Get scaling factor from physical to logical pixels
double pixelScale = 1.0 / WinUtils::SystemScaleFactor();
@ -675,17 +675,20 @@ LookAndFeelFont nsLookAndFeel::GetLookAndFeelFontInternal(
pixelHeight = 12;
}
result.haveFont = true;
result.haveFont() = true;
if (aUseShellDlg) {
result.fontName = u"MS Shell Dlg 2"_ns;
result.name() = u"MS Shell Dlg 2"_ns;
} else {
result.fontName = aLogFont.lfFaceName;
result.name() = aLogFont.lfFaceName;
}
result.pixelHeight = pixelHeight;
result.italic = !!aLogFont.lfItalic;
result.bold = (aLogFont.lfWeight == FW_BOLD);
result.size() = pixelHeight;
result.italic() = !!aLogFont.lfItalic;
// FIXME: Other weights?
result.weight() = ((aLogFont.lfWeight == FW_BOLD) ? FontWeight::Bold()
: FontWeight::Normal())
.ToFloat();
return result;
}
@ -697,7 +700,7 @@ LookAndFeelFont nsLookAndFeel::GetLookAndFeelFont(LookAndFeel::FontID anID) {
LookAndFeelFont result{};
result.haveFont = false;
result.haveFont() = false;
// FontID::Icon is handled differently than the others
if (anID == LookAndFeel::FontID::Icon) {
@ -754,20 +757,19 @@ bool nsLookAndFeel::GetSysFont(LookAndFeel::FontID anID, nsString& aFontName,
gfxFontStyle& aFontStyle) {
LookAndFeelFont font = GetLookAndFeelFont(anID);
if (!font.haveFont) {
if (!font.haveFont()) {
return false;
}
aFontName = std::move(font.fontName);
aFontName = std::move(font.name());
aFontStyle.size = font.pixelHeight;
aFontStyle.size = font.size();
// FIXME: What about oblique?
aFontStyle.style =
font.italic ? FontSlantStyle::Italic() : FontSlantStyle::Normal();
font.italic() ? FontSlantStyle::Italic() : FontSlantStyle::Normal();
// FIXME: Other weights?
aFontStyle.weight = font.bold ? FontWeight::Bold() : FontWeight::Normal();
aFontStyle.weight = FontWeight(font.weight());
// FIXME: Set aFontStyle->stretch correctly!
aFontStyle.stretch = FontStretch::Normal();
@ -813,21 +815,21 @@ LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
LookAndFeelCache cache = nsXPLookAndFeel::GetCacheImpl();
LookAndFeelInt lafInt;
lafInt.id = IntID::UseAccessibilityTheme;
lafInt.value = GetInt(IntID::UseAccessibilityTheme);
cache.mInts.AppendElement(lafInt);
lafInt.id() = IntID::UseAccessibilityTheme;
lafInt.value() = GetInt(IntID::UseAccessibilityTheme);
cache.mInts().AppendElement(lafInt);
lafInt.id = IntID::WindowsDefaultTheme;
lafInt.value = GetInt(IntID::WindowsDefaultTheme);
cache.mInts.AppendElement(lafInt);
lafInt.id() = IntID::WindowsDefaultTheme;
lafInt.value() = GetInt(IntID::WindowsDefaultTheme);
cache.mInts().AppendElement(lafInt);
lafInt.id = IntID::WindowsThemeIdentifier;
lafInt.value = GetInt(IntID::WindowsThemeIdentifier);
cache.mInts.AppendElement(lafInt);
lafInt.id() = IntID::WindowsThemeIdentifier;
lafInt.value() = GetInt(IntID::WindowsThemeIdentifier);
cache.mInts().AppendElement(lafInt);
for (size_t i = size_t(LookAndFeel::FontID::MINIMUM);
i <= size_t(LookAndFeel::FontID::MAXIMUM); ++i) {
cache.mFonts.AppendElement(GetLookAndFeelFont(LookAndFeel::FontID(i)));
cache.mFonts().AppendElement(GetLookAndFeelFont(LookAndFeel::FontID(i)));
}
return cache;
@ -835,18 +837,18 @@ LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
void nsLookAndFeel::SetCacheImpl(const LookAndFeelCache& aCache) {
MOZ_ASSERT(XRE_IsContentProcess());
MOZ_RELEASE_ASSERT(aCache.mFonts.Length() == mFontCache.length());
MOZ_RELEASE_ASSERT(aCache.mFonts().Length() == mFontCache.length());
for (auto entry : aCache.mInts) {
switch (entry.id) {
for (auto entry : aCache.mInts()) {
switch (entry.id()) {
case IntID::UseAccessibilityTheme:
mUseAccessibilityTheme = entry.value;
mUseAccessibilityTheme = entry.value();
break;
case IntID::WindowsDefaultTheme:
mUseDefaultTheme = entry.value;
mUseDefaultTheme = entry.value();
break;
case IntID::WindowsThemeIdentifier:
mNativeThemeId = entry.value;
mNativeThemeId = entry.value();
break;
default:
MOZ_ASSERT_UNREACHABLE("Bogus Int ID in cache");
@ -855,7 +857,7 @@ void nsLookAndFeel::SetCacheImpl(const LookAndFeelCache& aCache) {
}
size_t i = mFontCache.minIndex();
for (const auto& font : aCache.mFonts) {
for (const auto& font : aCache.mFonts()) {
mFontCache[i] = font;
++i;
}