mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
c14065f628
To be honest, I'm a bit baffled that bug 1773795 caused a performance regression, but I think it's because the standins codepath is not really cached, so system colors that are "spoofed" always go through the massive switch, which could potentially be expensive. To fix, this, rejigger a bit the caches so that we key on both color-scheme and use-standins. Also, while at it, make the set of colors we spoof a single bitflag check, rather than relying on the compiler to do something potentially smart with it. I had to shuffle the order of colors around so that the expression to initialize the bitfield is constexpr (doesn't go over 1 << 64), but other than that this patch should be relatively straight-forward. Differential Revision: https://phabricator.services.mozilla.com/D150100
63 lines
2.2 KiB
C++
63 lines
2.2 KiB
C++
/* 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/. */
|
|
|
|
#ifndef mozilla_WidgetMessageUtils_h
|
|
#define mozilla_WidgetMessageUtils_h
|
|
|
|
#include "ipc/EnumSerializer.h"
|
|
#include "ipc/IPCMessageUtils.h"
|
|
#include "mozilla/LookAndFeel.h"
|
|
#include "mozilla/widget/ThemeChangeKind.h"
|
|
#include "nsIWidget.h"
|
|
#include "nsStyleConsts.h"
|
|
|
|
namespace IPC {
|
|
|
|
template <>
|
|
struct ParamTraits<mozilla::widget::ThemeChangeKind>
|
|
: public BitFlagsEnumSerializer<mozilla::widget::ThemeChangeKind,
|
|
mozilla::widget::ThemeChangeKind::AllBits> {
|
|
};
|
|
|
|
template <>
|
|
struct ParamTraits<mozilla::LookAndFeel::IntID>
|
|
: ContiguousEnumSerializer<mozilla::LookAndFeel::IntID,
|
|
mozilla::LookAndFeel::IntID(0),
|
|
mozilla::LookAndFeel::IntID::End> {
|
|
using IdType = std::underlying_type_t<mozilla::LookAndFeel::IntID>;
|
|
};
|
|
|
|
template <>
|
|
struct ParamTraits<mozilla::LookAndFeel::ColorID>
|
|
: ContiguousEnumSerializer<mozilla::LookAndFeel::ColorID,
|
|
mozilla::LookAndFeel::ColorID(0),
|
|
mozilla::LookAndFeel::ColorID::End> {
|
|
using IdType = std::underlying_type_t<mozilla::LookAndFeel::ColorID>;
|
|
};
|
|
|
|
template <>
|
|
struct ParamTraits<nsTransparencyMode>
|
|
: ContiguousEnumSerializerInclusive<nsTransparencyMode, eTransparencyOpaque,
|
|
eTransparencyBorderlessGlass> {};
|
|
|
|
template <>
|
|
struct ParamTraits<nsCursor>
|
|
: ContiguousEnumSerializer<nsCursor, eCursor_standard, eCursorCount> {};
|
|
|
|
template <>
|
|
struct ParamTraits<nsIWidget::TouchpadGesturePhase>
|
|
: ContiguousEnumSerializerInclusive<
|
|
nsIWidget::TouchpadGesturePhase,
|
|
nsIWidget::TouchpadGesturePhase::PHASE_BEGIN,
|
|
nsIWidget::TouchpadGesturePhase::PHASE_END> {};
|
|
|
|
template <>
|
|
struct ParamTraits<nsIWidget::TouchPointerState>
|
|
: public BitFlagsEnumSerializer<nsIWidget::TouchPointerState,
|
|
nsIWidget::TouchPointerState::ALL_BITS> {};
|
|
|
|
} // namespace IPC
|
|
|
|
#endif // WidgetMessageUtils_h
|