Bug 1815161 - Remove validate attribute support from XUL images. r=Gijs

We have one single user left which goes back to bug 726444. No mention
to this attribute there and it seems to work without it.

Thunderbird has another validate="never" usage for favicons, but they
should replace it by an HTML image element like we did with ours in
bug 1718220.

Differential Revision: https://phabricator.services.mozilla.com/D168920
This commit is contained in:
Emilio Cobos Álvarez 2023-02-06 13:57:02 +00:00
parent 1db2f58537
commit daa95783bc
3 changed files with 3 additions and 32 deletions

View File

@ -431,7 +431,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
let MozXULElement = document.defaultView.MozXULElement;
downloadListItemFragment = MozXULElement.parseXULToFragment(`
<hbox class="downloadMainArea" flex="1" align="center">
<image class="downloadTypeIcon" validate="always"/>
<image class="downloadTypeIcon"/>
<vbox class="downloadContainer" flex="1" pack="center">
<description class="downloadTarget" crop="center"/>
<description class="downloadDetails downloadDetailsNormal"

View File

@ -143,9 +143,7 @@ nsresult nsImageBoxFrame::AttributeChanged(int32_t aNameSpaceID,
UpdateImage();
PresShell()->FrameNeedsReflow(
this, IntrinsicDirty::FrameAncestorsAndDescendants, NS_FRAME_IS_DIRTY);
} else if (aAttribute == nsGkAtoms::validate)
UpdateLoadFlags();
}
return rv;
}
@ -153,7 +151,6 @@ nsImageBoxFrame::nsImageBoxFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
: nsLeafBoxFrame(aStyle, aPresContext, kClassID),
mIntrinsicSize(0, 0),
mLoadFlags(nsIRequest::LOAD_NORMAL),
mRequestRegistered(false),
mUseSrcAttr(false),
mSuppressStyleCheck(false) {
@ -203,7 +200,6 @@ void nsImageBoxFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsLeafBoxFrame::Init(aContent, aParent, aPrevInFlow);
mSuppressStyleCheck = false;
UpdateLoadFlags();
UpdateImage();
}
@ -242,7 +238,7 @@ void nsImageBoxFrame::UpdateImage() {
auto referrerInfo = MakeRefPtr<ReferrerInfo>(*mContent->AsElement());
nsresult rv = nsContentUtils::LoadImage(
uri, mContent, doc, triggeringPrincipal, requestContextID,
referrerInfo, mListener, mLoadFlags, u""_ns,
referrerInfo, mListener, nsIRequest::LOAD_NORMAL, u""_ns,
getter_AddRefs(mImageRequest), contentPolicyType);
if (NS_SUCCEEDED(rv) && mImageRequest) {
@ -278,23 +274,6 @@ void nsImageBoxFrame::UpdateImage() {
}
}
void nsImageBoxFrame::UpdateLoadFlags() {
static Element::AttrValuesArray strings[] = {nsGkAtoms::always,
nsGkAtoms::never, nullptr};
switch (mContent->AsElement()->FindAttrValueIn(
kNameSpaceID_None, nsGkAtoms::validate, strings, eCaseMatters)) {
case 0:
mLoadFlags = nsIRequest::VALIDATE_ALWAYS;
break;
case 1:
mLoadFlags = nsIRequest::VALIDATE_NEVER | nsIRequest::LOAD_FROM_CACHE;
break;
default:
mLoadFlags = nsIRequest::LOAD_NORMAL;
break;
}
}
void nsImageBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) {
nsLeafBoxFrame::BuildDisplayList(aBuilder, aLists);

View File

@ -91,12 +91,6 @@ class nsImageBoxFrame final : public nsLeafBoxFrame {
* */
void UpdateImage();
/**
* Update mLoadFlags from content attributes. Does not attempt to reload the
* image using the new load flags.
*/
void UpdateLoadFlags();
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
@ -141,8 +135,6 @@ class nsImageBoxFrame final : public nsLeafBoxFrame {
RefPtr<imgRequestProxy> mImageRequest;
nsCOMPtr<imgINotificationObserver> mListener;
int32_t mLoadFlags;
// Boolean variable to determine if the current image request has been
// registered with the refresh driver.
bool mRequestRegistered;