Bug 1193349 - Part 1: Force a reload only when a source/img is really inserted into a picture; r=jdm
MozReview-Commit-ID: 4FfTwg1nRFO
This commit is contained in:
@@ -62,6 +62,35 @@ HTMLPictureElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLPictureElement::InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::InsertChildAt(aKid, aIndex, aNotify);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(aKid, rv);
|
||||
|
||||
if (aKid->IsHTMLElement(nsGkAtoms::img)) {
|
||||
HTMLImageElement* img = HTMLImageElement::FromContent(aKid);
|
||||
if (img) {
|
||||
img->PictureSourceAdded(aKid->AsContent());
|
||||
}
|
||||
} else if (aKid->IsHTMLElement(nsGkAtoms::source)) {
|
||||
// Find all img siblings after this <source> to notify them of its insertion
|
||||
nsCOMPtr<nsIContent> nextSibling = aKid->GetNextSibling();
|
||||
if (nextSibling && nextSibling->GetParentNode() == this) {
|
||||
do {
|
||||
HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
|
||||
if (img) {
|
||||
img->PictureSourceAdded(aKid->AsContent());
|
||||
}
|
||||
} while ( (nextSibling = nextSibling->GetNextSibling()) );
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLPictureElement::IsPictureEnabled()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user