mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-23 12:53:07 +09:00
Issue #2736 - Part 10: Re-work <source> srcset attribute.
Use subject principal as triggering principal in <source> "srcset" attribute for <picture>.
This commit is contained in:
parent
b1b5062dc4
commit
faf4f2c23f
4 changed files with 21 additions and 4 deletions
|
|
@ -1060,6 +1060,8 @@ HTMLImageElement::PictureSourceSrcsetChanged(nsIContent *aSourceNode,
|
|||
nsCOMPtr<nsIPrincipal> principal;
|
||||
if (aSourceNode == this) {
|
||||
principal = mSrcsetTriggeringPrincipal;
|
||||
} else if (auto* source = HTMLSourceElement::FromContent(aSourceNode)) {
|
||||
principal = source->GetSrcsetTriggeringPrincipal();
|
||||
}
|
||||
mResponsiveSelector->SetCandidatesFromSourceSet(aNewValue, principal);
|
||||
}
|
||||
|
|
@ -1254,6 +1256,8 @@ HTMLImageElement::TryCreateResponsiveSelector(nsIContent *aSourceNode)
|
|||
if (!SourceElementMatches(aSourceNode)) {
|
||||
return false;
|
||||
}
|
||||
auto* source = HTMLSourceElement::FromContent(aSourceNode);
|
||||
principal = source->GetSrcsetTriggeringPrincipal();
|
||||
} else if (aSourceNode->IsHTMLElement(nsGkAtoms::img)) {
|
||||
// Otherwise this is the <img> tag itself
|
||||
MOZ_ASSERT(aSourceNode == this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue