parser/html/nsHtml5SVGLoadDispatcher.cpp

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "nsHtml5SVGLoadDispatcher.h"
michael@0 6 #include "nsPresContext.h"
michael@0 7 #include "nsIPresShell.h"
michael@0 8 #include "mozilla/BasicEvents.h"
michael@0 9 #include "mozilla/EventDispatcher.h"
michael@0 10 #include "nsIDocument.h"
michael@0 11
michael@0 12 using namespace mozilla;
michael@0 13
michael@0 14 nsHtml5SVGLoadDispatcher::nsHtml5SVGLoadDispatcher(nsIContent* aElement)
michael@0 15 : mElement(aElement)
michael@0 16 , mDocument(mElement->OwnerDoc())
michael@0 17 {
michael@0 18 mDocument->BlockOnload();
michael@0 19 }
michael@0 20
michael@0 21 NS_IMETHODIMP
michael@0 22 nsHtml5SVGLoadDispatcher::Run()
michael@0 23 {
michael@0 24 WidgetEvent event(true, NS_SVG_LOAD);
michael@0 25 event.mFlags.mBubbles = false;
michael@0 26 // Do we care about forcing presshell creation if it hasn't happened yet?
michael@0 27 // That is, should this code flush or something? Does it really matter?
michael@0 28 // For that matter, do we really want to try getting the prescontext?
michael@0 29 // Does this event ever want one?
michael@0 30 nsRefPtr<nsPresContext> ctx;
michael@0 31 nsCOMPtr<nsIPresShell> shell = mElement->OwnerDoc()->GetShell();
michael@0 32 if (shell) {
michael@0 33 ctx = shell->GetPresContext();
michael@0 34 }
michael@0 35 EventDispatcher::Dispatch(mElement, ctx, &event);
michael@0 36 // Unblocking onload on the same document that it was blocked even if
michael@0 37 // the element has moved between docs since blocking.
michael@0 38 mDocument->UnblockOnload(false);
michael@0 39 return NS_OK;
michael@0 40 }

mercurial