mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Backed out changeset 82faf6a9be50 (bug 1578133) for failure increase in Bug 1352715
This commit is contained in:
parent
0b76713b25
commit
7620adca7a
@ -359,6 +359,7 @@ void nsLayoutStatics::Shutdown() {
|
||||
nsCSSKeywords::ReleaseTable();
|
||||
nsRepeatService::Shutdown();
|
||||
nsStackLayout::Shutdown();
|
||||
nsBox::Shutdown();
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
nsXULContentUtils::Finish();
|
||||
|
@ -54,9 +54,18 @@ nsresult nsBox::EndXULLayout(nsBoxLayoutState& aState) {
|
||||
return SyncLayout(aState);
|
||||
}
|
||||
|
||||
bool nsBox::gGotTheme = false;
|
||||
StaticRefPtr<nsITheme> nsBox::gTheme;
|
||||
|
||||
nsBox::nsBox(ComputedStyle* aStyle, nsPresContext* aPresContext, ClassID aID)
|
||||
: nsIFrame(aStyle, aPresContext, aID) {
|
||||
MOZ_COUNT_CTOR(nsBox);
|
||||
if (!gGotTheme) {
|
||||
gTheme = do_GetNativeTheme();
|
||||
if (gTheme) {
|
||||
gGotTheme = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsBox::~nsBox() {
|
||||
@ -65,6 +74,12 @@ nsBox::~nsBox() {
|
||||
MOZ_COUNT_DTOR(nsBox);
|
||||
}
|
||||
|
||||
/* static */
|
||||
void nsBox::Shutdown() {
|
||||
gGotTheme = false;
|
||||
gTheme = nullptr;
|
||||
}
|
||||
|
||||
nsresult nsBox::XULRelayoutChildAtOrdinal(nsIFrame* aChild) { return NS_OK; }
|
||||
|
||||
nsresult nsIFrame::GetXULClientRect(nsRect& aClientRect) {
|
||||
@ -128,17 +143,15 @@ nsresult nsBox::GetXULBorder(nsMargin& aMargin) {
|
||||
aMargin.SizeTo(0, 0, 0, 0);
|
||||
|
||||
const nsStyleDisplay* disp = StyleDisplay();
|
||||
if (disp->HasAppearance()) {
|
||||
if (disp->HasAppearance() && gTheme) {
|
||||
// Go to the theme for the border.
|
||||
nsPresContext* context = PresContext();
|
||||
if (nsITheme* theme = context->GetTheme()) {
|
||||
// Go to the theme for the border.
|
||||
if (theme->ThemeSupportsWidget(context, this, disp->mAppearance)) {
|
||||
LayoutDeviceIntMargin margin = theme->GetWidgetBorder(
|
||||
context->DeviceContext(), this, disp->mAppearance);
|
||||
aMargin = LayoutDevicePixel::ToAppUnits(margin,
|
||||
context->AppUnitsPerDevPixel());
|
||||
return NS_OK;
|
||||
}
|
||||
if (gTheme->ThemeSupportsWidget(context, this, disp->mAppearance)) {
|
||||
LayoutDeviceIntMargin margin = gTheme->GetWidgetBorder(
|
||||
context->DeviceContext(), this, disp->mAppearance);
|
||||
aMargin =
|
||||
LayoutDevicePixel::ToAppUnits(margin, context->AppUnitsPerDevPixel());
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,19 +162,17 @@ nsresult nsBox::GetXULBorder(nsMargin& aMargin) {
|
||||
|
||||
nsresult nsBox::GetXULPadding(nsMargin& aPadding) {
|
||||
const nsStyleDisplay* disp = StyleDisplay();
|
||||
if (disp->HasAppearance()) {
|
||||
if (disp->HasAppearance() && gTheme) {
|
||||
// Go to the theme for the padding.
|
||||
nsPresContext* context = PresContext();
|
||||
if (nsITheme* theme = context->GetTheme()) {
|
||||
// Go to the theme for the padding.
|
||||
if (theme->ThemeSupportsWidget(context, this, disp->mAppearance)) {
|
||||
LayoutDeviceIntMargin padding;
|
||||
bool useThemePadding = theme->GetWidgetPadding(
|
||||
context->DeviceContext(), this, disp->mAppearance, &padding);
|
||||
if (useThemePadding) {
|
||||
aPadding = LayoutDevicePixel::ToAppUnits(
|
||||
padding, context->AppUnitsPerDevPixel());
|
||||
return NS_OK;
|
||||
}
|
||||
if (gTheme->ThemeSupportsWidget(context, this, disp->mAppearance)) {
|
||||
LayoutDeviceIntMargin padding;
|
||||
bool useThemePadding = gTheme->GetWidgetPadding(
|
||||
context->DeviceContext(), this, disp->mAppearance, &padding);
|
||||
if (useThemePadding) {
|
||||
aPadding = LayoutDevicePixel::ToAppUnits(
|
||||
padding, context->AppUnitsPerDevPixel());
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,14 @@
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
class nsITheme;
|
||||
|
||||
class nsBox : public nsIFrame {
|
||||
public:
|
||||
friend class nsIFrame;
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
|
||||
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
|
||||
virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
|
||||
@ -78,6 +82,9 @@ class nsBox : public nsIFrame {
|
||||
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||
nsresult EndXULLayout(nsBoxLayoutState& aState);
|
||||
|
||||
static bool gGotTheme;
|
||||
static mozilla::StaticRefPtr<nsITheme> gTheme;
|
||||
|
||||
enum eMouseThrough { unset, never, always };
|
||||
};
|
||||
|
||||
|
@ -260,9 +260,9 @@ void nsImageBoxFrame::UpdateImage() {
|
||||
// Only get the list-style-image if we aren't being drawn
|
||||
// by a native theme.
|
||||
auto* display = StyleDisplay();
|
||||
nsITheme* theme;
|
||||
if (!(display->HasAppearance() && (theme = presContext->GetTheme()) &&
|
||||
theme->ThemeSupportsWidget(nullptr, this, display->mAppearance))) {
|
||||
if (!(display->HasAppearance() && nsBox::gTheme &&
|
||||
nsBox::gTheme->ThemeSupportsWidget(nullptr, this,
|
||||
display->mAppearance))) {
|
||||
// get the list-style-image
|
||||
imgRequestProxy* styleRequest = StyleList()->GetListStyleImage();
|
||||
if (styleRequest) {
|
||||
@ -624,9 +624,8 @@ void nsImageBoxFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
|
||||
|
||||
// If we're using a native theme implementation, we shouldn't draw anything.
|
||||
const nsStyleDisplay* disp = StyleDisplay();
|
||||
nsITheme* theme;
|
||||
if (disp->HasAppearance() && (theme = PresContext()->GetTheme()) &&
|
||||
theme->ThemeSupportsWidget(nullptr, this, disp->mAppearance))
|
||||
if (disp->HasAppearance() && nsBox::gTheme &&
|
||||
nsBox::gTheme->ThemeSupportsWidget(nullptr, this, disp->mAppearance))
|
||||
return;
|
||||
|
||||
// If list-style-image changes, we have a new image.
|
||||
|
Loading…
Reference in New Issue
Block a user