author | Boris Zbarsky <bzbarsky@mit.edu> |
Fri, 13 Jan 2017 10:41:04 -0500 | |
changeset 376625 | eda4ef1e028891d7a188badc964fdf968541a15f |
parent 376624 | e37ac7b0c913ce7d35681383c0244b7488b30605 |
child 376626 | 224432acd298fc74e4341bc14997cbf6848de319 |
push id | 1419 |
push user | jlund@mozilla.com |
push date | Mon, 10 Apr 2017 20:44:07 +0000 |
treeherder | mozilla-release@5e6801b73ef6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | peterv, heycam |
bugs | 851892 |
milestone | 53.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -71,17 +71,16 @@ // 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 "nsIDOMCSSFontFaceRule.h" #include "nsIDOMCSSCounterStyleRule.h" #include "nsIDOMXULCommandDispatcher.h" #include "nsIControllers.h" #ifdef MOZ_XUL #include "nsITreeSelection.h" #include "nsITreeContentView.h" #include "nsITreeView.h" #include "nsIXULTemplateBuilder.h" @@ -200,20 +199,16 @@ static nsDOMClassInfoData sClassInfoData #ifdef MOZ_XUL NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULTemplateBuilder, nsDOMGenericSH, DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULTreeBuilder, nsDOMGenericSH, 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 | nsIXPCScriptable::WANT_ENUMERATE | nsIXPCScriptable::IS_GLOBAL_OBJECT) NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentProcessMessageManager, nsMessageManagerSH<nsDOMGenericSH>, DOM_DEFAULT_SCRIPTABLE_FLAGS | @@ -520,21 +515,16 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(XULTreeBuilder, nsIXULTreeBuilder) DOM_CLASSINFO_MAP_ENTRY(nsIXULTreeBuilder) DOM_CLASSINFO_MAP_ENTRY(nsIXULTemplateBuilder) DOM_CLASSINFO_MAP_ENTRY(nsITreeView) 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) DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender) DOM_CLASSINFO_MAP_ENTRY(nsISyncMessageSender) DOM_CLASSINFO_MAP_ENTRY(nsIContentFrameMessageManager) DOM_CLASSINFO_MAP_END
--- a/dom/base/nsDOMClassInfoID.h +++ b/dom/base/nsDOMClassInfoID.h @@ -29,19 +29,16 @@ enum nsDOMClassInfoID eDOMClassInfo_TreeContentView_id, #endif #ifdef MOZ_XUL eDOMClassInfo_XULTemplateBuilder_id, eDOMClassInfo_XULTreeBuilder_id, #endif - // @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,
--- a/dom/base/nsWrapperCache.h +++ b/dom/base/nsWrapperCache.h @@ -18,17 +18,16 @@ namespace mozilla { namespace dom { class TabChildGlobal; class ProcessGlobal; } // namespace dom } // namespace mozilla class SandboxPrivate; class nsInProcessTabChildGlobal; class nsWindowRoot; -class nsCSSFontFaceRule; class nsCSSFontFeatureValuesRule; class nsCSSKeyframeRule; class nsCSSKeyframesRule; class nsCSSCounterStyleRule; #define NS_WRAPPERCACHE_IID \ { 0x6f3179a1, 0x36f7, 0x4a5c, \ { 0x8c, 0xf1, 0xad, 0xc8, 0x7c, 0xde, 0x3e, 0x87 } } @@ -280,17 +279,16 @@ 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; friend class nsInProcessTabChildGlobal; friend class nsWindowRoot; - friend class nsCSSFontFaceRule; friend class nsCSSFontFeatureValuesRule; friend class nsCSSKeyframeRule; friend class nsCSSKeyframesRule; friend class nsCSSCounterStyleRule; void SetIsNotDOMBinding() { MOZ_ASSERT(!mWrapper && !(GetWrapperFlags() & ~WRAPPER_IS_NOT_DOM_BINDING), "This flag should be set before creating any wrappers.");
--- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -197,16 +197,21 @@ DOMInterfaces = { }, 'CSSConditionRule': { 'concrete': False, 'nativeType': 'mozilla::css::ConditionRule', 'headerFile': 'mozilla/css/GroupRule.h', }, +'CSSFontFaceRule': { + 'nativeType': 'nsCSSFontFaceRule', + 'headerFile': 'nsCSSRules.h', +}, + 'CSSGroupingRule': { 'concrete': False, 'nativeType': 'mozilla::css::GroupRule', }, 'CSSImportRule': { 'nativeType': 'mozilla::css::ImportRule', },
new file mode 100644 --- /dev/null +++ b/dom/webidl/CSSFontFaceRule.webidl @@ -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; +};
--- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -85,16 +85,17 @@ WEBIDL_FILES = [ 'Coordinates.webidl', 'CreateOfferRequest.webidl', 'Crypto.webidl', 'CSPDictionaries.webidl', 'CSPReport.webidl', 'CSS.webidl', 'CSSAnimation.webidl', 'CSSConditionRule.webidl', + 'CSSFontFaceRule.webidl', 'CSSGroupingRule.webidl', 'CSSImportRule.webidl', 'CSSLexer.webidl', 'CSSMediaRule.webidl', 'CSSMozDocumentRule.webidl', 'CSSNamespaceRule.webidl', 'CSSPageRule.webidl', 'CSSPrimitiveValue.webidl',
--- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -34,16 +34,17 @@ #include "nsDOMClassInfoID.h" #include "mozilla/dom/CSSStyleDeclarationBinding.h" #include "mozilla/dom/CSSNamespaceRuleBinding.h" #include "mozilla/dom/CSSImportRuleBinding.h" #include "mozilla/dom/CSSMediaRuleBinding.h" #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" #include "mozAutoDocUpdate.h" using namespace mozilla; using namespace mozilla::dom; @@ -1584,17 +1585,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsCSSFontFaceRule, mozilla::css::Rule) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END // 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 void nsCSSFontFaceRule::List(FILE* out, int32_t aIndent) const { nsCString baseInd, descInd; for (int32_t indent = aIndent; --indent >= 0; ) { @@ -1640,16 +1640,22 @@ nsCSSFontFaceRule::GetCssTextImpl(nsAStr nsAutoString propText; mDecl.GetCssTextImpl(propText); aCssText.AssignLiteral("@font-face {\n"); aCssText.Append(propText); aCssText.Append('}'); } +nsICSSDeclaration* +nsCSSFontFaceRule::Style() +{ + return &mDecl; +} + NS_IMETHODIMP nsCSSFontFaceRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { NS_IF_ADDREF(*aStyle = &mDecl); return NS_OK; } // Arguably these should forward to nsCSSFontFaceStyleDecl methods. @@ -1684,18 +1690,17 @@ nsCSSFontFaceRule::SizeOfIncludingThis(M // worthwhile: // - mDecl } /* virtual */ JSObject* nsCSSFontFaceRule::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) { - NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor"); - return nullptr; + return CSSFontFaceRuleBinding::Wrap(aCx, this, aGivenProto); } // ----------------------------------- // nsCSSFontFeatureValuesRule // /* virtual */ already_AddRefed<css::Rule> nsCSSFontFeatureValuesRule::Clone() const
--- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -244,24 +244,22 @@ private: class nsCSSFontFaceRule final : public mozilla::css::Rule, public nsIDOMCSSFontFaceRule { 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 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsCSSFontFaceRule, mozilla::css::Rule) #ifdef DEBUG virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override; @@ -274,16 +272,17 @@ public: 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; }