2020-02-10 22:26:01 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* 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 nsNativeBasicTheme_h
|
|
|
|
#define nsNativeBasicTheme_h
|
|
|
|
|
2020-07-31 15:04:29 +03:00
|
|
|
#include "Units.h"
|
|
|
|
#include "mozilla/gfx/2D.h"
|
|
|
|
#include "mozilla/gfx/Rect.h"
|
|
|
|
#include "mozilla/gfx/Types.h"
|
2020-02-10 22:26:01 +03:00
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsNativeTheme.h"
|
2020-07-30 20:02:02 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
2021-03-12 17:44:13 +03:00
|
|
|
|
|
|
|
enum class StyleSystemColor : uint8_t;
|
|
|
|
|
2020-07-30 20:02:02 +03:00
|
|
|
namespace widget {
|
|
|
|
|
2020-07-31 15:04:29 +03:00
|
|
|
static const gfx::sRGBColor sColorWhite(gfx::sRGBColor::OpaqueWhite());
|
|
|
|
static const gfx::sRGBColor sColorWhiteAlpha50(gfx::sRGBColor::White(0.5f));
|
|
|
|
static const gfx::sRGBColor sColorWhiteAlpha80(gfx::sRGBColor::White(0.8f));
|
|
|
|
static const gfx::sRGBColor sColorBlack(gfx::sRGBColor::OpaqueBlack());
|
2020-07-30 20:02:02 +03:00
|
|
|
|
2020-07-31 15:04:29 +03:00
|
|
|
static const gfx::sRGBColor sColorGrey10(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xffe9e9ed));
|
|
|
|
static const gfx::sRGBColor sColorGrey10Alpha50(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0x7fe9e9ed));
|
|
|
|
static const gfx::sRGBColor sColorGrey20(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xffd0d0d7));
|
|
|
|
static const gfx::sRGBColor sColorGrey30(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xffb1b1b9));
|
|
|
|
static const gfx::sRGBColor sColorGrey40(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xff8f8f9d));
|
|
|
|
static const gfx::sRGBColor sColorGrey40Alpha50(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0x7f8f8f9d));
|
|
|
|
static const gfx::sRGBColor sColorGrey50(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xff676774));
|
|
|
|
static const gfx::sRGBColor sColorGrey50Alpha50(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0x7f676774));
|
|
|
|
static const gfx::sRGBColor sColorGrey60(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xff484851));
|
|
|
|
static const gfx::sRGBColor sColorGrey60Alpha50(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0x7f484851));
|
2020-07-30 20:02:02 +03:00
|
|
|
|
2020-07-31 15:04:29 +03:00
|
|
|
static const gfx::sRGBColor sColorMeterGreen10(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xff00ab60));
|
|
|
|
static const gfx::sRGBColor sColorMeterGreen20(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xff056139));
|
|
|
|
static const gfx::sRGBColor sColorMeterYellow10(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xffffbd4f));
|
|
|
|
static const gfx::sRGBColor sColorMeterYellow20(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xffd2811e));
|
|
|
|
static const gfx::sRGBColor sColorMeterRed10(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xffe22850));
|
|
|
|
static const gfx::sRGBColor sColorMeterRed20(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xff810220));
|
2020-07-30 20:02:02 +03:00
|
|
|
|
2021-01-21 00:33:34 +03:00
|
|
|
static const gfx::sRGBColor sScrollbarColor(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xfff0f0f0));
|
2020-07-31 15:04:29 +03:00
|
|
|
static const gfx::sRGBColor sScrollbarBorderColor(gfx::sRGBColor(1.0f, 1.0f,
|
|
|
|
1.0f));
|
2021-01-21 00:33:34 +03:00
|
|
|
static const gfx::sRGBColor sScrollbarThumbColor(
|
|
|
|
gfx::sRGBColor::UnusualFromARGB(0xffcdcdcd));
|
2020-07-30 20:02:02 +03:00
|
|
|
|
2020-11-30 07:48:07 +03:00
|
|
|
static const CSSCoord kMinimumColorPickerHeight = 32.0f;
|
|
|
|
static const CSSCoord kMinimumRangeThumbSize = 20.0f;
|
|
|
|
static const CSSCoord kMinimumDropdownArrowButtonWidth = 18.0f;
|
2021-01-22 19:09:35 +03:00
|
|
|
static const CSSCoord kMinimumSpinnerButtonWidth = 18.0f;
|
|
|
|
static const CSSCoord kMinimumSpinnerButtonHeight = 9.0f;
|
2020-07-30 20:02:02 +03:00
|
|
|
static const CSSCoord kButtonBorderWidth = 1.0f;
|
|
|
|
static const CSSCoord kMenulistBorderWidth = 1.0f;
|
|
|
|
static const CSSCoord kTextFieldBorderWidth = 1.0f;
|
|
|
|
static const CSSCoord kRangeHeight = 6.0f;
|
|
|
|
static const CSSCoord kProgressbarHeight = 6.0f;
|
|
|
|
static const CSSCoord kMeterHeight = 12.0f;
|
|
|
|
|
2021-01-20 23:08:35 +03:00
|
|
|
// nsCheckboxRadioFrame takes the bottom of the content box as the baseline.
|
|
|
|
// This border-width makes its baseline 2px under the bottom, which is nice.
|
2021-03-02 01:55:37 +03:00
|
|
|
static constexpr CSSCoord kCheckboxRadioBorderWidth = 2.0f;
|
2021-01-20 23:08:35 +03:00
|
|
|
|
2020-07-30 20:02:02 +03:00
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
2020-02-10 22:26:01 +03:00
|
|
|
|
2020-10-06 00:15:18 +03:00
|
|
|
class nsNativeBasicTheme : protected nsNativeTheme, public nsITheme {
|
|
|
|
protected:
|
2020-07-31 15:04:29 +03:00
|
|
|
using sRGBColor = mozilla::gfx::sRGBColor;
|
|
|
|
using CSSCoord = mozilla::CSSCoord;
|
2020-11-30 07:48:07 +03:00
|
|
|
using CSSPoint = mozilla::CSSPoint;
|
2020-12-03 02:11:32 +03:00
|
|
|
using CSSIntCoord = mozilla::CSSIntCoord;
|
2020-10-15 07:54:06 +03:00
|
|
|
using ComputedStyle = mozilla::ComputedStyle;
|
2020-07-31 15:04:29 +03:00
|
|
|
using EventStates = mozilla::EventStates;
|
|
|
|
using DrawTarget = mozilla::gfx::DrawTarget;
|
|
|
|
using Path = mozilla::gfx::Path;
|
|
|
|
using Rect = mozilla::gfx::Rect;
|
2020-11-02 20:09:05 +03:00
|
|
|
using Point = mozilla::gfx::Point;
|
2020-07-31 15:04:29 +03:00
|
|
|
using RectCornerRadii = mozilla::gfx::RectCornerRadii;
|
2020-11-30 07:48:07 +03:00
|
|
|
using LayoutDeviceCoord = mozilla::LayoutDeviceCoord;
|
2020-11-30 01:19:10 +03:00
|
|
|
using LayoutDeviceRect = mozilla::LayoutDeviceRect;
|
2020-07-31 15:04:29 +03:00
|
|
|
|
2020-02-10 22:26:01 +03:00
|
|
|
public:
|
2021-02-10 03:47:38 +03:00
|
|
|
static void Init();
|
|
|
|
static void Shutdown();
|
|
|
|
static void LookAndFeelChanged();
|
|
|
|
|
2020-11-30 07:48:07 +03:00
|
|
|
using DPIRatio = mozilla::CSSToLayoutDeviceScale;
|
|
|
|
|
2020-02-10 22:26:01 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// The nsITheme interface.
|
2021-02-22 19:18:33 +03:00
|
|
|
NS_IMETHOD DrawWidgetBackground(gfxContext* aContext, nsIFrame*,
|
|
|
|
StyleAppearance, const nsRect& aRect,
|
2020-02-10 22:26:01 +03:00
|
|
|
const nsRect& aDirtyRect) override;
|
2021-02-23 13:49:37 +03:00
|
|
|
|
|
|
|
struct WebRenderBackendData {
|
|
|
|
mozilla::wr::DisplayListBuilder& mBuilder;
|
|
|
|
mozilla::wr::IpcResourceUpdateQueue& mResources;
|
|
|
|
const mozilla::layers::StackingContextHelper& mSc;
|
|
|
|
mozilla::layers::RenderRootStateManager* mManager;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool CreateWebRenderCommandsForWidget(
|
|
|
|
mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
|
const mozilla::layers::StackingContextHelper& aSc,
|
|
|
|
mozilla::layers::RenderRootStateManager* aManager, nsIFrame*,
|
|
|
|
StyleAppearance, const nsRect& aRect) override;
|
|
|
|
|
|
|
|
// PaintBackendData will be either a DrawTarget, or a WebRenderBackendData.
|
|
|
|
//
|
|
|
|
// The return value represents whether the widget could be painted with the
|
|
|
|
// given back-end.
|
|
|
|
template <typename PaintBackendData>
|
|
|
|
bool DoDrawWidgetBackground(PaintBackendData&, nsIFrame*, StyleAppearance,
|
|
|
|
const nsRect& aRect);
|
|
|
|
|
2021-02-22 19:18:33 +03:00
|
|
|
[[nodiscard]] LayoutDeviceIntMargin GetWidgetBorder(nsDeviceContext* aContext,
|
|
|
|
nsIFrame*,
|
|
|
|
StyleAppearance) override;
|
|
|
|
bool GetWidgetPadding(nsDeviceContext* aContext, nsIFrame*, StyleAppearance,
|
2020-12-03 02:11:32 +03:00
|
|
|
LayoutDeviceIntMargin* aResult) override;
|
2021-02-22 19:18:33 +03:00
|
|
|
bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame*, StyleAppearance,
|
2020-07-30 20:02:02 +03:00
|
|
|
nsRect* aOverflowRect) override;
|
2021-02-22 19:18:33 +03:00
|
|
|
NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame*,
|
|
|
|
StyleAppearance,
|
2020-12-03 02:11:32 +03:00
|
|
|
mozilla::LayoutDeviceIntSize* aResult,
|
2020-02-10 22:26:01 +03:00
|
|
|
bool* aIsOverridable) override;
|
2021-02-22 19:18:33 +03:00
|
|
|
Transparency GetWidgetTransparency(nsIFrame*, StyleAppearance) override;
|
|
|
|
NS_IMETHOD WidgetStateChanged(nsIFrame*, StyleAppearance, nsAtom* aAttribute,
|
|
|
|
bool* aShouldRepaint,
|
2020-02-10 22:26:01 +03:00
|
|
|
const nsAttrValue* aOldValue) override;
|
|
|
|
NS_IMETHOD ThemeChanged() override;
|
2021-02-22 19:18:33 +03:00
|
|
|
bool WidgetAppearanceDependsOnWindowFocus(StyleAppearance) override;
|
2020-07-30 20:02:02 +03:00
|
|
|
/*bool NeedToClearBackgroundBehindWidget(
|
2021-02-22 19:18:33 +03:00
|
|
|
nsIFrame*, StyleAppearance) override;*/
|
|
|
|
ThemeGeometryType ThemeGeometryTypeForWidget(nsIFrame*,
|
|
|
|
StyleAppearance) override;
|
2021-03-09 03:05:51 +03:00
|
|
|
bool ThemeSupportsWidget(nsPresContext*, nsIFrame*, StyleAppearance) override;
|
2021-02-22 19:18:33 +03:00
|
|
|
bool WidgetIsContainer(StyleAppearance) override;
|
|
|
|
bool ThemeDrawsFocusForWidget(StyleAppearance) override;
|
2020-02-10 22:26:01 +03:00
|
|
|
bool ThemeNeedsComboboxDropmarker() override;
|
2021-02-05 19:25:57 +03:00
|
|
|
ScrollbarSizes GetScrollbarSizes(nsPresContext*, StyleScrollbarWidth,
|
2021-01-29 01:11:54 +03:00
|
|
|
Overlay) override;
|
2021-02-04 19:15:27 +03:00
|
|
|
static nscolor AdjustUnthemedScrollbarThumbColor(nscolor, EventStates);
|
2021-03-12 17:44:13 +03:00
|
|
|
static nscolor GetScrollbarButtonColor(nscolor aTrackColor, EventStates);
|
|
|
|
static nscolor GetScrollbarArrowColor(nscolor aButtonColor);
|
2020-02-10 22:26:01 +03:00
|
|
|
|
2021-02-20 03:13:10 +03:00
|
|
|
nscoord GetCheckboxRadioPrefSize() override;
|
|
|
|
|
2020-02-10 22:26:01 +03:00
|
|
|
protected:
|
2020-07-30 20:02:02 +03:00
|
|
|
nsNativeBasicTheme() = default;
|
2020-02-10 22:26:01 +03:00
|
|
|
virtual ~nsNativeBasicTheme() = default;
|
2020-07-30 20:02:02 +03:00
|
|
|
|
2021-01-29 01:11:54 +03:00
|
|
|
static DPIRatio GetDPIRatioForScrollbarPart(nsPresContext*);
|
|
|
|
static DPIRatio GetDPIRatio(nsPresContext*, StyleAppearance);
|
2021-02-22 19:18:33 +03:00
|
|
|
static DPIRatio GetDPIRatio(nsIFrame*, StyleAppearance);
|
|
|
|
static bool IsDateTimeResetButton(nsIFrame*);
|
|
|
|
static bool IsColorPickerButton(nsIFrame*);
|
2020-07-30 20:02:02 +03:00
|
|
|
|
2021-03-12 17:44:13 +03:00
|
|
|
// Whether we should use system colors (for high contrast mode).
|
|
|
|
enum class UseSystemColors : bool { No, Yes };
|
|
|
|
static UseSystemColors ShouldUseSystemColors(const mozilla::dom::Document&);
|
|
|
|
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeCheckboxColors(const EventStates&,
|
|
|
|
StyleAppearance,
|
|
|
|
UseSystemColors);
|
|
|
|
sRGBColor ComputeCheckmarkColor(const EventStates&, UseSystemColors);
|
|
|
|
sRGBColor ComputeBorderColor(const EventStates&, UseSystemColors);
|
|
|
|
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeButtonColors(const EventStates&,
|
|
|
|
UseSystemColors,
|
|
|
|
nsIFrame* = nullptr);
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeTextfieldColors(const EventStates&,
|
|
|
|
UseSystemColors);
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeRangeProgressColors(const EventStates&,
|
|
|
|
UseSystemColors);
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeRangeTrackColors(const EventStates&,
|
|
|
|
UseSystemColors);
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeRangeThumbColors(const EventStates&,
|
|
|
|
UseSystemColors);
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeProgressColors(UseSystemColors);
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeProgressTrackColors(UseSystemColors);
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeMeterchunkColors(
|
|
|
|
const EventStates& aMeterState, UseSystemColors);
|
|
|
|
sRGBColor ComputeMenulistArrowButtonColor(const EventStates&,
|
|
|
|
UseSystemColors);
|
|
|
|
std::array<sRGBColor, 3> ComputeFocusRectColors(UseSystemColors);
|
|
|
|
|
|
|
|
static bool ShouldUseDarkScrollbar(nsIFrame*, const ComputedStyle&);
|
|
|
|
virtual sRGBColor ComputeScrollbarColor(nsIFrame*, const ComputedStyle&,
|
|
|
|
const EventStates& aDocumentState,
|
|
|
|
UseSystemColors);
|
2021-01-21 00:33:34 +03:00
|
|
|
virtual sRGBColor ComputeScrollbarThumbColor(
|
2021-02-22 19:18:33 +03:00
|
|
|
nsIFrame*, const ComputedStyle&, const EventStates& aElementState,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState, UseSystemColors);
|
|
|
|
// Returned colors are button, arrow.
|
|
|
|
std::pair<sRGBColor, sRGBColor> ComputeScrollbarButtonColors(
|
2021-02-22 19:18:33 +03:00
|
|
|
nsIFrame*, StyleAppearance, const ComputedStyle&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aElementState, const EventStates& aDocumentState,
|
|
|
|
UseSystemColors);
|
2020-11-17 23:53:01 +03:00
|
|
|
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintRoundedFocusRect(PaintBackendData&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
UseSystemColors, DPIRatio, CSSCoord aRadius,
|
|
|
|
CSSCoord aOffset);
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintAutoStyleOutline(nsIFrame*, PaintBackendData&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const LayoutDeviceRect&, UseSystemColors,
|
|
|
|
DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
|
|
|
|
static void PaintRoundedRectWithRadius(DrawTarget&,
|
|
|
|
const LayoutDeviceRect& aRect,
|
|
|
|
const LayoutDeviceRect& aClipRect,
|
|
|
|
const sRGBColor& aBackgroundColor,
|
|
|
|
const sRGBColor& aBorderColor,
|
|
|
|
CSSCoord aBorderWidth,
|
|
|
|
CSSCoord aRadius, DPIRatio);
|
|
|
|
static void PaintRoundedRectWithRadius(WebRenderBackendData&,
|
|
|
|
const LayoutDeviceRect& aRect,
|
|
|
|
const LayoutDeviceRect& aClipRect,
|
|
|
|
const sRGBColor& aBackgroundColor,
|
|
|
|
const sRGBColor& aBorderColor,
|
|
|
|
CSSCoord aBorderWidth,
|
|
|
|
CSSCoord aRadius, DPIRatio);
|
|
|
|
template <typename PaintBackendData>
|
|
|
|
static void PaintRoundedRectWithRadius(PaintBackendData& aData,
|
|
|
|
const LayoutDeviceRect& aRect,
|
|
|
|
const sRGBColor& aBackgroundColor,
|
|
|
|
const sRGBColor& aBorderColor,
|
|
|
|
CSSCoord aBorderWidth,
|
|
|
|
CSSCoord aRadius, DPIRatio aDpiRatio) {
|
|
|
|
PaintRoundedRectWithRadius(aData, aRect, aRect, aBackgroundColor,
|
|
|
|
aBorderColor, aBorderWidth, aRadius, aDpiRatio);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void FillRect(DrawTarget&, const LayoutDeviceRect&, const sRGBColor&);
|
|
|
|
static void FillRect(WebRenderBackendData&, const LayoutDeviceRect&,
|
|
|
|
const sRGBColor&);
|
|
|
|
|
2021-02-22 19:18:33 +03:00
|
|
|
void PaintCheckboxControl(DrawTarget& aDrawTarget, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors, DPIRatio);
|
|
|
|
void PaintCheckMark(DrawTarget&, const LayoutDeviceRect&, const EventStates&,
|
|
|
|
UseSystemColors);
|
2021-02-22 19:18:33 +03:00
|
|
|
void PaintIndeterminateMark(DrawTarget&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors);
|
2021-02-24 02:22:19 +03:00
|
|
|
|
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintStrokedCircle(PaintBackendData&, const LayoutDeviceRect&,
|
|
|
|
const sRGBColor& aBackgroundColor,
|
|
|
|
const sRGBColor& aBorderColor,
|
|
|
|
const CSSCoord aBorderWidth, DPIRatio);
|
|
|
|
void PaintCircleShadow(DrawTarget&, const LayoutDeviceRect& aBoxRect,
|
|
|
|
const LayoutDeviceRect& aClipRect, float aShadowAlpha,
|
|
|
|
const CSSPoint& aShadowOffset,
|
|
|
|
CSSCoord aShadowBlurStdDev, DPIRatio);
|
|
|
|
void PaintCircleShadow(WebRenderBackendData&,
|
|
|
|
const LayoutDeviceRect& aBoxRect,
|
|
|
|
const LayoutDeviceRect& aClipRect, float aShadowAlpha,
|
|
|
|
const CSSPoint& aShadowOffset,
|
|
|
|
CSSCoord aShadowBlurStdDev, DPIRatio);
|
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintRadioControl(PaintBackendData&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors, DPIRatio);
|
2021-02-24 02:22:19 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintRadioCheckmark(PaintBackendData&, const LayoutDeviceRect&,
|
2021-02-22 19:18:33 +03:00
|
|
|
const EventStates&, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintTextField(PaintBackendData&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintListbox(PaintBackendData&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintMenulist(PaintBackendData&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors, DPIRatio);
|
2021-02-22 19:18:33 +03:00
|
|
|
void PaintArrow(DrawTarget&, const LayoutDeviceRect&,
|
2021-01-21 00:54:58 +03:00
|
|
|
const float aArrowPolygonX[], const float aArrowPolygonY[],
|
2021-03-02 01:55:37 +03:00
|
|
|
const float aArrowPolygonSize, const int32_t aArrowNumPoints,
|
|
|
|
const sRGBColor aFillColor);
|
2021-02-22 19:18:33 +03:00
|
|
|
void PaintMenulistArrowButton(nsIFrame*, DrawTarget&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors);
|
2021-02-22 19:18:33 +03:00
|
|
|
void PaintSpinnerButton(nsIFrame*, DrawTarget&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, StyleAppearance, UseSystemColors,
|
|
|
|
DPIRatio);
|
2021-02-24 02:22:19 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintRange(nsIFrame*, PaintBackendData&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors, DPIRatio,
|
|
|
|
bool aHorizontal);
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintProgress(nsIFrame*, PaintBackendData&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors, DPIRatio,
|
2021-03-16 00:01:08 +03:00
|
|
|
bool aIsMeter);
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
void PaintButton(nsIFrame*, PaintBackendData&, const LayoutDeviceRect&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates&, UseSystemColors, DPIRatio);
|
2020-07-30 20:02:02 +03:00
|
|
|
|
2021-02-23 13:49:37 +03:00
|
|
|
void PaintScrollbarButton(DrawTarget&, StyleAppearance,
|
|
|
|
const LayoutDeviceRect&, nsIFrame*,
|
|
|
|
const ComputedStyle&,
|
|
|
|
const EventStates& aElementState,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState, UseSystemColors,
|
|
|
|
DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
|
|
|
|
virtual bool PaintScrollbarThumb(DrawTarget&, const LayoutDeviceRect&,
|
2021-02-22 19:18:33 +03:00
|
|
|
bool aHorizontal, nsIFrame*,
|
|
|
|
const ComputedStyle&,
|
2020-10-27 18:27:31 +03:00
|
|
|
const EventStates& aElementState,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState,
|
|
|
|
UseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
virtual bool PaintScrollbarThumb(WebRenderBackendData&,
|
|
|
|
const LayoutDeviceRect&, bool aHorizontal,
|
|
|
|
nsIFrame*, const ComputedStyle&,
|
|
|
|
const EventStates& aElementState,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState,
|
|
|
|
UseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
bool DoPaintDefaultScrollbarThumb(PaintBackendData&, const LayoutDeviceRect&,
|
|
|
|
bool aHorizontal, nsIFrame*,
|
|
|
|
const ComputedStyle&,
|
|
|
|
const EventStates& aElementState,
|
|
|
|
const EventStates& aDocumentState,
|
2021-03-12 17:44:13 +03:00
|
|
|
UseSystemColors aUseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
|
|
|
|
virtual bool PaintScrollbar(DrawTarget&, const LayoutDeviceRect&,
|
|
|
|
bool aHorizontal, nsIFrame*, const ComputedStyle&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState,
|
|
|
|
UseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
virtual bool PaintScrollbar(WebRenderBackendData&, const LayoutDeviceRect&,
|
2021-02-22 19:18:33 +03:00
|
|
|
bool aHorizontal, nsIFrame*, const ComputedStyle&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState,
|
|
|
|
UseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
bool DoPaintDefaultScrollbar(PaintBackendData&, const LayoutDeviceRect&,
|
|
|
|
bool aHorizontal, nsIFrame*,
|
|
|
|
const ComputedStyle&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState,
|
|
|
|
UseSystemColors aUseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
|
|
|
|
virtual bool PaintScrollbarTrack(DrawTarget&, const LayoutDeviceRect&,
|
2021-02-22 19:18:33 +03:00
|
|
|
bool aHorizontal, nsIFrame*,
|
|
|
|
const ComputedStyle&,
|
2021-02-23 13:49:37 +03:00
|
|
|
const EventStates& aDocumentState,
|
2021-03-12 17:44:13 +03:00
|
|
|
UseSystemColors, DPIRatio) {
|
2021-02-23 13:49:37 +03:00
|
|
|
// Draw nothing by default. Subclasses can override this.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual bool PaintScrollbarTrack(WebRenderBackendData&,
|
|
|
|
const LayoutDeviceRect&, bool aHorizontal,
|
|
|
|
nsIFrame*, const ComputedStyle&,
|
|
|
|
const EventStates& aDocumentState,
|
2021-03-12 17:44:13 +03:00
|
|
|
UseSystemColors, DPIRatio) {
|
2021-02-23 13:49:37 +03:00
|
|
|
// Draw nothing by default. Subclasses can override this.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool PaintScrollCorner(DrawTarget&, const LayoutDeviceRect&,
|
2021-02-23 05:58:47 +03:00
|
|
|
nsIFrame*, const ComputedStyle&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState,
|
|
|
|
UseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
virtual bool PaintScrollCorner(WebRenderBackendData&, const LayoutDeviceRect&,
|
|
|
|
nsIFrame*, const ComputedStyle&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState,
|
|
|
|
UseSystemColors, DPIRatio);
|
2021-02-23 13:49:37 +03:00
|
|
|
template <typename PaintBackendData>
|
|
|
|
bool DoPaintDefaultScrollCorner(PaintBackendData&, const LayoutDeviceRect&,
|
|
|
|
nsIFrame*, const ComputedStyle&,
|
2021-03-12 17:44:13 +03:00
|
|
|
const EventStates& aDocumentState,
|
|
|
|
UseSystemColors, DPIRatio);
|
2021-02-10 03:47:38 +03:00
|
|
|
|
|
|
|
static sRGBColor sAccentColor;
|
|
|
|
static sRGBColor sAccentColorForeground;
|
|
|
|
|
|
|
|
// Note that depending on the exact accent color, lighter/darker might really
|
|
|
|
// be inverted.
|
|
|
|
static sRGBColor sAccentColorLight;
|
|
|
|
static sRGBColor sAccentColorDark;
|
|
|
|
static sRGBColor sAccentColorDarker;
|
2021-03-18 22:12:49 +03:00
|
|
|
static CSSIntCoord sHorizontalScrollbarHeight;
|
|
|
|
static CSSIntCoord sVerticalScrollbarWidth;
|
2021-02-10 03:47:38 +03:00
|
|
|
|
2021-03-18 22:12:49 +03:00
|
|
|
static void PrefChangedCallback(const char*, void*) { LookAndFeelChanged(); }
|
2021-02-10 03:47:38 +03:00
|
|
|
static void RecomputeAccentColors();
|
2021-03-18 22:12:49 +03:00
|
|
|
static void RecomputeScrollbarSizes();
|
2020-02-10 22:26:01 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|