forked from mirrors/gecko-dev
Bug 1478823: Add a chrome DOM event signalling that the head element's children have been parsed. r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D2612 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
a3c93fda4e
commit
7ea0473c02
3 changed files with 20 additions and 1 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/dom/HTMLParamElementBinding.h"
|
||||
#include "mozilla/dom/HTMLQuoteElementBinding.h"
|
||||
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
|
@ -56,6 +57,21 @@ HTMLSharedElement::GetHref(nsAString& aValue)
|
|||
CopyUTF8toUTF16(spec, aValue);
|
||||
}
|
||||
|
||||
void
|
||||
HTMLSharedElement::DoneAddingChildren(bool aHaveNotified)
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::head)) {
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("DOMHeadElementParsed"),
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
// Always run async in order to avoid running script when the content
|
||||
// sink isn't expecting it.
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLSharedElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsAtom* aAttribute,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ public:
|
|||
}
|
||||
|
||||
// nsIContent
|
||||
virtual void DoneAddingChildren(bool aHaveNotified) override;
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
|
|
|
|||
|
|
@ -1109,7 +1109,8 @@ nsHtml5TreeBuilder::elementPopped(int32_t aNamespace,
|
|||
// properly (e.g. form state restoration).
|
||||
// XXX expose ElementName group here and do switch
|
||||
if (aName == nsGkAtoms::object || aName == nsGkAtoms::select ||
|
||||
aName == nsGkAtoms::textarea || aName == nsGkAtoms::output) {
|
||||
aName == nsGkAtoms::textarea || aName == nsGkAtoms::output ||
|
||||
aName == nsGkAtoms::head) {
|
||||
if (mBuilder) {
|
||||
nsHtml5TreeOperation::DoneAddingChildren(
|
||||
static_cast<nsIContent*>(aElement));
|
||||
|
|
|
|||
Loading…
Reference in a new issue