Backed out 4 changesets (bug 1670694, bug 1670853, bug 1669368, bug 1670145) for build bustages on nsNativeBasicTheme.h. CLOSED TREE

Backed out changeset fcb1b57645e0 (bug 1669368)
Backed out changeset 6ac5b674c3b6 (bug 1670853)
Backed out changeset 913fd041e5dd (bug 1670145)
Backed out changeset 89504c0fb0cd (bug 1670694)
This commit is contained in:
Razvan Maries 2020-10-15 07:45:35 +03:00
Родитель 76b30e3307
Коммит 8d3a29c27b
17 изменённых файлов: 153 добавлений и 535 удалений

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

@ -450,11 +450,10 @@ enum class LuminanceType : int8_t {
/* Color is stored in non-premultiplied form in sRGB color space */
struct sRGBColor {
public:
constexpr sRGBColor() : r(0.0f), g(0.0f), b(0.0f), a(0.0f) {}
constexpr sRGBColor(Float aR, Float aG, Float aB, Float aA)
sRGBColor() : r(0.0f), g(0.0f), b(0.0f), a(0.0f) {}
sRGBColor(Float aR, Float aG, Float aB, Float aA)
: r(aR), g(aG), b(aB), a(aA) {}
constexpr sRGBColor(Float aR, Float aG, Float aB)
: r(aR), g(aG), b(aB), a(1.0f) {}
sRGBColor(Float aR, Float aG, Float aB) : r(aR), g(aG), b(aB), a(1.0f) {}
static sRGBColor White(float aA) { return sRGBColor(1.f, 1.f, 1.f, aA); }

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

@ -19,9 +19,6 @@
int32_t(mozilla::Abs(NS_GetLuminosity(a | 0xff000000) - \
NS_GetLuminosity(b | 0xff000000)))
// Maximum value that NS_GetLuminosity can return.
#define NS_MAX_LUMINOSITY 255000
// To determine 3D colors for groove / ridge borders based on the border color
void NS_GetSpecial3DColors(nscolor aResult[2], nscolor aBorderColor);
@ -29,7 +26,7 @@ void NS_GetSpecial3DColors(nscolor aResult[2], nscolor aBorderColor);
int NS_GetBrightness(uint8_t aRed, uint8_t aGreen, uint8_t aBlue);
// Get Luminosity of a specific color. That is same as Y of YIQ color space.
// The range of return value is 0 to NS_MAX_LUMINOSITY.
// The range of return value is 0 to 255000.
int32_t NS_GetLuminosity(nscolor aColor);
// function to convert from RGBA color space to HSVA color space

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

@ -107,16 +107,6 @@ pub enum SystemColor {
IMESelectedConvertedTextUnderline,
#[css(skip)]
SpellCheckerUnderline,
#[css(skip)]
ScrollbarInactive,
#[css(skip)]
ScrollbarThumb,
#[css(skip)]
ScrollbarThumbHover,
#[css(skip)]
ScrollbarThumbActive,
#[css(skip)]
ScrollbarThumbInactive,
Activeborder,
Activecaption,
Appworkspace,

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

@ -4493,37 +4493,6 @@ widget:
record_in_processes:
- 'main'
gtk_theme_scrollbar_uses_images:
bug_numbers:
- 1670145
description: >
Whether the active Gtk theme uses background images for its scrollbar
parts.
kind: boolean
expires: "87"
notification_emails:
- layout-telemetry-alerts@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- 'main'
gtk_version:
bug_numbers:
- 1670145
description: >
The version of Gtk 3 in use.
kind: string
expires: never
notification_emails:
- layout-telemetry-alerts@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- 'main'
# The following section contains memory reporter counters.
memoryreporter:
max_ghost_windows:

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

@ -321,12 +321,6 @@ const DEFAULT_ENVIRONMENT_PREFS = new Map([
["signon.generation.enabled", { what: RECORD_PREF_VALUE }],
["signon.rememberSignons", { what: RECORD_PREF_VALUE }],
["toolkit.telemetry.pioneerId", { what: RECORD_PREF_STATE }],
["widget.content.allow-gtk-dark-theme", { what: RECORD_DEFAULTPREF_VALUE }],
["widget.content.gtk-theme-override", { what: RECORD_PREF_STATE }],
[
"widget.content.gtk-high-contrast.enabled",
{ what: RECORD_DEFAULTPREF_VALUE },
],
["xpinstall.signatures.required", { what: RECORD_PREF_VALUE }],
]);

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

@ -565,20 +565,13 @@ struct LookAndFeelFont {
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

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

@ -54,29 +54,6 @@ struct ParamTraits<LookAndFeelFont> {
}
};
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;
@ -84,14 +61,12 @@ struct ParamTraits<LookAndFeelCache> {
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);
ReadParam(aMsg, aIter, &aResult->mFonts);
}
};

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

@ -18,6 +18,7 @@
#include "WidgetStyleCache.h"
#include "nsString.h"
#include "nsDebug.h"
#include "mozilla/Telemetry.h"
#include <math.h>
#include <dlfcn.h>
@ -2793,6 +2794,9 @@ static void InitScrollbarMetrics(ScrollbarGTKMetrics* aMetrics,
"has-secondary-forward-stepper", &secondary_forward, nullptr);
bool hasButtons =
backward || forward || secondary_backward || secondary_forward;
mozilla::Telemetry::ScalarSet(
mozilla::Telemetry::ScalarID::WIDGET_GTK_THEME_HAS_SCROLLBAR_BUTTONS,
hasButtons);
if (gtk_get_minor_version() < 20) {
gint slider_width, trough_border, stepper_size, min_slider_size;

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

@ -140,7 +140,7 @@ typedef enum {
#define MOZ_GTK_WIDGET_INCONSISTENT (1 << 1)
/*** widget type constants ***/
enum WidgetNodeType : int {
typedef enum {
/* Paints a GtkButton. flags is a GtkReliefStyle. */
MOZ_GTK_BUTTON,
/* Paints a button with image and no text */
@ -350,7 +350,7 @@ enum WidgetNodeType : int {
MOZ_GTK_WINDOW_DECORATION_SOLID,
MOZ_GTK_WIDGET_NODE_COUNT
};
} WidgetNodeType;
/* ButtonLayout represents a GTK CSD button and whether its on the left or
* right side of the tab bar */

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

@ -22,7 +22,6 @@
#include "mozilla/RelativeLuminanceUtils.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/StaticPrefs_widget.h"
#include "mozilla/Telemetry.h"
#include "ScreenHelperGTK.h"
#include "gtkdrawing.h"
@ -270,23 +269,13 @@ void nsLookAndFeel::RefreshImpl() {
LookAndFeelCache nsLookAndFeel::GetCacheImpl() {
LookAndFeelCache cache = nsXPLookAndFeel::GetCacheImpl();
constexpr IntID kIntIdsToCache[] = {IntID::SystemUsesDarkTheme,
IntID::PrefersReducedMotion,
IntID::UseAccessibilityTheme};
constexpr ColorID kColorIdsToCache[] = {ColorID::Scrollbar,
ColorID::ScrollbarInactive,
ColorID::ScrollbarThumb,
ColorID::ScrollbarThumbHover,
ColorID::ScrollbarThumbActive,
ColorID::ScrollbarThumbInactive};
const IntID kIdsToCache[] = {IntID::SystemUsesDarkTheme,
IntID::PrefersReducedMotion,
IntID::UseAccessibilityTheme};
for (IntID id : kIntIdsToCache) {
for (IntID id : kIdsToCache) {
cache.mInts.AppendElement(LookAndFeelInt{.id = id, .value = GetInt(id)});
}
for (ColorID id : kColorIdsToCache) {
cache.mColors.AppendElement(
LookAndFeelColor{.id = id, .color = GetColor(id)});
}
return cache;
}
@ -308,31 +297,6 @@ void nsLookAndFeel::SetCacheImpl(const LookAndFeelCache& aCache) {
break;
}
}
for (const auto& entry : aCache.mColors) {
switch (entry.id) {
case ColorID::Scrollbar:
mMozScrollbar = entry.color;
break;
case ColorID::ScrollbarInactive:
mScrollbarInactive = entry.color;
break;
case ColorID::ScrollbarThumb:
mScrollbarThumb = entry.color;
break;
case ColorID::ScrollbarThumbHover:
mScrollbarThumbHover = entry.color;
break;
case ColorID::ScrollbarThumbActive:
mScrollbarThumbActive = entry.color;
break;
case ColorID::ScrollbarThumbInactive:
mScrollbarThumbInactive = entry.color;
break;
default:
MOZ_ASSERT_UNREACHABLE("Bogus Color ID in cache");
break;
}
}
}
nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
@ -413,21 +377,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
case ColorID::SpellCheckerUnderline:
aColor = NS_RGB(0xff, 0, 0);
break;
case ColorID::ScrollbarInactive:
aColor = mScrollbarInactive;
break;
case ColorID::ScrollbarThumb:
aColor = mScrollbarThumb;
break;
case ColorID::ScrollbarThumbHover:
aColor = mScrollbarThumbHover;
break;
case ColorID::ScrollbarThumbActive:
aColor = mScrollbarThumbActive;
break;
case ColorID::ScrollbarThumbInactive:
aColor = mScrollbarThumbInactive;
break;
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
case ColorID::Activeborder:
@ -1044,7 +993,6 @@ void nsLookAndFeel::EnsureInit() {
MOZ_ASSERT(NS_IsMainThread());
GtkStyleContext* style;
GdkRGBA color;
if (XRE_IsContentProcess()) {
LOG(("nsLookAndFeel::EnsureInit() [%p] Content process\n", (void*)this));
@ -1075,30 +1023,6 @@ void nsLookAndFeel::EnsureInit() {
gboolean enableAnimations = false;
g_object_get(settings, "gtk-enable-animations", &enableAnimations, nullptr);
mPrefersReducedMotion = !enableAnimations;
// Colors that we pass to content processes through the LookAndFeelCache.
style = GetStyleContext(MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
&color);
mMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_BACKDROP,
&color);
mScrollbarInactive = GDK_RGBA_TO_NS_RGBA(color);
style = GetStyleContext(MOZ_GTK_SCROLLBAR_THUMB_VERTICAL);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
&color);
mScrollbarThumb = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT,
&color);
mScrollbarThumbHover = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_background_color(
style, GtkStateFlags(GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_ACTIVE),
&color);
mScrollbarThumbActive = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_BACKDROP,
&color);
mScrollbarThumbInactive = GDK_RGBA_TO_NS_RGBA(color);
}
// The label is not added to a parent widget, but shared for constructing
@ -1107,6 +1031,12 @@ void nsLookAndFeel::EnsureInit() {
GtkWidget* labelWidget = gtk_label_new("M");
g_object_ref_sink(labelWidget);
// Scrollbar colors
GdkRGBA color;
style = GetStyleContext(MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
mMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
// Window colors
style = GetStyleContext(MOZ_GTK_WINDOW);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
@ -1398,52 +1328,3 @@ char16_t nsLookAndFeel::GetPasswordCharacterImpl() {
}
bool nsLookAndFeel::GetEchoPasswordImpl() { return false; }
bool nsLookAndFeel::WidgetUsesImage(WidgetNodeType aNodeType) {
static constexpr GtkStateFlags sFlagsToCheck[] {
GTK_STATE_FLAG_NORMAL,
GTK_STATE_FLAG_PRELIGHT,
GtkStateFlags(GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_ACTIVE),
GTK_STATE_FLAG_BACKDROP,
GTK_STATE_FLAG_INSENSITIVE
};
GtkStyleContext* style = GetStyleContext(aNodeType);
GValue value = G_VALUE_INIT;
for (GtkStateFlags state : sFlagsToCheck) {
gtk_style_context_get_property(style, "background-image", state, &value);
bool hasPattern = G_VALUE_TYPE(&value) == CAIRO_GOBJECT_TYPE_PATTERN &&
g_value_get_boxed(&value);
g_value_unset(&value);
if (hasPattern) {
return true;
}
}
return false;
}
void nsLookAndFeel::RecordLookAndFeelSpecificTelemetry() {
// Gtk version we're on.
nsString version;
version.AppendPrintf("%d.%d", gtk_major_version, gtk_minor_version);
Telemetry::ScalarSet(Telemetry::ScalarID::WIDGET_GTK_VERSION, version);
// Whether the current Gtk theme has scrollbar buttons.
bool hasScrollbarButtons =
GetInt(LookAndFeel::IntID::ScrollArrowStyle) != eScrollArrow_None;
mozilla::Telemetry::ScalarSet(
mozilla::Telemetry::ScalarID::WIDGET_GTK_THEME_HAS_SCROLLBAR_BUTTONS,
hasScrollbarButtons);
// Whether the current Gtk theme uses something other than a solid color
// background for scrollbar parts.
bool scrollbarUsesImage =
WidgetUsesImage(MOZ_GTK_SCROLLBAR_VERTICAL) ||
WidgetUsesImage(MOZ_GTK_SCROLLBAR_CONTENTS_VERTICAL) ||
WidgetUsesImage(MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL) ||
WidgetUsesImage(MOZ_GTK_SCROLLBAR_THUMB_VERTICAL);
mozilla::Telemetry::ScalarSet(
mozilla::Telemetry::ScalarID::WIDGET_GTK_THEME_SCROLLBAR_USES_IMAGES,
scrollbarUsesImage);
}

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

@ -13,7 +13,6 @@
#include "nsCOMPtr.h"
#include "gfxFont.h"
enum WidgetNodeType : int;
struct _GtkStyle;
class nsLookAndFeel final : public nsXPLookAndFeel {
@ -41,9 +40,6 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
static const nscolor kWhite = NS_RGB(255, 255, 255);
protected:
bool WidgetUsesImage(WidgetNodeType aNodeType);
void RecordLookAndFeelSpecificTelemetry() override;
// Cached fonts
nsString mDefaultFontName;
nsString mButtonFontName;
@ -90,11 +86,6 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
nscolor mInfoBarText = kBlack;
nscolor mMozColHeaderText = kBlack;
nscolor mMozColHeaderHoverText = kBlack;
nscolor mScrollbarInactive = kBlack;
nscolor mScrollbarThumb = kBlack;
nscolor mScrollbarThumbHover = kBlack;
nscolor mScrollbarThumbActive = kBlack;
nscolor mScrollbarThumbInactive = kBlack;
char16_t mInvisibleCharacter = 0;
float mCaretRatio = 0.0f;
int32_t mCaretBlinkTime = 0;

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

@ -5,13 +5,9 @@
#include "nsNativeBasicThemeGTK.h"
#include "nsLayoutUtils.h"
using namespace mozilla;
static constexpr CSSIntCoord kGtkMinimumScrollbarSize = 12;
static constexpr CSSIntCoord kGtkMinimumThinScrollbarSize = 6;
static constexpr CSSIntCoord kGtkMinimumScrollbarThumbSize = 40;
static constexpr CSSIntCoord kMinimumScrollbarSize = 12;
already_AddRefed<nsITheme> do_GetBasicNativeThemeDoNotUseDirectly() {
static mozilla::StaticRefPtr<nsITheme> gInstance;
@ -41,88 +37,63 @@ nsNativeBasicThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
StyleAppearance aAppearance,
LayoutDeviceIntSize* aResult,
bool* aIsOverridable) {
if (!IsWidgetScrollbarPart(aAppearance)) {
return nsNativeBasicTheme::GetMinimumWidgetSize(
aPresContext, aFrame, aAppearance, aResult, aIsOverridable);
}
uint32_t dpiRatio = GetDPIRatio(aFrame);
switch (aAppearance) {
case StyleAppearance::Scrollbar:
case StyleAppearance::ScrollbarSmall:
case StyleAppearance::ScrollbarVertical:
case StyleAppearance::ScrollbarHorizontal:
case StyleAppearance::ScrollbarbuttonUp:
case StyleAppearance::ScrollbarbuttonDown:
case StyleAppearance::ScrollbarbuttonLeft:
case StyleAppearance::ScrollbarbuttonRight:
case StyleAppearance::ScrollbarthumbVertical:
case StyleAppearance::ScrollbarthumbHorizontal:
case StyleAppearance::ScrollbartrackHorizontal:
case StyleAppearance::ScrollbartrackVertical:
case StyleAppearance::Scrollcorner: {
ComputedStyle* style = nsLayoutUtils::StyleForScrollbar(aFrame);
if (style->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::Thin) {
aResult->SizeTo(
static_cast<uint32_t>(kGtkMinimumThinScrollbarSize) * dpiRatio,
static_cast<uint32_t>(kGtkMinimumThinScrollbarSize) * dpiRatio);
} else {
aResult->SizeTo(
static_cast<uint32_t>(kGtkMinimumScrollbarSize) * dpiRatio,
static_cast<uint32_t>(kGtkMinimumScrollbarSize) * dpiRatio);
}
break;
}
default:
return nsNativeBasicTheme::GetMinimumWidgetSize(
aPresContext, aFrame, aAppearance, aResult, aIsOverridable);
}
switch (aAppearance) {
case StyleAppearance::ScrollbarthumbHorizontal:
aResult->width =
static_cast<uint32_t>(kGtkMinimumScrollbarThumbSize) * dpiRatio;
break;
case StyleAppearance::ScrollbarthumbVertical:
aResult->height =
static_cast<uint32_t>(kGtkMinimumScrollbarThumbSize) * dpiRatio;
break;
default:
break;
}
auto size = static_cast<uint32_t>(kMinimumScrollbarSize) * dpiRatio;
aResult->SizeTo(size, size);
*aIsOverridable = true;
return NS_OK;
}
static sRGBColor GetScrollbarthumbColor(const EventStates& aState) {
if (aState.HasAllStates(NS_EVENT_STATE_ACTIVE)) {
return widget::sScrollbarThumbColorActive;
}
if (aState.HasAllStates(NS_EVENT_STATE_HOVER)) {
return widget::sScrollbarThumbColorHover;
}
return widget::sScrollbarThumbColor;
}
void nsNativeBasicThemeGTK::PaintScrollbarthumbHorizontal(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aElementState, const EventStates& aDocumentState) {
sRGBColor thumbColor =
ComputeScrollbarthumbColor(aStyle, aElementState, aDocumentState);
DrawTarget* aDrawTarget, const Rect& aRect, const EventStates& aState) {
sRGBColor thumbColor = GetScrollbarthumbColor(aState);
Rect thumbRect(aRect);
thumbRect.Deflate(floorf(aRect.height / 4.0f));
thumbRect.Deflate(aRect.height / 4.0f);
PaintRoundedRectWithRadius(aDrawTarget, thumbRect, thumbColor, sRGBColor(), 0,
thumbRect.height / 2.0f, 1);
}
void nsNativeBasicThemeGTK::PaintScrollbarthumbVertical(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aElementState, const EventStates& aDocumentState) {
sRGBColor thumbColor =
ComputeScrollbarthumbColor(aStyle, aElementState, aDocumentState);
DrawTarget* aDrawTarget, const Rect& aRect, const EventStates& aState) {
sRGBColor thumbColor = GetScrollbarthumbColor(aState);
Rect thumbRect(aRect);
thumbRect.Deflate(floorf(aRect.width / 4.0f));
thumbRect.Deflate(aRect.width / 4.0f);
PaintRoundedRectWithRadius(aDrawTarget, thumbRect, thumbColor, sRGBColor(), 0,
thumbRect.width / 2.0f, 1);
}
void nsNativeBasicThemeGTK::PaintScrollbarHorizontal(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aDocumentState, bool aIsRoot) {
sRGBColor trackColor = ComputeScrollbarColor(aStyle, aDocumentState, aIsRoot);
aDrawTarget->FillRect(aRect, ColorPattern(ToDeviceColor(trackColor)));
void nsNativeBasicThemeGTK::PaintScrollbarHorizontal(DrawTarget* aDrawTarget,
const Rect& aRect,
bool aIsRoot) {
if (!aIsRoot) {
return;
}
aDrawTarget->FillRect(aRect,
ColorPattern(ToDeviceColor(widget::sScrollbarColor)));
}
void nsNativeBasicThemeGTK::PaintScrollbarVerticalAndCorner(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aDocumentState, uint32_t aDpiRatio, bool aIsRoot) {
sRGBColor trackColor = ComputeScrollbarColor(aStyle, aDocumentState, aIsRoot);
aDrawTarget->FillRect(aRect, ColorPattern(ToDeviceColor(trackColor)));
DrawTarget* aDrawTarget, const Rect& aRect, uint32_t aDpiRatio,
bool aIsRoot) {
if (!aIsRoot) {
return;
}
aDrawTarget->FillRect(aRect,
ColorPattern(ToDeviceColor(widget::sScrollbarColor)));
}

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

@ -20,22 +20,14 @@ class nsNativeBasicThemeGTK : public nsNativeBasicTheme {
nsITheme::Transparency GetWidgetTransparency(
nsIFrame* aFrame, StyleAppearance aAppearance) override;
void PaintScrollbarthumbHorizontal(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aElementState,
const EventStates& aDocumentState) override;
void PaintScrollbarthumbHorizontal(DrawTarget* aDrawTarget, const Rect& aRect,
const EventStates& aState) override;
void PaintScrollbarthumbVertical(DrawTarget* aDrawTarget, const Rect& aRect,
const ComputedStyle& aStyle,
const EventStates& aElementState,
const EventStates& aDocumentState) override;
const EventStates& aState) override;
void PaintScrollbarHorizontal(DrawTarget* aDrawTarget, const Rect& aRect,
const ComputedStyle& aStyle,
const EventStates& aDocumentState,
bool aIsRoot) override;
void PaintScrollbarVerticalAndCorner(DrawTarget* aDrawTarget,
const Rect& aRect,
const ComputedStyle& aStyle,
const EventStates& aDocumentState,
uint32_t aDpiRatio,
bool aIsRoot) override;

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

@ -5,7 +5,6 @@
#include "nsNativeBasicTheme.h"
#include "nsCSSColorUtils.h"
#include "nsCSSRendering.h"
#include "nsLayoutUtils.h"
#include "PathHelpers.h"
@ -871,128 +870,64 @@ void nsNativeBasicTheme::PaintButton(nsIFrame* aFrame, DrawTarget* aDrawTarget,
}
}
sRGBColor nsNativeBasicTheme::ComputeScrollbarthumbColor(
const ComputedStyle& aStyle, const EventStates& aElementState,
const EventStates& aDocumentState) {
const nsStyleUI* ui = aStyle.StyleUI();
nscolor color;
if (ui->mScrollbarColor.IsColors()) {
color = ui->mScrollbarColor.AsColors().thumb.CalcColor(aStyle);
} else if (aDocumentState.HasAllStates(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
color = LookAndFeel::GetColor(LookAndFeel::ColorID::ScrollbarThumbInactive,
sScrollbarThumbColor.ToABGR());
} else if (aElementState.HasAllStates(NS_EVENT_STATE_ACTIVE)) {
color = LookAndFeel::GetColor(LookAndFeel::ColorID::ScrollbarThumbActive,
sScrollbarThumbColorActive.ToABGR());
} else if (aElementState.HasAllStates(NS_EVENT_STATE_HOVER)) {
color = LookAndFeel::GetColor(LookAndFeel::ColorID::ScrollbarThumbHover,
sScrollbarThumbColorHover.ToABGR());
} else {
color = LookAndFeel::GetColor(LookAndFeel::ColorID::ScrollbarThumb,
sScrollbarThumbColor.ToABGR());
}
return gfx::sRGBColor::FromABGR(color);
}
sRGBColor nsNativeBasicTheme::ComputeScrollbarColor(
const ComputedStyle& aStyle, const EventStates& aDocumentState,
bool aIsRoot) {
const nsStyleUI* ui = aStyle.StyleUI();
nscolor color;
if (ui->mScrollbarColor.IsColors()) {
color = ui->mScrollbarColor.AsColors().track.CalcColor(aStyle);
} else if (aDocumentState.HasAllStates(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
color = LookAndFeel::GetColor(LookAndFeel::ColorID::ScrollbarInactive,
sScrollbarColor.ToABGR());
} else {
color = LookAndFeel::GetColor(LookAndFeel::ColorID::Scrollbar,
sScrollbarColor.ToABGR());
}
if (aIsRoot) {
// Root scrollbars must be opaque.
nscolor bg = LookAndFeel::GetColor(LookAndFeel::ColorID::WindowBackground,
NS_RGB(0xff, 0xff, 0xff));
color = NS_ComposeColors(bg, color);
}
return gfx::sRGBColor::FromABGR(color);
}
void nsNativeBasicTheme::PaintScrollbarthumbHorizontal(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aElementState, const EventStates& aDocumentState) {
sRGBColor thumbColor =
ComputeScrollbarthumbColor(aStyle, aElementState, aDocumentState);
DrawTarget* aDrawTarget, const Rect& aRect, const EventStates& aState) {
sRGBColor thumbColor = sScrollbarThumbColor;
if (aState.HasState(NS_EVENT_STATE_ACTIVE)) {
thumbColor = sScrollbarThumbColorActive;
} else if (aState.HasState(NS_EVENT_STATE_HOVER)) {
thumbColor = sScrollbarThumbColorHover;
}
aDrawTarget->FillRect(aRect, ColorPattern(ToDeviceColor(thumbColor)));
}
void nsNativeBasicTheme::PaintScrollbarthumbVertical(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aElementState, const EventStates& aDocumentState) {
sRGBColor thumbColor =
ComputeScrollbarthumbColor(aStyle, aElementState, aDocumentState);
DrawTarget* aDrawTarget, const Rect& aRect, const EventStates& aState) {
sRGBColor thumbColor = sScrollbarThumbColor;
if (aState.HasState(NS_EVENT_STATE_ACTIVE)) {
thumbColor = sScrollbarThumbColorActive;
} else if (aState.HasState(NS_EVENT_STATE_HOVER)) {
thumbColor = sScrollbarThumbColorHover;
}
aDrawTarget->FillRect(aRect, ColorPattern(ToDeviceColor(thumbColor)));
}
void nsNativeBasicTheme::PaintScrollbarHorizontal(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aDocumentState, bool aIsRoot) {
sRGBColor scrollbarColor =
ComputeScrollbarColor(aStyle, aDocumentState, aIsRoot);
aDrawTarget->FillRect(aRect, ColorPattern(ToDeviceColor(scrollbarColor)));
// FIXME(heycam): We should probably derive the border color when custom
// scrollbar colors are in use too. But for now, just skip painting it,
// to avoid ugliness.
if (aStyle.StyleUI()->mScrollbarColor.IsAuto()) {
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
builder->MoveTo(Point(aRect.x, aRect.y));
builder->LineTo(Point(aRect.x + aRect.width, aRect.y));
RefPtr<Path> path = builder->Finish();
aDrawTarget->Stroke(path,
ColorPattern(ToDeviceColor(sScrollbarBorderColor)));
}
void nsNativeBasicTheme::PaintScrollbarHorizontal(DrawTarget* aDrawTarget,
const Rect& aRect,
bool aIsRoot) {
aDrawTarget->FillRect(aRect, ColorPattern(ToDeviceColor(sScrollbarColor)));
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
builder->MoveTo(Point(aRect.x, aRect.y));
builder->LineTo(Point(aRect.x + aRect.width, aRect.y));
RefPtr<Path> path = builder->Finish();
aDrawTarget->Stroke(path, ColorPattern(ToDeviceColor(sScrollbarBorderColor)));
}
void nsNativeBasicTheme::PaintScrollbarVerticalAndCorner(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aDocumentState, uint32_t aDpiRatio, bool aIsRoot) {
sRGBColor scrollbarColor =
ComputeScrollbarColor(aStyle, aDocumentState, aIsRoot);
aDrawTarget->FillRect(aRect, ColorPattern(ToDeviceColor(scrollbarColor)));
// FIXME(heycam): We should probably derive the border color when custom
// scrollbar colors are in use too. But for now, just skip painting it,
// to avoid ugliness.
if (aStyle.StyleUI()->mScrollbarColor.IsAuto()) {
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
builder->MoveTo(Point(aRect.x, aRect.y));
builder->LineTo(Point(aRect.x, aRect.y + aRect.height));
RefPtr<Path> path = builder->Finish();
aDrawTarget->Stroke(path,
ColorPattern(ToDeviceColor(sScrollbarBorderColor)),
StrokeOptions(1.0f * aDpiRatio));
}
DrawTarget* aDrawTarget, const Rect& aRect, uint32_t aDpiRatio,
bool aIsRoot) {
aDrawTarget->FillRect(aRect, ColorPattern(ToDeviceColor(sScrollbarColor)));
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
builder->MoveTo(Point(aRect.x, aRect.y));
builder->LineTo(Point(aRect.x, aRect.y + aRect.height));
RefPtr<Path> path = builder->Finish();
aDrawTarget->Stroke(path, ColorPattern(ToDeviceColor(sScrollbarBorderColor)),
StrokeOptions(1.0f * aDpiRatio));
}
void nsNativeBasicTheme::PaintScrollbarbutton(
DrawTarget* aDrawTarget, StyleAppearance aAppearance, const Rect& aRect,
const ComputedStyle& aStyle, const EventStates& aElementState,
const EventStates& aDocumentState, uint32_t aDpiRatio) {
bool isActive = aElementState.HasState(NS_EVENT_STATE_ACTIVE);
bool isHovered = aElementState.HasState(NS_EVENT_STATE_HOVER);
void nsNativeBasicTheme::PaintScrollbarbutton(DrawTarget* aDrawTarget,
StyleAppearance aAppearance,
const Rect& aRect,
const EventStates& aState,
uint32_t aDpiRatio) {
bool isActive = aState.HasState(NS_EVENT_STATE_ACTIVE);
bool isHovered = aState.HasState(NS_EVENT_STATE_HOVER);
bool hasCustomColor = aStyle.StyleUI()->mScrollbarColor.IsColors();
sRGBColor buttonColor;
if (hasCustomColor) {
// When scrollbar-color is in use, use the thumb color for the button.
buttonColor =
ComputeScrollbarthumbColor(aStyle, aElementState, aDocumentState);
} else if (isActive) {
buttonColor = sScrollbarButtonActiveColor;
} else if (!hasCustomColor && isHovered) {
buttonColor = sScrollbarButtonHoverColor;
} else {
buttonColor = sScrollbarColor;
}
aDrawTarget->FillRect(aRect, ColorPattern(ToDeviceColor(buttonColor)));
aDrawTarget->FillRect(
aRect, ColorPattern(
ToDeviceColor(isActive ? sScrollbarButtonActiveColor
: isHovered ? sScrollbarButtonHoverColor
: sScrollbarColor)));
// Start with Up arrow.
int32_t arrowPolygonX[] = {3, 0, -3};
@ -1026,47 +961,25 @@ void nsNativeBasicTheme::PaintScrollbarbutton(
return;
}
sRGBColor arrowColor;
if (hasCustomColor) {
// When scrollbar-color is in use, derive the arrow color from the button
// color.
nscolor bg = buttonColor.ToABGR();
bool darken = NS_GetLuminosity(bg) >= NS_MAX_LUMINOSITY / 2;
if (isActive) {
float c = darken ? 0.0f : 1.0f;
arrowColor = sRGBColor(c, c, c);
} else {
uint8_t c = darken ? 0 : 255;
arrowColor = sRGBColor::FromABGR(NS_ComposeColors(bg, NS_RGBA(c, c, c, 160)));
}
} else if (isActive) {
arrowColor = sScrollbarArrowColorActive;
} else if (isHovered) {
arrowColor = sScrollbarArrowColorHover;
} else {
arrowColor = sScrollbarArrowColor;
}
PaintArrow(aDrawTarget, aRect, arrowPolygonX, arrowPolygonY, arrowNumPoints,
arrowSize, arrowColor,
arrowSize,
isActive
? sScrollbarArrowColorActive
: isHovered ? sScrollbarArrowColorHover : sScrollbarArrowColor,
aDpiRatio);
// FIXME(heycam): We should probably derive the border color when custom
// scrollbar colors are in use too. But for now, just skip painting it,
// to avoid ugliness.
if (!hasCustomColor) {
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
builder->MoveTo(Point(aRect.x, aRect.y));
if (aAppearance == StyleAppearance::ScrollbarbuttonUp ||
aAppearance == StyleAppearance::ScrollbarbuttonDown) {
builder->LineTo(Point(aRect.x, aRect.y + aRect.height));
} else {
builder->LineTo(Point(aRect.x + aRect.width, aRect.y));
}
RefPtr<Path> path = builder->Finish();
aDrawTarget->Stroke(path, ColorPattern(ToDeviceColor(sScrollbarBorderColor)),
StrokeOptions(1.0f * aDpiRatio));
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
builder->MoveTo(Point(aRect.x, aRect.y));
if (aAppearance == StyleAppearance::ScrollbarbuttonUp ||
aAppearance == StyleAppearance::ScrollbarbuttonDown) {
builder->LineTo(Point(aRect.x, aRect.y + aRect.height));
} else {
builder->LineTo(Point(aRect.x + aRect.width, aRect.y));
}
RefPtr<Path> path = builder->Finish();
aDrawTarget->Stroke(path, ColorPattern(ToDeviceColor(sScrollbarBorderColor)),
StrokeOptions(1.0f * aDpiRatio));
}
// Checks whether the frame is for a root <scrollbar> or <scrollcorner>, which
@ -1086,7 +999,6 @@ nsNativeBasicTheme::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
DrawTarget* dt = aContext->GetDrawTarget();
const nscoord twipsPerPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
EventStates eventState = GetContentState(aFrame, aAppearance);
EventStates docState = aFrame->GetContent()->OwnerDoc()->GetDocumentState();
Rect devPxRect = NSRectToSnappedRect(aRect, twipsPerPixel, *dt);
if (aAppearance == StyleAppearance::MozMenulistArrowButton) {
@ -1162,33 +1074,24 @@ nsNativeBasicTheme::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
PaintMeterchunk(aFrame, dt, devPxRect, eventState, dpiRatio);
break;
case StyleAppearance::ScrollbarthumbHorizontal:
PaintScrollbarthumbHorizontal(dt, devPxRect,
*nsLayoutUtils::StyleForScrollbar(aFrame),
eventState, docState);
PaintScrollbarthumbHorizontal(dt, devPxRect, eventState);
break;
case StyleAppearance::ScrollbarthumbVertical:
PaintScrollbarthumbVertical(dt, devPxRect,
*nsLayoutUtils::StyleForScrollbar(aFrame),
eventState, docState);
PaintScrollbarthumbVertical(dt, devPxRect, eventState);
break;
case StyleAppearance::ScrollbarHorizontal:
PaintScrollbarHorizontal(dt, devPxRect,
*nsLayoutUtils::StyleForScrollbar(aFrame),
docState, IsRootScrollbar(aFrame));
PaintScrollbarHorizontal(dt, devPxRect, IsRootScrollbar(aFrame));
break;
case StyleAppearance::ScrollbarVertical:
case StyleAppearance::Scrollcorner:
PaintScrollbarVerticalAndCorner(
dt, devPxRect, *nsLayoutUtils::StyleForScrollbar(aFrame), docState,
dpiRatio, IsRootScrollbar(aFrame));
PaintScrollbarVerticalAndCorner(dt, devPxRect, dpiRatio,
IsRootScrollbar(aFrame));
break;
case StyleAppearance::ScrollbarbuttonUp:
case StyleAppearance::ScrollbarbuttonDown:
case StyleAppearance::ScrollbarbuttonLeft:
case StyleAppearance::ScrollbarbuttonRight:
PaintScrollbarbutton(dt, aAppearance, devPxRect,
*nsLayoutUtils::StyleForScrollbar(aFrame),
eventState, docState, dpiRatio);
PaintScrollbarbutton(dt, aAppearance, devPxRect, eventState, dpiRatio);
break;
case StyleAppearance::Button:
PaintButton(aFrame, dt, devPxRect, eventState, dpiRatio);
@ -1365,31 +1268,6 @@ nsNativeBasicTheme::GetMinimumWidgetSize(nsPresContext* aPresContext,
aResult->width =
static_cast<uint32_t>(kMinimumSpinnerButtonWidth) * dpiRatio;
break;
case StyleAppearance::Scrollbar:
case StyleAppearance::ScrollbarSmall:
case StyleAppearance::ScrollbarVertical:
case StyleAppearance::ScrollbarHorizontal:
case StyleAppearance::ScrollbarbuttonUp:
case StyleAppearance::ScrollbarbuttonDown:
case StyleAppearance::ScrollbarbuttonLeft:
case StyleAppearance::ScrollbarbuttonRight:
case StyleAppearance::ScrollbarthumbVertical:
case StyleAppearance::ScrollbarthumbHorizontal:
case StyleAppearance::ScrollbartrackHorizontal:
case StyleAppearance::ScrollbartrackVertical:
case StyleAppearance::Scrollcorner: {
ComputedStyle* style = nsLayoutUtils::StyleForScrollbar(aFrame);
if (style->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::Thin) {
aResult->SizeTo(
static_cast<uint32_t>(kMinimumThinScrollbarSize) * dpiRatio,
static_cast<uint32_t>(kMinimumThinScrollbarSize) * dpiRatio);
} else {
aResult->SizeTo(
static_cast<uint32_t>(kMinimumScrollbarSize) * dpiRatio,
static_cast<uint32_t>(kMinimumScrollbarSize) * dpiRatio);
}
break;
}
default:
break;
}
@ -1434,9 +1312,8 @@ nsNativeBasicTheme::WidgetStateChanged(nsIFrame* aFrame,
NS_IMETHODIMP
nsNativeBasicTheme::ThemeChanged() { return NS_OK; }
bool nsNativeBasicTheme::WidgetAppearanceDependsOnWindowFocus(
StyleAppearance aAppearance) {
return IsWidgetScrollbarPart(aAppearance);
bool nsNativeBasicTheme::WidgetAppearanceDependsOnWindowFocus(StyleAppearance) {
return false;
}
nsITheme::ThemeGeometryType nsNativeBasicTheme::ThemeGeometryTypeForWidget(
@ -1447,6 +1324,16 @@ nsITheme::ThemeGeometryType nsNativeBasicTheme::ThemeGeometryTypeForWidget(
bool nsNativeBasicTheme::ThemeSupportsWidget(nsPresContext* aPresContext,
nsIFrame* aFrame,
StyleAppearance aAppearance) {
if (IsWidgetScrollbarPart(aAppearance)) {
const auto* style = nsLayoutUtils::StyleForScrollbar(aFrame);
// We don't currently handle custom scrollbars on nsNativeBasicTheme. We
// could, potentially.
if (style->StyleUI()->HasCustomScrollbars() ||
style->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::Thin) {
return false;
}
}
switch (aAppearance) {
case StyleAppearance::Radio:
case StyleAppearance::Checkbox:

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

@ -103,8 +103,6 @@ static const gfx::sRGBColor sScrollbarButtonHoverColor(gfx::sRGBColor(0.86f,
0.86f));
static const CSSIntCoord kMinimumWidgetSize = 14;
static const CSSIntCoord kMinimumScrollbarSize = 14;
static const CSSIntCoord kMinimumThinScrollbarSize = 6;
static const CSSIntCoord kMinimumColorPickerHeight = 32;
static const CSSIntCoord kMinimumRangeThumbSize = 20;
static const CSSIntCoord kMinimumDropdownArrowButtonWidth = 18;
@ -257,12 +255,6 @@ class nsNativeBasicTheme : protected nsNativeTheme, public nsITheme {
const EventStates& aState);
static std::pair<sRGBColor, sRGBColor> ComputeRangeThumbColors(
const EventStates& aState);
static sRGBColor ComputeScrollbarColor(const ComputedStyle& aStyle,
const EventStates& aDocumentState,
bool aIsRoot);
static sRGBColor ComputeScrollbarthumbColor(
const ComputedStyle& aStyle, const EventStates& aState,
const EventStates& aDocumentState);
static void PaintListbox(DrawTarget* aDrawTarget, const Rect& aRect,
const EventStates& aState, uint32_t aDpiRatio);
static void PaintMenulist(DrawTarget* aDrawTarget, const Rect& aRect,
@ -305,26 +297,21 @@ class nsNativeBasicTheme : protected nsNativeTheme, public nsITheme {
virtual void PaintScrollbarthumbHorizontal(DrawTarget* aDrawTarget,
const Rect& aRect,
const ComputedStyle& aStyle,
const EventStates& aElementState,
const EventStates& aDocumentState);
const EventStates& aState);
virtual void PaintScrollbarthumbVertical(DrawTarget* aDrawTarget,
const Rect& aRect,
const ComputedStyle& aStyle,
const EventStates& aElementState,
const EventStates& aDocumentState);
const EventStates& aState);
virtual void PaintScrollbarHorizontal(DrawTarget* aDrawTarget,
const Rect& aRect,
const ComputedStyle& aStyle,
const EventStates& aDocumentState,
bool aIsRoot);
virtual void PaintScrollbarVerticalAndCorner(
DrawTarget* aDrawTarget, const Rect& aRect, const ComputedStyle& aStyle,
const EventStates& aDocumentState, uint32_t aDpiRatio, bool aIsRoot);
virtual void PaintScrollbarbutton(
DrawTarget* aDrawTarget, StyleAppearance aAppearance, const Rect& aRect,
const ComputedStyle& aStyle, const EventStates& aElementState,
const EventStates& aDocumentState, uint32_t aDpiRatio);
const Rect& aRect, bool aIsRoot);
virtual void PaintScrollbarVerticalAndCorner(DrawTarget* aDrawTarget,
const Rect& aRect,
uint32_t aDpiRatio,
bool aIsRoot);
virtual void PaintScrollbarbutton(DrawTarget* aDrawTarget,
StyleAppearance aAppearance,
const Rect& aRect,
const EventStates& aState,
uint32_t aDpiRatio);
};
#endif

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

@ -146,11 +146,6 @@ const char nsXPLookAndFeel::sColorPrefs[][41] = {
"ui.IMESelectedConvertedTextForeground",
"ui.IMESelectedConvertedTextUnderline",
"ui.SpellCheckerUnderline",
"ui.scrollbarInactive",
"ui.scrollbarThumb",
"ui.scrollbarThumbHover",
"ui.scrollbarThumbActive",
"ui.scrollbarThumbInactive",
"ui.activeborder",
"ui.activecaption",
"ui.appworkspace",
@ -1009,10 +1004,6 @@ LookAndFeelCache nsXPLookAndFeel::GetCacheImpl() { return LookAndFeelCache{}; }
static bool sRecordedLookAndFeelTelemetry = false;
void nsXPLookAndFeel::RecordTelemetry() {
if (!XRE_IsParentProcess()) {
return;
}
if (sRecordedLookAndFeelTelemetry) {
return;
}
@ -1023,8 +1014,6 @@ void nsXPLookAndFeel::RecordTelemetry() {
Telemetry::ScalarSet(
Telemetry::ScalarID::WIDGET_DARK_MODE,
NS_SUCCEEDED(GetIntImpl(IntID::SystemUsesDarkTheme, i)) && i != 0);
RecordLookAndFeelSpecificTelemetry();
}
namespace mozilla {
@ -1100,4 +1089,4 @@ void LookAndFeel::SetCache(const LookAndFeelCache& aCache) {
nsLookAndFeel::GetInstance()->SetCacheImpl(aCache);
}
} // namespace mozilla
} // namespace mozilla

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

@ -91,7 +91,6 @@ class nsXPLookAndFeel : public mozilla::LookAndFeel {
bool ColorIsNotCSSAccessible(ColorID aID);
nscolor GetStandinForNativeColor(ColorID aID);
void RecordTelemetry();
virtual void RecordLookAndFeelSpecificTelemetry() {}
static void OnPrefChanged(const char* aPref, void* aClosure);