зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1031051: Part 16 - Migrate Style*ChangeEvent to the WebIDL code generator. r=smaug
This commit is contained in:
Родитель
adffec442f
Коммит
0f7b974094
|
@ -139,9 +139,9 @@
|
|||
#include "nsIPrompt.h"
|
||||
#include "nsIPropertyBag2.h"
|
||||
#include "mozilla/dom/PageTransitionEvent.h"
|
||||
#include "nsIDOMStyleRuleChangeEvent.h"
|
||||
#include "nsIDOMStyleSheetChangeEvent.h"
|
||||
#include "nsIDOMStyleSheetApplicableStateChangeEvent.h"
|
||||
#include "mozilla/dom/StyleRuleChangeEvent.h"
|
||||
#include "mozilla/dom/StyleSheetChangeEvent.h"
|
||||
#include "mozilla/dom/StyleSheetApplicableStateChangeEvent.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsEscape.h"
|
||||
|
@ -3982,30 +3982,27 @@ nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet)
|
|||
}
|
||||
}
|
||||
|
||||
#define DO_STYLESHEET_NOTIFICATION(createFunc, concreteInterface, initMethod, type, ...) \
|
||||
do { \
|
||||
nsCOMPtr<nsIDOMEvent> event; \
|
||||
nsresult rv = createFunc(getter_AddRefs(event), this, \
|
||||
mPresShell ? \
|
||||
mPresShell->GetPresContext() : nullptr, \
|
||||
nullptr); \
|
||||
if (NS_FAILED(rv)) { \
|
||||
return; \
|
||||
} \
|
||||
nsCOMPtr<nsIDOMCSSStyleSheet> cssSheet(do_QueryInterface(aSheet)); \
|
||||
if (!cssSheet) { \
|
||||
return; \
|
||||
} \
|
||||
nsCOMPtr<concreteInterface> ssEvent(do_QueryInterface(event)); \
|
||||
MOZ_ASSERT(ssEvent); \
|
||||
ssEvent->initMethod(NS_LITERAL_STRING(type), true, true, \
|
||||
cssSheet, __VA_ARGS__); \
|
||||
event->SetTrusted(true); \
|
||||
event->SetTarget(this); \
|
||||
nsRefPtr<AsyncEventDispatcher> asyncDispatcher = \
|
||||
new AsyncEventDispatcher(this, event); \
|
||||
asyncDispatcher->mDispatchChromeOnly = true; \
|
||||
asyncDispatcher->PostDOMEvent(); \
|
||||
#define DO_STYLESHEET_NOTIFICATION(className, type, memberName, argName) \
|
||||
do { \
|
||||
nsRefPtr<CSSStyleSheet> cssSheet = do_QueryObject(aSheet); \
|
||||
if (!cssSheet) { \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
className##Init init; \
|
||||
init.mBubbles = true; \
|
||||
init.mCancelable = true; \
|
||||
init.mStylesheet = cssSheet; \
|
||||
init.memberName = argName; \
|
||||
\
|
||||
nsRefPtr<className> event = \
|
||||
className::Constructor(this, NS_LITERAL_STRING(type), init); \
|
||||
event->SetTrusted(true); \
|
||||
event->SetTarget(this); \
|
||||
nsRefPtr<AsyncEventDispatcher> asyncDispatcher = \
|
||||
new AsyncEventDispatcher(this, event); \
|
||||
asyncDispatcher->mDispatchChromeOnly = true; \
|
||||
asyncDispatcher->PostDOMEvent(); \
|
||||
} while (0);
|
||||
|
||||
void
|
||||
|
@ -4014,10 +4011,9 @@ nsDocument::NotifyStyleSheetAdded(nsIStyleSheet* aSheet, bool aDocumentSheet)
|
|||
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, aSheet, aDocumentSheet));
|
||||
|
||||
if (StyleSheetChangeEventsEnabled()) {
|
||||
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleSheetChangeEvent,
|
||||
nsIDOMStyleSheetChangeEvent,
|
||||
InitStyleSheetChangeEvent,
|
||||
DO_STYLESHEET_NOTIFICATION(StyleSheetChangeEvent,
|
||||
"StyleSheetAdded",
|
||||
mDocumentSheet,
|
||||
aDocumentSheet);
|
||||
}
|
||||
}
|
||||
|
@ -4028,10 +4024,9 @@ nsDocument::NotifyStyleSheetRemoved(nsIStyleSheet* aSheet, bool aDocumentSheet)
|
|||
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetRemoved, (this, aSheet, aDocumentSheet));
|
||||
|
||||
if (StyleSheetChangeEventsEnabled()) {
|
||||
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleSheetChangeEvent,
|
||||
nsIDOMStyleSheetChangeEvent,
|
||||
InitStyleSheetChangeEvent,
|
||||
DO_STYLESHEET_NOTIFICATION(StyleSheetChangeEvent,
|
||||
"StyleSheetRemoved",
|
||||
mDocumentSheet,
|
||||
aDocumentSheet);
|
||||
}
|
||||
}
|
||||
|
@ -4157,10 +4152,9 @@ nsDocument::SetStyleSheetApplicableState(nsIStyleSheet* aSheet,
|
|||
(this, aSheet, aApplicable));
|
||||
|
||||
if (StyleSheetChangeEventsEnabled()) {
|
||||
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleSheetApplicableStateChangeEvent,
|
||||
nsIDOMStyleSheetApplicableStateChangeEvent,
|
||||
InitStyleSheetApplicableStateChangeEvent,
|
||||
DO_STYLESHEET_NOTIFICATION(StyleSheetApplicableStateChangeEvent,
|
||||
"StyleSheetApplicableStateChanged",
|
||||
mApplicable,
|
||||
aApplicable);
|
||||
}
|
||||
|
||||
|
@ -4931,10 +4925,9 @@ nsDocument::StyleRuleChanged(nsIStyleSheet* aSheet,
|
|||
|
||||
if (StyleSheetChangeEventsEnabled()) {
|
||||
nsCOMPtr<css::Rule> rule = do_QueryInterface(aNewStyleRule);
|
||||
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleRuleChangeEvent,
|
||||
nsIDOMStyleRuleChangeEvent,
|
||||
InitStyleRuleChangeEvent,
|
||||
DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
|
||||
"StyleRuleChanged",
|
||||
mRule,
|
||||
rule ? rule->GetDOMRule() : nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -4948,10 +4941,9 @@ nsDocument::StyleRuleAdded(nsIStyleSheet* aSheet,
|
|||
|
||||
if (StyleSheetChangeEventsEnabled()) {
|
||||
nsCOMPtr<css::Rule> rule = do_QueryInterface(aStyleRule);
|
||||
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleRuleChangeEvent,
|
||||
nsIDOMStyleRuleChangeEvent,
|
||||
InitStyleRuleChangeEvent,
|
||||
DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
|
||||
"StyleRuleAdded",
|
||||
mRule,
|
||||
rule ? rule->GetDOMRule() : nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -4965,10 +4957,9 @@ nsDocument::StyleRuleRemoved(nsIStyleSheet* aSheet,
|
|||
|
||||
if (StyleSheetChangeEventsEnabled()) {
|
||||
nsCOMPtr<css::Rule> rule = do_QueryInterface(aStyleRule);
|
||||
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleRuleChangeEvent,
|
||||
nsIDOMStyleRuleChangeEvent,
|
||||
InitStyleRuleChangeEvent,
|
||||
DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
|
||||
"StyleRuleRemoved",
|
||||
mRule,
|
||||
rule ? rule->GetDOMRule() : nullptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,6 @@ XPIDL_SOURCES += [
|
|||
'nsIDOMPaintRequest.idl',
|
||||
'nsIDOMScrollAreaEvent.idl',
|
||||
'nsIDOMSimpleGestureEvent.idl',
|
||||
'nsIDOMStyleRuleChangeEvent.idl',
|
||||
'nsIDOMStyleSheetApplicableStateChangeEvent.idl',
|
||||
'nsIDOMStyleSheetChangeEvent.idl',
|
||||
'nsIDOMTouchEvent.idl',
|
||||
'nsIDOMTransitionEvent.idl',
|
||||
'nsIDOMUIEvent.idl',
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
interface nsIDOMCSSRule;
|
||||
interface nsIDOMCSSStyleSheet;
|
||||
|
||||
[builtinclass, uuid(36098d39-b471-47e9-976e-33fee3d81467)]
|
||||
interface nsIDOMStyleRuleChangeEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute nsIDOMCSSStyleSheet stylesheet;
|
||||
readonly attribute nsIDOMCSSRule rule;
|
||||
[noscript] void initStyleRuleChangeEvent(in DOMString aTypeArg,
|
||||
in boolean aCanBubbleArg,
|
||||
in boolean aCancelableArg,
|
||||
in nsIDOMCSSStyleSheet aStyleSheet,
|
||||
in nsIDOMCSSRule aRule);
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
interface nsIDOMCSSStyleSheet;
|
||||
|
||||
[builtinclass, uuid(75f27960-fd1a-4e05-8b8b-55d97ea22a9a)]
|
||||
interface nsIDOMStyleSheetApplicableStateChangeEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute nsIDOMCSSStyleSheet stylesheet;
|
||||
readonly attribute boolean applicable;
|
||||
[noscript] void initStyleSheetApplicableStateChangeEvent(in DOMString aTypeArg,
|
||||
in boolean aCanBubbleArg,
|
||||
in boolean aCancelableArg,
|
||||
in nsIDOMCSSStyleSheet aStyleSheet,
|
||||
in boolean aApplicable);
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
interface nsIDOMCSSStyleSheet;
|
||||
|
||||
[builtinclass, uuid(f94c6a47-58f0-4996-b1db-3ea1d14c4ddd)]
|
||||
interface nsIDOMStyleSheetChangeEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute nsIDOMCSSStyleSheet stylesheet;
|
||||
readonly attribute boolean documentSheet;
|
||||
[noscript] void initStyleSheetChangeEvent(in DOMString aTypeArg,
|
||||
in boolean aCanBubbleArg,
|
||||
in boolean aCancelableArg,
|
||||
in nsIDOMCSSStyleSheet aStyleSheet,
|
||||
in boolean aDocumentSheet);
|
||||
};
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
interface CSSRule;
|
||||
|
||||
[ChromeOnly, Constructor(DOMString type, optional StyleRuleChangeEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
|
||||
[ChromeOnly, Constructor(DOMString type, optional StyleRuleChangeEventInit eventInitDict)]
|
||||
interface StyleRuleChangeEvent : Event
|
||||
{
|
||||
readonly attribute CSSStyleSheet? stylesheet;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[ChromeOnly, Constructor(DOMString type, optional StyleSheetApplicableStateChangeEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
|
||||
[ChromeOnly, Constructor(DOMString type, optional StyleSheetApplicableStateChangeEventInit eventInitDict)]
|
||||
interface StyleSheetApplicableStateChangeEvent : Event
|
||||
{
|
||||
readonly attribute CSSStyleSheet? stylesheet;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[ChromeOnly, Constructor(DOMString type, optional StyleSheetChangeEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
|
||||
[ChromeOnly, Constructor(DOMString type, optional StyleSheetChangeEventInit eventInitDict)]
|
||||
interface StyleSheetChangeEvent : Event
|
||||
{
|
||||
readonly attribute CSSStyleSheet? stylesheet;
|
||||
|
|
|
@ -658,6 +658,9 @@ GENERATED_EVENTS_WEBIDL_FILES = [
|
|||
'RTCPeerConnectionIdentityErrorEvent.webidl',
|
||||
'RTCPeerConnectionIdentityEvent.webidl',
|
||||
'SmartCardEvent.webidl',
|
||||
'StyleRuleChangeEvent.webidl',
|
||||
'StyleSheetApplicableStateChangeEvent.webidl',
|
||||
'StyleSheetChangeEvent.webidl',
|
||||
'TrackEvent.webidl',
|
||||
'UserProximityEvent.webidl',
|
||||
'USSDReceivedEvent.webidl',
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
|
||||
simple_events = [
|
||||
'CustomEvent',
|
||||
'StyleRuleChangeEvent',
|
||||
'StyleSheetChangeEvent',
|
||||
'StyleSheetApplicableStateChangeEvent',
|
||||
]
|
||||
|
||||
""" include file names """
|
||||
|
|
|
@ -126,9 +126,6 @@
|
|||
#include "nsIDOMSimpleGestureEvent.h"
|
||||
#include "nsIDOMStyleSheet.h"
|
||||
#include "nsIDOMStyleSheetList.h"
|
||||
#include "nsIDOMStyleRuleChangeEvent.h"
|
||||
#include "nsIDOMStyleSheetApplicableStateChangeEvent.h"
|
||||
#include "nsIDOMStyleSheetChangeEvent.h"
|
||||
#include "nsIDOMSVGElement.h"
|
||||
#include "nsIDOMSVGLength.h"
|
||||
#include "nsIDOMText.h"
|
||||
|
@ -270,9 +267,6 @@
|
|||
#include "mozilla/dom/StorageEventBinding.h"
|
||||
#include "mozilla/dom/StyleSheetBinding.h"
|
||||
#include "mozilla/dom/StyleSheetListBinding.h"
|
||||
#include "mozilla/dom/StyleRuleChangeEventBinding.h"
|
||||
#include "mozilla/dom/StyleSheetApplicableStateChangeEventBinding.h"
|
||||
#include "mozilla/dom/StyleSheetChangeEventBinding.h"
|
||||
#include "mozilla/dom/SVGElementBinding.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/TextBinding.h"
|
||||
|
@ -463,9 +457,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
|
|||
DEFINE_SHIM(SimpleGestureEvent),
|
||||
DEFINE_SHIM(StyleSheet),
|
||||
DEFINE_SHIM(StyleSheetList),
|
||||
DEFINE_SHIM(StyleRuleChangeEvent),
|
||||
DEFINE_SHIM(StyleSheetApplicableStateChangeEvent),
|
||||
DEFINE_SHIM(StyleSheetChangeEvent),
|
||||
DEFINE_SHIM(SVGElement),
|
||||
DEFINE_SHIM(SVGLength),
|
||||
DEFINE_SHIM(Text),
|
||||
|
|
Загрузка…
Ссылка в новой задаче