Bug 1332956 part 3. Implement the same behavior for <object>-inside-<object> and <object>-inside-mediaelement as we do for <embed> already. r=qdot
This commit is contained in:
@@ -180,7 +180,7 @@ HTMLSharedObjectElement::SetAttr(int32_t aNameSpaceID, nsIAtom *aName,
|
||||
// attributes before inserting the node into the document.
|
||||
if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
|
||||
aNameSpaceID == kNameSpaceID_None && aName == URIAttrName()
|
||||
&& !BlockEmbedContentLoading()) {
|
||||
&& !BlockEmbedOrObjectContentLoading()) {
|
||||
return LoadObject(aNotify, true);
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ HTMLSharedObjectElement::StartObjectLoad(bool aNotify, bool aForceLoad)
|
||||
// BindToTree can call us asynchronously, and we may be removed from the tree
|
||||
// in the interim
|
||||
if (!IsInComposedDoc() || !OwnerDoc()->IsActive() ||
|
||||
BlockEmbedContentLoading()) {
|
||||
BlockEmbedOrObjectContentLoading()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -389,31 +389,5 @@ HTMLSharedObjectElement::GetContentPolicyType() const
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLSharedObjectElement::BlockEmbedContentLoading()
|
||||
{
|
||||
// Only check on embed elements
|
||||
if (!IsHTMLElement(nsGkAtoms::embed)) {
|
||||
return false;
|
||||
}
|
||||
// Traverse up the node tree to see if we have any ancestors that may block us
|
||||
// from loading
|
||||
for (nsIContent* parent = GetParent(); parent; parent = parent->GetParent()) {
|
||||
if (parent->IsAnyOfHTMLElements(nsGkAtoms::video, nsGkAtoms::audio)) {
|
||||
return true;
|
||||
}
|
||||
// If we have an ancestor that is an object with a source, it'll have an
|
||||
// associated displayed type. If that type is not null, don't load content
|
||||
// for the embed.
|
||||
if (HTMLObjectElement* object = HTMLObjectElement::FromContent(parent)) {
|
||||
uint32_t type = object->DisplayedType();
|
||||
if (type != eType_Null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
Reference in New Issue
Block a user