Commit e65533e9 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1698821 - Simplify native-appearance-disabling for number spinners. r=dholbert

The root cause of this bug is that we're now accidentally using the
native theme for the spinners because GetNumberControlFrameForSpinButton
broke with my changes.

These pseudos are not exposed to content, and there's just one user of
this pseudo-class (the print.css one).

So just disable native appearance explicitly and remove that check.

Differential Revision: https://phabricator.services.mozilla.com/D108653
parent 4e97659d
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -188,28 +188,6 @@ bool nsNumberControlFrame::SpinnerDownButtonIsDepressed() const {
      ->NumberSpinnerDownButtonIsDepressed();
}

#define STYLES_DISABLING_NATIVE_THEMING \
  NS_AUTHOR_SPECIFIED_BORDER_OR_BACKGROUND | NS_AUTHOR_SPECIFIED_PADDING

bool nsNumberControlFrame::ShouldUseNativeStyleForSpinner() const {
  MOZ_ASSERT(mSpinUp && mSpinDown,
             "We should not be called when we have no spinner");

  nsIFrame* spinUpFrame = mSpinUp->GetPrimaryFrame();
  nsIFrame* spinDownFrame = mSpinDown->GetPrimaryFrame();

  return spinUpFrame &&
         spinUpFrame->StyleDisplay()->EffectiveAppearance() ==
             StyleAppearance::SpinnerUpbutton &&
         !PresContext()->HasAuthorSpecifiedRules(
             spinUpFrame, STYLES_DISABLING_NATIVE_THEMING) &&
         spinDownFrame &&
         spinDownFrame->StyleDisplay()->EffectiveAppearance() ==
             StyleAppearance::SpinnerDownbutton &&
         !PresContext()->HasAuthorSpecifiedRules(
             spinDownFrame, STYLES_DISABLING_NATIVE_THEMING);
}

void nsNumberControlFrame::AppendAnonymousContentTo(
    nsTArray<nsIContent*>& aElements, uint32_t aFilter) {
  if (mSpinBox) {
+1 −0
Original line number Diff line number Diff line
@@ -292,6 +292,7 @@ input[type="number"].photon-number::-moz-number-spin-down {
  background-position: center;
  -moz-context-properties: fill;
  fill: currentColor;
  appearance: none;
}

input[type="number"].photon-number::-moz-number-spin-up {
+6 −11
Original line number Diff line number Diff line
@@ -46,9 +46,13 @@ NS_IMPL_ISUPPORTS(nsNativeTheme, nsITimerCallback, nsINamed)
  bool isXULCheckboxRadio = (aAppearance == StyleAppearance::Checkbox ||
                             aAppearance == StyleAppearance::Radio) &&
                            aFrame->GetContent()->IsXULElement();
  if (isXULCheckboxRadio) aFrame = aFrame->GetParent();
  if (isXULCheckboxRadio) {
    aFrame = aFrame->GetParent();
  }

  if (!aFrame->GetContent()) return EventStates();
  if (!aFrame->GetContent()) {
    return EventStates();
  }

  nsIContent* frameContent = aFrame->GetContent();
  EventStates flags;
@@ -264,15 +268,6 @@ bool nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext,
    }
  }

  if (aAppearance == StyleAppearance::SpinnerUpbutton ||
      aAppearance == StyleAppearance::SpinnerDownbutton) {
    nsNumberControlFrame* numberControlFrame =
        nsNumberControlFrame::GetNumberControlFrameForSpinButton(aFrame);
    if (numberControlFrame) {
      return !numberControlFrame->ShouldUseNativeStyleForSpinner();
    }
  }

  return nsLayoutUtils::AuthorSpecifiedBorderBackgroundDisablesTheming(
             aAppearance) &&
         aFrame->GetContent()->IsHTMLElement() &&