Bug 1850342 - Remove non-standard, un-tested :-moz-loading pseudo-class. r=layout-reviewers,jfkthame

This is technically web-exposed, but if we needed to introduce it for
compat we could always re-introduce it matching false.

Differential Revision: https://phabricator.services.mozilla.com/D186938
This commit is contained in:
Emilio Cobos Álvarez 2023-08-29 20:57:30 +00:00
parent 8ee5ec3bbb
commit afdec6f2a3
12 changed files with 41 additions and 64 deletions

View File

@ -841,7 +841,8 @@ async function waitUntilVisitedState(tab, selectors) {
tab.linkedBrowser,
selectors,
args => {
const ELEMENT_STATE_VISITED = 1 << 19;
// ElementState::VISITED
const ELEMENT_STATE_VISITED = 1 << 18;
for (const selector of args) {
const target =

View File

@ -1348,14 +1348,9 @@ CSSIntSize nsImageLoadingContent::GetWidthHeightForImage() {
ElementState nsImageLoadingContent::ImageState() const {
ElementState states;
if (mBroken) {
states |= ElementState::BROKEN;
}
if (mLoading) {
states |= ElementState::LOADING;
}
return states;
}

View File

@ -554,6 +554,7 @@ class nsImageLoadingContent : public nsIImageLoadingContent {
bool mLoadingEnabled : 1;
protected:
/**
* The state we had the last time we checked whether we needed to notify the
* document of a state change. These are maintained by UpdateImageState.
@ -561,7 +562,6 @@ class nsImageLoadingContent : public nsIImageLoadingContent {
bool mLoading : 1;
bool mBroken : 1;
protected:
/**
* A hack to get animations to reset, see bug 594771. On requests
* that originate from setting .src, we mark them for needing their animation

View File

@ -680,7 +680,7 @@ nsObjectLoadingContent::AsyncOnChannelRedirect(
ElementState nsObjectLoadingContent::ObjectState() const {
switch (mType) {
case eType_Loading:
return ElementState::LOADING;
return {};
case eType_Image:
return ImageState();
case eType_FakePlugin:
@ -690,7 +690,6 @@ ElementState nsObjectLoadingContent::ObjectState() const {
// plugins.
ElementState states = ElementState();
if (mLoadingSyntheticDocument) {
states |= ElementState::LOADING;
states |= ImageState();
}
return states;
@ -703,7 +702,7 @@ ElementState nsObjectLoadingContent::ObjectState() const {
return ElementState::BROKEN;
}
MOZ_ASSERT_UNREACHABLE("unknown type?");
return ElementState::LOADING;
return {};
}
void nsObjectLoadingContent::MaybeRewriteYoutubeEmbed(nsIURI* aURI,

View File

@ -48,88 +48,86 @@ bitflags! {
const USER_INVALID = 1 << 13;
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-broken
const BROKEN = 1 << 14;
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-loading
const LOADING = 1 << 15;
/// <https://html.spec.whatwg.org/multipage/#selector-required>
const REQUIRED = 1 << 16;
const REQUIRED = 1 << 15;
/// <https://html.spec.whatwg.org/multipage/#selector-optional>
/// We use an underscore to workaround a silly windows.h define.
const OPTIONAL_ = 1 << 17;
const OPTIONAL_ = 1 << 16;
/// <https://html.spec.whatwg.org/multipage/#selector-defined>
const DEFINED = 1 << 18;
const DEFINED = 1 << 17;
/// <https://html.spec.whatwg.org/multipage/#selector-visited>
const VISITED = 1 << 19;
const VISITED = 1 << 18;
/// <https://html.spec.whatwg.org/multipage/#selector-link>
const UNVISITED = 1 << 20;
const UNVISITED = 1 << 19;
/// <https://drafts.csswg.org/selectors-4/#the-any-link-pseudo>
const VISITED_OR_UNVISITED = Self::VISITED.bits | Self::UNVISITED.bits;
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-drag-over
const DRAGOVER = 1 << 21;
const DRAGOVER = 1 << 20;
/// <https://html.spec.whatwg.org/multipage/#selector-in-range>
const INRANGE = 1 << 22;
const INRANGE = 1 << 21;
/// <https://html.spec.whatwg.org/multipage/#selector-out-of-range>
const OUTOFRANGE = 1 << 23;
const OUTOFRANGE = 1 << 22;
/// <https://html.spec.whatwg.org/multipage/#selector-read-only>
const READONLY = 1 << 24;
const READONLY = 1 << 23;
/// <https://html.spec.whatwg.org/multipage/#selector-read-write>
const READWRITE = 1 << 25;
const READWRITE = 1 << 24;
/// <https://html.spec.whatwg.org/multipage/#selector-default>
const DEFAULT = 1 << 26;
const DEFAULT = 1 << 25;
/// Non-standard & undocumented.
const OPTIMUM = 1 << 28;
const OPTIMUM = 1 << 26;
/// Non-standard & undocumented.
const SUB_OPTIMUM = 1 << 29;
const SUB_OPTIMUM = 1 << 27;
/// Non-standard & undocumented.
const SUB_SUB_OPTIMUM = 1 << 30;
const SUB_SUB_OPTIMUM = 1 << 28;
/// All the above <meter> bits in one place.
const METER_OPTIMUM_STATES = Self::OPTIMUM.bits | Self::SUB_OPTIMUM.bits | Self::SUB_SUB_OPTIMUM.bits;
/// Non-standard & undocumented.
const INCREMENT_SCRIPT_LEVEL = 1u64 << 31;
const INCREMENT_SCRIPT_LEVEL = 1 << 29;
/// <https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo>
const FOCUSRING = 1u64 << 32;
const FOCUSRING = 1 << 30;
/// <https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo>
const FOCUS_WITHIN = 1u64 << 33;
const FOCUS_WITHIN = 1u64 << 31;
/// :dir matching; the states are used for dynamic change detection.
/// State that elements that match :dir(ltr) are in.
const LTR = 1u64 << 34;
const LTR = 1u64 << 32;
/// State that elements that match :dir(rtl) are in.
const RTL = 1u64 << 35;
const RTL = 1u64 << 33;
/// State that HTML elements that have a "dir" attr are in.
const HAS_DIR_ATTR = 1u64 << 36;
const HAS_DIR_ATTR = 1u64 << 34;
/// State that HTML elements with dir="ltr" (or something
/// case-insensitively equal to "ltr") are in.
const HAS_DIR_ATTR_LTR = 1u64 << 37;
const HAS_DIR_ATTR_LTR = 1u64 << 35;
/// State that HTML elements with dir="rtl" (or something
/// case-insensitively equal to "rtl") are in.
const HAS_DIR_ATTR_RTL = 1u64 << 38;
const HAS_DIR_ATTR_RTL = 1u64 << 36;
/// State that HTML <bdi> elements without a valid-valued "dir" attr or
/// any HTML elements (including <bdi>) with dir="auto" (or something
/// case-insensitively equal to "auto") are in.
const HAS_DIR_ATTR_LIKE_AUTO = 1u64 << 39;
const HAS_DIR_ATTR_LIKE_AUTO = 1u64 << 37;
/// Non-standard & undocumented.
const AUTOFILL = 1u64 << 40;
const AUTOFILL = 1u64 << 38;
/// Non-standard & undocumented.
const AUTOFILL_PREVIEW = 1u64 << 41;
const AUTOFILL_PREVIEW = 1u64 << 39;
/// State for modal elements:
/// <https://drafts.csswg.org/selectors-4/#modal-state>
const MODAL = 1u64 << 42;
const MODAL = 1u64 << 40;
/// <https://html.spec.whatwg.org/multipage/#inert-subtrees>
const INERT = 1u64 << 43;
const INERT = 1u64 << 41;
/// State for the topmost modal element in top layer
const TOPMOST_MODAL = 1u64 << 44;
const TOPMOST_MODAL = 1u64 << 42;
/// Initially used for the devtools highlighter, but now somehow only
/// used for the devtools accessibility inspector.
const DEVTOOLS_HIGHLIGHTED = 1u64 << 45;
const DEVTOOLS_HIGHLIGHTED = 1u64 << 43;
/// Used for the devtools style editor. Probably should go away.
const STYLEEDITOR_TRANSITIONING = 1u64 << 46;
const STYLEEDITOR_TRANSITIONING = 1u64 << 44;
/// For :-moz-value-empty (to show widgets like the reveal password
/// button or the clear button).
const VALUE_EMPTY = 1u64 << 47;
const VALUE_EMPTY = 1u64 << 45;
/// For :-moz-revealed.
const REVEALED = 1u64 << 48;
const REVEALED = 1u64 << 46;
/// https://html.spec.whatwg.org/#selector-popover-open
/// Match element's popover visibility state of showing
const POPOVER_OPEN = 1u64 << 49;
const POPOVER_OPEN = 1u64 << 47;
/// Some convenience unions.
const DIR_STATES = Self::LTR.bits | Self::RTL.bits;

View File

@ -30,9 +30,6 @@ HTMLEmbedElement::HTMLEmbedElement(
: nsGenericHTMLElement(std::move(aNodeInfo)) {
RegisterActivityObserver();
SetIsNetworkCreated(aFromParser == FROM_PARSER_NETWORK);
// By default we're in the loading state
AddStatesSilently(ElementState::LOADING);
}
HTMLEmbedElement::~HTMLEmbedElement() {

View File

@ -341,8 +341,7 @@ void HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
bool forceReload = false;
if (aName == nsGkAtoms::loading &&
!ImageState().HasState(ElementState::LOADING)) {
if (aName == nsGkAtoms::loading && !mLoading) {
if (aValue && Loading(aValue->GetEnumValue()) == Loading::Lazy) {
SetLazyLoading();
} else if (aOldValue &&

View File

@ -35,9 +35,6 @@ HTMLObjectElement::HTMLObjectElement(
// <object> is always barred from constraint validation.
SetBarredFromConstraintValidation(true);
// By default we're in the loading state
AddStatesSilently(ElementState::LOADING);
}
HTMLObjectElement::~HTMLObjectElement() {

View File

@ -513,17 +513,11 @@ static bool StateChangeMayAffectFrame(const Element& aElement,
return false;
}
const bool loadingChanged = aStates.HasState(ElementState::LOADING);
if (!brokenChanged && !loadingChanged) {
if (!brokenChanged) {
return false;
}
if (aElement.IsHTMLElement(nsGkAtoms::img)) {
if (!brokenChanged) {
// Loading state doesn't affect <img>, see
// `nsImageFrame::ImageFrameTypeForElement`.
return false;
}
const bool needsImageFrame =
nsImageFrame::ImageFrameTypeFor(aElement, *aFrame.Style()) !=
nsImageFrame::ImageFrameType::None;
@ -535,7 +529,7 @@ static bool StateChangeMayAffectFrame(const Element& aElement,
return false;
}
return brokenChanged || loadingChanged;
return brokenChanged;
}
/**

View File

@ -1309,7 +1309,6 @@ function runTests() {
}
test_parseable(":-moz-broken");
test_parseable(":-moz-loading");
run_deferred_tests();
}

View File

@ -56,7 +56,6 @@ macro_rules! apply_non_ts_list {
("modal", Modal, MODAL, _),
("-moz-topmost-modal", MozTopmostModal, TOPMOST_MODAL, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-broken", MozBroken, BROKEN, _),
("-moz-loading", MozLoading, LOADING, _),
("-moz-has-dir-attr", MozHasDirAttr, HAS_DIR_ATTR, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-dir-attr-ltr", MozDirAttrLTR, HAS_DIR_ATTR_LTR, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-dir-attr-rtl", MozDirAttrRTL, HAS_DIR_ATTR_RTL, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),

View File

@ -1915,7 +1915,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
NonTSPseudoClass::Valid |
NonTSPseudoClass::Invalid |
NonTSPseudoClass::MozBroken |
NonTSPseudoClass::MozLoading |
NonTSPseudoClass::Required |
NonTSPseudoClass::Optional |
NonTSPseudoClass::ReadOnly |