2012-05-29 19:52:43 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-07-19 02:07:54 +04:00
|
|
|
|
|
|
|
#include "nsHtml5SVGLoadDispatcher.h"
|
2013-09-25 15:21:22 +04:00
|
|
|
#include "mozilla/BasicEvents.h"
|
2014-03-18 08:48:21 +04:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2013-10-02 15:40:07 +04:00
|
|
|
#include "nsIDocument.h"
|
2018-03-16 18:26:06 +03:00
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsPresContext.h"
|
2010-07-19 02:07:54 +04:00
|
|
|
|
2013-10-02 07:46:04 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2010-07-19 02:07:54 +04:00
|
|
|
nsHtml5SVGLoadDispatcher::nsHtml5SVGLoadDispatcher(nsIContent* aElement)
|
2017-01-18 03:50:34 +03:00
|
|
|
: Runnable("nsHtml5SVGLoadDispatcher")
|
|
|
|
, mElement(aElement)
|
2011-10-18 14:53:36 +04:00
|
|
|
, mDocument(mElement->OwnerDoc())
|
2010-07-19 02:07:54 +04:00
|
|
|
{
|
|
|
|
mDocument->BlockOnload();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHtml5SVGLoadDispatcher::Run()
|
|
|
|
{
|
2015-09-07 17:55:51 +03:00
|
|
|
WidgetEvent event(true, eSVGLoad);
|
2012-12-16 05:26:03 +04:00
|
|
|
event.mFlags.mBubbles = false;
|
2010-07-19 02:07:54 +04:00
|
|
|
// Do we care about forcing presshell creation if it hasn't happened yet?
|
|
|
|
// That is, should this code flush or something? Does it really matter?
|
|
|
|
// For that matter, do we really want to try getting the prescontext?
|
|
|
|
// Does this event ever want one?
|
2018-02-21 01:00:10 +03:00
|
|
|
RefPtr<nsPresContext> ctx = mElement->OwnerDoc()->GetPresContext();
|
2014-03-18 08:48:21 +04:00
|
|
|
EventDispatcher::Dispatch(mElement, ctx, &event);
|
2010-07-19 02:07:54 +04:00
|
|
|
// Unblocking onload on the same document that it was blocked even if
|
|
|
|
// the element has moved between docs since blocking.
|
2011-10-17 18:59:28 +04:00
|
|
|
mDocument->UnblockOnload(false);
|
2010-07-19 02:07:54 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|