mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 851892 part 14. Convert CSSPageRule to WebIDL. r=peterv,heycam
The PutForwards bit is a new feature, but easy enough to implement here.
This commit is contained in:
parent
85499be2bd
commit
c6365390a7
@ -78,7 +78,6 @@
|
||||
#include "nsIDOMCSSKeyframesRule.h"
|
||||
#include "nsIDOMCSSFontFaceRule.h"
|
||||
#include "nsIDOMCSSCounterStyleRule.h"
|
||||
#include "nsIDOMCSSPageRule.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIControllers.h"
|
||||
#ifdef MOZ_XUL
|
||||
@ -237,10 +236,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_PRECREATE)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSPageRule, nsCSSRuleSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_PRECREATE)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSFontFeatureValuesRule, nsCSSRuleSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_PRECREATE)
|
||||
@ -580,11 +575,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSCounterStyleRule)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CSSPageRule, nsIDOMCSSPageRule)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSRule)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSPageRule)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CSSFontFeatureValuesRule, nsIDOMCSSFontFeatureValuesRule)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSRule)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFeatureValuesRule)
|
||||
|
@ -48,8 +48,6 @@ enum nsDOMClassInfoID
|
||||
// @counter-style in CSS
|
||||
eDOMClassInfo_CSSCounterStyleRule_id,
|
||||
|
||||
eDOMClassInfo_CSSPageRule_id,
|
||||
|
||||
eDOMClassInfo_CSSFontFeatureValuesRule_id,
|
||||
|
||||
eDOMClassInfo_XULControlElement_id,
|
||||
|
@ -27,7 +27,6 @@ class nsCSSFontFaceRule;
|
||||
class nsCSSFontFeatureValuesRule;
|
||||
class nsCSSKeyframeRule;
|
||||
class nsCSSKeyframesRule;
|
||||
class nsCSSPageRule;
|
||||
class nsCSSCounterStyleRule;
|
||||
|
||||
#define NS_WRAPPERCACHE_IID \
|
||||
@ -290,7 +289,6 @@ private:
|
||||
friend class nsCSSFontFeatureValuesRule;
|
||||
friend class nsCSSKeyframeRule;
|
||||
friend class nsCSSKeyframesRule;
|
||||
friend class nsCSSPageRule;
|
||||
friend class nsCSSCounterStyleRule;
|
||||
void SetIsNotDOMBinding()
|
||||
{
|
||||
|
@ -229,6 +229,11 @@ DOMInterfaces = {
|
||||
'nativeType': 'mozilla::css::NameSpaceRule',
|
||||
},
|
||||
|
||||
'CSSPageRule': {
|
||||
'nativeType': 'nsCSSPageRule',
|
||||
'headerFile': 'nsCSSRules.h',
|
||||
},
|
||||
|
||||
'CSSPrimitiveValue': {
|
||||
'nativeType': 'nsROCSSPrimitiveValue',
|
||||
},
|
||||
|
17
dom/webidl/CSSPageRule.webidl
Normal file
17
dom/webidl/CSSPageRule.webidl
Normal file
@ -0,0 +1,17 @@
|
||||
/* -*- 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;
|
||||
};
|
@ -96,6 +96,7 @@ WEBIDL_FILES = [
|
||||
'CSSMediaRule.webidl',
|
||||
'CSSMozDocumentRule.webidl',
|
||||
'CSSNamespaceRule.webidl',
|
||||
'CSSPageRule.webidl',
|
||||
'CSSPrimitiveValue.webidl',
|
||||
'CSSPseudoElement.webidl',
|
||||
'CSSRule.webidl',
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "mozilla/dom/CSSMediaRuleBinding.h"
|
||||
#include "mozilla/dom/CSSSupportsRuleBinding.h"
|
||||
#include "mozilla/dom/CSSMozDocumentRuleBinding.h"
|
||||
#include "mozilla/dom/CSSPageRuleBinding.h"
|
||||
#include "StyleRule.h"
|
||||
#include "nsFont.h"
|
||||
#include "nsIURI.h"
|
||||
@ -2580,7 +2581,6 @@ nsCSSPageRule::nsCSSPageRule(const nsCSSPageRule& aCopy)
|
||||
: Rule(aCopy)
|
||||
, mDeclaration(new css::Declaration(*aCopy.mDeclaration))
|
||||
{
|
||||
SetIsNotDOMBinding();
|
||||
mDeclaration->SetOwningRule(this);
|
||||
}
|
||||
|
||||
@ -2626,7 +2626,6 @@ nsCSSPageRule::IsCCLeaf() const
|
||||
// QueryInterface implementation for nsCSSPageRule
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsCSSPageRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSPageRule)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSPageRule)
|
||||
NS_INTERFACE_MAP_END_INHERITING(mozilla::css::Rule)
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -2671,12 +2670,18 @@ nsCSSPageRule::GetCssTextImpl(nsAString& aCssText) const
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSPageRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
|
||||
{
|
||||
NS_ADDREF(*aStyle = Style());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsICSSDeclaration*
|
||||
nsCSSPageRule::Style()
|
||||
{
|
||||
if (!mDOMDeclaration) {
|
||||
mDOMDeclaration = new nsCSSPageStyleDeclaration(this);
|
||||
}
|
||||
NS_ADDREF(*aStyle = mDOMDeclaration);
|
||||
return NS_OK;
|
||||
return mDOMDeclaration;
|
||||
}
|
||||
|
||||
void
|
||||
@ -2703,8 +2708,7 @@ nsCSSPageRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
nsCSSPageRule::WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
|
||||
return nullptr;
|
||||
return CSSPageRuleBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -546,7 +546,6 @@ public:
|
||||
: mozilla::css::Rule(aLineNumber, aColumnNumber)
|
||||
, mDeclaration(aDeclaration)
|
||||
{
|
||||
SetIsNotDOMBinding();
|
||||
mDeclaration->SetOwningRule(this);
|
||||
}
|
||||
private:
|
||||
@ -570,6 +569,7 @@ public:
|
||||
// WebIDL interface
|
||||
uint16_t Type() const override;
|
||||
void GetCssTextImpl(nsAString& aCssText) const override;
|
||||
nsICSSDeclaration* Style();
|
||||
|
||||
mozilla::css::Declaration* Declaration() { return mDeclaration; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user