Backed out 20 changesets (bug 851892) for load failures in Android crashtest-4

Backed out changeset b9c4115cdeac (bug 851892)
Backed out changeset 5f491bf49b85 (bug 851892)
Backed out changeset 9bf5bcb3e8c5 (bug 851892)
Backed out changeset a9cab46e8b45 (bug 851892)
Backed out changeset 73858e15c8c0 (bug 851892)
Backed out changeset a25638588b6b (bug 851892)
Backed out changeset d58e0e5069ef (bug 851892)
Backed out changeset d8da2a3d8f10 (bug 851892)
Backed out changeset a8da3c34983f (bug 851892)
Backed out changeset 29cf8acbd21e (bug 851892)
Backed out changeset c53cd7bdf8b3 (bug 851892)
Backed out changeset e841a2796375 (bug 851892)
Backed out changeset 2eab85b00159 (bug 851892)
Backed out changeset ca4b1fb9cae4 (bug 851892)
Backed out changeset 74c0ba66f108 (bug 851892)
Backed out changeset 719bb9f41e5b (bug 851892)
Backed out changeset d6aa4c6192df (bug 851892)
Backed out changeset dc81a167a75d (bug 851892)
Backed out changeset 65422477b3a5 (bug 851892)
Backed out changeset 3089dd379077 (bug 851892)
This commit is contained in:
Phil Ringnalda 2017-01-15 11:50:10 -08:00
Родитель a54b17c3c5
Коммит 686006613e
66 изменённых файлов: 1168 добавлений и 1326 удалений

Просмотреть файл

@ -69,10 +69,21 @@
#include "nsIDOMEventTarget.h"
// CSS related includes
#include "nsCSSRules.h"
#include "nsIDOMCSSRule.h"
#include "nsMemory.h"
// includes needed for the prototype chain interfaces
#include "nsIDOMCSSKeyframeRule.h"
#include "nsIDOMCSSKeyframesRule.h"
#include "nsIDOMCSSImportRule.h"
#include "nsIDOMCSSMediaRule.h"
#include "nsIDOMCSSFontFaceRule.h"
#include "nsIDOMCSSMozDocumentRule.h"
#include "nsIDOMCSSSupportsRule.h"
#include "nsIDOMCSSCounterStyleRule.h"
#include "nsIDOMCSSPageRule.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIControllers.h"
#ifdef MOZ_XUL
@ -178,6 +189,16 @@ static nsDOMClassInfoData sClassInfoData[] = {
// Misc Core related classes
// CSS classes
NS_DEFINE_CLASSINFO_DATA(CSSStyleRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSImportRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSMediaRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSNameSpaceRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
// XUL classes
#ifdef MOZ_XUL
NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULCommandDispatcher, nsDOMGenericSH,
@ -200,6 +221,15 @@ static nsDOMClassInfoData sClassInfoData[] = {
DEFAULT_SCRIPTABLE_FLAGS)
#endif
NS_DEFINE_CLASSINFO_DATA(CSSMozDocumentRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSSupportsRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager,
nsMessageManagerSH<nsEventTargetSH>,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
@ -216,6 +246,20 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSKeyframeRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSKeyframesRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSCounterStyleRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSPageRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSFontFeatureValuesRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULControlElement, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULLabeledControlElement, nsDOMGenericSH,
@ -468,6 +512,22 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSStyleRule, nsIDOMCSSStyleRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSStyleRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSImportRule, nsIDOMCSSImportRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSImportRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSMediaRule, nsIDOMCSSMediaRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSMediaRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(CSSNameSpaceRule, nsIDOMCSSRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSRule)
DOM_CLASSINFO_MAP_END
#ifdef MOZ_XUL
DOM_CLASSINFO_MAP_BEGIN(XULCommandDispatcher, nsIDOMXULCommandDispatcher)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULCommandDispatcher)
@ -501,6 +561,18 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_END
#endif
DOM_CLASSINFO_MAP_BEGIN(CSSMozDocumentRule, nsIDOMCSSMozDocumentRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSMozDocumentRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSSupportsRule, nsIDOMCSSSupportsRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSSupportsRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFaceRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsISupports)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
@ -531,6 +603,26 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSKeyframeRule, nsIDOMCSSKeyframeRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSKeyframeRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSKeyframesRule, nsIDOMCSSKeyframesRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSKeyframesRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSCounterStyleRule, nsIDOMCSSCounterStyleRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSCounterStyleRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSPageRule, nsIDOMCSSPageRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSPageRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSFontFeatureValuesRule, nsIDOMCSSFontFeatureValuesRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFeatureValuesRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(XULControlElement, nsIDOMXULControlElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULControlElement)
DOM_CLASSINFO_MAP_END

Просмотреть файл

@ -19,6 +19,12 @@ enum nsDOMClassInfoID
eDOMClassInfo_DOMPrototype_id,
eDOMClassInfo_DOMConstructor_id,
// CSS classes
eDOMClassInfo_CSSStyleRule_id,
eDOMClassInfo_CSSImportRule_id,
eDOMClassInfo_CSSMediaRule_id,
eDOMClassInfo_CSSNameSpaceRule_id,
// XUL classes
#ifdef MOZ_XUL
eDOMClassInfo_XULCommandDispatcher_id,
@ -34,11 +40,27 @@ enum nsDOMClassInfoID
eDOMClassInfo_XULTreeBuilder_id,
#endif
eDOMClassInfo_CSSMozDocumentRule_id,
eDOMClassInfo_CSSSupportsRule_id,
// @font-face in CSS
eDOMClassInfo_CSSFontFaceRule_id,
eDOMClassInfo_ContentFrameMessageManager_id,
eDOMClassInfo_ContentProcessMessageManager_id,
eDOMClassInfo_ChromeMessageBroadcaster_id,
eDOMClassInfo_ChromeMessageSender_id,
eDOMClassInfo_CSSKeyframeRule_id,
eDOMClassInfo_CSSKeyframesRule_id,
// @counter-style in CSS
eDOMClassInfo_CSSCounterStyleRule_id,
eDOMClassInfo_CSSPageRule_id,
eDOMClassInfo_CSSFontFeatureValuesRule_id,
eDOMClassInfo_XULControlElement_id,
eDOMClassInfo_XULLabeledControlElement_id,
eDOMClassInfo_XULButtonElement_id,

Просмотреть файл

@ -5180,7 +5180,7 @@ nsDocument::StyleRuleChanged(StyleSheet* aSheet,
DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
"StyleRuleChanged",
mRule,
aStyleRule);
aStyleRule ? aStyleRule->GetDOMRule() : nullptr);
}
}
@ -5194,7 +5194,8 @@ nsDocument::StyleRuleAdded(StyleSheet* aSheet,
DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
"StyleRuleAdded",
mRule,
aStyleRule);
aStyleRule ? aStyleRule->GetDOMRule()
: nullptr);
}
}
@ -5208,7 +5209,8 @@ nsDocument::StyleRuleRemoved(StyleSheet* aSheet,
DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
"StyleRuleRemoved",
mRule,
aStyleRule);
aStyleRule ? aStyleRule->GetDOMRule()
: nullptr);
}
}

Просмотреть файл

@ -272,9 +272,6 @@ protected:
}
private:
// Friend declarations for things that need to be able to call
// SetIsNotDOMBinding(). The goal is to get rid of all of these, and
// SetIsNotDOMBinding() too.
friend class mozilla::dom::TabChildGlobal;
friend class mozilla::dom::ProcessGlobal;
friend class SandboxPrivate;

Просмотреть файл

@ -196,96 +196,23 @@ DOMInterfaces = {
'nativeType': 'nsDOMCSSDeclaration'
},
'CSSConditionRule': {
'concrete': False,
'nativeType': 'mozilla::css::ConditionRule',
'headerFile': 'mozilla/css/GroupRule.h',
},
'CSSCounterStyleRule': {
'nativeType': 'nsCSSCounterStyleRule',
'headerFile': 'nsCSSRules.h',
},
'CSSFontFaceRule': {
'nativeType': 'nsCSSFontFaceRule',
'headerFile': 'nsCSSRules.h',
},
'CSSFontFeatureValuesRule': {
'nativeType': 'nsCSSFontFeatureValuesRule',
'headerFile': 'nsCSSRules.h',
},
'CSSGroupingRule': {
'concrete': False,
'nativeType': 'mozilla::css::GroupRule',
},
'CSSImportRule': {
'nativeType': 'mozilla::css::ImportRule',
},
'CSSKeyframeRule': {
'nativeType': 'nsCSSKeyframeRule',
'headerFile': 'nsCSSRules.h',
},
'CSSKeyframesRule': {
'nativeType': 'nsCSSKeyframesRule',
'headerFile': 'nsCSSRules.h',
},
'CSSLexer': {
'wrapperCache': False
},
'CSSMediaRule': {
'nativeType': 'mozilla::css::MediaRule',
'headerFile': 'nsCSSRules.h',
},
'CSSMozDocumentRule': {
'nativeType': 'mozilla::css::DocumentRule',
'headerFile': 'nsCSSRules.h',
},
'CSSNamespaceRule': {
'nativeType': 'mozilla::css::NameSpaceRule',
},
'CSSPageRule': {
'nativeType': 'nsCSSPageRule',
'headerFile': 'nsCSSRules.h',
},
'CSSPrimitiveValue': {
'nativeType': 'nsROCSSPrimitiveValue',
},
'CSSRule': {
'concrete': False,
'nativeType': 'mozilla::css::Rule'
},
'CSSStyleDeclaration': {
'nativeType': 'nsICSSDeclaration'
},
'CSSStyleRule': {
'nativeType': 'mozilla::BindingStyleRule',
},
'CSSStyleSheet': {
'nativeType': 'mozilla::StyleSheet',
'binaryNames': { 'ownerRule': 'DOMOwnerRule' },
},
'CSSSupportsRule': {
'nativeType': 'mozilla::CSSSupportsRule',
'headerFile': 'nsCSSRules.h',
},
'CSSValue': {
'concrete': False
},
@ -1733,6 +1660,7 @@ def addExternalIface(iface, nativeType=None, headerFile=None,
addExternalIface('ApplicationCache', nativeType='nsIDOMOfflineResourceList')
addExternalIface('Counter')
addExternalIface('CSSRule')
addExternalIface('RTCDataChannel', nativeType='nsIDOMDataChannel')
addExternalIface('HitRegionOptions', nativeType='nsISupports')
addExternalIface('imgINotificationObserver', nativeType='imgINotificationObserver')

Просмотреть файл

@ -4,10 +4,10 @@
* 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 "nsISupports.idl"
#include "nsIDOMCSSRule.idl"
[scriptable, uuid(9b5e48ce-d84c-4e31-aff5-34e9f4141313)]
interface nsIDOMCSSCounterStyleRule : nsISupports
interface nsIDOMCSSCounterStyleRule : nsIDOMCSSRule
{
attribute DOMString name;
attribute DOMString system;

Просмотреть файл

@ -3,12 +3,10 @@
* 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 "nsISupports.idl"
interface nsIDOMCSSStyleDeclaration;
#include "nsIDOMCSSRule.idl"
[scriptable, uuid(db971017-fe0c-4529-972c-8217f2fee217)]
interface nsIDOMCSSFontFaceRule : nsISupports
interface nsIDOMCSSFontFaceRule : nsIDOMCSSRule
{
readonly attribute nsIDOMCSSStyleDeclaration style;
};

Просмотреть файл

@ -3,10 +3,10 @@
* 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 "nsISupports.idl"
#include "nsIDOMCSSRule.idl"
[scriptable, uuid(a343d27f-1da6-4fc3-9355-d4ca434f958e)]
interface nsIDOMCSSFontFeatureValuesRule : nsISupports
interface nsIDOMCSSFontFeatureValuesRule : nsIDOMCSSRule
{
attribute DOMString fontFamily;
// raises(DOMException) on setting

Просмотреть файл

@ -3,15 +3,13 @@
* 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 "nsISupports.idl"
interface nsIDOMCSSRuleList;
#include "nsIDOMCSSRule.idl"
/**
* Interface for at-rules that have child rules in the CSS OM.
*/
[scriptable, uuid(a0e3324a-f911-4baf-9591-5322c76cbb0d)]
interface nsIDOMCSSGroupingRule : nsISupports
interface nsIDOMCSSGroupingRule : nsIDOMCSSRule
{
readonly attribute nsIDOMCSSRuleList cssRules;

Просмотреть файл

@ -3,13 +3,10 @@
* 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 "nsISupports.idl"
interface nsIDOMMediaList;
interface nsIDOMCSSStyleSheet;
#include "nsIDOMCSSRule.idl"
[scriptable, uuid(d3b2b914-01ef-4663-beda-a6475a26f491)]
interface nsIDOMCSSImportRule : nsISupports
interface nsIDOMCSSImportRule : nsIDOMCSSRule
{
readonly attribute DOMString href;
readonly attribute nsIDOMMediaList media;

Просмотреть файл

@ -3,12 +3,10 @@
* 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 "nsISupports.idl"
interface nsIDOMCSSStyleDeclaration;
#include "nsIDOMCSSRule.idl"
[scriptable, uuid(a281a8b4-eaa2-49a8-8b97-acc2814a57c9)]
interface nsIDOMCSSKeyframeRule : nsISupports
interface nsIDOMCSSKeyframeRule : nsIDOMCSSRule
{
attribute DOMString keyText;
readonly attribute nsIDOMCSSStyleDeclaration style;

Просмотреть файл

@ -3,13 +3,10 @@
* 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 "nsISupports.idl"
interface nsIDOMCSSRuleList;
interface nsIDOMCSSKeyframeRule;
#include "nsIDOMCSSRule.idl"
[scriptable, uuid(400f4b70-ad0a-4047-aba4-ee8019f6b907)]
interface nsIDOMCSSKeyframesRule : nsISupports
interface nsIDOMCSSKeyframesRule : nsIDOMCSSRule
{
attribute DOMString name;
readonly attribute nsIDOMCSSRuleList cssRules;

Просмотреть файл

@ -5,8 +5,6 @@
#include "nsIDOMCSSConditionRule.idl"
interface nsIDOMMediaList;
/**
* Interface for @media rules in the CSS OM.
*/

Просмотреть файл

@ -3,12 +3,10 @@
* 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 "nsISupports.idl"
interface nsIDOMCSSStyleDeclaration;
#include "nsIDOMCSSRule.idl"
[scriptable, uuid(c119072b-7d2f-4aeb-a90d-e2d6b606c32a)]
interface nsIDOMCSSPageRule : nsISupports
interface nsIDOMCSSPageRule : nsIDOMCSSRule
{
//attribute DOMString selectorText;
// raises(DOMException) on setting

Просмотреть файл

@ -3,12 +3,10 @@
* 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 "nsISupports.idl"
interface nsIDOMCSSStyleDeclaration;
#include "nsIDOMCSSRule.idl"
[scriptable, uuid(b5e9af48-a7c2-4f88-aae3-58307af4b5a5)]
interface nsIDOMCSSStyleRule : nsISupports
interface nsIDOMCSSStyleRule : nsIDOMCSSRule
{
attribute DOMString selectorText;
// raises(DOMException) on setting

Просмотреть файл

@ -3,9 +3,9 @@
* 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 "nsISupports.idl"
#include "nsIDOMCSSRule.idl"
[scriptable, uuid(98f4c27b-fb35-4355-8fd9-546c4697d71a)]
interface nsIDOMCSSUnknownRule : nsISupports
interface nsIDOMCSSUnknownRule : nsIDOMCSSRule
{
};

Просмотреть файл

@ -15,7 +15,6 @@
#include "nsTArray.h"
#include "js/TypeDecls.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/TypedArray.h"
namespace mozilla {

Просмотреть файл

@ -249,7 +249,7 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
"CSSMozDocumentRule",
// IMPORTANT: Do not change this list without review from a DOM peer!
"CSSNamespaceRule",
"CSSNameSpaceRule",
// IMPORTANT: Do not change this list without review from a DOM peer!
"CSSPageRule",
// IMPORTANT: Do not change this list without review from a DOM peer!

Просмотреть файл

@ -1,14 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface
*/
// https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface
interface CSSConditionRule : CSSGroupingRule {
[SetterThrows]
attribute DOMString conditionText;
};

Просмотреть файл

@ -1,23 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-counter-styles-3/#the-csscounterstylerule-interface
*/
// https://drafts.csswg.org/css-counter-styles-3/#the-csscounterstylerule-interface
interface CSSCounterStyleRule : CSSRule {
attribute DOMString name;
attribute DOMString system;
attribute DOMString symbols;
attribute DOMString additiveSymbols;
attribute DOMString negative;
attribute DOMString prefix;
attribute DOMString suffix;
attribute DOMString range;
attribute DOMString pad;
attribute DOMString speakAs;
attribute DOMString fallback;
};

Просмотреть файл

@ -1,15 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-fonts/#om-fontface
*/
// https://drafts.csswg.org/css-fonts/#om-fontface
// But we implement a very old draft, apparently....
// See bug 1058408 for implementing the current spec.
interface CSSFontFaceRule : CSSRule {
[SameObject] readonly attribute CSSStyleDeclaration style;
};

Просмотреть файл

@ -1,29 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-fonts/#om-fontfeaturevalues
*/
// https://drafts.csswg.org/css-fonts/#om-fontfeaturevalues
// but we don't implement anything remotely resembling the spec.
interface CSSFontFeatureValuesRule : CSSRule {
[SetterThrows]
attribute DOMString fontFamily;
// Not yet implemented
// readonly attribute CSSFontFeatureValuesMap annotation;
// readonly attribute CSSFontFeatureValuesMap ornaments;
// readonly attribute CSSFontFeatureValuesMap stylistic;
// readonly attribute CSSFontFeatureValuesMap swash;
// readonly attribute CSSFontFeatureValuesMap characterVariant;
// readonly attribute CSSFontFeatureValuesMap styleset;
};
partial interface CSSFontFeatureValuesRule {
// Gecko addition?
[SetterThrows]
attribute DOMString valueText;
};

Просмотреть файл

@ -1,17 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#cssgroupingrule
*/
// https://drafts.csswg.org/cssom/#cssgroupingrule
interface CSSGroupingRule : CSSRule {
[SameObject] readonly attribute CSSRuleList cssRules;
[Throws]
unsigned long insertRule(DOMString rule, unsigned long index);
[Throws]
void deleteRule(unsigned long index);
};

Просмотреть файл

@ -1,17 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#cssimportrule
*/
// https://drafts.csswg.org/cssom/#cssimportrule
interface CSSImportRule : CSSRule {
readonly attribute DOMString href;
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
// Per spec, the .styleSheet is never null, but in our implementation it can
// be. See <https://bugzilla.mozilla.org/show_bug.cgi?id=1326509>.
[SameObject] readonly attribute CSSStyleSheet? styleSheet;
};

Просмотреть файл

@ -1,14 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-animations/#interface-csskeyframerule
*/
// https://drafts.csswg.org/css-animations/#interface-csskeyframerule
interface CSSKeyframeRule : CSSRule {
attribute DOMString keyText;
readonly attribute CSSStyleDeclaration style;
};

Просмотреть файл

@ -1,18 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-animations/#interface-csskeyframesrule
*/
// https://drafts.csswg.org/css-animations/#interface-csskeyframesrule
interface CSSKeyframesRule : CSSRule {
attribute DOMString name;
readonly attribute CSSRuleList cssRules;
void appendRule(DOMString rule);
void deleteRule(DOMString select);
CSSKeyframeRule? findRule(DOMString select);
};

Просмотреть файл

@ -1,17 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#the-cssmediarule-interface
* https://drafts.csswg.org/css-conditional/#the-cssmediarule-interface
*/
// https://drafts.csswg.org/cssom/#the-cssmediarule-interface and
// https://drafts.csswg.org/css-conditional/#the-cssmediarule-interface
// except they disagree with each other. We're taking the inheritance from
// css-conditional and the PutForwards behavior from cssom.
interface CSSMediaRule : CSSConditionRule {
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
};

Просмотреть файл

@ -1,10 +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/.
*/
// This is a non-standard interface for @-moz-document rules
interface CSSMozDocumentRule : CSSConditionRule {
// XXX Add access to the URL list.
};

Просмотреть файл

@ -1,16 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#cssnamespacerule
*/
// https://drafts.csswg.org/cssom/#cssnamespacerule
interface CSSNamespaceRule : CSSRule {
// Not implemented yet. <See
// https://bugzilla.mozilla.org/show_bug.cgi?id=1326514>.
// readonly attribute DOMString namespaceURI;
// readonly attribute DOMString prefix;
};

Просмотреть файл

@ -1,17 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#the-csspagerule-interface
*/
// https://drafts.csswg.org/cssom/#the-csspagerule-interface
// Per spec, this should inherit from CSSGroupingRule, but we don't
// implement this yet.
interface CSSPageRule : CSSRule {
// selectorText not implemented yet
// attribute DOMString selectorText;
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
};

Просмотреть файл

@ -1,52 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#the-cssrule-interface
* https://drafts.csswg.org/css-animations/#interface-cssrule
* https://drafts.csswg.org/css-counter-styles-3/#extentions-to-cssrule-interface
* https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface
* https://drafts.csswg.org/css-fonts-3/#om-fontfeaturevalues
*/
// https://drafts.csswg.org/cssom/#the-cssrule-interface
interface CSSRule {
const unsigned short STYLE_RULE = 1;
const unsigned short CHARSET_RULE = 2; // historical
const unsigned short IMPORT_RULE = 3;
const unsigned short MEDIA_RULE = 4;
const unsigned short FONT_FACE_RULE = 5;
const unsigned short PAGE_RULE = 6;
// FIXME: We don't support MARGIN_RULE yet.
// XXXbz Should we expose the constant anyway?
// const unsigned short MARGIN_RULE = 9;
const unsigned short NAMESPACE_RULE = 10;
readonly attribute unsigned short type;
attribute DOMString cssText;
readonly attribute CSSRule? parentRule;
readonly attribute CSSStyleSheet? parentStyleSheet;
};
// https://drafts.csswg.org/css-animations/#interface-cssrule
partial interface CSSRule {
const unsigned short KEYFRAMES_RULE = 7;
const unsigned short KEYFRAME_RULE = 8;
};
// https://drafts.csswg.org/css-counter-styles-3/#extentions-to-cssrule-interface
partial interface CSSRule {
const unsigned short COUNTER_STYLE_RULE = 11;
};
// https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface
partial interface CSSRule {
const unsigned short SUPPORTS_RULE = 12;
};
// https://drafts.csswg.org/css-fonts-3/#om-fontfeaturevalues
partial interface CSSRule {
const unsigned short FONT_FEATURE_VALUES_RULE = 14;
};

Просмотреть файл

@ -7,6 +7,8 @@
* http://dev.w3.org/csswg/cssom/
*/
interface CSSRule;
interface CSSStyleDeclaration {
[SetterThrows]
attribute DOMString cssText;

Просмотреть файл

@ -1,14 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#the-cssstylerule-interface
*/
// https://drafts.csswg.org/cssom/#the-cssstylerule-interface
interface CSSStyleRule : CSSRule {
attribute DOMString selectorText;
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
};

Просмотреть файл

@ -7,6 +7,8 @@
* http://dev.w3.org/csswg/cssom/
*/
interface CSSRule;
enum CSSStyleSheetParsingMode {
"author",
"user",

Просмотреть файл

@ -1,12 +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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-conditional/#the-csssupportsrule-interface
*/
// https://drafts.csswg.org/css-conditional/#the-csssupportsrule-interface
interface CSSSupportsRule : CSSConditionRule {
};

Просмотреть файл

@ -24,10 +24,8 @@ BoxObject implements LegacyQueryInterface;
CaretPosition implements LegacyQueryInterface;
Comment implements LegacyQueryInterface;
Crypto implements LegacyQueryInterface;
CSSMozDocumentRule implements LegacyQueryInterface;
CSSPrimitiveValue implements LegacyQueryInterface;
CSSStyleDeclaration implements LegacyQueryInterface;
CSSStyleRule implements LegacyQueryInterface;
CSSValueList implements LegacyQueryInterface;
DOMImplementation implements LegacyQueryInterface;
DOMParser implements LegacyQueryInterface;

Просмотреть файл

@ -3,6 +3,8 @@
* 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/.
*/
interface CSSRule;
[ChromeOnly, Constructor(DOMString type, optional StyleRuleChangeEventInit eventInitDict)]
interface StyleRuleChangeEvent : Event
{

Просмотреть файл

@ -7,6 +7,8 @@
* http://dev.w3.org/csswg/cssom/
*/
interface CSSRule;
interface StyleSheet {
[Constant]
readonly attribute DOMString type;

Просмотреть файл

@ -89,27 +89,12 @@ WEBIDL_FILES = [
'CSPReport.webidl',
'CSS.webidl',
'CSSAnimation.webidl',
'CSSConditionRule.webidl',
'CSSCounterStyleRule.webidl',
'CSSFontFaceRule.webidl',
'CSSFontFeatureValuesRule.webidl',
'CSSGroupingRule.webidl',
'CSSImportRule.webidl',
'CSSKeyframeRule.webidl',
'CSSKeyframesRule.webidl',
'CSSLexer.webidl',
'CSSMediaRule.webidl',
'CSSMozDocumentRule.webidl',
'CSSNamespaceRule.webidl',
'CSSPageRule.webidl',
'CSSPrimitiveValue.webidl',
'CSSPseudoElement.webidl',
'CSSRule.webidl',
'CSSRuleList.webidl',
'CSSStyleDeclaration.webidl',
'CSSStyleRule.webidl',
'CSSStyleSheet.webidl',
'CSSSupportsRule.webidl',
'CSSTransition.webidl',
'CSSValue.webidl',
'CSSValueList.webidl',

Просмотреть файл

@ -214,8 +214,28 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=668855
make_live_map();
// We're out of ideas for unpreservable natives, now that just about
// everything is on webidl, so just don't test those.
let unpreservable_native_key = function () {
// We only allow natives that support wrapper preservation to be used as weak
// map keys. We should be able to try to add unpreservable natives as keys without
// crashing (bug 711616), but we should throw an error (bug 761620).
let dummy_test_map = new WeakMap;
let rule_fail = false;
let got_rule = false;
try {
var rule = document.styleSheets[0].cssRules[0];
got_rule = true;
dummy_test_map.set(rule, 1);
} catch (e) {
rule_fail = true;
}
ok(got_rule, "Got the CSS rule");
ok(rule_fail, "Using a CSS rule as a weak map key should produce an exception because it can't be wrapper preserved.");
}
unpreservable_native_key();
/* set up for running precise GC/CC then checking the results */

Просмотреть файл

@ -1,6 +1,7 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="data:text/css,div {}">
<title>Test Cross-Compartment DOM WeakMaps</title>
</head>
<body>

Просмотреть файл

@ -15,6 +15,14 @@ function setup() {
var item = window.frames[0].document.querySelector("body");
my_map.set(item, "success_string");
var rule_fail = false;
try {
my_map.set(window.frames[0].document.styleSheets[0].cssRules[0], 1);
} catch (e) {
rule_fail = true;
}
ok(rule_fail, "Using rule as a weak map key across compartments should produce an exception because it can't be wrapper preserved.");
}
function runTest() {

Просмотреть файл

@ -18,7 +18,6 @@
#include "nsIDOMCSSImportRule.h"
#include "nsIDOMCSSMediaRule.h"
#include "nsIDOMCSSSupportsRule.h"
#include "nsIDOMCSSRule.h"
#include "nsIURI.h"
#include "nsIDocument.h"
#include "nsNetUtil.h"

Просмотреть файл

@ -253,9 +253,13 @@ inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement,
for (nsRuleNode* ruleNode : Reversed(ruleNodes)) {
RefPtr<Declaration> decl = do_QueryObject(ruleNode->GetRule());
if (decl) {
css::Rule* owningRule = decl->GetOwningRule();
if (owningRule) {
rules->AppendElement(owningRule, /*weak =*/ false);
RefPtr<mozilla::css::StyleRule> styleRule =
do_QueryObject(decl->GetOwningRule());
if (styleRule) {
nsCOMPtr<nsIDOMCSSRule> domRule = styleRule->GetDOMRule();
if (domRule) {
rules->AppendElement(domRule, /*weak =*/ false);
}
}
}
}

Просмотреть файл

@ -1,18 +0,0 @@
/* -*- Mode: C++; 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 "mozilla/BindingStyleRule.h"
#include "mozilla/dom/CSSStyleRuleBinding.h"
namespace mozilla {
/* virtual */ JSObject*
BindingStyleRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
return dom::CSSStyleRuleBinding::Wrap(aCx, this, aGivenProto);
}
} // namespace mozilla

Просмотреть файл

@ -1,57 +0,0 @@
/* -*- Mode: C++; 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/. */
#ifndef mozilla_BindingStyleRule_h__
#define mozilla_BindingStyleRule_h__
#include "nscore.h"
#include "nsStringGlue.h"
#include "mozilla/css/Rule.h"
/**
* Shared superclass for mozilla::css::StyleRule and mozilla::ServoStyleRule,
* for use from bindings code.
*/
class nsICSSDeclaration;
namespace mozilla {
class BindingStyleRule : public css::Rule
{
protected:
BindingStyleRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: css::Rule(aLineNumber, aColumnNumber)
{
}
BindingStyleRule(const BindingStyleRule& aCopy)
: css::Rule(aCopy)
{
}
virtual ~BindingStyleRule() {}
public:
// This is pure virtual because we have no members, and are an abstract class
// to start with. The fact that we have to have this declaration at all is
// kinda dumb. :(
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const override MOZ_MUST_OVERRIDE = 0;
// WebIDL API
// For GetSelectorText/SetSelectorText, we purposefully use a signature that
// matches the nsIDOMCSSStyleRule one for now, so subclasses can just
// implement both at once. The actual implementations must never return
// anything other than NS_OK;
NS_IMETHOD GetSelectorText(nsAString& aSelectorText) = 0;
NS_IMETHOD SetSelectorText(const nsAString& aSelectorText) = 0;
virtual nsICSSDeclaration* Style() = 0;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
};
} // namespace mozilla
#endif // mozilla_BindingStyleRule_h__

Просмотреть файл

@ -7,7 +7,6 @@
#define mozilla_dom_CSSRuleList_h
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Rule.h"
#include "nsIDOMCSSRule.h"
#include "nsIDOMCSSRuleList.h"
#include "nsWrapperCache.h"
@ -46,13 +45,13 @@ public:
}
// WebIDL API
css::Rule* Item(uint32_t aIndex)
nsIDOMCSSRule* Item(uint32_t aIndex)
{
bool unused;
return IndexedGetter(aIndex, unused);
}
virtual css::Rule* IndexedGetter(uint32_t aIndex, bool& aFound) = 0;
virtual nsIDOMCSSRule* IndexedGetter(uint32_t aIndex, bool& aFound) = 0;
virtual uint32_t Length() = 0;
protected:

Просмотреть файл

@ -61,7 +61,7 @@ public:
virtual CSSStyleSheet* GetParentObject() override;
virtual css::Rule*
virtual nsIDOMCSSRule*
IndexedGetter(uint32_t aIndex, bool& aFound) override;
virtual uint32_t
Length() override;
@ -101,7 +101,7 @@ CSSRuleListImpl::Length()
return AssertedCast<uint32_t>(mStyleSheet->StyleRuleCount());
}
css::Rule*
nsIDOMCSSRule*
CSSRuleListImpl::IndexedGetter(uint32_t aIndex, bool& aFound)
{
aFound = false;
@ -112,7 +112,7 @@ CSSRuleListImpl::IndexedGetter(uint32_t aIndex, bool& aFound)
css::Rule* rule = mStyleSheet->GetStyleRuleAt(aIndex);
if (rule) {
aFound = true;
return rule;
return rule->GetDOMRule();
}
}
@ -508,7 +508,7 @@ CSSStyleSheet::TraverseInner(nsCycleCollectionTraversalCallback &cb)
const nsCOMArray<css::Rule>& rules = mInner->mOrderedRules;
for (int32_t i = 0, count = rules.Count(); i < count; ++i) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mOrderedRules[i]");
cb.NoteXPCOMChild(rules[i]);
cb.NoteXPCOMChild(rules[i]->GetExistingDOMRule());
}
}
@ -865,10 +865,10 @@ CSSStyleSheet::RegisterNamespaceRule(css::Rule* aRule)
return NS_OK;
}
css::Rule*
nsIDOMCSSRule*
CSSStyleSheet::GetDOMOwnerRule() const
{
return mOwnerRule;
return mOwnerRule ? mOwnerRule->GetDOMRule() : nullptr;
}
CSSRuleList*
@ -1031,6 +1031,11 @@ CSSStyleSheet::DeleteRuleInternal(uint32_t aIndex, ErrorResult& aRv)
RefPtr<css::Rule> rule = mInner->mOrderedRules.ObjectAt(aIndex);
if (rule) {
mInner->mOrderedRules.RemoveObjectAt(aIndex);
if (mDocument && mDocument->StyleSheetChangeEventsEnabled()) {
// Force creation of the DOM rule, so that it can be put on the
// StyleRuleRemoved event object.
rule->GetDOMRule();
}
rule->SetStyleSheet(nullptr);
DidDirty();

Просмотреть файл

@ -194,7 +194,7 @@ public:
// Can't be inline because we can't include ImportRule here. And can't be
// called GetOwnerRule because that would be ambiguous with the ImportRule
// version.
css::Rule* GetDOMOwnerRule() const final;
nsIDOMCSSRule* GetDOMOwnerRule() const final;
void WillDirty();
void DidDirty();

Просмотреть файл

@ -12,7 +12,6 @@
#define mozilla_css_GroupRule_h__
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/IncrementalClearCOMRuleArray.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/Rule.h"
@ -25,10 +24,6 @@ namespace mozilla {
class StyleSheet;
namespace dom {
class CSSRuleList;
} // namespace dom
namespace css {
class GroupRuleRuleList;
@ -43,9 +38,11 @@ protected:
virtual ~GroupRule();
public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(GroupRule, Rule)
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS(GroupRule)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
// implement part of Rule
DECL_STYLE_RULE_INHERIT_NO_DOMRULE
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
@ -83,15 +80,9 @@ public:
return true;
}
// WebIDL API
dom::CSSRuleList* CssRules();
uint32_t InsertRule(const nsAString& aRule, uint32_t aIndex,
ErrorResult& aRv);
void DeleteRule(uint32_t aIndex, ErrorResult& aRv);
protected:
// to help implement nsIDOMCSSRule
void AppendRulesToCssText(nsAString& aCssText) const;
void AppendRulesToCssText(nsAString& aCssText);
// to implement common methods on nsIDOMCSSMediaRule and
// nsIDOMCSSMozDocumentRule
@ -104,24 +95,6 @@ protected:
RefPtr<GroupRuleRuleList> mRuleCollection; // lazily constructed
};
// Implementation of WebIDL CSSConditionRule.
class ConditionRule : public GroupRule
{
protected:
ConditionRule(uint32_t aLineNumber, uint32_t aColumnNumber);
ConditionRule(const ConditionRule& aCopy);
virtual ~ConditionRule();
public:
// GetConditionText signature matches nsIDOMCSSConditionRule, so subclasses
// can implement this easily. The implementations should never return
// anything other than NS_OK.
NS_IMETHOD GetConditionText(nsAString& aConditionText) = 0;
virtual void SetConditionText(const nsAString& aConditionText,
ErrorResult& aRv) = 0;
};
} // namespace css
} // namespace mozilla

Просмотреть файл

@ -20,7 +20,6 @@ class nsString;
namespace mozilla {
class CSSStyleSheet;
class StyleSheet;
namespace css {
@ -35,8 +34,10 @@ private:
ImportRule(const ImportRule& aCopy);
~ImportRule();
public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ImportRule, Rule)
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(ImportRule, mozilla::css::Rule)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
DECL_STYLE_RULE_INHERIT
using Rule::GetStyleSheet; // unhide since nsIDOMCSSImportRule has its own GetStyleSheet
@ -45,26 +46,18 @@ public:
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<Rule> Clone() const override;
void SetSheet(CSSStyleSheet*);
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSImportRule interface
NS_DECL_NSIDOMCSSIMPORTRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// The XPCOM GetHref is fine, since it never fails.
nsMediaList* Media() const { return mMedia; }
StyleSheet* GetStyleSheet() const;
private:
nsString mURLSpec;
RefPtr<nsMediaList> mMedia;

Просмотреть файл

@ -24,7 +24,8 @@ class nsIAtom;
namespace mozilla {
namespace css {
class NameSpaceRule final : public Rule
class NameSpaceRule final : public Rule,
public nsIDOMCSSRule
{
public:
NameSpaceRule(nsIAtom* aPrefix, const nsString& aURLSpec,
@ -36,28 +37,25 @@ private:
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CSS_NAMESPACE_RULE_IMPL_CID)
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_ISUPPORTS
// Rule methods
DECL_STYLE_RULE_INHERIT
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<Rule> Clone() const override;
nsIAtom* GetPrefix() const { return mPrefix; }
void GetURLSpec(nsString& aURLSpec) const { aURLSpec = mURLSpec; }
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
override MOZ_MUST_OVERRIDE;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
private:
nsCOMPtr<nsIAtom> mPrefix;

Просмотреть файл

@ -12,7 +12,6 @@
#include "mozilla/MemoryReporting.h"
#include "nsISupports.h"
#include "nsIDOMCSSRule.h"
#include "nsWrapperCache.h"
class nsIDocument;
struct nsRuleData;
@ -23,9 +22,15 @@ namespace mozilla {
namespace css {
class GroupRule;
class Rule : public nsIDOMCSSRule
, public nsWrapperCache
{
#define DECL_STYLE_RULE_INHERIT_NO_DOMRULE \
/* nothing */
#define DECL_STYLE_RULE_INHERIT \
DECL_STYLE_RULE_INHERIT_NO_DOMRULE \
virtual nsIDOMCSSRule* GetDOMRule() override; \
virtual nsIDOMCSSRule* GetExistingDOMRule() override;
class Rule : public nsISupports {
protected:
Rule(uint32_t aLineNumber, uint32_t aColumnNumber)
: mSheet(nullptr),
@ -47,12 +52,6 @@ protected:
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Rule)
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const = 0;
#endif
@ -107,20 +106,23 @@ public:
*/
virtual already_AddRefed<Rule> Clone() const = 0;
// Note that this returns null for inline style rules since they aren't
// supposed to have a DOM rule representation (and our code wouldn't work).
virtual nsIDOMCSSRule* GetDOMRule() = 0;
// Like GetDOMRule(), but won't create one if we don't have one yet
virtual nsIDOMCSSRule* GetExistingDOMRule() = 0;
// to implement methods on nsIDOMCSSRule
nsresult GetParentRule(nsIDOMCSSRule** aParentRule);
nsresult GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet);
Rule* GetCSSRule();
// This is pure virtual because all of Rule's data members are non-owning and
// thus measured elsewhere.
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const MOZ_MUST_OVERRIDE = 0;
// WebIDL interface, aka helpers for nsIDOMCSSRule implementation.
virtual uint16_t Type() const = 0;
virtual void GetCssTextImpl(nsAString& aCssText) const = 0;
// XPCOM GetCssText is OK, since it never throws.
// XPCOM SetCssText is OK, since it never throws.
Rule* GetParentRule() const;
StyleSheet* GetParentStyleSheet() const { return GetStyleSheet(); }
nsIDocument* GetParentObject() const { return GetDocument(); }
protected:
// This is sometimes null (e.g., for style attributes).
StyleSheet* mSheet;

Просмотреть файл

@ -47,7 +47,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ServoCSSRuleList,
dom::CSSRuleList)
tmp->EnumerateInstantiatedRules([&](css::Rule* aRule) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mRules[i]");
cb.NoteXPCOMChild(aRule);
cb.NoteXPCOMChild(aRule->GetExistingDOMRule());
});
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -79,7 +79,7 @@ ServoCSSRuleList::GetRule(uint32_t aIndex)
return CastToPtr(rule);
}
css::Rule*
nsIDOMCSSRule*
ServoCSSRuleList::IndexedGetter(uint32_t aIndex, bool& aFound)
{
if (aIndex >= mRules.Length()) {
@ -87,7 +87,10 @@ ServoCSSRuleList::IndexedGetter(uint32_t aIndex, bool& aFound)
return nullptr;
}
aFound = true;
return GetRule(aIndex);
if (css::Rule* rule = GetRule(aIndex)) {
return rule->GetDOMRule();
}
return nullptr;
}
template<typename Func>

Просмотреть файл

@ -30,7 +30,7 @@ public:
ServoStyleSheet* GetParentObject() final { return mStyleSheet; }
css::Rule* IndexedGetter(uint32_t aIndex, bool& aFound) final;
nsIDOMCSSRule* IndexedGetter(uint32_t aIndex, bool& aFound) final;
uint32_t Length() final { return mRules.Length(); }
void DropReference();

Просмотреть файл

@ -11,8 +11,8 @@
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/ServoDeclarationBlock.h"
#include "mozilla/dom/CSSStyleRuleBinding.h"
#include "nsDOMClassInfoID.h"
#include "mozAutoDocUpdate.h"
namespace mozilla {
@ -100,37 +100,40 @@ ServoStyleRuleDeclaration::GetCSSParsingEnvironment(
// -- ServoStyleRule --------------------------------------------------
ServoStyleRule::ServoStyleRule(already_AddRefed<RawServoStyleRule> aRawRule)
: BindingStyleRule(0, 0)
: css::Rule(0, 0)
, mRawRule(aRawRule)
, mDecls(Servo_StyleRule_GetStyle(mRawRule).Consume())
{
}
// QueryInterface implementation for ServoStyleRule
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ServoStyleRule)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServoStyleRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleRule)
NS_INTERFACE_MAP_END_INHERITING(css::Rule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRule)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, css::Rule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSStyleRule)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF_INHERITED(ServoStyleRule, css::Rule)
NS_IMPL_RELEASE_INHERITED(ServoStyleRule, css::Rule)
NS_IMPL_CYCLE_COLLECTING_ADDREF(ServoStyleRule)
NS_IMPL_CYCLE_COLLECTING_RELEASE(ServoStyleRule)
NS_IMPL_CYCLE_COLLECTION_CLASS(ServoStyleRule)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(ServoStyleRule, css::Rule)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ServoStyleRule)
// Trace the wrapper for our declaration. This just expands out
// NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
// directly because the wrapper is on the declaration, not on us.
tmp->mDecls.TraceWrapper(aCallbacks, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(ServoStyleRule, css::Rule)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ServoStyleRule)
// Unlink the wrapper for our declaraton. This just expands out
// NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER which we can't use
// directly because the wrapper is on the declaration, not on us.
tmp->mDecls.ReleaseWrapper(static_cast<nsISupports*>(p));
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ServoStyleRule, css::Rule)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ServoStyleRule)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
already_AddRefed<css::Rule>
@ -165,22 +168,43 @@ ServoStyleRule::List(FILE* out, int32_t aIndent) const
/* CSSRule implementation */
uint16_t
ServoStyleRule::Type() const
NS_IMETHODIMP
ServoStyleRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::STYLE_RULE;
*aType = nsIDOMCSSRule::STYLE_RULE;
return NS_OK;
}
void
ServoStyleRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
ServoStyleRule::GetCssText(nsAString& aCssText)
{
Servo_StyleRule_GetCssText(mRawRule, &aCssText);
return NS_OK;
}
nsICSSDeclaration*
ServoStyleRule::Style()
NS_IMETHODIMP
ServoStyleRule::SetCssText(const nsAString& aCssText)
{
return &mDecls;
return NS_OK;
}
NS_IMETHODIMP
ServoStyleRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return css::Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
ServoStyleRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
*aParentRule = nullptr;
return NS_ERROR_NOT_IMPLEMENTED;
}
css::Rule*
ServoStyleRule::GetCSSRule()
{
return this;
}
/* CSSStyleRule implementation */

Просмотреть файл

@ -9,7 +9,7 @@
#ifndef mozilla_ServoStyleRule_h
#define mozilla_ServoStyleRule_h
#include "mozilla/BindingStyleRule.h"
#include "mozilla/css/Rule.h"
#include "mozilla/ServoBindingTypes.h"
#include "nsIDOMCSSStyleRule.h"
@ -47,28 +47,25 @@ private:
RefPtr<ServoDeclarationBlock> mDecls;
};
class ServoStyleRule final : public BindingStyleRule
class ServoStyleRule final : public css::Rule
, public nsIDOMCSSStyleRule
{
public:
explicit ServoStyleRule(already_AddRefed<RawServoStyleRule> aRawRule);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(ServoStyleRule,
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(ServoStyleRule,
css::Rule)
NS_DECL_NSIDOMCSSRULE
NS_DECL_NSIDOMCSSSTYLERULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
virtual nsICSSDeclaration* Style() override;
RawServoStyleRule* Raw() const { return mRawRule; }
// Methods of mozilla::css::Rule
int32_t GetType() const final { return css::Rule::STYLE_RULE; }
using Rule::GetType;
already_AddRefed<Rule> Clone() const final;
nsIDOMCSSRule* GetDOMRule() final { return this; }
nsIDOMCSSRule* GetExistingDOMRule() final { return this; }
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
#ifdef DEBUG
void List(FILE* out = stdout, int32_t aIndent = 0) const final;

Просмотреть файл

@ -145,10 +145,9 @@ ServoStyleSheet::List(FILE* aOut, int32_t aIndex) const
}
#endif
css::Rule*
nsIDOMCSSRule*
ServoStyleSheet::GetDOMOwnerRule() const
{
NS_ERROR("stylo: Don't know how to get DOM owner rule for ServoStyleSheet");
return nullptr;
}

Просмотреть файл

@ -20,7 +20,6 @@ class ServoCSSRuleList;
namespace css {
class Loader;
class Rule;
}
/**
@ -74,7 +73,7 @@ public:
// Can't be inline because we can't include ImportRule here. And can't be
// called GetOwnerRule because that would be ambiguous with the ImportRule
// version.
css::Rule* GetDOMOwnerRule() const final;
nsIDOMCSSRule* GetDOMOwnerRule() const final;
void WillDirty() {}
void DidDirty() {}

Просмотреть файл

@ -16,17 +16,18 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/GroupRule.h"
#include "mozilla/css/Declaration.h"
#include "mozilla/dom/CSSStyleRuleBinding.h"
#include "nsIDocument.h"
#include "nsIAtom.h"
#include "nsString.h"
#include "nsStyleUtil.h"
#include "nsICSSStyleRuleDOMWrapper.h"
#include "nsDOMCSSDeclaration.h"
#include "nsNameSpaceManager.h"
#include "nsXMLNameSpaceMap.h"
#include "nsCSSPseudoClasses.h"
#include "nsCSSAnonBoxes.h"
#include "nsTArray.h"
#include "nsDOMClassInfoID.h"
#include "nsContentUtils.h"
#include "nsError.h"
#include "mozAutoDocUpdate.h"
@ -1046,26 +1047,30 @@ nsCSSSelectorList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) cons
// --------------------------------------------------------
namespace mozilla {
namespace css {
class DOMCSSStyleRule;
} // namespace css
} // namespace mozilla
class DOMCSSDeclarationImpl : public nsDOMCSSDeclaration
{
protected:
// Needs to be protected so we can use NS_IMPL_ADDREF_USING_AGGREGATOR.
virtual ~DOMCSSDeclarationImpl(void);
// But we need to allow UniquePtr to delete us.
friend class mozilla::DefaultDelete<DOMCSSDeclarationImpl>;
public:
explicit DOMCSSDeclarationImpl(css::StyleRule *aRule);
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
void DropReference(void);
virtual DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
virtual nsresult SetCSSDeclaration(DeclarationBlock* aDecl) override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
virtual nsIDocument* DocToUpdate() override;
// Override |AddRef| and |Release| for being owned by StyleRule. Also, we
// need to forward QI for cycle collection things to StyleRule.
// Override |AddRef| and |Release| for being a member of
// |DOMCSSStyleRule|. Also, we need to forward QI for cycle
// collection things to DOMCSSStyleRule.
NS_DECL_ISUPPORTS_INHERITED
virtual nsINode *GetParentObject() override
@ -1073,12 +1078,55 @@ public:
return mRule ? mRule->GetDocument() : nullptr;
}
friend class css::DOMCSSStyleRule;
protected:
// This reference is not reference-counted. The rule object owns us and we go
// away when it does.
// This reference is not reference-counted. The rule object tells us
// when it's about to go away.
css::StyleRule *mRule;
inline css::DOMCSSStyleRule* DomRule();
private:
// NOT TO BE IMPLEMENTED
// This object cannot be allocated on its own. It must be a member of
// DOMCSSStyleRule.
void* operator new(size_t size) CPP_THROW_NEW;
};
namespace mozilla {
namespace css {
class DOMCSSStyleRule : public nsICSSStyleRuleDOMWrapper
{
public:
explicit DOMCSSStyleRule(StyleRule *aRule);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMCSSStyleRule)
NS_DECL_NSIDOMCSSRULE
NS_DECL_NSIDOMCSSSTYLERULE
// nsICSSStyleRuleDOMWrapper
NS_IMETHOD GetCSSStyleRule(StyleRule **aResult) override;
DOMCSSDeclarationImpl* DOMDeclaration() { return &mDOMDeclaration; }
friend class ::DOMCSSDeclarationImpl;
protected:
virtual ~DOMCSSStyleRule();
DOMCSSDeclarationImpl mDOMDeclaration;
StyleRule* Rule() {
return mDOMDeclaration.mRule;
}
};
} // namespace css
} // namespace mozilla
DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(css::StyleRule *aRule)
: mRule(aRule)
{
@ -1086,32 +1134,50 @@ DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(css::StyleRule *aRule)
DOMCSSDeclarationImpl::~DOMCSSDeclarationImpl(void)
{
NS_ASSERTION(!mRule, "DropReference not called.");
}
NS_IMPL_ADDREF_USING_AGGREGATOR(DOMCSSDeclarationImpl, mRule)
NS_IMPL_RELEASE_USING_AGGREGATOR(DOMCSSDeclarationImpl, mRule)
inline css::DOMCSSStyleRule* DOMCSSDeclarationImpl::DomRule()
{
return reinterpret_cast<css::DOMCSSStyleRule*>
(reinterpret_cast<char*>(this) -
offsetof(css::DOMCSSStyleRule, mDOMDeclaration));
}
NS_IMPL_ADDREF_USING_AGGREGATOR(DOMCSSDeclarationImpl, DomRule())
NS_IMPL_RELEASE_USING_AGGREGATOR(DOMCSSDeclarationImpl, DomRule())
NS_INTERFACE_MAP_BEGIN(DOMCSSDeclarationImpl)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
// We forward the cycle collection interfaces to mRule, which is
// never null.
// We forward the cycle collection interfaces to DomRule(), which is
// never null (in fact, we're part of that object!)
if (aIID.Equals(NS_GET_IID(nsCycleCollectionISupports)) ||
aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant))) {
return mRule->QueryInterface(aIID, aInstancePtr);
return DomRule()->QueryInterface(aIID, aInstancePtr);
}
else
NS_IMPL_QUERY_TAIL_INHERITING(nsDOMCSSDeclaration)
void
DOMCSSDeclarationImpl::DropReference(void)
{
mRule = nullptr;
}
DeclarationBlock*
DOMCSSDeclarationImpl::GetCSSDeclaration(Operation aOperation)
{
if (aOperation != eOperation_Read) {
RefPtr<CSSStyleSheet> sheet = mRule->GetStyleSheet();
if (sheet) {
sheet->WillDirty();
if (mRule) {
if (aOperation != eOperation_Read) {
RefPtr<CSSStyleSheet> sheet = mRule->GetStyleSheet();
if (sheet) {
sheet->WillDirty();
}
}
return mRule->GetDeclaration();
} else {
return nullptr;
}
return mRule->GetDeclaration();
}
void
@ -1125,7 +1191,12 @@ DOMCSSDeclarationImpl::GetParentRule(nsIDOMCSSRule **aParent)
{
NS_ENSURE_ARG_POINTER(aParent);
NS_IF_ADDREF(*aParent = mRule);
if (!mRule) {
*aParent = nullptr;
return NS_OK;
}
NS_IF_ADDREF(*aParent = mRule->GetDOMRule());
return NS_OK;
}
@ -1161,46 +1232,151 @@ DOMCSSDeclarationImpl::DocToUpdate()
return nullptr;
}
namespace mozilla {
namespace css {
DOMCSSStyleRule::DOMCSSStyleRule(StyleRule* aRule)
: mDOMDeclaration(aRule)
{
}
DOMCSSStyleRule::~DOMCSSStyleRule()
{
}
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMCSSStyleRule)
NS_INTERFACE_MAP_ENTRY(nsICSSStyleRuleDOMWrapper)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRule)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSStyleRule)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMCSSStyleRule)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMCSSStyleRule)
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMCSSStyleRule)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMCSSStyleRule)
// Trace the wrapper for our declaration. This just expands out
// NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
// directly because the wrapper is on the declaration, not on us.
tmp->DOMDeclaration()->TraceWrapper(aCallbacks, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMCSSStyleRule)
// Unlink the wrapper for our declaraton. This just expands out
// NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER which we can't use
// directly because the wrapper is on the declaration, not on us.
tmp->DOMDeclaration()->ReleaseWrapper(static_cast<nsISupports*>(p));
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMCSSStyleRule)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMETHODIMP
DOMCSSStyleRule::GetType(uint16_t* aType)
{
*aType = nsIDOMCSSRule::STYLE_RULE;
return NS_OK;
}
NS_IMETHODIMP
DOMCSSStyleRule::GetCssText(nsAString& aCssText)
{
if (!Rule()) {
aCssText.Truncate();
} else {
Rule()->GetCssText(aCssText);
}
return NS_OK;
}
NS_IMETHODIMP
DOMCSSStyleRule::SetCssText(const nsAString& aCssText)
{
if (Rule()) {
Rule()->SetCssText(aCssText);
}
return NS_OK;
}
NS_IMETHODIMP
DOMCSSStyleRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
if (!Rule()) {
*aSheet = nullptr;
return NS_OK;
}
return Rule()->GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
DOMCSSStyleRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
if (!Rule()) {
*aParentRule = nullptr;
return NS_OK;
}
return Rule()->GetParentRule(aParentRule);
}
css::Rule*
DOMCSSStyleRule::GetCSSRule()
{
return Rule();
}
NS_IMETHODIMP
DOMCSSStyleRule::GetSelectorText(nsAString& aSelectorText)
{
if (!Rule()) {
aSelectorText.Truncate();
} else {
Rule()->GetSelectorText(aSelectorText);
}
return NS_OK;
}
NS_IMETHODIMP
DOMCSSStyleRule::SetSelectorText(const nsAString& aSelectorText)
{
if (Rule()) {
Rule()->SetSelectorText(aSelectorText);
}
return NS_OK;
}
NS_IMETHODIMP
DOMCSSStyleRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
*aStyle = &mDOMDeclaration;
NS_ADDREF(*aStyle);
return NS_OK;
}
NS_IMETHODIMP
DOMCSSStyleRule::GetCSSStyleRule(StyleRule **aResult)
{
*aResult = Rule();
NS_IF_ADDREF(*aResult);
return NS_OK;
}
} // namespace css
} // namespace mozilla
// -- StyleRule ------------------------------------
namespace mozilla {
namespace css {
uint16_t
StyleRule::Type() const
{
return nsIDOMCSSRule::STYLE_RULE;
}
NS_IMETHODIMP
StyleRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
NS_ADDREF(*aStyle = Style());
return NS_OK;
}
nsICSSDeclaration*
StyleRule::Style()
{
if (!mDOMDeclaration) {
mDOMDeclaration.reset(new DOMCSSDeclarationImpl(this));
}
return mDOMDeclaration.get();
}
NS_IMETHODIMP
StyleRule::GetCSSStyleRule(StyleRule **aResult)
{
*aResult = this;
NS_ADDREF(*aResult);
return NS_OK;
}
StyleRule::StyleRule(nsCSSSelectorList* aSelector,
Declaration* aDeclaration,
uint32_t aLineNumber,
uint32_t aColumnNumber)
: BindingStyleRule(aLineNumber, aColumnNumber),
: Rule(aLineNumber, aColumnNumber),
mSelector(aSelector),
mDeclaration(aDeclaration)
{
@ -1211,7 +1387,7 @@ StyleRule::StyleRule(nsCSSSelectorList* aSelector,
// for |Clone|
StyleRule::StyleRule(const StyleRule& aCopy)
: BindingStyleRule(aCopy),
: Rule(aCopy),
mSelector(aCopy.mSelector ? aCopy.mSelector->Clone() : nullptr),
mDeclaration(new Declaration(*aCopy.mDeclaration))
{
@ -1222,54 +1398,28 @@ StyleRule::StyleRule(const StyleRule& aCopy)
StyleRule::~StyleRule()
{
delete mSelector;
DropReferences();
}
if (mDOMRule) {
mDOMRule->DOMDeclaration()->DropReference();
}
void
StyleRule::DropReferences()
{
if (mDeclaration) {
mDeclaration->SetOwningRule(nullptr);
mDeclaration = nullptr;
}
}
// QueryInterface implementation for StyleRule
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(StyleRule)
NS_INTERFACE_MAP_BEGIN(StyleRule)
if (aIID.Equals(NS_GET_IID(mozilla::css::StyleRule))) {
*aInstancePtr = this;
NS_ADDREF_THIS();
return NS_OK;
}
else
NS_INTERFACE_MAP_ENTRY(nsICSSStyleRuleDOMWrapper)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleRule)
NS_INTERFACE_MAP_END_INHERITING(Rule)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, mozilla::css::Rule)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF_INHERITED(StyleRule, Rule)
NS_IMPL_RELEASE_INHERITED(StyleRule, Rule)
NS_IMPL_CYCLE_COLLECTION_CLASS(StyleRule)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(StyleRule, Rule)
// Trace the wrapper for our declaration. This just expands out
// NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
// directly because the wrapper is on the declaration, not on us.
if (tmp->mDOMDeclaration) {
tmp->mDOMDeclaration->TraceWrapper(aCallbacks, aClosure);
}
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(StyleRule, Rule)
// Unlink the wrapper for our declaraton. This just expands out
// NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER which we can't use
// directly because the wrapper is on the declaration, not on us.
if (tmp->mDOMDeclaration) {
tmp->mDOMDeclaration->ReleaseWrapper(static_cast<nsISupports*>(p));
}
tmp->DropReferences();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(StyleRule, Rule)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDeclaration)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF(StyleRule)
NS_IMPL_RELEASE(StyleRule)
/* virtual */ int32_t
StyleRule::GetType() const
@ -1284,6 +1434,27 @@ StyleRule::Clone() const
return clone.forget();
}
/* virtual */ nsIDOMCSSRule*
StyleRule::GetDOMRule()
{
if (!mDOMRule) {
if (!GetStyleSheet()) {
// Inline style rules aren't supposed to have a DOM rule object, only
// a declaration. But if we do have one already, from a style sheet
// rule that used to be in a document, we still want to return it.
return nullptr;
}
mDOMRule = new DOMCSSStyleRule(this);
}
return mDOMRule;
}
/* virtual */ nsIDOMCSSRule*
StyleRule::GetExistingDOMRule()
{
return mDOMRule;
}
void
StyleRule::SetDeclaration(Declaration* aDecl)
{
@ -1339,7 +1510,7 @@ StyleRule::List(FILE* out, int32_t aIndent) const
#endif
void
StyleRule::GetCssTextImpl(nsAString& aCssText) const
StyleRule::GetCssText(nsAString& aCssText)
{
if (mSelector) {
mSelector->ToString(aCssText, GetStyleSheet());
@ -1357,23 +1528,27 @@ StyleRule::GetCssTextImpl(nsAString& aCssText) const
aCssText.Append(char16_t('}'));
}
NS_IMETHODIMP
void
StyleRule::SetCssText(const nsAString& aCssText)
{
// XXX TBI - need to re-parse rule & declaration
}
void
StyleRule::GetSelectorText(nsAString& aSelectorText)
{
if (mSelector)
mSelector->ToString(aSelectorText, GetStyleSheet());
else
aSelectorText.Truncate();
return NS_OK;
}
NS_IMETHODIMP
void
StyleRule::SetSelectorText(const nsAString& aSelectorText)
{
// XXX TBI - get a parser and re-parse the selectors,
// XXX then need to re-compute the cascade
// XXX and dirty sheet
return NS_OK;
}
/* virtual */ size_t
@ -1390,5 +1565,6 @@ StyleRule::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
return n;
}
} // namespace css
} // namespace mozilla

Просмотреть файл

@ -13,14 +13,12 @@
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/BindingStyleRule.h"
#include "mozilla/css/Rule.h"
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsCSSPseudoElements.h"
#include "nsIStyleRule.h"
#include "nsICSSStyleRuleDOMWrapper.h"
class nsIAtom;
struct nsCSSSelectorList;
@ -304,15 +302,13 @@ private:
{ 0x464bab7a, 0x2fce, 0x4f30, \
{ 0xab, 0x44, 0xb7, 0xa5, 0xf3, 0xaa, 0xe5, 0x7d } }
class DOMCSSDeclarationImpl;
namespace mozilla {
namespace css {
class Declaration;
class DOMCSSStyleRule;
class StyleRule final : public BindingStyleRule
, public nsICSSStyleRuleDOMWrapper
class StyleRule final : public Rule
{
public:
StyleRule(nsCSSSelectorList* aSelector,
@ -324,17 +320,7 @@ private:
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CSS_STYLE_RULE_IMPL_CID)
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(StyleRule, Rule)
NS_DECL_NSIDOMCSSSTYLERULE
// nsICSSStyleRuleDOMWrapper
NS_IMETHOD GetCSSStyleRule(StyleRule **aResult) override;
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
virtual nsICSSDeclaration* Style() override;
NS_DECL_ISUPPORTS
// null for style attribute
nsCSSSelectorList* Selector() { return mSelector; }
@ -343,8 +329,13 @@ public:
void SetDeclaration(Declaration* aDecl);
// hooks for DOM rule
void GetCssText(nsAString& aCssText);
void SetCssText(const nsAString& aCssText);
void GetSelectorText(nsAString& aSelectorText);
void SetSelectorText(const nsAString& aSelectorText);
virtual int32_t GetType() const override;
using Rule::GetType;
CSSStyleSheet* GetStyleSheet() const
{
@ -354,6 +345,10 @@ public:
virtual already_AddRefed<Rule> Clone() const override;
virtual nsIDOMCSSRule* GetDOMRule() override;
virtual nsIDOMCSSRule* GetExistingDOMRule() override;
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
@ -363,16 +358,10 @@ public:
private:
~StyleRule();
// Drop our references to mDeclaration and mRule, and let them know we're
// doing that.
void DropReferences();
private:
nsCSSSelectorList* mSelector; // null for style attribute
RefPtr<Declaration> mDeclaration;
// We own it, and it aggregates its refcount with us.
UniquePtr<DOMCSSDeclarationImpl> mDOMDeclaration;
RefPtr<DOMCSSStyleRule> mDOMRule;
private:
StyleRule& operator=(const StyleRule& aCopy) = delete;

Просмотреть файл

@ -33,10 +33,6 @@ class CSSRuleList;
class SRIMetadata;
} // namespace dom
namespace css {
class Rule;
}
/**
* Superclass for data common to CSSStyleSheet and ServoStyleSheet.
*/
@ -152,7 +148,7 @@ public:
// The XPCOM SetDisabled is fine for WebIDL.
// WebIDL CSSStyleSheet API
virtual css::Rule* GetDOMOwnerRule() const = 0;
virtual nsIDOMCSSRule* GetDOMOwnerRule() const = 0;
dom::CSSRuleList* GetCssRules(nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv);
uint32_t InsertRule(const nsAString& aRule, uint32_t aIndex,

Просмотреть файл

@ -81,7 +81,6 @@ EXPORTS += [
EXPORTS.mozilla += [
'AnimationCollection.h',
'BindingStyleRule.h',
'CSSEnabledState.h',
'CSSStyleSheet.h',
'CSSVariableDeclarations.h',
@ -217,18 +216,10 @@ UNIFIED_SOURCES += [
'SVGAttrAnimationRuleProcessor.cpp',
]
# - BindingStyleRule.cpp doesn't _really_ needs to be built separately,
# except insofar as it shifts unified build boundaries, causing
# Unified_cpp_layout_style4.cpp to include nsStyleCoord.cpp, which
# includes, via nsStyleCoord.h, <type_traits>, which ends up including
# <xutility>, which fails in much the way described in
# <https://bugzilla.mozilla.org/show_bug.cgi?id=1331102>.
# - nsCSSRuleProcessor.cpp needs to be built separately because it uses
# plarena.h.
# - nsLayoutStylesheetCache.cpp needs to be built separately because it uses
# nsCSSRuleProcessor.cpp needs to be built separately because it uses plarena.h.
# nsLayoutStylesheetCache.cpp needs to be built separately because it uses
# nsExceptionHandler.h, which includes windows.h.
SOURCES += [
'BindingStyleRule.cpp',
'nsCSSRuleProcessor.cpp',
'nsLayoutStylesheetCache.cpp',
]

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -43,7 +43,7 @@ class ErrorResult;
namespace css {
class MediaRule final : public ConditionRule,
class MediaRule final : public GroupRule,
public nsIDOMCSSMediaRule
{
public:
@ -53,7 +53,6 @@ private:
~MediaRule();
public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaRule, ConditionRule)
NS_DECL_ISUPPORTS_INHERITED
// Rule methods
@ -67,8 +66,18 @@ public:
return sheet ? sheet->AsGecko() : nullptr;
}
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<Rule> Clone() const override;
virtual nsIDOMCSSRule* GetDOMRule() override
{
return this;
}
virtual nsIDOMCSSRule* GetExistingDOMRule() override
{
return this;
}
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSGroupingRule interface
NS_DECL_NSIDOMCSSGROUPINGRULE
@ -86,27 +95,16 @@ public:
// @media rule methods
nsresult SetMedia(nsMediaList* aMedia);
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// Our XPCOM GetConditionText is OK
virtual void SetConditionText(const nsAString& aConditionText,
ErrorResult& aRv) override;
nsMediaList* Media() const;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const override MOZ_MUST_OVERRIDE;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
protected:
void AppendConditionText(nsAString& aOutput) const;
void AppendConditionText(nsAString& aOutput);
RefPtr<nsMediaList> mMedia;
};
class DocumentRule final : public ConditionRule,
class DocumentRule final : public GroupRule,
public nsIDOMCSSMozDocumentRule
{
public:
@ -123,8 +121,18 @@ public:
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<Rule> Clone() const override;
virtual nsIDOMCSSRule* GetDOMRule() override
{
return this;
}
virtual nsIDOMCSSRule* GetExistingDOMRule() override
{
return this;
}
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSGroupingRule interface
NS_DECL_NSIDOMCSSGROUPINGRULE
@ -165,21 +173,11 @@ public:
void SetURLs(URL *aURLs) { mURLs = aURLs; }
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// Our XPCOM GetConditionText is OK
virtual void SetConditionText(const nsAString& aConditionText,
ErrorResult& aRv) override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const override MOZ_MUST_OVERRIDE;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
protected:
void AppendConditionText(nsAString& aOutput) const;
void AppendConditionText(nsAString& aOutput);
nsAutoPtr<URL> mURLs; // linked list of |struct URL| above.
};
@ -232,9 +230,6 @@ protected:
mozilla::CSSFontFaceDescriptors mDescriptors;
// The actual implementation of GetCssText, so we can make it const.
void GetCssTextImpl(nsAString& aCssText) const;
private:
// NOT TO BE IMPLEMENTED
// This object cannot be allocated on its own, only as part of
@ -247,43 +242,35 @@ class nsCSSFontFaceRule final : public mozilla::css::Rule,
{
public:
nsCSSFontFaceRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: mozilla::css::Rule(aLineNumber, aColumnNumber)
{
}
: mozilla::css::Rule(aLineNumber, aColumnNumber) {}
nsCSSFontFaceRule(const nsCSSFontFaceRule& aCopy)
// copy everything except our reference count
: mozilla::css::Rule(aCopy), mDecl(aCopy.mDecl)
{
}
: mozilla::css::Rule(aCopy), mDecl(aCopy.mDecl) {}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsCSSFontFaceRule,
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsCSSFontFaceRule,
mozilla::css::Rule)
// Rule methods
DECL_STYLE_RULE_INHERIT
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSFontFaceRule interface
NS_DECL_NSIDOMCSSFONTFACERULE
void SetDesc(nsCSSFontDesc aDescID, nsCSSValue const & aValue);
void GetDesc(nsCSSFontDesc aDescID, nsCSSValue & aValue);
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
nsICSSDeclaration* Style();
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
void GetDescriptors(mozilla::CSSFontFaceDescriptors& aDescriptors) const
{ aDescriptors = mDecl.mDescriptors; }
@ -320,38 +307,30 @@ class nsCSSFontFeatureValuesRule final : public mozilla::css::Rule,
{
public:
nsCSSFontFeatureValuesRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: mozilla::css::Rule(aLineNumber, aColumnNumber)
{
}
: mozilla::css::Rule(aLineNumber, aColumnNumber) {}
nsCSSFontFeatureValuesRule(const nsCSSFontFeatureValuesRule& aCopy)
// copy everything except our reference count
: mozilla::css::Rule(aCopy),
mFamilyList(aCopy.mFamilyList),
mFeatureValues(aCopy.mFeatureValues)
{
}
mFeatureValues(aCopy.mFeatureValues) {}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_ISUPPORTS
// Rule methods
DECL_STYLE_RULE_INHERIT
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSFontFaceRule interface
NS_DECL_NSIDOMCSSFONTFEATUREVALUESRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// The XPCOM GetFontFamily is fine
void SetFontFamily(const nsAString& aFamily, mozilla::ErrorResult& aRv);
// The XPCOM GetValueText is fine
void SetValueText(const nsAString& aFamily, mozilla::ErrorResult& aRv);
const mozilla::FontFamilyList& GetFamilyList() { return mFamilyList; }
void SetFamilyList(const mozilla::FontFamilyList& aFamilyList);
@ -365,9 +344,6 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
protected:
~nsCSSFontFeatureValuesRule() {}
@ -421,26 +397,23 @@ private:
nsCSSKeyframeRule(const nsCSSKeyframeRule& aCopy);
~nsCSSKeyframeRule();
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsCSSKeyframeRule, mozilla::css::Rule)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCSSKeyframeRule, mozilla::css::Rule)
// Rule methods
DECL_STYLE_RULE_INHERIT
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSKeyframeRule interface
NS_DECL_NSIDOMCSSKEYFRAMERULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// The XPCOM GetKeyText is fine.
// The XPCOM SetKeyText is fine.
nsICSSDeclaration* Style();
const nsTArray<float>& GetKeys() const { return mKeys; }
mozilla::css::Declaration* Declaration() { return mDeclaration; }
@ -448,9 +421,6 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
void DoGetKeyText(nsAString &aKeyText) const;
private:
@ -481,22 +451,22 @@ public:
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
virtual nsIDOMCSSRule* GetDOMRule() override
{
return this;
}
virtual nsIDOMCSSRule* GetExistingDOMRule() override
{
return this;
}
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSKeyframesRule interface
NS_DECL_NSIDOMCSSKEYFRAMESRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// The XPCOM GetName is OK
// The XPCOM SetName is OK
using mozilla::css::GroupRule::CssRules;
// The XPCOM appendRule is OK, since it never throws
// The XPCOM deleteRule is OK, since it never throws
nsCSSKeyframeRule* FindRule(const nsAString& aKey);
// rest of GroupRule
virtual bool UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey) override;
@ -505,9 +475,6 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
private:
uint32_t FindRuleIndexForKey(const nsAString& aKey);
@ -557,33 +524,28 @@ private:
nsCSSPageRule(const nsCSSPageRule& aCopy);
~nsCSSPageRule();
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsCSSPageRule, mozilla::css::Rule)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCSSPageRule, nsIDOMCSSPageRule)
// Rule methods
DECL_STYLE_RULE_INHERIT
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSPageRule interface
NS_DECL_NSIDOMCSSPAGERULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
nsICSSDeclaration* Style();
mozilla::css::Declaration* Declaration() { return mDeclaration; }
void ChangeDeclaration(mozilla::css::Declaration* aDeclaration);
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
private:
RefPtr<mozilla::css::Declaration> mDeclaration;
// lazily created when needed:
@ -592,8 +554,8 @@ private:
namespace mozilla {
class CSSSupportsRule final : public css::ConditionRule,
public nsIDOMCSSSupportsRule
class CSSSupportsRule : public css::GroupRule,
public nsIDOMCSSSupportsRule
{
public:
CSSSupportsRule(bool aConditionMet, const nsString& aCondition,
@ -605,13 +567,23 @@ public:
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
virtual bool UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey) override;
virtual nsIDOMCSSRule* GetDOMRule() override
{
return this;
}
virtual nsIDOMCSSRule* GetExistingDOMRule() override
{
return this;
}
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSGroupingRule interface
NS_DECL_NSIDOMCSSGROUPINGRULE
@ -621,18 +593,8 @@ public:
// nsIDOMCSSSupportsRule interface
NS_DECL_NSIDOMCSSSUPPORTSRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// Our XPCOM GetConditionText is OK
virtual void SetConditionText(const nsAString& aConditionText,
ErrorResult& aRv) override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
protected:
virtual ~CSSSupportsRule();
@ -659,44 +621,22 @@ private:
~nsCSSCounterStyleRule();
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_ISUPPORTS
// Rule methods
DECL_STYLE_RULE_INHERIT
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSCounterStyleRule
NS_DECL_NSIDOMCSSCOUNTERSTYLERULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// The XPCOM GetName is OK
// The XPCOM SetName is OK
// The XPCOM GetSystem is OK
// The XPCOM SetSystem is OK
// The XPCOM GetSymbols is OK
// The XPCOM SetSymbols is OK
// The XPCOM GetAdditiveSymbols is OK
// The XPCOM SetAdditiveSymbols is OK
// The XPCOM GetNegative is OK
// The XPCOM SetNegative is OK
// The XPCOM GetPrefix is OK
// The XPCOM SetPrefix is OK
// The XPCOM GetSuffix is OK
// The XPCOM SetSuffix is OK
// The XPCOM GetRange is OK
// The XPCOM SetRange is OK
// The XPCOM GetPad is OK
// The XPCOM SetPad is OK
// The XPCOM GetSpeakAs is OK
// The XPCOM SetSpeakAs is OK
// The XPCOM GetFallback is OK
// The XPCOM SetFallback is OK
// This function is only used to check whether a non-empty value, which has
// been accepted by parser, is valid for the given system and descriptor.
static bool CheckDescValue(int32_t aSystem,
@ -721,9 +661,6 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
private:
typedef NS_STDCALL_FUNCPROTO(nsresult, Getter, nsCSSCounterStyleRule,
GetSymbols, (nsAString&));

Просмотреть файл

@ -18,11 +18,6 @@
#define NS_ICSS_STYLE_RULE_DOM_WRAPPER_IID \
{0xcee1bbb6, 0x0a32, 0x4cf3, {0x8d, 0x42, 0xba, 0x39, 0x38, 0xe9, 0xec, 0xaa}}
namespace mozilla {
namespace css {
class StyleRule;
} // namespace css
} // namespace mozilla
class nsICSSStyleRuleDOMWrapper : public nsIDOMCSSStyleRule {
public: