зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1292432 part 8 - Move XPCOM IDL methods which just call WebIDL methods to StyleSheet. r=heycam
MozReview-Commit-ID: 3xpdLGc6hqH --HG-- extra : source : d156efabc47b4a2966a5972dec6755d40fcc624e
This commit is contained in:
Родитель
2169694adb
Коммит
541b51df00
|
@ -1628,25 +1628,6 @@ CSSStyleSheet::RegisterNamespaceRule(css::Rule* aRule)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIDOMStyleSheet interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSStyleSheet::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParentStyleSheet);
|
||||
|
||||
NS_IF_ADDREF(*aParentStyleSheet = mParent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSStyleSheet::GetMedia(nsIDOMMediaList** aMedia)
|
||||
{
|
||||
NS_ADDREF(*aMedia = Media());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsMediaList*
|
||||
CSSStyleSheet::Media()
|
||||
{
|
||||
|
@ -1658,29 +1639,12 @@ CSSStyleSheet::Media()
|
|||
return mMedia;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSStyleSheet::GetOwnerRule(nsIDOMCSSRule** aOwnerRule)
|
||||
{
|
||||
NS_IF_ADDREF(*aOwnerRule = GetOwnerRule());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDOMCSSRule*
|
||||
CSSStyleSheet::GetDOMOwnerRule() const
|
||||
{
|
||||
return mOwnerRule ? mOwnerRule->GetDOMRule() : nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
|
||||
{
|
||||
ErrorResult rv;
|
||||
nsCOMPtr<nsIDOMCSSRuleList> rules =
|
||||
GetCssRules(*nsContentUtils::SubjectPrincipal(), rv);
|
||||
rules.forget(aCssRules);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
CSSRuleList*
|
||||
CSSStyleSheet::GetCssRulesInternal(ErrorResult& aRv)
|
||||
{
|
||||
|
@ -1690,17 +1654,6 @@ CSSStyleSheet::GetCssRulesInternal(ErrorResult& aRv)
|
|||
return mRuleCollection;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSStyleSheet::InsertRule(const nsAString& aRule,
|
||||
uint32_t aIndex,
|
||||
uint32_t* aReturn)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aReturn =
|
||||
InsertRule(aRule, aIndex, *nsContentUtils::SubjectPrincipal(), rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
static bool
|
||||
RuleHasPendingChildSheet(css::Rule *cssRule)
|
||||
{
|
||||
|
@ -1832,14 +1785,6 @@ CSSStyleSheet::InsertRuleInternal(const nsAString& aRule,
|
|||
return aIndex;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSStyleSheet::DeleteRule(uint32_t aIndex)
|
||||
{
|
||||
ErrorResult rv;
|
||||
DeleteRule(aIndex, *nsContentUtils::SubjectPrincipal(), rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
void
|
||||
CSSStyleSheet::DeleteRuleInternal(uint32_t aIndex, ErrorResult& aRv)
|
||||
{
|
||||
|
|
|
@ -156,6 +156,8 @@ public:
|
|||
|
||||
void SetOwnerRule(css::ImportRule* aOwnerRule) { mOwnerRule = aOwnerRule; /* Not ref counted */ }
|
||||
css::ImportRule* GetOwnerRule() const { return mOwnerRule; }
|
||||
// Workaround overloaded-virtual warning in GCC.
|
||||
using StyleSheet::GetOwnerRule;
|
||||
|
||||
nsXMLNameSpaceMap* GetNameSpaceMap() const { return mInner->mNameSpaceMap; }
|
||||
|
||||
|
@ -194,13 +196,6 @@ public:
|
|||
|
||||
void SetInRuleProcessorCache() { mInRuleProcessorCache = true; }
|
||||
|
||||
// nsIDOMStyleSheet interface
|
||||
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) final;
|
||||
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) final;
|
||||
|
||||
// nsIDOMCSSStyleSheet interface
|
||||
NS_DECL_NSIDOMCSSSTYLESHEET
|
||||
|
||||
// Function used as a callback to rebuild our inner's child sheet
|
||||
// list after we clone a unique inner for ourselves.
|
||||
static bool RebuildChildList(css::Rule* aRule, void* aBuilder);
|
||||
|
@ -214,7 +209,6 @@ public:
|
|||
}
|
||||
|
||||
// WebIDL StyleSheet API
|
||||
using GetParentStyleSheet;
|
||||
nsMediaList* Media() final;
|
||||
|
||||
// WebIDL CSSStyleSheet API
|
||||
|
@ -222,9 +216,6 @@ public:
|
|||
// called GetOwnerRule because that would be ambiguous with the ImportRule
|
||||
// version.
|
||||
nsIDOMCSSRule* GetDOMOwnerRule() const final;
|
||||
using StyleSheet::GetCssRules;
|
||||
using StyleSheet::InsertRule;
|
||||
using StyleSheet::DeleteRule;
|
||||
|
||||
// WebIDL miscellaneous bits
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
|
|
@ -112,45 +112,16 @@ ServoStyleSheet::List(FILE* aOut, int32_t aIndex) const
|
|||
}
|
||||
#endif
|
||||
|
||||
// nsIDOMStyleSheet implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServoStyleSheet::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
|
||||
nsMediaList*
|
||||
ServoStyleSheet::Media()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServoStyleSheet::GetMedia(nsIDOMMediaList** aMedia)
|
||||
nsIDOMCSSRule*
|
||||
ServoStyleSheet::GetDOMOwnerRule() const
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIDOMCSSStyleSheet implementation
|
||||
|
||||
nsresult
|
||||
ServoStyleSheet::GetOwnerRule(nsIDOMCSSRule** aOwnerRule)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSheet::InsertRule(const nsAString& rule,
|
||||
uint32_t aIndex, uint32_t* aReturn)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSheet::DeleteRule(uint32_t aIndex)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CSSRuleList*
|
||||
|
|
|
@ -50,12 +50,14 @@ public:
|
|||
|
||||
RawServoStyleSheet* RawSheet() const { return mSheet; }
|
||||
|
||||
// nsIDOMStyleSheet interface
|
||||
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) final;
|
||||
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) final;
|
||||
// WebIDL StyleSheet API
|
||||
nsMediaList* Media() final;
|
||||
|
||||
// nsIDOMCSSStyleSheet interface
|
||||
NS_DECL_NSIDOMCSSSTYLESHEET
|
||||
// WebIDL CSSStyleSheet API
|
||||
// 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.
|
||||
nsIDOMCSSRule* GetDOMOwnerRule() const final;
|
||||
|
||||
void WillDirty() {}
|
||||
void DidDirty() {}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "mozilla/StyleSheet.h"
|
||||
|
||||
#include "mozilla/dom/CSSRuleList.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/ServoStyleSheet.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
|
@ -154,6 +155,58 @@ StyleSheet::GetTitle(nsAString& aTitle)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIDOMStyleSheet interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
StyleSheet::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParentStyleSheet);
|
||||
NS_IF_ADDREF(*aParentStyleSheet = GetParentStyleSheet());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
StyleSheet::GetMedia(nsIDOMMediaList** aMedia)
|
||||
{
|
||||
NS_ADDREF(*aMedia = Media());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
StyleSheet::GetOwnerRule(nsIDOMCSSRule** aOwnerRule)
|
||||
{
|
||||
NS_IF_ADDREF(*aOwnerRule = GetDOMOwnerRule());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
StyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
|
||||
{
|
||||
ErrorResult rv;
|
||||
nsCOMPtr<nsIDOMCSSRuleList> rules =
|
||||
GetCssRules(*nsContentUtils::SubjectPrincipal(), rv);
|
||||
rules.forget(aCssRules);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
StyleSheet::InsertRule(const nsAString& aRule, uint32_t aIndex,
|
||||
uint32_t* aReturn)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aReturn =
|
||||
InsertRule(aRule, aIndex, *nsContentUtils::SubjectPrincipal(), rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
StyleSheet::DeleteRule(uint32_t aIndex)
|
||||
{
|
||||
ErrorResult rv;
|
||||
DeleteRule(aIndex, *nsContentUtils::SubjectPrincipal(), rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
// WebIDL CSSStyleSheet API
|
||||
|
||||
#define FORWARD_INTERNAL(method_, args_) \
|
||||
|
|
|
@ -149,8 +149,17 @@ public:
|
|||
NS_IMETHOD GetDisabled(bool* aDisabled) final;
|
||||
NS_IMETHOD SetDisabled(bool aDisabled) final;
|
||||
NS_IMETHOD GetOwnerNode(nsIDOMNode** aOwnerNode) final;
|
||||
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) final;
|
||||
NS_IMETHOD GetHref(nsAString& aHref) final;
|
||||
NS_IMETHOD GetTitle(nsAString& aTitle) final;
|
||||
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) final;
|
||||
|
||||
// nsIDOMCSSStyleSheet
|
||||
NS_IMETHOD GetOwnerRule(nsIDOMCSSRule** aOwnerRule) final;
|
||||
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules) final;
|
||||
NS_IMETHOD InsertRule(const nsAString& aRule, uint32_t aIndex,
|
||||
uint32_t* aReturn) final;
|
||||
NS_IMETHOD DeleteRule(uint32_t aIndex) final;
|
||||
|
||||
// Changes to sheets should be inside of a WillDirty-DidDirty pair.
|
||||
// However, the calls do not need to be matched; it's ok to call
|
||||
|
|
Загрузка…
Ссылка в новой задаче