Bug 1664432 - Remove -moz-user-disabled. r=edgar

We treat it exactly the same as -moz-broken. The pseudo-class is not
exposed to content, so I don't think we have a reason to keep it around.

Differential Revision: https://phabricator.services.mozilla.com/D89904
This commit is contained in:
Emilio Cobos Álvarez 2020-09-11 19:26:40 +00:00
Родитель 4cbf7b36fd
Коммит 1ef2a5628a
18 изменённых файлов: 23 добавлений и 50 удалений

Просмотреть файл

@ -55,8 +55,6 @@ interface nsIObjectLoadingContent : nsISupports
const unsigned long PLUGIN_CRASHED = 5;
// Suppressed by security policy
const unsigned long PLUGIN_SUPPRESSED = 6;
// Blocked by content policy
const unsigned long PLUGIN_USER_DISABLED = 7;
/// ** All values >= PLUGIN_CLICK_TO_PLAY are plugin placeholder types that
/// would be replaced by a real plugin if activated (playPlugin())
/// ** Furthermore, values >= PLUGIN_CLICK_TO_PLAY and

Просмотреть файл

@ -102,7 +102,6 @@ nsImageLoadingContent::nsImageLoadingContent()
mLoading(false),
// mBroken starts out true, since an image without a URI is broken....
mBroken(true),
mUserDisabled(false),
mSuppressed(false),
mNewRequestsWillNeedAnimationReset(false),
mUseUrgentStartForChannel(false),
@ -1279,9 +1278,6 @@ EventStates nsImageLoadingContent::ImageState() const {
if (mBroken) {
states |= NS_EVENT_STATE_BROKEN;
}
if (mUserDisabled) {
states |= NS_EVENT_STATE_USERDISABLED;
}
if (mSuppressed) {
states |= NS_EVENT_STATE_SUPPRESSED;
}
@ -1305,7 +1301,7 @@ void nsImageLoadingContent::UpdateImageState(bool aNotify) {
nsIContent* thisContent = AsContent();
mLoading = mBroken = mUserDisabled = mSuppressed = false;
mLoading = mBroken = mSuppressed = false;
// If we were blocked by server-based content policy, we claim to be
// suppressed. If we were blocked by type-based content policy, we claim to
@ -1313,7 +1309,7 @@ void nsImageLoadingContent::UpdateImageState(bool aNotify) {
if (mImageBlockingStatus == nsIContentPolicy::REJECT_SERVER) {
mSuppressed = true;
} else if (mImageBlockingStatus == nsIContentPolicy::REJECT_TYPE) {
mUserDisabled = true;
mBroken = true;
} else if (!mCurrentRequest) {
if (!mLazyLoading) {
// In case of non-lazy loading, no current request means error, since we

Просмотреть файл

@ -120,9 +120,10 @@ class nsImageLoadingContent : public nsIImageLoadingContent {
/**
* ImageState is called by subclasses that are computing their content state.
* The return value will have the NS_EVENT_STATE_BROKEN,
* NS_EVENT_STATE_USERDISABLED, and NS_EVENT_STATE_SUPPRESSED bits set as
* needed. Note that this state assumes that this node is "trying" to be an
* The return value will have the NS_EVENT_STATE_BROKEN, and
* NS_EVENT_STATE_SUPPRESSED bits set as needed.
*
* Note that this state assumes that this node is "trying" to be an
* image (so for example complete lack of attempt to load an image will lead
* to NS_EVENT_STATE_BROKEN being set). Subclasses that are not "trying" to
* be an image (eg an HTML <input> of type other than "image") should just
@ -575,7 +576,6 @@ class nsImageLoadingContent : public nsIImageLoadingContent {
*/
bool mLoading : 1;
bool mBroken : 1;
bool mUserDisabled : 1;
bool mSuppressed : 1;
protected:

Просмотреть файл

@ -1276,8 +1276,6 @@ EventStates nsObjectLoadingContent::ObjectState() const {
switch (mFallbackType) {
case eFallbackSuppressed:
return NS_EVENT_STATE_SUPPRESSED;
case eFallbackUserDisabled:
return NS_EVENT_STATE_USERDISABLED;
case eFallbackClickToPlay:
case eFallbackClickToPlayQuiet:
return NS_EVENT_STATE_TYPE_CLICK_TO_PLAY;
@ -2047,7 +2045,7 @@ nsresult nsObjectLoadingContent::LoadObject(bool aNotify, bool aForceLoad,
LOG(("OBJLC [%p]: Load denied by policy", this));
mType = eType_Null;
if (contentPolicy == nsIContentPolicy::REJECT_TYPE) {
fallbackType = eFallbackUserDisabled;
fallbackType = eFallbackDisabled;
} else {
fallbackType = eFallbackSuppressed;
}

Просмотреть файл

@ -91,8 +91,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent,
eFallbackCrashed = nsIObjectLoadingContent::PLUGIN_CRASHED,
// Suppressed by security policy
eFallbackSuppressed = nsIObjectLoadingContent::PLUGIN_SUPPRESSED,
// Blocked by content policy
eFallbackUserDisabled = nsIObjectLoadingContent::PLUGIN_USER_DISABLED,
/// ** All values >= eFallbackClickToPlay are plugin placeholder types
/// that would be replaced by a real plugin if activated (PlayPlugin())
/// ** Furthermore, values >= eFallbackClickToPlay and

Просмотреть файл

@ -28,9 +28,7 @@ function onLoad() {
img:-moz-broken {
color: red
}
img:-moz-user-disabled {
color: blue
}`;
`;
var sheetURL = "data:text/css," + encodeURIComponent(css);
winUtils.loadSheetUsingURIString(sheetURL, winUtils.AGENT_SHEET);
@ -82,16 +80,14 @@ function onLoad() {
});
}).then(() => {
// Now image is denied, loading image will be rejected with REJECT_TYPE,
// which will be mapped to :-moz-user-disabled
// which will be mapped to :-moz-broken too.
img3.src = "https://example.com/tests/image/test/mochitest/shaver.png";
doc.body.appendChild(img3);
return imgListener(img3);
}).then(() => {
ok(true, "img3 shouldn't be loaded");
// -moz-user-disabled is also chrome only, so we didn't use matches() to verify.
is(iframe.contentWindow.getComputedStyle(img3).color, "rgb(0, 0, 255)",
"color of img3 should be blue");
ok(img3.matches(":-moz-broken"), "should match ':-moz-broken' selector");
is(img3.imageBlockingStatus, Ci.nsIContentPolicy.REJECT_TYPE,
"imageBlockingStatues should be REJECT_TYPE.");

Просмотреть файл

@ -199,8 +199,9 @@ class EventStates {
#define NS_EVENT_STATE_MOZ_UI_INVALID NS_DEFINE_EVENT_STATE_MACRO(13)
// Content could not be rendered (image/object/etc).
#define NS_EVENT_STATE_BROKEN NS_DEFINE_EVENT_STATE_MACRO(14)
// Content disabled by the user (images turned off, say).
#define NS_EVENT_STATE_USERDISABLED NS_DEFINE_EVENT_STATE_MACRO(15)
// There's a free bit here.
// Content suppressed by the user (ad blocking, etc).
#define NS_EVENT_STATE_SUPPRESSED NS_DEFINE_EVENT_STATE_MACRO(16)
// Content is still loading such that there is nothing to show the

Просмотреть файл

@ -117,9 +117,6 @@ interface mixin MozObjectLoadingContent {
// Suppressed by security policy
[ChromeOnly]
const unsigned long PLUGIN_SUPPRESSED = 6;
// Blocked by content policy
[ChromeOnly]
const unsigned long PLUGIN_USER_DISABLED = 7;
/// ** All values >= PLUGIN_CLICK_TO_PLAY are plugin placeholder types that
/// would be replaced by a real plugin if activated (playPlugin())
/// ** Furthermore, values >= PLUGIN_CLICK_TO_PLAY and

Просмотреть файл

@ -469,8 +469,7 @@ static bool StateChangeMayAffectFrame(const Element& aElement,
}
const bool brokenChanged = aStates.HasAtLeastOneOfStates(
NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED |
NS_EVENT_STATE_SUPPRESSED);
NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_SUPPRESSED);
const bool loadingChanged =
aStates.HasAtLeastOneOfStates(NS_EVENT_STATE_LOADING);

Просмотреть файл

@ -3504,7 +3504,6 @@ nsCSSFrameConstructor::FindObjectData(const Element& aElement,
// we want to treat those cases as TYPE_NULL
uint32_t type;
if (aElement.State().HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN |
NS_EVENT_STATE_USERDISABLED |
NS_EVENT_STATE_SUPPRESSED)) {
type = nsIObjectLoadingContent::TYPE_NULL;
} else {

Просмотреть файл

@ -632,14 +632,12 @@ nsRect nsImageFrame::SourceRectToDest(const nsIntRect& aRect) {
return r;
}
// Note that we treat NS_EVENT_STATE_SUPPRESSED images as "OK". This means
// that we'll construct image frames for them as needed if their display is
// toggled from "none" (though we won't paint them, unless their visibility
// is changed too).
#define BAD_STATES (NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED)
static bool ImageOk(EventStates aState) {
return !aState.HasAtLeastOneOfStates(BAD_STATES);
// Note that we treat NS_EVENT_STATE_SUPPRESSED images as "OK". This means
// that we'll construct image frames for them as needed if their display is
// toggled from "none" (though we won't paint them, unless their visibility
// is changed too).
return !aState.HasState(NS_EVENT_STATE_BROKEN);
}
static bool HasAltText(const Element& aElement) {

Просмотреть файл

@ -647,13 +647,13 @@ hr[size="1"] {
border-style: solid none none none;
}
input:is(:-moz-broken, :-moz-user-disabled)::before,
img:is(:-moz-broken, :-moz-user-disabled)::before {
input:-moz-broken::before,
img:-moz-broken::before {
content: -moz-alt-content !important;
unicode-bidi: isolate;
}
object:is(:-moz-broken,:-moz-user-disabled) > *|* {
object:-moz-broken > *|* {
/*
Inherit in the object's alignment so that if we aren't aligned explicitly
we'll end up in the right place vertically. See bug 36997. Note that this

Просмотреть файл

@ -20,7 +20,6 @@ const NON_CONTENT_ACCESIBLE_PSEUDOS = [
":-moz-browser-frame",
":-moz-devtools-highlighted",
":-moz-styleeditor-transitioning",
":-moz-user-disabled",
":-moz-handler-clicktoplay",
":-moz-handler-vulnerable-updatable",
":-moz-handler-vulnerable-no-update",

Просмотреть файл

@ -1125,7 +1125,6 @@ function runTests() {
// Plugin pseudoclasses are chrome-only:
test_unbalanced_unparseable(":-moz-type-unsupported");
test_unbalanced_unparseable(":-moz-user-disabled");
test_unbalanced_unparseable(":-moz-suppressed");
test_unbalanced_unparseable(":-moz-type-unsupported");
test_unbalanced_unparseable(":-moz-type-unsupported-platform");

Просмотреть файл

@ -53,8 +53,6 @@ bitflags! {
const IN_MOZ_UI_INVALID_STATE = 1 << 13;
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-broken
const IN_BROKEN_STATE = 1 << 14;
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-user-disabled
const IN_USER_DISABLED_STATE = 1 << 15;
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-suppressed
const IN_SUPPRESSED_STATE = 1 << 16;
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-loading

Просмотреть файл

@ -92,8 +92,6 @@ macro_rules! apply_non_ts_list {
("-moz-meter-sub-optimum", MozMeterSubOptimum, IN_SUB_OPTIMUM_STATE, _),
("-moz-meter-sub-sub-optimum", MozMeterSubSubOptimum, IN_SUB_SUB_OPTIMUM_STATE, _),
("-moz-user-disabled", MozUserDisabled, IN_USER_DISABLED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-first-node", MozFirstNode, _, _),
("-moz-last-node", MozLastNode, _, _),
("-moz-only-whitespace", MozOnlyWhitespace, _, _),

Просмотреть файл

@ -2023,7 +2023,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
NonTSPseudoClass::Invalid |
NonTSPseudoClass::MozUIValid |
NonTSPseudoClass::MozBroken |
NonTSPseudoClass::MozUserDisabled |
NonTSPseudoClass::MozSuppressed |
NonTSPseudoClass::MozLoading |
NonTSPseudoClass::MozHandlerBlocked |

Просмотреть файл

@ -242,7 +242,7 @@ var classifierTester = {
}
return null;
case "denied":
return Ci.nsIObjectLoadingContent.PLUGIN_USER_DISABLED;
return Ci.nsIObjectLoadingContent.PLUGIN_DISABLED;
}
throw new Error("Invalid classification or flash setting");
},