Bug 1333482 part 2 - [css-ui] Change all consumers of StyleDisplay::mAppearance to use the accessor UsedAppearance() instead, and make mAppearance/mMozAppearance private. r=dholbert

MozReview-Commit-ID: 8JwLsY1CLDJ
This commit is contained in:
Mats Palmgren 2017-03-23 23:13:18 +01:00 committed by Bobby Holley
parent eeffa0c3eb
commit 79cff05243
29 changed files with 100 additions and 100 deletions

View File

@ -300,11 +300,11 @@ GeckoRestyleManager::AttributeChanged(Element* aElement,
if (primaryFrame) {
// See if we have appearance information for a theme.
const nsStyleDisplay* disp = primaryFrame->StyleDisplay();
if (disp->mAppearance) {
if (disp->UsedAppearance()) {
nsITheme* theme = PresContext()->GetTheme();
if (theme && theme->ThemeSupportsWidget(PresContext(), primaryFrame, disp->mAppearance)) {
if (theme && theme->ThemeSupportsWidget(PresContext(), primaryFrame, disp->UsedAppearance())) {
bool repaint = false;
theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute,
theme->WidgetStateChanged(primaryFrame, disp->UsedAppearance(), aAttribute,
&repaint, aOldValue);
if (repaint)
hint |= nsChangeHint_RepaintFrame;

View File

@ -355,7 +355,7 @@ RestyleManager::ContentStateChangedInternal(Element* aElement,
NS_EVENT_STATE_LOADING)) {
*aOutChangeHint = nsChangeHint_ReconstructFrame;
} else {
uint8_t app = primaryFrame->StyleDisplay()->mAppearance;
uint8_t app = primaryFrame->StyleDisplay()->UsedAppearance();
if (app) {
nsITheme* theme = PresContext()->GetTheme();
if (theme &&

View File

@ -3739,7 +3739,7 @@ nsCSSFrameConstructor::FindInputData(Element* aElement,
// not (respectively) NS_THEME_RADIO and NS_THEME_CHECKBOX.)
if ((controlType == NS_FORM_INPUT_CHECKBOX ||
controlType == NS_FORM_INPUT_RADIO) &&
aStyleContext->StyleDisplay()->mAppearance == NS_THEME_NONE) {
aStyleContext->StyleDisplay()->UsedAppearance() == NS_THEME_NONE) {
return nullptr;
}
#endif

View File

@ -5037,7 +5037,7 @@ AddIntrinsicSizeOffset(nsRenderingContext* aRenderingContext,
LayoutDeviceIntSize devSize;
bool canOverride = true;
nsPresContext* pc = aFrame->PresContext();
pc->GetTheme()->GetMinimumWidgetSize(pc, aFrame, disp->mAppearance,
pc->GetTheme()->GetMinimumWidgetSize(pc, aFrame, disp->UsedAppearance(),
&devSize, &canOverride);
nscoord themeSize =
pc->DevPixelsToAppUnits(aAxis == eAxisVertical ? devSize.height
@ -6947,10 +6947,10 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame,
if (HasNonZeroCorner(aCSSRootFrame->StyleBorder()->mBorderRadius))
return eTransparencyTransparent;
if (aCSSRootFrame->StyleDisplay()->mAppearance == NS_THEME_WIN_GLASS)
if (aCSSRootFrame->StyleDisplay()->UsedAppearance() == NS_THEME_WIN_GLASS)
return eTransparencyGlass;
if (aCSSRootFrame->StyleDisplay()->mAppearance == NS_THEME_WIN_BORDERLESS_GLASS)
if (aCSSRootFrame->StyleDisplay()->UsedAppearance() == NS_THEME_WIN_BORDERLESS_GLASS)
return eTransparencyBorderlessGlass;
nsITheme::Transparency transparency;

View File

@ -318,7 +318,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->GetTheme()->ThemeDrawsFocusForWidget(disp->UsedAppearance())) {
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
// Draw the -moz-focus-inner border
@ -340,7 +340,7 @@ nsDisplayButtonForeground::GetLayerState(nsDisplayListBuilder* aBuilder,
nsPresContext *presContext = mFrame->PresContext();
const nsStyleDisplay *disp = mFrame->StyleDisplay();
if (!mFrame->IsThemed(disp) ||
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->UsedAppearance())) {
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
br = mBFR->CreateInnerFocusBorderRenderer(aBuilder, presContext, nullptr, mVisibleRect, r);
}

View File

@ -781,7 +781,7 @@ nsComboboxControlFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext,
// add room for the dropmarker button if there is one
if ((!IsThemed() ||
presContext->GetTheme()->ThemeNeedsComboboxDropmarker()) &&
StyleDisplay()->mAppearance != NS_THEME_NONE) {
StyleDisplay()->UsedAppearance() != NS_THEME_NONE) {
displayISize += scrollbarWidth;
}
@ -864,7 +864,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
nscoord buttonISize;
const nsStyleDisplay *disp = StyleDisplay();
if ((IsThemed(disp) && !aPresContext->GetTheme()->ThemeNeedsComboboxDropmarker()) ||
StyleDisplay()->mAppearance == NS_THEME_NONE) {
StyleDisplay()->UsedAppearance() == NS_THEME_NONE) {
buttonISize = 0;
}
else {
@ -1580,7 +1580,7 @@ nsComboboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsPresContext *presContext = PresContext();
const nsStyleDisplay *disp = StyleDisplay();
if ((!IsThemed(disp) ||
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) &&
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->UsedAppearance())) &&
mDisplayFrame && IsVisibleForPainting(aBuilder)) {
aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplayComboboxFocus(aBuilder, this));

View File

@ -50,7 +50,7 @@ nsFormControlFrame::GetMinISize(nsRenderingContext *aRenderingContext)
nscoord result;
DISPLAY_MIN_WIDTH(this, result);
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK)
result = StyleDisplay()->mAppearance == NS_THEME_NONE ? 0 : DefaultSize();
result = StyleDisplay()->UsedAppearance() == NS_THEME_NONE ? 0 : DefaultSize();
#else
result = DefaultSize();
#endif
@ -63,7 +63,7 @@ nsFormControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK)
result = StyleDisplay()->mAppearance == NS_THEME_NONE ? 0 : DefaultSize();
result = StyleDisplay()->UsedAppearance() == NS_THEME_NONE ? 0 : DefaultSize();
#else
result = DefaultSize();
#endif
@ -83,7 +83,7 @@ nsFormControlFrame::ComputeAutoSize(nsRenderingContext* aRC,
{
LogicalSize size(aWM, 0, 0);
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK)
if (StyleDisplay()->mAppearance == NS_THEME_NONE) {
if (StyleDisplay()->UsedAppearance() == NS_THEME_NONE) {
return size;
}
#endif
@ -107,7 +107,7 @@ nsFormControlFrame::GetLogicalBaseline(WritingMode aWritingMode) const
#if !defined(MOZ_WIDGET_ANDROID)
// For appearance:none we use a standard CSS baseline, i.e. synthesized from
// our margin-box.
if (StyleDisplay()->mAppearance == NS_THEME_NONE) {
if (StyleDisplay()->UsedAppearance() == NS_THEME_NONE) {
return nsAtomicContainerFrame::GetLogicalBaseline(aWritingMode);
}
#endif

View File

@ -272,11 +272,11 @@ nsMeterFrame::ShouldUseNativeStyle() const
// - both frames use the native appearance;
// - neither frame has author specified rules setting the border or the
// background.
return StyleDisplay()->mAppearance == NS_THEME_METERBAR &&
return StyleDisplay()->UsedAppearance() == NS_THEME_METERBAR &&
!PresContext()->HasAuthorSpecifiedRules(this,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
barFrame &&
barFrame->StyleDisplay()->mAppearance == NS_THEME_METERCHUNK &&
barFrame->StyleDisplay()->UsedAppearance() == NS_THEME_METERCHUNK &&
!PresContext()->HasAuthorSpecifiedRules(barFrame,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
}

View File

@ -416,7 +416,7 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
nsContentUtils::AddScriptRunner(focusJob);
}
if (StyleDisplay()->mAppearance == NS_THEME_TEXTFIELD) {
if (StyleDisplay()->UsedAppearance() == NS_THEME_TEXTFIELD) {
// The author has elected to hide the spinner by setting this
// -moz-appearance. We will reframe if it changes.
return rv;
@ -621,11 +621,11 @@ nsNumberControlFrame::ShouldUseNativeStyleForSpinner() const
nsIFrame* spinDownFrame = mSpinDown->GetPrimaryFrame();
return spinUpFrame &&
spinUpFrame->StyleDisplay()->mAppearance == NS_THEME_SPINNER_UPBUTTON &&
spinUpFrame->StyleDisplay()->UsedAppearance() == NS_THEME_SPINNER_UPBUTTON &&
!PresContext()->HasAuthorSpecifiedRules(spinUpFrame,
STYLES_DISABLING_NATIVE_THEMING) &&
spinDownFrame &&
spinDownFrame->StyleDisplay()->mAppearance == NS_THEME_SPINNER_DOWNBUTTON &&
spinDownFrame->StyleDisplay()->UsedAppearance() == NS_THEME_SPINNER_DOWNBUTTON &&
!PresContext()->HasAuthorSpecifiedRules(spinDownFrame,
STYLES_DISABLING_NATIVE_THEMING);
}

View File

@ -285,11 +285,11 @@ nsProgressFrame::ShouldUseNativeStyle() const
// - both frames use the native appearance;
// - neither frame has author specified rules setting the border or the
// background.
return StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR &&
return StyleDisplay()->UsedAppearance() == NS_THEME_PROGRESSBAR &&
!PresContext()->HasAuthorSpecifiedRules(this,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
barFrame &&
barFrame->StyleDisplay()->mAppearance == NS_THEME_PROGRESSCHUNK &&
barFrame->StyleDisplay()->UsedAppearance() == NS_THEME_PROGRESSCHUNK &&
!PresContext()->HasAuthorSpecifiedRules(barFrame,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
}

View File

@ -300,7 +300,7 @@ nsRangeFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsStyleDisplay *disp = StyleDisplay();
if (IsThemed(disp) &&
PresContext()->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
PresContext()->GetTheme()->ThemeDrawsFocusForWidget(disp->UsedAppearance())) {
return; // the native theme displays its own visual indication of focus
}
@ -883,7 +883,7 @@ nsRangeFrame::ShouldUseNativeStyle() const
nsIFrame* progressFrame = mProgressDiv->GetPrimaryFrame();
nsIFrame* thumbFrame = mThumbDiv->GetPrimaryFrame();
return (StyleDisplay()->mAppearance == NS_THEME_RANGE) &&
return (StyleDisplay()->UsedAppearance() == NS_THEME_RANGE) &&
!PresContext()->HasAuthorSpecifiedRules(this,
(NS_AUTHOR_SPECIFIED_BORDER |
NS_AUTHOR_SPECIFIED_BACKGROUND)) &&

View File

@ -2527,7 +2527,7 @@ SizeComputationInput::InitOffsets(WritingMode aWM,
nsIntMargin widget;
if (isThemed &&
presContext->GetTheme()->GetWidgetPadding(presContext->DeviceContext(),
mFrame, disp->mAppearance,
mFrame, disp->UsedAppearance(),
&widget)) {
ComputedPhysicalPadding().top = presContext->DevPixelsToAppUnits(widget.top);
ComputedPhysicalPadding().right = presContext->DevPixelsToAppUnits(widget.right);
@ -2578,7 +2578,7 @@ SizeComputationInput::InitOffsets(WritingMode aWM,
if (isThemed) {
nsIntMargin widget;
presContext->GetTheme()->GetWidgetBorder(presContext->DeviceContext(),
mFrame, disp->mAppearance,
mFrame, disp->UsedAppearance(),
&widget);
ComputedPhysicalBorderPadding().top =
presContext->DevPixelsToAppUnits(widget.top);

View File

@ -1405,7 +1405,7 @@ nsFlexContainerFrame::GenerateFlexItemForChild(
bool canOverride = true;
aPresContext->GetTheme()->
GetMinimumWidgetSize(aPresContext, aChildFrame,
disp->mAppearance,
disp->UsedAppearance(),
&widgetMinSize, &canOverride);
nscoord widgetMainMinSize =

View File

@ -1155,7 +1155,7 @@ nsIFrame::GetUsedBorder() const
nsIntMargin result;
nsPresContext *presContext = PresContext();
presContext->GetTheme()->GetWidgetBorder(presContext->DeviceContext(),
mutable_this, disp->mAppearance,
mutable_this, disp->UsedAppearance(),
&result);
border.left = presContext->DevPixelsToAppUnits(result.left);
border.top = presContext->DevPixelsToAppUnits(result.top);
@ -1191,7 +1191,7 @@ nsIFrame::GetUsedPadding() const
nsIntMargin widget;
if (presContext->GetTheme()->GetWidgetPadding(presContext->DeviceContext(),
mutable_this,
disp->mAppearance,
disp->UsedAppearance(),
&widget)) {
padding.top = presContext->DevPixelsToAppUnits(widget.top);
padding.right = presContext->DevPixelsToAppUnits(widget.right);
@ -2060,7 +2060,7 @@ nsFrame::DisplayBackgroundUnconditional(nsDisplayListBuilder* aBuilder,
// receive a propagated background should just set aForceBackground to
// true.
if (aBuilder->IsForEventDelivery() || aForceBackground ||
!StyleBackground()->IsTransparent(this) || StyleDisplay()->mAppearance) {
!StyleBackground()->IsTransparent(this) || StyleDisplay()->UsedAppearance()) {
return nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, this, GetRectRelativeToSelf(), aLists.BorderBackground());
}
@ -2984,7 +2984,7 @@ 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()->GetTheme()->WidgetIsContainer(ourDisp->UsedAppearance()))
return;
// Since we're now sure that we're adding this frame to the display list
@ -4884,7 +4884,7 @@ IntrinsicSizeOffsets(nsIFrame* aFrame, bool aForISize)
nsIntMargin border;
presContext->GetTheme()->GetWidgetBorder(presContext->DeviceContext(),
aFrame, disp->mAppearance,
aFrame, disp->UsedAppearance(),
&border);
result.hBorder =
presContext->DevPixelsToAppUnits(verticalAxis ? border.TopBottom()
@ -4892,7 +4892,7 @@ IntrinsicSizeOffsets(nsIFrame* aFrame, bool aForISize)
nsIntMargin padding;
if (presContext->GetTheme()->GetWidgetPadding(presContext->DeviceContext(),
aFrame, disp->mAppearance,
aFrame, disp->UsedAppearance(),
&padding)) {
result.hPadding =
presContext->DevPixelsToAppUnits(verticalAxis ? padding.TopBottom()
@ -5164,7 +5164,7 @@ nsFrame::ComputeSize(nsRenderingContext* aRenderingContext,
bool canOverride = true;
nsPresContext *presContext = PresContext();
presContext->GetTheme()->
GetMinimumWidgetSize(presContext, this, disp->mAppearance,
GetMinimumWidgetSize(presContext, this, disp->UsedAppearance(),
&widget, &canOverride);
// Convert themed widget's physical dimensions to logical coords
@ -5624,7 +5624,7 @@ nsFrame::ComputeSimpleTightBounds(DrawTarget* aDrawTarget) const
{
if (StyleOutline()->mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE ||
StyleBorder()->HasBorder() || !StyleBackground()->IsTransparent(this) ||
StyleDisplay()->mAppearance) {
StyleDisplay()->UsedAppearance()) {
// Not necessarily tight, due to clipping, negative
// outline-offset, and lots of other issues, but that's OK
return GetVisualOverflowRect();
@ -8985,7 +8985,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
nsPresContext *presContext = PresContext();
if (presContext->GetTheme()->
GetWidgetOverflow(presContext->DeviceContext(), this,
disp->mAppearance, &r)) {
disp->UsedAppearance(), &r)) {
nsRect& vo = aOverflowAreas.VisualOverflow();
vo.UnionRectEdges(vo, r);
}

View File

@ -1584,16 +1584,16 @@ public:
bool IsThemed(const nsStyleDisplay* aDisp,
nsITheme::Transparency* aTransparencyState = nullptr) const {
nsIFrame* mutable_this = const_cast<nsIFrame*>(this);
if (!aDisp->mAppearance)
if (!aDisp->UsedAppearance())
return false;
nsPresContext* pc = PresContext();
nsITheme *theme = pc->GetTheme();
if(!theme ||
!theme->ThemeSupportsWidget(pc, mutable_this, aDisp->mAppearance))
!theme->ThemeSupportsWidget(pc, mutable_this, aDisp->UsedAppearance()))
return false;
if (aTransparencyState) {
*aTransparencyState =
theme->GetWidgetTransparency(mutable_this, aDisp->mAppearance);
theme->GetWidgetTransparency(mutable_this, aDisp->UsedAppearance());
}
return true;
}

View File

@ -822,11 +822,11 @@ nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
// renderer draw the border. DO not get the data from aForFrame, since the passed in style context
// may be different! Always use |aStyleContext|!
const nsStyleDisplay* displayData = aStyleContext->StyleDisplay();
if (displayData->mAppearance) {
if (displayData->UsedAppearance()) {
nsITheme *theme = aPresContext->GetTheme();
if (theme &&
theme->ThemeSupportsWidget(aPresContext, aForFrame,
displayData->mAppearance)) {
displayData->UsedAppearance())) {
return DrawResult::SUCCESS; // Let the theme handle it.
}
}
@ -906,11 +906,11 @@ nsCSSRendering::CreateBorderRendererWithStyleBorder(nsPresContext* aPresContext,
Sides aSkipSides)
{
const nsStyleDisplay* displayData = aStyleContext->StyleDisplay();
if (displayData->mAppearance) {
if (displayData->UsedAppearance()) {
nsITheme *theme = aPresContext->GetTheme();
if (theme &&
theme->ThemeSupportsWidget(aPresContext, aForFrame,
displayData->mAppearance)) {
displayData->UsedAppearance())) {
return Nothing();
}
}
@ -1592,7 +1592,7 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
nativeRect.IntersectRect(frameRect, nativeRect);
nsRenderingContext wrapperCtx(shadowContext);
aPresContext->GetTheme()->DrawWidgetBackground(&wrapperCtx, aForFrame,
styleDisplay->mAppearance, aFrameArea, nativeRect);
styleDisplay->UsedAppearance(), aFrameArea, nativeRect);
blurringArea.DoPaint();
renderContext->Restore();
@ -1937,7 +1937,7 @@ nsCSSRendering::PaintStyleImageLayer(const PaintBGParams& aParams)
// a root, otherwise keep going in order to let the theme stuff
// draw the background. The canvas really should be drawing the
// bg, but there's no way to hook that up via css.
if (!aParams.frame->StyleDisplay()->mAppearance) {
if (!aParams.frame->StyleDisplay()->UsedAppearance()) {
return DrawResult::SUCCESS;
}
@ -3386,18 +3386,18 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
// renderer draw the background and bail out.
// XXXzw this ignores aParams.bgClipRect.
const nsStyleDisplay* displayData = aParams.frame->StyleDisplay();
if (displayData->mAppearance) {
if (displayData->UsedAppearance()) {
nsITheme *theme = aParams.presCtx.GetTheme();
if (theme && theme->ThemeSupportsWidget(&aParams.presCtx,
aParams.frame,
displayData->mAppearance)) {
displayData->UsedAppearance())) {
nsRect drawing(aParams.borderArea);
theme->GetWidgetOverflow(aParams.presCtx.DeviceContext(),
aParams.frame, displayData->mAppearance,
aParams.frame, displayData->UsedAppearance(),
&drawing);
drawing.IntersectRect(drawing, aParams.dirtyRect);
theme->DrawWidgetBackground(&aParams.renderingCtx, aParams.frame,
displayData->mAppearance, aParams.borderArea,
displayData->UsedAppearance(), aParams.borderArea,
drawing);
return DrawResult::SUCCESS;
}

View File

@ -2924,7 +2924,7 @@ static nsStyleContext* GetBackgroundStyleContext(nsIFrame* aFrame)
// a root, other wise keep going in order to let the theme stuff
// draw the background. The canvas really should be drawing the
// bg, but there's no way to hook that up via css.
if (!aFrame->StyleDisplay()->mAppearance) {
if (!aFrame->StyleDisplay()->UsedAppearance()) {
return nullptr;
}
@ -3071,7 +3071,7 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
if (isThemed) {
nsITheme* theme = presContext->GetTheme();
if (theme->NeedToClearBackgroundBehindWidget(aFrame, aFrame->StyleDisplay()->mAppearance) &&
if (theme->NeedToClearBackgroundBehindWidget(aFrame, aFrame->StyleDisplay()->UsedAppearance()) &&
aBuilder->IsInChromeDocumentOrPopup() && !aBuilder->IsInTransform()) {
bgItemList.AppendNewToTop(
new (aBuilder) nsDisplayClearBackground(aBuilder, aFrame));
@ -3624,19 +3624,19 @@ nsDisplayThemedBackground::nsDisplayThemedBackground(nsDisplayListBuilder* aBuil
MOZ_COUNT_CTOR(nsDisplayThemedBackground);
const nsStyleDisplay* disp = mFrame->StyleDisplay();
mAppearance = disp->mAppearance;
mAppearance = disp->UsedAppearance();
mFrame->IsThemed(disp, &mThemeTransparency);
// Perform necessary RegisterThemeGeometry
nsITheme* theme = mFrame->PresContext()->GetTheme();
nsITheme::ThemeGeometryType type =
theme->ThemeGeometryTypeForWidget(mFrame, disp->mAppearance);
theme->ThemeGeometryTypeForWidget(mFrame, disp->UsedAppearance());
if (type != nsITheme::eThemeGeometryTypeUnknown) {
RegisterThemeGeometry(aBuilder, aFrame, type);
}
if (disp->mAppearance == NS_THEME_WIN_BORDERLESS_GLASS ||
disp->mAppearance == NS_THEME_WIN_GLASS) {
if (disp->UsedAppearance() == NS_THEME_WIN_BORDERLESS_GLASS ||
disp->UsedAppearance() == NS_THEME_WIN_GLASS) {
aBuilder->SetGlassDisplayItem(this);
}
@ -3770,7 +3770,7 @@ nsDisplayThemedBackground::GetBoundsInternal() {
nsRect r = mBackgroundRect - ToReferenceFrame();
presContext->GetTheme()->
GetWidgetOverflow(presContext->DeviceContext(), mFrame,
mFrame->StyleDisplay()->mAppearance, &r);
mFrame->StyleDisplay()->UsedAppearance(), &r);
return r + ToReferenceFrame();
}

View File

@ -2661,7 +2661,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
// otherwise equal to
// mDisplay
uint8_t mContain; // [reset] see nsStyleConsts.h NS_STYLE_CONTAIN_*
//private: XXX not yet
private:
friend class nsComputedDOMStyle;
friend class nsRuleNode;
uint8_t mMozAppearance; // [reset]

View File

@ -508,7 +508,7 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// display background if we need to.
if (aBuilder->IsForEventDelivery() ||
!StyleBackground()->IsTransparent(this) ||
StyleDisplay()->mAppearance) {
StyleDisplay()->UsedAppearance()) {
if (!tableFrame->IsBorderCollapse()) {
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder,
this,

View File

@ -1401,7 +1401,7 @@ static inline bool FrameHasBorderOrBackground(nsTableFrame* tableFrame, nsIFrame
return true;
}
if (!f->StyleBackground()->IsTransparent(f) ||
f->StyleDisplay()->mAppearance) {
f->StyleDisplay()->UsedAppearance()) {
nsTableCellFrame *cellFrame = do_QueryFrame(f);
// We could also return false here if the current frame is the root

View File

@ -299,13 +299,13 @@ nsBox::GetXULBorder(nsMargin& aMargin)
aMargin.SizeTo(0,0,0,0);
const nsStyleDisplay* disp = StyleDisplay();
if (disp->mAppearance && gTheme) {
if (disp->UsedAppearance() && gTheme) {
// Go to the theme for the border.
nsPresContext *context = PresContext();
if (gTheme->ThemeSupportsWidget(context, this, disp->mAppearance)) {
if (gTheme->ThemeSupportsWidget(context, this, disp->UsedAppearance())) {
nsIntMargin margin(0, 0, 0, 0);
gTheme->GetWidgetBorder(context->DeviceContext(), this,
disp->mAppearance, &margin);
disp->UsedAppearance(), &margin);
aMargin.top = context->DevPixelsToAppUnits(margin.top);
aMargin.right = context->DevPixelsToAppUnits(margin.right);
aMargin.bottom = context->DevPixelsToAppUnits(margin.bottom);
@ -323,15 +323,15 @@ nsresult
nsBox::GetXULPadding(nsMargin& aMargin)
{
const nsStyleDisplay *disp = StyleDisplay();
if (disp->mAppearance && gTheme) {
if (disp->UsedAppearance() && gTheme) {
// Go to the theme for the padding.
nsPresContext *context = PresContext();
if (gTheme->ThemeSupportsWidget(context, this, disp->mAppearance)) {
if (gTheme->ThemeSupportsWidget(context, this, disp->UsedAppearance())) {
nsIntMargin margin(0, 0, 0, 0);
bool useThemePadding;
useThemePadding = gTheme->GetWidgetPadding(context->DeviceContext(),
this, disp->mAppearance,
this, disp->UsedAppearance(),
&margin);
if (useThemePadding) {
aMargin.top = context->DevPixelsToAppUnits(margin.top);
@ -669,12 +669,12 @@ nsIFrame::AddXULMinSize(nsBoxLayoutState& aState, nsIFrame* aBox, nsSize& aSize,
// See if a native theme wants to supply a minimum size.
const nsStyleDisplay* display = aBox->StyleDisplay();
if (display->mAppearance) {
if (display->UsedAppearance()) {
nsITheme *theme = aState.PresContext()->GetTheme();
if (theme && theme->ThemeSupportsWidget(aState.PresContext(), aBox, display->mAppearance)) {
if (theme && theme->ThemeSupportsWidget(aState.PresContext(), aBox, display->UsedAppearance())) {
LayoutDeviceIntSize size;
theme->GetMinimumWidgetSize(aState.PresContext(), aBox,
display->mAppearance, &size, &canOverride);
display->UsedAppearance(), &size, &canOverride);
if (size.width) {
aSize.width = aState.PresContext()->DevPixelsToAppUnits(size.width);
aWidthSet = true;

View File

@ -1323,7 +1323,7 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// Check for frames that are marked as a part of the region used
// in calculating glass margins on Windows.
const nsStyleDisplay* styles = StyleDisplay();
if (styles && styles->mAppearance == NS_THEME_WIN_EXCLUDE_GLASS) {
if (styles && styles->UsedAppearance() == NS_THEME_WIN_EXCLUDE_GLASS) {
aBuilder->AddWindowExcludeGlassRegion(
nsRect(aBuilder->ToReferenceFrame(this), GetSize()));
}

View File

@ -256,7 +256,7 @@ nsImageBoxFrame::UpdateImage()
} else {
// Only get the list-style-image if we aren't being drawn
// by a native theme.
uint8_t appearance = StyleDisplay()->mAppearance;
uint8_t appearance = StyleDisplay()->UsedAppearance();
if (!(appearance && nsBox::gTheme &&
nsBox::gTheme->ThemeSupportsWidget(nullptr, this, appearance))) {
// get the list-style-image
@ -532,8 +532,8 @@ nsImageBoxFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
// If we're using a native theme implementation, we shouldn't draw anything.
const nsStyleDisplay* disp = StyleDisplay();
if (disp->mAppearance && nsBox::gTheme &&
nsBox::gTheme->ThemeSupportsWidget(nullptr, this, disp->mAppearance))
if (disp->UsedAppearance() && nsBox::gTheme &&
nsBox::gTheme->ThemeSupportsWidget(nullptr, this, disp->UsedAppearance()))
return;
// If list-style-image changes, we have a new image.

View File

@ -338,7 +338,7 @@ nsMenuPopupFrame::GetShadowStyle()
if (shadow != NS_STYLE_WINDOW_SHADOW_DEFAULT)
return shadow;
switch (StyleDisplay()->mAppearance) {
switch (StyleDisplay()->UsedAppearance()) {
case NS_THEME_TOOLTIP:
return NS_STYLE_WINDOW_SHADOW_TOOLTIP;
case NS_THEME_MENUPOPUP:

View File

@ -296,13 +296,13 @@ nsScrollbarFrame::MoveToNewPosition()
// See if we have appearance information for a theme.
const nsStyleDisplay* disp = StyleDisplay();
nsPresContext* presContext = PresContext();
if (disp->mAppearance) {
if (disp->UsedAppearance()) {
nsITheme *theme = presContext->GetTheme();
if (theme && theme->ThemeSupportsWidget(presContext, this, disp->mAppearance)) {
if (theme && theme->ThemeSupportsWidget(presContext, this, disp->UsedAppearance())) {
bool repaint;
nsAttrValue oldValue;
oldValue.SetTo(oldCurpos);
theme->WidgetStateChanged(this, disp->mAppearance, nsGkAtoms::curpos,
theme->WidgetStateChanged(this, disp->UsedAppearance(), nsGkAtoms::curpos,
&repaint, &oldValue);
}
}

View File

@ -2075,16 +2075,16 @@ nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex,
bool useTheme = false;
nsITheme *theme = nullptr;
const nsStyleDisplay* twistyDisplayData = aTwistyContext->StyleDisplay();
if (twistyDisplayData->mAppearance) {
if (twistyDisplayData->UsedAppearance()) {
theme = aPresContext->GetTheme();
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, twistyDisplayData->mAppearance))
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, twistyDisplayData->UsedAppearance()))
useTheme = true;
}
if (useTheme) {
LayoutDeviceIntSize minTwistySizePx;
bool canOverride = true;
theme->GetMinimumWidgetSize(aPresContext, this, twistyDisplayData->mAppearance,
theme->GetMinimumWidgetSize(aPresContext, this, twistyDisplayData->UsedAppearance(),
&minTwistySizePx, &canOverride);
// GMWS() returns size in pixels, we need to convert it back to app units
@ -2851,7 +2851,7 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// geometrics for the row. In order to make the vibrancy effect to work
// properly, we also need the tree to be themed as a source list.
if (selection && treeFrame && theme &&
treeFrame->StyleDisplay()->mAppearance == NS_THEME_MAC_SOURCE_LIST) {
treeFrame->StyleDisplay()->UsedAppearance() == NS_THEME_MAC_SOURCE_LIST) {
// Loop through our onscreen rows. If the row is selected and a
// -moz-appearance is provided, RegisterThemeGeometry might be necessary.
const auto end = std::min(mRowCount, LastVisibleRow() + 1);
@ -2865,7 +2865,7 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsTreeUtils::TokenizeProperties(properties, mScratchArray);
nsStyleContext* rowContext =
GetPseudoStyleContext(nsCSSAnonBoxes::moztreerow);
auto appearance = rowContext->StyleDisplay()->mAppearance;
auto appearance = rowContext->StyleDisplay()->UsedAppearance();
if (appearance) {
if (theme->ThemeSupportsWidget(PresContext(), this, appearance)) {
nsITheme::ThemeGeometryType type =
@ -3045,7 +3045,7 @@ nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
// Paint our borders and background for our row rect.
nsITheme* theme = nullptr;
auto appearance = rowContext->StyleDisplay()->mAppearance;
auto appearance = rowContext->StyleDisplay()->UsedAppearance();
if (appearance) {
theme = aPresContext->GetTheme();
}
@ -3186,9 +3186,9 @@ nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
bool useTheme = false;
nsITheme *theme = nullptr;
const nsStyleDisplay* displayData = separatorContext->StyleDisplay();
if ( displayData->mAppearance ) {
if ( displayData->UsedAppearance() ) {
theme = aPresContext->GetTheme();
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, displayData->mAppearance))
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, displayData->UsedAppearance()))
useTheme = true;
}
@ -3199,7 +3199,7 @@ nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
nsRect dirty;
dirty.IntersectRect(aSeparatorRect, aDirtyRect);
theme->DrawWidgetBackground(&aRenderingContext, this,
displayData->mAppearance, aSeparatorRect, dirty);
displayData->UsedAppearance(), aSeparatorRect, dirty);
}
else {
const nsStylePosition* stylePosition = separatorContext->StylePosition();
@ -3503,7 +3503,7 @@ nsTreeBodyFrame::PaintTwisty(int32_t aRowIndex,
nsRect dirty;
dirty.IntersectRect(twistyRect, aDirtyRect);
theme->DrawWidgetBackground(&aRenderingContext, this,
twistyContext->StyleDisplay()->mAppearance, twistyRect, dirty);
twistyContext->StyleDisplay()->UsedAppearance(), twistyRect, dirty);
}
else {
// Time to paint the twisty.

View File

@ -311,7 +311,7 @@ static BOOL IsToolbarStyleContainer(nsIFrame* aFrame)
nsGkAtoms::statusbar))
return YES;
switch (aFrame->StyleDisplay()->mAppearance) {
switch (aFrame->StyleDisplay()->UsedAppearance()) {
case NS_THEME_TOOLBAR:
case NS_THEME_STATUSBAR:
return YES;
@ -516,7 +516,7 @@ static BOOL IsActive(nsIFrame* aFrame, BOOL aIsToolbarControl)
static bool IsInSourceList(nsIFrame* aFrame) {
for (nsIFrame* frame = aFrame->GetParent(); frame; frame = frame->GetParent()) {
if (frame->StyleDisplay()->mAppearance == NS_THEME_MAC_SOURCE_LIST) {
if (frame->StyleDisplay()->UsedAppearance() == NS_THEME_MAC_SOURCE_LIST) {
return true;
}
}
@ -2761,7 +2761,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
BOOL isHorizontal = (aWidgetType == NS_THEME_SCROLLBARTHUMB_HORIZONTAL);
BOOL isRolledOver = IsParentScrollbarRolledOver(aFrame);
nsIFrame* scrollbarFrame = GetParentScrollbarFrame(aFrame);
bool isSmall = (scrollbarFrame && scrollbarFrame->StyleDisplay()->mAppearance == NS_THEME_SCROLLBAR_SMALL);
bool isSmall = (scrollbarFrame && scrollbarFrame->StyleDisplay()->UsedAppearance() == NS_THEME_SCROLLBAR_SMALL);
if (isOverlay && !isRolledOver) {
if (isHorizontal) {
macRect.origin.y += 4;
@ -2811,7 +2811,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
if (!isOverlay || IsParentScrollbarRolledOver(aFrame)) {
BOOL isHorizontal = (aWidgetType == NS_THEME_SCROLLBARTRACK_HORIZONTAL);
nsIFrame* scrollbarFrame = GetParentScrollbarFrame(aFrame);
bool isSmall = (scrollbarFrame && scrollbarFrame->StyleDisplay()->mAppearance == NS_THEME_SCROLLBAR_SMALL);
bool isSmall = (scrollbarFrame && scrollbarFrame->StyleDisplay()->UsedAppearance() == NS_THEME_SCROLLBAR_SMALL);
const BOOL isOnTopOfDarkBackground = IsDarkBackground(aFrame);
RenderWithCoreUI(macRect, cgContext,
[NSDictionary dictionaryWithObjectsAndKeys:
@ -3382,7 +3382,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext,
if (!scrollbarFrame)
return NS_ERROR_FAILURE;
bool isSmall = (scrollbarFrame->StyleDisplay()->mAppearance == NS_THEME_SCROLLBAR_SMALL);
bool isSmall = (scrollbarFrame->StyleDisplay()->UsedAppearance() == NS_THEME_SCROLLBAR_SMALL);
bool isHorizontal = (aWidgetType == NS_THEME_SCROLLBARTHUMB_HORIZONTAL);
int32_t& minSize = isHorizontal ? aResult->width : aResult->height;
minSize = isSmall ? kSmallScrollbarThumbMinSize : kRegularScrollbarThumbMinSize;
@ -3399,7 +3399,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext,
if (nsLookAndFeel::UseOverlayScrollbars()) {
nsIFrame* scrollbarFrame = GetParentScrollbarFrame(aFrame);
if (scrollbarFrame &&
scrollbarFrame->StyleDisplay()->mAppearance ==
scrollbarFrame->StyleDisplay()->UsedAppearance() ==
NS_THEME_SCROLLBAR_SMALL) {
aResult->SizeTo(14, 14);
}
@ -3417,7 +3417,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext,
nsIFrame *scrollbarFrame = GetParentScrollbarFrame(aFrame);
if (!scrollbarFrame) return NS_ERROR_FAILURE;
int32_t themeMetric = (scrollbarFrame->StyleDisplay()->mAppearance == NS_THEME_SCROLLBAR_SMALL) ?
int32_t themeMetric = (scrollbarFrame->StyleDisplay()->UsedAppearance() == NS_THEME_SCROLLBAR_SMALL) ?
kThemeMetricSmallScrollBarWidth :
kThemeMetricScrollBarWidth;
SInt32 scrollbarWidth = 0;
@ -3433,7 +3433,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext,
if (aFrame) {
nsIFrame* scrollbarFrame = GetParentScrollbarFrame(aFrame);
if (scrollbarFrame &&
scrollbarFrame->StyleDisplay()->mAppearance ==
scrollbarFrame->StyleDisplay()->UsedAppearance() ==
NS_THEME_SCROLLBAR_SMALL) {
// XXX We're interested in the width of non-disappearing scrollbars
// to leave enough space for a dropmarker in non-native styled
@ -3458,7 +3458,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext,
if (!scrollbarFrame) return NS_ERROR_FAILURE;
// Since there is no NS_THEME_SCROLLBARBUTTON_UP_SMALL we need to ask the parent what appearance style it has.
int32_t themeMetric = (scrollbarFrame->StyleDisplay()->mAppearance == NS_THEME_SCROLLBAR_SMALL) ?
int32_t themeMetric = (scrollbarFrame->StyleDisplay()->UsedAppearance() == NS_THEME_SCROLLBAR_SMALL) ?
kThemeMetricSmallScrollBarWidth :
kThemeMetricScrollBarWidth;
SInt32 scrollbarWidth = 0;

View File

@ -287,7 +287,7 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
parentFrame = parentFrame->GetParent();
if (parentFrame) {
return IsWidgetStyled(aPresContext, parentFrame,
parentFrame->StyleDisplay()->mAppearance);
parentFrame->StyleDisplay()->UsedAppearance());
}
}
}
@ -698,7 +698,7 @@ nsNativeTheme::GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame,
// Check same appearance and adjacency.
if (!sibling ||
sibling->StyleDisplay()->mAppearance != aFrame->StyleDisplay()->mAppearance ||
sibling->StyleDisplay()->UsedAppearance() != aFrame->StyleDisplay()->UsedAppearance() ||
(sibling->GetRect().XMost() != aFrame->GetRect().x &&
aFrame->GetRect().XMost() != sibling->GetRect().x))
return nullptr;

View File

@ -926,7 +926,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
else {
nsIFrame *parent = aFrame->GetParent();
EventStates parentState =
GetContentState(parent, parent->StyleDisplay()->mAppearance);
GetContentState(parent, parent->StyleDisplay()->UsedAppearance());
if (eventState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
aState += TS_ACTIVE;
else if (eventState.HasState(NS_EVENT_STATE_HOVER))