Bug 851892 part 15. Convert CSSFontFaceRule to WebIDL. r=peterv,heycam

This commit is contained in:
Boris Zbarsky 2017-01-13 10:41:04 -05:00
Родитель b1b80495aa
Коммит 5398bc5f13
8 изменённых файлов: 30 добавлений и 20 удалений

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

@ -76,7 +76,6 @@
// includes needed for the prototype chain interfaces
#include "nsIDOMCSSKeyframeRule.h"
#include "nsIDOMCSSKeyframesRule.h"
#include "nsIDOMCSSFontFaceRule.h"
#include "nsIDOMCSSCounterStyleRule.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIControllers.h"
@ -205,10 +204,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DEFAULT_SCRIPTABLE_FLAGS)
#endif
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsCSSRuleSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE)
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager,
nsMessageManagerSH<nsEventTargetSH>,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
@ -525,11 +520,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_END
#endif
DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSRule)
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)

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

@ -34,9 +34,6 @@ enum nsDOMClassInfoID
eDOMClassInfo_XULTreeBuilder_id,
#endif
// @font-face in CSS
eDOMClassInfo_CSSFontFaceRule_id,
eDOMClassInfo_ContentFrameMessageManager_id,
eDOMClassInfo_ContentProcessMessageManager_id,
eDOMClassInfo_ChromeMessageBroadcaster_id,

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

@ -23,7 +23,6 @@ class ProcessGlobal;
class SandboxPrivate;
class nsInProcessTabChildGlobal;
class nsWindowRoot;
class nsCSSFontFaceRule;
class nsCSSFontFeatureValuesRule;
class nsCSSKeyframeRule;
class nsCSSKeyframesRule;
@ -285,7 +284,6 @@ private:
friend class SandboxPrivate;
friend class nsInProcessTabChildGlobal;
friend class nsWindowRoot;
friend class nsCSSFontFaceRule;
friend class nsCSSFontFeatureValuesRule;
friend class nsCSSKeyframeRule;
friend class nsCSSKeyframesRule;

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

@ -202,6 +202,11 @@ DOMInterfaces = {
'headerFile': 'mozilla/css/GroupRule.h',
},
'CSSFontFaceRule': {
'nativeType': 'nsCSSFontFaceRule',
'headerFile': 'nsCSSRules.h',
},
'CSSGroupingRule': {
'concrete': False,
'nativeType': 'mozilla::css::GroupRule',

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

@ -0,0 +1,15 @@
/* -*- 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;
};

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

@ -90,6 +90,7 @@ WEBIDL_FILES = [
'CSS.webidl',
'CSSAnimation.webidl',
'CSSConditionRule.webidl',
'CSSFontFaceRule.webidl',
'CSSGroupingRule.webidl',
'CSSImportRule.webidl',
'CSSLexer.webidl',

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

@ -39,6 +39,7 @@
#include "mozilla/dom/CSSSupportsRuleBinding.h"
#include "mozilla/dom/CSSMozDocumentRuleBinding.h"
#include "mozilla/dom/CSSPageRuleBinding.h"
#include "mozilla/dom/CSSFontFaceRuleBinding.h"
#include "StyleRule.h"
#include "nsFont.h"
#include "nsIURI.h"
@ -1672,7 +1673,6 @@ nsCSSFontFaceRule::IsCCLeaf() const
// QueryInterface implementation for nsCSSFontFaceRule
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsCSSFontFaceRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSFontFaceRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSFontFaceRule)
NS_INTERFACE_MAP_END_INHERITING(Rule)
#ifdef DEBUG
@ -1728,6 +1728,12 @@ nsCSSFontFaceRule::GetCssTextImpl(nsAString& aCssText) const
aCssText.Append('}');
}
nsICSSDeclaration*
nsCSSFontFaceRule::Style()
{
return &mDecl;
}
NS_IMETHODIMP
nsCSSFontFaceRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
@ -1772,8 +1778,7 @@ nsCSSFontFaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
nsCSSFontFaceRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
return CSSFontFaceRuleBinding::Wrap(aCx, this, aGivenProto);
}
// -----------------------------------

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

@ -249,14 +249,12 @@ public:
nsCSSFontFaceRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: mozilla::css::Rule(aLineNumber, aColumnNumber)
{
SetIsNotDOMBinding();
}
nsCSSFontFaceRule(const nsCSSFontFaceRule& aCopy)
// copy everything except our reference count
: mozilla::css::Rule(aCopy), mDecl(aCopy.mDecl)
{
SetIsNotDOMBinding();
}
NS_DECL_ISUPPORTS_INHERITED
@ -280,6 +278,7 @@ public:
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
nsICSSDeclaration* Style();
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;