Bug 1367523 Part 2: Gecko-side implement the CounterStyle and FontFaceRule clone functions.
MozReview-Commit-ID: HHGgItSdyZ5
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -2319,16 +2319,23 @@ Gecko_CSSKeywordString(nsCSSKeyword aKey
nsCSSFontFaceRule*
Gecko_CSSFontFaceRule_Create(uint32_t aLine, uint32_t aColumn)
{
RefPtr<nsCSSFontFaceRule> rule = new nsCSSFontFaceRule(aLine, aColumn);
return rule.forget().take();
}
+nsCSSFontFaceRule*
+Gecko_CSSFontFaceRule_Clone(const nsCSSFontFaceRule* aRule)
+{
+ RefPtr<css::Rule> rule = aRule->Clone();
+ return static_cast<nsCSSFontFaceRule*>(rule.forget().take());
+}
+
void
Gecko_CSSFontFaceRule_GetCssText(const nsCSSFontFaceRule* aRule,
nsAString* aResult)
{
// GetCSSText serializes nsCSSValues, which have a heap write
// hazard when dealing with color values (nsCSSKeywords::AddRefTable)
// We only serialize on the main thread; assert to convince the analysis
// and prevent accidentally calling this elsewhere
@@ -2365,16 +2372,23 @@ NS_IMPL_FFI_REFCOUNTING(nsCSSFontFaceRul
nsCSSCounterStyleRule*
Gecko_CSSCounterStyle_Create(nsIAtom* aName)
{
RefPtr<nsCSSCounterStyleRule> rule = new nsCSSCounterStyleRule(aName, 0, 0);
return rule.forget().take();
}
+nsCSSCounterStyleRule*
+Gecko_CSSCounterStyle_Clone(const nsCSSCounterStyleRule* aRule)
+{
+ RefPtr<css::Rule> rule = aRule->Clone();
+ return static_cast<nsCSSCounterStyleRule*>(rule.forget().take());
+}
+
void
Gecko_CSSCounterStyle_GetCssText(const nsCSSCounterStyleRule* aRule,
nsAString* aResult)
{
MOZ_ASSERT(NS_IsMainThread());
aRule->GetCssText(*aResult);
}
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -545,22 +545,24 @@ void AssertIsMainThreadOrServoLangFontPr
const nsMediaFeature* Gecko_GetMediaFeatures();
nsCSSKeyword Gecko_LookupCSSKeyword(const uint8_t* string, uint32_t len);
const char* Gecko_CSSKeywordString(nsCSSKeyword keyword, uint32_t* len);
// Font face rule
// Creates and returns a new (already-addrefed) nsCSSFontFaceRule object.
nsCSSFontFaceRule* Gecko_CSSFontFaceRule_Create(uint32_t line, uint32_t column);
+nsCSSFontFaceRule* Gecko_CSSFontFaceRule_Clone(const nsCSSFontFaceRule* rule);
void Gecko_CSSFontFaceRule_GetCssText(const nsCSSFontFaceRule* rule, nsAString* result);
NS_DECL_FFI_REFCOUNTING(nsCSSFontFaceRule, CSSFontFaceRule);
// Counter style rule
// Creates and returns a new (already-addrefed) nsCSSCounterStyleRule object.
nsCSSCounterStyleRule* Gecko_CSSCounterStyle_Create(nsIAtom* name);
+nsCSSCounterStyleRule* Gecko_CSSCounterStyle_Clone(const nsCSSCounterStyleRule* rule);
void Gecko_CSSCounterStyle_GetCssText(const nsCSSCounterStyleRule* rule, nsAString* result);
NS_DECL_FFI_REFCOUNTING(nsCSSCounterStyleRule, CSSCounterStyleRule);
RawGeckoElementBorrowedOrNull Gecko_GetBody(RawGeckoPresContextBorrowed pres_context);
// We use an int32_t here instead of a LookAndFeel::ColorID
// because forward-declaring a nested enum/struct is impossible
nscolor Gecko_GetLookAndFeelSystemColor(int32_t color_id,