Bug 1690340 - Part 1: Hide all the panel tools in the developer tools menu. r=jdescottes
[gecko.git] / parser / html / nsHtml5SVGLoadDispatcher.cpp
blob10abf8ee42d353c4c1851fbd1613678574834aa8
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsHtml5SVGLoadDispatcher.h"
6 #include "mozilla/BasicEvents.h"
7 #include "mozilla/EventDispatcher.h"
8 #include "mozilla/dom/Document.h"
9 #include "mozilla/dom/DocumentInlines.h"
10 #include "nsPresContext.h"
12 using namespace mozilla;
14 nsHtml5SVGLoadDispatcher::nsHtml5SVGLoadDispatcher(nsIContent* aElement)
15 : Runnable("nsHtml5SVGLoadDispatcher"),
16 mElement(aElement),
17 mDocument(mElement->OwnerDoc()) {
18 mDocument->BlockOnload();
21 NS_IMETHODIMP
22 nsHtml5SVGLoadDispatcher::Run() {
23 WidgetEvent event(true, eSVGLoad);
24 event.mFlags.mBubbles = false;
25 // Do we care about forcing presshell creation if it hasn't happened yet?
26 // That is, should this code flush or something? Does it really matter?
27 // For that matter, do we really want to try getting the prescontext?
28 // Does this event ever want one?
29 RefPtr<nsPresContext> ctx = mElement->OwnerDoc()->GetPresContext();
30 EventDispatcher::Dispatch(mElement, ctx, &event);
31 // Unblocking onload on the same document that it was blocked even if
32 // the element has moved between docs since blocking.
33 mDocument->UnblockOnload(false);
34 return NS_OK;