/src/mozilla-central/parser/html/nsHtml5SVGLoadDispatcher.cpp
Line | Count | Source (jump to first uncovered line) |
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/. */ |
4 | | |
5 | | #include "nsHtml5SVGLoadDispatcher.h" |
6 | | #include "mozilla/BasicEvents.h" |
7 | | #include "mozilla/EventDispatcher.h" |
8 | | #include "nsIDocument.h" |
9 | | #include "nsIPresShell.h" |
10 | | #include "nsPresContext.h" |
11 | | |
12 | | using namespace mozilla; |
13 | | |
14 | | nsHtml5SVGLoadDispatcher::nsHtml5SVGLoadDispatcher(nsIContent* aElement) |
15 | | : Runnable("nsHtml5SVGLoadDispatcher") |
16 | | , mElement(aElement) |
17 | | , mDocument(mElement->OwnerDoc()) |
18 | 0 | { |
19 | 0 | mDocument->BlockOnload(); |
20 | 0 | } |
21 | | |
22 | | NS_IMETHODIMP |
23 | | nsHtml5SVGLoadDispatcher::Run() |
24 | 0 | { |
25 | 0 | WidgetEvent event(true, eSVGLoad); |
26 | 0 | event.mFlags.mBubbles = false; |
27 | 0 | // Do we care about forcing presshell creation if it hasn't happened yet? |
28 | 0 | // That is, should this code flush or something? Does it really matter? |
29 | 0 | // For that matter, do we really want to try getting the prescontext? |
30 | 0 | // Does this event ever want one? |
31 | 0 | RefPtr<nsPresContext> ctx = mElement->OwnerDoc()->GetPresContext(); |
32 | 0 | EventDispatcher::Dispatch(mElement, ctx, &event); |
33 | 0 | // Unblocking onload on the same document that it was blocked even if |
34 | 0 | // the element has moved between docs since blocking. |
35 | 0 | mDocument->UnblockOnload(false); |
36 | 0 | return NS_OK; |
37 | 0 | } |