mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 11:45:37 +00:00
Bug 837315 - Add SVG document loaded event. r=bz
This commit is contained in:
parent
792423680f
commit
9e1cc718d6
@ -7541,15 +7541,30 @@ nsDocument::UnblockOnload(bool aFireSync)
|
||||
|
||||
--mOnloadBlockCount;
|
||||
|
||||
// If mScriptGlobalObject is null, we shouldn't be messing with the loadgroup
|
||||
// -- it's not ours.
|
||||
if (mOnloadBlockCount == 0 && mScriptGlobalObject) {
|
||||
if (aFireSync && mAsyncOnloadBlockCount == 0) {
|
||||
// Increment mOnloadBlockCount, since DoUnblockOnload will decrement it
|
||||
++mOnloadBlockCount;
|
||||
DoUnblockOnload();
|
||||
} else {
|
||||
PostUnblockOnloadEvent();
|
||||
if (mOnloadBlockCount == 0) {
|
||||
if (mScriptGlobalObject) {
|
||||
// Only manipulate the loadgroup in this case, because if mScriptGlobalObject
|
||||
// is null, it's not ours.
|
||||
if (aFireSync && mAsyncOnloadBlockCount == 0) {
|
||||
// Increment mOnloadBlockCount, since DoUnblockOnload will decrement it
|
||||
++mOnloadBlockCount;
|
||||
DoUnblockOnload();
|
||||
} else {
|
||||
PostUnblockOnloadEvent();
|
||||
}
|
||||
} else if (mIsBeingUsedAsImage) {
|
||||
// To correctly unblock onload for a document that contains an SVG
|
||||
// image, we need to know when all of the SVG document's resources are
|
||||
// done loading, in a way comparable to |window.onload|. We fire this
|
||||
// event to indicate that the SVG should be considered fully loaded.
|
||||
// Because scripting is disabled on SVG-as-image documents, this event
|
||||
// is not accessible to content authors. (See bug 837135.)
|
||||
nsRefPtr<nsAsyncDOMEvent> e =
|
||||
new nsAsyncDOMEvent(this,
|
||||
NS_LITERAL_STRING("MozSVGAsImageDocumentLoad"),
|
||||
false,
|
||||
false);
|
||||
e->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user