Bug 1328319 part 5 - Add bindings for list and pair list value of nsCSSValue. r?Manishearth draft
authorXidorn Quan <me@upsuper.org>
Mon, 15 May 2017 14:20:52 +1000
changeset 578529 8ee71dbb2c82cc175ef62cb12f6c370f92ed651e
parent 578528 a3cb87efdedb94628717e49e6620de91efd403be
child 578530 c43d93623279f67a22861781a57bd142fc8fcf44
push id58946
push userxquan@mozilla.com
push dateTue, 16 May 2017 04:45:08 +0000
reviewersManishearth
bugs1328319
milestone55.0a1
Bug 1328319 part 5 - Add bindings for list and pair list value of nsCSSValue. r?Manishearth MozReview-Commit-ID: KO0UCkrlxBi
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1902,16 +1902,38 @@ Gecko_CSSValue_GetArrayItemConst(nsCSSVa
 void
 Gecko_CSSValue_SetPair(nsCSSValueBorrowedMut aCSSValue,
                        nsCSSValueBorrowed aXValue, nsCSSValueBorrowed aYValue)
 {
   MOZ_ASSERT(NS_IsMainThread());
   aCSSValue->SetPairValue(*aXValue, *aYValue);
 }
 
+void
+Gecko_CSSValue_SetList(nsCSSValueBorrowedMut aCSSValue, uint32_t aLen)
+{
+  MOZ_ASSERT(NS_IsMainThread());
+  nsCSSValueList* item = aCSSValue->SetListValue();
+  for (uint32_t i = 1; i < aLen; ++i) {
+    item->mNext = new nsCSSValueList;
+    item = item->mNext;
+  }
+}
+
+void
+Gecko_CSSValue_SetPairList(nsCSSValueBorrowedMut aCSSValue, uint32_t aLen)
+{
+  MOZ_ASSERT(NS_IsMainThread());
+  nsCSSValuePairList* item = aCSSValue->SetPairListValue();
+  for (uint32_t i = 1; i < aLen; ++i) {
+    item->mNext = new nsCSSValuePairList;
+    item = item->mNext;
+  }
+}
+
 
 bool
 Gecko_PropertyId_IsPrefEnabled(nsCSSPropertyID id)
 {
   return nsCSSProps::IsEnabled(id);
 }
 
 void
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -481,16 +481,18 @@ void Gecko_CSSValue_SetStringFromAtom(ns
                                       nsIAtom* atom, nsCSSUnit unit);
 // Take an addrefed nsIAtom and set it to the nsCSSValue
 void Gecko_CSSValue_SetAtomIdent(nsCSSValueBorrowedMut css_value, nsIAtom* atom);
 void Gecko_CSSValue_SetArray(nsCSSValueBorrowedMut css_value, int32_t len);
 void Gecko_CSSValue_SetURL(nsCSSValueBorrowedMut css_value, ServoBundledURI uri);
 void Gecko_CSSValue_SetInt(nsCSSValueBorrowedMut css_value, int32_t integer, nsCSSUnit unit);
 void Gecko_CSSValue_SetPair(nsCSSValueBorrowedMut css_value,
                             nsCSSValueBorrowed xvalue, nsCSSValueBorrowed yvalue);
+void Gecko_CSSValue_SetList(nsCSSValueBorrowedMut css_value, uint32_t len);
+void Gecko_CSSValue_SetPairList(nsCSSValueBorrowedMut css_value, uint32_t len);
 void Gecko_CSSValue_Drop(nsCSSValueBorrowedMut css_value);
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList);
 bool Gecko_PropertyId_IsPrefEnabled(nsCSSPropertyID id);
 
 void Gecko_nsStyleFont_SetLang(nsStyleFont* font, nsIAtom* atom);
 void Gecko_nsStyleFont_CopyLangFrom(nsStyleFont* aFont, const nsStyleFont* aSource);
 void Gecko_nsStyleFont_FixupNoneGeneric(nsStyleFont* font,
                                         RawGeckoPresContextBorrowed pres_context);