Bug 1578448 - Make img.complete align with spec; r=bzbarsky
If the img has srcset attribute and the current request isn't complete or broken, the img.complete should return false per spec, https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete. We should check srcset or src attribute, checking only mCurrentRequest isn't enough given that updating mCurrentRequest happens async. Differential Revision: https://phabricator.services.mozilla.com/D44678
This commit is contained in:
@@ -164,11 +164,17 @@ bool HTMLImageElement::Draggable() const {
|
||||
}
|
||||
|
||||
bool HTMLImageElement::Complete() {
|
||||
if (!mCurrentRequest) {
|
||||
return true;
|
||||
// It is still not clear what value should img.complete return in various
|
||||
// cases, see https://github.com/whatwg/html/issues/4884
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::srcset)) {
|
||||
nsAutoString src;
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::src, src) || src.IsEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mPendingRequest) {
|
||||
if (!mCurrentRequest || mPendingRequest) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user