mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-06 16:51:46 +00:00
Bug 1619664 - Rename and don't null-check nsPresContext::GetTheme as it can't return null. r=dholbert
There were some callers in nsRangeFrame that were already not-null-checking. All platforms have a native theme and should we add new ones they could use nsBasicNativeTheme. Differential Revision: https://phabricator.services.mozilla.com/D65169 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
741c54ae79
commit
46d1624d9d
@ -221,9 +221,9 @@ class nsITheme : public nsISupports {
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsITheme, NS_ITHEME_IID)
|
||||
|
||||
// Singleton accessor function
|
||||
// Singleton accessor functions, these should never return null.
|
||||
//
|
||||
// Do not use directly, use nsPresContext::GetTheme instead.
|
||||
// Do not use directly, use nsPresContext::Theme instead.
|
||||
extern already_AddRefed<nsITheme> do_GetNativeThemeDoNotUseDirectly();
|
||||
extern already_AddRefed<nsITheme> do_GetBasicNativeThemeDoNotUseDirectly();
|
||||
|
||||
|
@ -507,9 +507,8 @@ static nsChangeHint ChangeForContentStateChange(const Element& aElement,
|
||||
auto* disp = primaryFrame->StyleDisplay();
|
||||
if (disp->HasAppearance()) {
|
||||
nsPresContext* pc = primaryFrame->PresContext();
|
||||
nsITheme* theme = pc->GetTheme();
|
||||
if (theme &&
|
||||
theme->ThemeSupportsWidget(pc, primaryFrame, disp->mAppearance)) {
|
||||
nsITheme* theme = pc->Theme();
|
||||
if (theme->ThemeSupportsWidget(pc, primaryFrame, disp->mAppearance)) {
|
||||
bool repaint = false;
|
||||
theme->WidgetStateChanged(primaryFrame, disp->mAppearance, nullptr,
|
||||
&repaint, nullptr);
|
||||
@ -3373,9 +3372,9 @@ void RestyleManager::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
|
||||
// See if we have appearance information for a theme.
|
||||
const nsStyleDisplay* disp = primaryFrame->StyleDisplay();
|
||||
if (disp->HasAppearance()) {
|
||||
nsITheme* theme = PresContext()->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(PresContext(), primaryFrame,
|
||||
disp->mAppearance)) {
|
||||
nsITheme* theme = PresContext()->Theme();
|
||||
if (theme->ThemeSupportsWidget(PresContext(), primaryFrame,
|
||||
disp->mAppearance)) {
|
||||
bool repaint = false;
|
||||
theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute,
|
||||
&repaint, aOldValue);
|
||||
|
@ -5333,8 +5333,8 @@ static nscoord AddIntrinsicSizeOffset(
|
||||
LayoutDeviceIntSize devSize;
|
||||
bool canOverride = true;
|
||||
nsPresContext* pc = aFrame->PresContext();
|
||||
pc->GetTheme()->GetMinimumWidgetSize(pc, aFrame, disp->mAppearance,
|
||||
&devSize, &canOverride);
|
||||
pc->Theme()->GetMinimumWidgetSize(pc, aFrame, disp->mAppearance, &devSize,
|
||||
&canOverride);
|
||||
nscoord themeSize = pc->DevPixelsToAppUnits(
|
||||
aAxis == eAxisVertical ? devSize.height : devSize.width);
|
||||
// GetMinimumWidgetSize() returns a border-box width.
|
||||
@ -8435,9 +8435,9 @@ nsRect nsLayoutUtils::GetBoxShadowRectForFrame(nsIFrame* aFrame,
|
||||
// border-box path with border-radius disabled.
|
||||
if (transparency != nsITheme::eOpaque) {
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
presContext->GetTheme()->GetWidgetOverflow(
|
||||
presContext->DeviceContext(), aFrame, styleDisplay->mAppearance,
|
||||
&inputRect);
|
||||
presContext->Theme()->GetWidgetOverflow(presContext->DeviceContext(),
|
||||
aFrame, styleDisplay->mAppearance,
|
||||
&inputRect);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,10 +332,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsPresContext)
|
||||
tmp->Destroy();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
// whether no native theme service exists;
|
||||
// if this gets set to true, we'll stop asking for it.
|
||||
static bool sNoTheme = false;
|
||||
|
||||
// Set to true when LookAndFeelChanged needs to be called. This is used
|
||||
// because the look and feel is a service, so there's no need to notify it from
|
||||
// more than one prescontext.
|
||||
@ -1274,17 +1270,15 @@ void nsPresContext::RecordInteractionTime(InteractionType aType,
|
||||
}
|
||||
}
|
||||
|
||||
nsITheme* nsPresContext::GetTheme() {
|
||||
if (!sNoTheme && !mTheme) {
|
||||
if (StaticPrefs::widget_disable_native_theme_for_content() &&
|
||||
(!IsChrome() || XRE_IsContentProcess())) {
|
||||
mTheme = do_GetBasicNativeThemeDoNotUseDirectly();
|
||||
} else {
|
||||
mTheme = do_GetNativeThemeDoNotUseDirectly();
|
||||
}
|
||||
if (!mTheme) sNoTheme = true;
|
||||
nsITheme* nsPresContext::EnsureTheme() {
|
||||
MOZ_ASSERT(!mTheme);
|
||||
if (StaticPrefs::widget_disable_native_theme_for_content() &&
|
||||
(!IsChrome() || XRE_IsContentProcess())) {
|
||||
mTheme = do_GetBasicNativeThemeDoNotUseDirectly();
|
||||
} else {
|
||||
mTheme = do_GetNativeThemeDoNotUseDirectly();
|
||||
}
|
||||
|
||||
MOZ_RELEASE_ASSERT(mTheme);
|
||||
return mTheme;
|
||||
}
|
||||
|
||||
|
@ -752,10 +752,17 @@ class nsPresContext : public nsISupports,
|
||||
uint32_t GetBidi() const;
|
||||
|
||||
/*
|
||||
* Obtain a native them for rendering our widgets (both form controls and
|
||||
* Obtain a native theme for rendering our widgets (both form controls and
|
||||
* html)
|
||||
*
|
||||
* Guaranteed to return non-null.
|
||||
*/
|
||||
nsITheme* GetTheme();
|
||||
nsITheme* Theme() MOZ_NONNULL_RETURN {
|
||||
if (MOZ_LIKELY(mTheme)) {
|
||||
return mTheme;
|
||||
}
|
||||
return EnsureTheme();
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify the pres context that the theme has changed. An internal switch
|
||||
@ -1320,6 +1327,8 @@ class nsPresContext : public nsISupports,
|
||||
|
||||
void LastRelease();
|
||||
|
||||
nsITheme* EnsureTheme();
|
||||
|
||||
#ifdef DEBUG
|
||||
private:
|
||||
friend struct nsAutoLayoutPhase;
|
||||
|
@ -340,7 +340,7 @@ void nsDisplayButtonForeground::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
const nsStyleDisplay* disp = mFrame->StyleDisplay();
|
||||
if (!mFrame->IsThemed(disp) ||
|
||||
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
|
||||
!presContext->Theme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
|
||||
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
|
||||
// Draw the -moz-focus-inner border
|
||||
@ -362,7 +362,7 @@ bool nsDisplayButtonForeground::CreateWebRenderCommands(
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
const nsStyleDisplay* disp = mFrame->StyleDisplay();
|
||||
if (!mFrame->IsThemed(disp) ||
|
||||
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
|
||||
!presContext->Theme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
|
||||
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
br = mBFR->CreateInnerFocusBorderRenderer(aDisplayListBuilder, presContext,
|
||||
nullptr, GetPaintRect(), r,
|
||||
|
@ -700,7 +700,7 @@ bool nsComboboxControlFrame::HasDropDownButton() const {
|
||||
const nsStyleDisplay* disp = StyleDisplay();
|
||||
return disp->mAppearance == StyleAppearance::Menulist &&
|
||||
(!IsThemed(disp) ||
|
||||
PresContext()->GetTheme()->ThemeNeedsComboboxDropmarker());
|
||||
PresContext()->Theme()->ThemeNeedsComboboxDropmarker());
|
||||
}
|
||||
|
||||
nscoord nsComboboxControlFrame::GetIntrinsicISize(
|
||||
@ -1496,9 +1496,8 @@ void nsComboboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
if (window && window->ShouldShowFocusRing()) {
|
||||
nsPresContext* presContext = PresContext();
|
||||
const nsStyleDisplay* disp = StyleDisplay();
|
||||
if ((!IsThemed(disp) ||
|
||||
!presContext->GetTheme()->ThemeDrawsFocusForWidget(
|
||||
disp->mAppearance)) &&
|
||||
if ((!IsThemed(disp) || !presContext->Theme()->ThemeDrawsFocusForWidget(
|
||||
disp->mAppearance)) &&
|
||||
mDisplayFrame && IsVisibleForPainting()) {
|
||||
aLists.Content()->AppendNewToTop<nsDisplayComboboxFocus>(aBuilder,
|
||||
this);
|
||||
|
@ -262,7 +262,7 @@ void nsRangeFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
if (IsThemed(disp) &&
|
||||
PresContext()->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
|
||||
PresContext()->Theme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
|
||||
return; // the native theme displays its own visual indication of focus
|
||||
}
|
||||
|
||||
@ -514,9 +514,9 @@ Decimal nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent) {
|
||||
nsPresContext* presContext = PresContext();
|
||||
bool notUsedCanOverride;
|
||||
LayoutDeviceIntSize size;
|
||||
presContext->GetTheme()->GetMinimumWidgetSize(presContext, this,
|
||||
StyleAppearance::RangeThumb,
|
||||
&size, ¬UsedCanOverride);
|
||||
presContext->Theme()->GetMinimumWidgetSize(presContext, this,
|
||||
StyleAppearance::RangeThumb,
|
||||
&size, ¬UsedCanOverride);
|
||||
thumbSize.width = presContext->DevPixelsToAppUnits(size.width);
|
||||
thumbSize.height = presContext->DevPixelsToAppUnits(size.height);
|
||||
// For GTK, GetMinimumWidgetSize returns zero for the thumb dimension
|
||||
@ -723,8 +723,8 @@ nscoord nsRangeFrame::AutoCrossSize(nscoord aEm) {
|
||||
bool unused;
|
||||
LayoutDeviceIntSize size;
|
||||
nsPresContext* pc = PresContext();
|
||||
pc->GetTheme()->GetMinimumWidgetSize(pc, this, StyleAppearance::RangeThumb,
|
||||
&size, &unused);
|
||||
pc->Theme()->GetMinimumWidgetSize(pc, this, StyleAppearance::RangeThumb,
|
||||
&size, &unused);
|
||||
minCrossSize =
|
||||
pc->DevPixelsToAppUnits(IsHorizontal() ? size.height : size.width);
|
||||
}
|
||||
|
@ -2551,7 +2551,7 @@ void SizeComputationInput::InitOffsets(WritingMode aWM, nscoord aPercentBasis,
|
||||
bool isThemed = mFrame->IsThemed(disp);
|
||||
bool needPaddingProp;
|
||||
LayoutDeviceIntMargin widgetPadding;
|
||||
if (isThemed && presContext->GetTheme()->GetWidgetPadding(
|
||||
if (isThemed && presContext->Theme()->GetWidgetPadding(
|
||||
presContext->DeviceContext(), mFrame, disp->mAppearance,
|
||||
&widgetPadding)) {
|
||||
ComputedPhysicalPadding() = LayoutDevicePixel::ToAppUnits(
|
||||
@ -2602,7 +2602,7 @@ void SizeComputationInput::InitOffsets(WritingMode aWM, nscoord aPercentBasis,
|
||||
}
|
||||
|
||||
if (isThemed) {
|
||||
LayoutDeviceIntMargin border = presContext->GetTheme()->GetWidgetBorder(
|
||||
LayoutDeviceIntMargin border = presContext->Theme()->GetWidgetBorder(
|
||||
presContext->DeviceContext(), mFrame, disp->mAppearance);
|
||||
ComputedPhysicalBorderPadding() = LayoutDevicePixel::ToAppUnits(
|
||||
border, presContext->AppUnitsPerDevPixel());
|
||||
|
@ -1303,9 +1303,9 @@ UniquePtr<FlexItem> nsFlexContainerFrame::GenerateFlexItemForChild(
|
||||
if (aChildFrame->IsThemed(disp)) {
|
||||
LayoutDeviceIntSize widgetMinSize;
|
||||
bool canOverride = true;
|
||||
PresContext()->GetTheme()->GetMinimumWidgetSize(
|
||||
PresContext(), aChildFrame, disp->mAppearance, &widgetMinSize,
|
||||
&canOverride);
|
||||
PresContext()->Theme()->GetMinimumWidgetSize(PresContext(), aChildFrame,
|
||||
disp->mAppearance,
|
||||
&widgetMinSize, &canOverride);
|
||||
|
||||
nscoord widgetMainMinSize = PresContext()->DevPixelsToAppUnits(
|
||||
aAxisTracker.MainComponent(widgetMinSize));
|
||||
|
@ -1596,7 +1596,7 @@ nsMargin nsIFrame::GetUsedBorder() const {
|
||||
const nsStyleDisplay* disp = StyleDisplay();
|
||||
if (mutable_this->IsThemed(disp)) {
|
||||
nsPresContext* pc = PresContext();
|
||||
LayoutDeviceIntMargin widgetBorder = pc->GetTheme()->GetWidgetBorder(
|
||||
LayoutDeviceIntMargin widgetBorder = pc->Theme()->GetWidgetBorder(
|
||||
pc->DeviceContext(), mutable_this, disp->mAppearance);
|
||||
border =
|
||||
LayoutDevicePixel::ToAppUnits(widgetBorder, pc->AppUnitsPerDevPixel());
|
||||
@ -1626,8 +1626,8 @@ nsMargin nsIFrame::GetUsedPadding() const {
|
||||
if (mutable_this->IsThemed(disp)) {
|
||||
nsPresContext* pc = PresContext();
|
||||
LayoutDeviceIntMargin widgetPadding;
|
||||
if (pc->GetTheme()->GetWidgetPadding(pc->DeviceContext(), mutable_this,
|
||||
disp->mAppearance, &widgetPadding)) {
|
||||
if (pc->Theme()->GetWidgetPadding(pc->DeviceContext(), mutable_this,
|
||||
disp->mAppearance, &widgetPadding)) {
|
||||
return LayoutDevicePixel::ToAppUnits(widgetPadding,
|
||||
pc->AppUnitsPerDevPixel());
|
||||
}
|
||||
@ -4121,7 +4121,7 @@ void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
|
||||
// REVIEW: Taken from nsBoxFrame::Paint
|
||||
// Don't paint our children if the theme object is a leaf.
|
||||
if (IsThemed(ourDisp) &&
|
||||
!PresContext()->GetTheme()->WidgetIsContainer(ourDisp->mAppearance))
|
||||
!PresContext()->Theme()->WidgetIsContainer(ourDisp->mAppearance))
|
||||
return;
|
||||
|
||||
// Since we're now sure that we're adding this frame to the display list
|
||||
@ -5905,15 +5905,15 @@ static nsIFrame::IntrinsicSizeOffsetData IntrinsicSizeOffsets(
|
||||
if (aFrame->IsThemed(disp)) {
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
|
||||
LayoutDeviceIntMargin border = presContext->GetTheme()->GetWidgetBorder(
|
||||
LayoutDeviceIntMargin border = presContext->Theme()->GetWidgetBorder(
|
||||
presContext->DeviceContext(), aFrame, disp->mAppearance);
|
||||
result.border = presContext->DevPixelsToAppUnits(
|
||||
verticalAxis ? border.TopBottom() : border.LeftRight());
|
||||
|
||||
LayoutDeviceIntMargin padding;
|
||||
if (presContext->GetTheme()->GetWidgetPadding(presContext->DeviceContext(),
|
||||
aFrame, disp->mAppearance,
|
||||
&padding)) {
|
||||
if (presContext->Theme()->GetWidgetPadding(presContext->DeviceContext(),
|
||||
aFrame, disp->mAppearance,
|
||||
&padding)) {
|
||||
result.padding = presContext->DevPixelsToAppUnits(
|
||||
verticalAxis ? padding.TopBottom() : padding.LeftRight());
|
||||
}
|
||||
@ -6170,7 +6170,7 @@ LogicalSize nsFrame::ComputeSize(gfxContext* aRenderingContext, WritingMode aWM,
|
||||
LayoutDeviceIntSize widget;
|
||||
bool canOverride = true;
|
||||
nsPresContext* presContext = PresContext();
|
||||
presContext->GetTheme()->GetMinimumWidgetSize(
|
||||
presContext->Theme()->GetMinimumWidgetSize(
|
||||
presContext, this, disp->mAppearance, &widget, &canOverride);
|
||||
|
||||
// Convert themed widget's physical dimensions to logical coords
|
||||
@ -9553,9 +9553,9 @@ static void ComputeAndIncludeOutlineArea(nsIFrame* aFrame,
|
||||
useOutlineAuto = outline->mOutlineStyle.IsAuto();
|
||||
if (MOZ_UNLIKELY(useOutlineAuto)) {
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
nsITheme* theme = presContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(presContext, aFrame,
|
||||
StyleAppearance::FocusOutline)) {
|
||||
nsITheme* theme = presContext->Theme();
|
||||
if (theme->ThemeSupportsWidget(presContext, aFrame,
|
||||
StyleAppearance::FocusOutline)) {
|
||||
outerRect.Inflate(offset);
|
||||
theme->GetWidgetOverflow(presContext->DeviceContext(), aFrame,
|
||||
StyleAppearance::FocusOutline, &outerRect);
|
||||
@ -9694,8 +9694,8 @@ bool nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
|
||||
if (!::IsXULBoxWrapped(this) && IsThemed(disp)) {
|
||||
nsRect r(bounds);
|
||||
nsPresContext* presContext = PresContext();
|
||||
if (presContext->GetTheme()->GetWidgetOverflow(
|
||||
presContext->DeviceContext(), this, disp->mAppearance, &r)) {
|
||||
if (presContext->Theme()->GetWidgetOverflow(presContext->DeviceContext(),
|
||||
this, disp->mAppearance, &r)) {
|
||||
nsRect& vo = aOverflowAreas.VisualOverflow();
|
||||
vo.UnionRectEdges(vo, r);
|
||||
}
|
||||
|
@ -1335,9 +1335,8 @@ nscoord ScrollFrameHelper::GetNondisappearingScrollbarWidth(
|
||||
if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
|
||||
// We're using overlay scrollbars, so we need to get the width that
|
||||
// non-disappearing scrollbars would have.
|
||||
nsITheme* theme = aState->PresContext()->GetTheme();
|
||||
if (theme &&
|
||||
theme->ThemeSupportsWidget(aState->PresContext(),
|
||||
nsITheme* theme = aState->PresContext()->Theme();
|
||||
if (theme->ThemeSupportsWidget(aState->PresContext(),
|
||||
verticalWM ? mHScrollbarBox : mVScrollbarBox,
|
||||
StyleAppearance::ScrollbarNonDisappearing)) {
|
||||
LayoutDeviceIntSize size;
|
||||
|
@ -1699,10 +1699,10 @@ class nsIFrame : public nsQueryFrame {
|
||||
}
|
||||
nsIFrame* mutable_this = const_cast<nsIFrame*>(this);
|
||||
nsPresContext* pc = PresContext();
|
||||
nsITheme* theme = pc->GetTheme();
|
||||
if (!theme ||
|
||||
!theme->ThemeSupportsWidget(pc, mutable_this, aDisp->mAppearance))
|
||||
nsITheme* theme = pc->Theme();
|
||||
if (!theme->ThemeSupportsWidget(pc, mutable_this, aDisp->mAppearance)) {
|
||||
return false;
|
||||
}
|
||||
if (aTransparencyState) {
|
||||
*aTransparencyState =
|
||||
theme->GetWidgetTransparency(mutable_this, aDisp->mAppearance);
|
||||
|
@ -838,9 +838,9 @@ ImgDrawResult nsCSSRendering::PaintBorderWithStyleBorder(
|
||||
// passed in ComputedStyle may be different! Always use |aStyle|!
|
||||
const nsStyleDisplay* displayData = aStyle->StyleDisplay();
|
||||
if (displayData->HasAppearance()) {
|
||||
nsITheme* theme = aPresContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
displayData->mAppearance)) {
|
||||
nsITheme* theme = aPresContext->Theme();
|
||||
if (theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
displayData->mAppearance)) {
|
||||
return ImgDrawResult::SUCCESS; // Let the theme handle it.
|
||||
}
|
||||
}
|
||||
@ -926,9 +926,9 @@ nsCSSRendering::CreateNullBorderRendererWithStyleBorder(
|
||||
bool* aOutBorderIsEmpty, Sides aSkipSides) {
|
||||
const nsStyleDisplay* displayData = aStyle->StyleDisplay();
|
||||
if (displayData->HasAppearance()) {
|
||||
nsITheme* theme = aPresContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
displayData->mAppearance)) {
|
||||
nsITheme* theme = aPresContext->Theme();
|
||||
if (theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
displayData->mAppearance)) {
|
||||
return Nothing();
|
||||
}
|
||||
}
|
||||
@ -1020,9 +1020,9 @@ Maybe<nsCSSBorderRenderer> nsCSSRendering::CreateBorderRendererForOutline(
|
||||
StyleBorderStyle outlineStyle;
|
||||
if (ourOutline->mOutlineStyle.IsAuto()) {
|
||||
if (StaticPrefs::layout_css_outline_style_auto_enabled()) {
|
||||
nsITheme* theme = aPresContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
StyleAppearance::FocusOutline)) {
|
||||
nsITheme* theme = aPresContext->Theme();
|
||||
if (theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
StyleAppearance::FocusOutline)) {
|
||||
theme->DrawWidgetBackground(aRenderingContext, aForFrame,
|
||||
StyleAppearance::FocusOutline, innerRect,
|
||||
aDirtyRect);
|
||||
@ -1529,9 +1529,9 @@ void nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
|
||||
nsRect nativeRect = aDirtyRect;
|
||||
nativeRect.MoveBy(-shadowOffset);
|
||||
nativeRect.IntersectRect(frameRect, nativeRect);
|
||||
aPresContext->GetTheme()->DrawWidgetBackground(shadowContext, aForFrame,
|
||||
styleDisplay->mAppearance,
|
||||
aFrameArea, nativeRect);
|
||||
aPresContext->Theme()->DrawWidgetBackground(shadowContext, aForFrame,
|
||||
styleDisplay->mAppearance,
|
||||
aFrameArea, nativeRect);
|
||||
|
||||
blurringArea.DoPaint();
|
||||
aRenderingContext.Restore();
|
||||
@ -1874,9 +1874,9 @@ bool nsCSSRendering::CanBuildWebRenderDisplayItemsForStyleImageLayer(
|
||||
// We cannot draw native themed backgrounds
|
||||
const nsStyleDisplay* displayData = aFrame->StyleDisplay();
|
||||
if (displayData->HasAppearance()) {
|
||||
nsITheme* theme = aPresCtx.GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(&aPresCtx, aFrame,
|
||||
displayData->mAppearance)) {
|
||||
nsITheme* theme = aPresCtx.Theme();
|
||||
if (theme->ThemeSupportsWidget(&aPresCtx, aFrame,
|
||||
displayData->mAppearance)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -2448,9 +2448,9 @@ ImgDrawResult nsCSSRendering::PaintStyleImageLayerWithSC(
|
||||
// XXXzw this ignores aParams.bgClipRect.
|
||||
const nsStyleDisplay* displayData = aParams.frame->StyleDisplay();
|
||||
if (displayData->HasAppearance()) {
|
||||
nsITheme* theme = aParams.presCtx.GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(&aParams.presCtx, aParams.frame,
|
||||
displayData->mAppearance)) {
|
||||
nsITheme* theme = aParams.presCtx.Theme();
|
||||
if (theme->ThemeSupportsWidget(&aParams.presCtx, aParams.frame,
|
||||
displayData->mAppearance)) {
|
||||
nsRect drawing(aParams.borderArea);
|
||||
theme->GetWidgetOverflow(aParams.presCtx.DeviceContext(), aParams.frame,
|
||||
displayData->mAppearance, &drawing);
|
||||
|
@ -4188,7 +4188,7 @@ bool nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
}
|
||||
|
||||
if (isThemed) {
|
||||
nsITheme* theme = presContext->GetTheme();
|
||||
nsITheme* theme = presContext->Theme();
|
||||
if (theme->NeedToClearBackgroundBehindWidget(
|
||||
aFrame, aFrame->StyleDisplay()->mAppearance) &&
|
||||
aBuilder->IsInChromeDocumentOrPopup() && !aBuilder->IsInTransform()) {
|
||||
@ -4848,7 +4848,7 @@ void nsDisplayThemedBackground::Init(nsDisplayListBuilder* aBuilder) {
|
||||
StyleFrame()->IsThemed(disp, &mThemeTransparency);
|
||||
|
||||
// Perform necessary RegisterThemeGeometry
|
||||
nsITheme* theme = StyleFrame()->PresContext()->GetTheme();
|
||||
nsITheme* theme = StyleFrame()->PresContext()->Theme();
|
||||
nsITheme::ThemeGeometryType type =
|
||||
theme->ThemeGeometryTypeForWidget(StyleFrame(), disp->mAppearance);
|
||||
if (type != nsITheme::eThemeGeometryTypeUnknown) {
|
||||
@ -4913,7 +4913,7 @@ void nsDisplayThemedBackground::PaintInternal(nsDisplayListBuilder* aBuilder,
|
||||
nsRect* aClipRect) {
|
||||
// XXXzw this ignores aClipRect.
|
||||
nsPresContext* presContext = StyleFrame()->PresContext();
|
||||
nsITheme* theme = presContext->GetTheme();
|
||||
nsITheme* theme = presContext->Theme();
|
||||
nsRect drawing(mBackgroundRect);
|
||||
theme->GetWidgetOverflow(presContext->DeviceContext(), StyleFrame(),
|
||||
mAppearance, &drawing);
|
||||
@ -4928,7 +4928,7 @@ bool nsDisplayThemedBackground::CreateWebRenderCommands(
|
||||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) {
|
||||
nsITheme* theme = StyleFrame()->PresContext()->GetTheme();
|
||||
nsITheme* theme = StyleFrame()->PresContext()->Theme();
|
||||
return theme->CreateWebRenderCommandsForWidget(aBuilder, aResources, aSc,
|
||||
aManager, StyleFrame(),
|
||||
mAppearance, mBackgroundRect);
|
||||
@ -4958,7 +4958,7 @@ void nsDisplayThemedBackground::ComputeInvalidationRegion(
|
||||
// painting area.
|
||||
aInvalidRegion->Xor(bounds, geometry->mBounds);
|
||||
}
|
||||
nsITheme* theme = StyleFrame()->PresContext()->GetTheme();
|
||||
nsITheme* theme = StyleFrame()->PresContext()->Theme();
|
||||
if (theme->WidgetAppearanceDependsOnWindowFocus(mAppearance) &&
|
||||
IsWindowActive() != geometry->mWindowIsActive) {
|
||||
aInvalidRegion->Or(*aInvalidRegion, bounds);
|
||||
@ -4975,9 +4975,9 @@ nsRect nsDisplayThemedBackground::GetBoundsInternal() {
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
|
||||
nsRect r = mBackgroundRect - ToReferenceFrame();
|
||||
presContext->GetTheme()->GetWidgetOverflow(
|
||||
presContext->DeviceContext(), mFrame, mFrame->StyleDisplay()->mAppearance,
|
||||
&r);
|
||||
presContext->Theme()->GetWidgetOverflow(presContext->DeviceContext(), mFrame,
|
||||
mFrame->StyleDisplay()->mAppearance,
|
||||
&r);
|
||||
return r + ToReferenceFrame();
|
||||
}
|
||||
|
||||
@ -5404,9 +5404,8 @@ bool nsDisplayOutline::IsThemedOutline() const {
|
||||
}
|
||||
|
||||
nsPresContext* pc = mFrame->PresContext();
|
||||
nsITheme* theme = pc->GetTheme();
|
||||
return theme &&
|
||||
theme->ThemeSupportsWidget(pc, mFrame, StyleAppearance::FocusOutline);
|
||||
nsITheme* theme = pc->Theme();
|
||||
return theme->ThemeSupportsWidget(pc, mFrame, StyleAppearance::FocusOutline);
|
||||
}
|
||||
|
||||
bool nsDisplayOutline::CreateWebRenderCommands(
|
||||
|
@ -130,8 +130,8 @@ nsresult nsBox::GetXULBorder(nsMargin& aMargin) {
|
||||
if (disp->HasAppearance()) {
|
||||
// Go to the theme for the border.
|
||||
nsPresContext* pc = PresContext();
|
||||
nsITheme* theme = pc->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(pc, this, disp->mAppearance)) {
|
||||
nsITheme* theme = pc->Theme();
|
||||
if (theme->ThemeSupportsWidget(pc, this, disp->mAppearance)) {
|
||||
LayoutDeviceIntMargin margin =
|
||||
theme->GetWidgetBorder(pc->DeviceContext(), this, disp->mAppearance);
|
||||
aMargin =
|
||||
@ -150,8 +150,8 @@ nsresult nsBox::GetXULPadding(nsMargin& aPadding) {
|
||||
if (disp->HasAppearance()) {
|
||||
// Go to the theme for the padding.
|
||||
nsPresContext* pc = PresContext();
|
||||
nsITheme* theme = pc->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(pc, this, disp->mAppearance)) {
|
||||
nsITheme* theme = pc->Theme();
|
||||
if (theme->ThemeSupportsWidget(pc, this, disp->mAppearance)) {
|
||||
LayoutDeviceIntMargin padding;
|
||||
bool useThemePadding = theme->GetWidgetPadding(
|
||||
pc->DeviceContext(), this, disp->mAppearance, &padding);
|
||||
@ -420,9 +420,8 @@ bool nsIFrame::AddXULMinSize(nsIFrame* aBox,
|
||||
// See if a native theme wants to supply a minimum size.
|
||||
const nsStyleDisplay* display = aBox->StyleDisplay();
|
||||
if (display->HasAppearance()) {
|
||||
nsITheme* theme = pc->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(pc, aBox,
|
||||
display->mAppearance)) {
|
||||
nsITheme* theme = pc->Theme();
|
||||
if (theme->ThemeSupportsWidget(pc, aBox, display->mAppearance)) {
|
||||
LayoutDeviceIntSize size;
|
||||
theme->GetMinimumWidgetSize(pc, aBox,
|
||||
display->mAppearance, &size, &canOverride);
|
||||
|
@ -608,8 +608,7 @@ imgRequestProxy* nsImageBoxFrame::GetRequestFromStyle() {
|
||||
const nsStyleDisplay* disp = StyleDisplay();
|
||||
if (disp->HasAppearance()) {
|
||||
nsPresContext* pc = PresContext();
|
||||
nsITheme* theme = pc->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(pc, this, disp->mAppearance)) {
|
||||
if (pc->Theme()->ThemeSupportsWidget(pc, this, disp->mAppearance)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1809,9 +1809,9 @@ nsITheme* nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex,
|
||||
nsITheme* theme = nullptr;
|
||||
const nsStyleDisplay* twistyDisplayData = aTwistyContext->StyleDisplay();
|
||||
if (twistyDisplayData->mAppearance != StyleAppearance::None) {
|
||||
theme = aPresContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr,
|
||||
twistyDisplayData->mAppearance))
|
||||
theme = aPresContext->Theme();
|
||||
if (theme->ThemeSupportsWidget(aPresContext, nullptr,
|
||||
twistyDisplayData->mAppearance))
|
||||
useTheme = true;
|
||||
}
|
||||
|
||||
@ -2550,7 +2550,7 @@ void nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* treeFrame = tree ? tree->GetPrimaryFrame() : nullptr;
|
||||
nsCOMPtr<nsITreeSelection> selection;
|
||||
mView->GetSelection(getter_AddRefs(selection));
|
||||
nsITheme* theme = PresContext()->GetTheme();
|
||||
nsITheme* theme = PresContext()->Theme();
|
||||
// On Mac, we support native theming of selected rows. On 10.10 and higher,
|
||||
// this means applying vibrancy which require us to register the theme
|
||||
// geometrics for the row. In order to make the vibrancy effect to work
|
||||
@ -2754,7 +2754,7 @@ ImgDrawResult nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
|
||||
nsITheme* theme = nullptr;
|
||||
auto appearance = rowContext->StyleDisplay()->mAppearance;
|
||||
if (appearance != StyleAppearance::None) {
|
||||
theme = aPresContext->GetTheme();
|
||||
theme = aPresContext->Theme();
|
||||
}
|
||||
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, appearance)) {
|
||||
@ -2882,9 +2882,9 @@ ImgDrawResult nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
|
||||
nsITheme* theme = nullptr;
|
||||
const nsStyleDisplay* displayData = separatorContext->StyleDisplay();
|
||||
if (displayData->HasAppearance()) {
|
||||
theme = aPresContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr,
|
||||
displayData->mAppearance))
|
||||
theme = aPresContext->Theme();
|
||||
if (theme->ThemeSupportsWidget(aPresContext, nullptr,
|
||||
displayData->mAppearance))
|
||||
useTheme = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user