зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1045532 - Part 2 - Trigger <picture> source selection when a previous source type is updated. r=bz
This commit is contained in:
Родитель
4f50823674
Коммит
d68824ead0
|
@ -985,9 +985,8 @@ HTMLImageElement::PictureSourceSizesChanged(nsIContent *aSourceNode,
|
|||
}
|
||||
|
||||
void
|
||||
HTMLImageElement::PictureSourceMediaChanged(nsIContent *aSourceNode,
|
||||
const nsAString& aNewValue,
|
||||
bool aNotify)
|
||||
HTMLImageElement::PictureSourceMediaOrTypeChanged(nsIContent *aSourceNode,
|
||||
bool aNotify)
|
||||
{
|
||||
if (!HTMLPictureElement::IsPictureEnabled()) {
|
||||
return;
|
||||
|
|
|
@ -230,8 +230,9 @@ protected:
|
|||
const nsAString& aNewValue, bool aNotify);
|
||||
void PictureSourceSizesChanged(nsIContent *aSourceNode,
|
||||
const nsAString& aNewValue, bool aNotify);
|
||||
void PictureSourceMediaChanged(nsIContent *aSourceNode,
|
||||
const nsAString& aNewValue, bool aNotify);
|
||||
// As we re-run the source selection on these mutations regardless,
|
||||
// we don't actually care which changed or to what
|
||||
void PictureSourceMediaOrTypeChanged(nsIContent *aSourceNode, bool aNotify);
|
||||
|
||||
void PictureSourceAdded(nsIContent *aSourceNode);
|
||||
// This should be called prior to the unbind, such that nextsibling works
|
||||
|
|
|
@ -65,7 +65,8 @@ HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
if (aNameSpaceID == kNameSpaceID_None &&
|
||||
(aName == nsGkAtoms::srcset ||
|
||||
aName == nsGkAtoms::sizes ||
|
||||
aName == nsGkAtoms::media) &&
|
||||
aName == nsGkAtoms::media ||
|
||||
aName == nsGkAtoms::type) &&
|
||||
parent && parent->Tag() == nsGkAtoms::picture) {
|
||||
nsString strVal = aValue ? aValue->GetStringValue() : EmptyString();
|
||||
// Find all img siblings after this <source> and notify them of the change
|
||||
|
@ -77,8 +78,9 @@ HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
img->PictureSourceSrcsetChanged(AsContent(), strVal, aNotify);
|
||||
} else if (aName == nsGkAtoms::sizes) {
|
||||
img->PictureSourceSizesChanged(AsContent(), strVal, aNotify);
|
||||
} else if (aName == nsGkAtoms::media) {
|
||||
img->PictureSourceMediaChanged(AsContent(), strVal, aNotify);
|
||||
} else if (aName == nsGkAtoms::media ||
|
||||
aName == nsGkAtoms::type) {
|
||||
img->PictureSourceMediaOrTypeChanged(AsContent(), aNotify);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче