Bug 1371115 - Part 12: implements nsStyleImage type properties animatable. r=hiro,r=birtles draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Wed, 05 Jul 2017 13:53:47 +0900
changeset 604016 e0bd4ee1969177f43ecb6f65096cfc204e211b42
parent 604015 118b6659a7be58f7b84e6024bfeea0a13dad66c0
child 604017 91af99918e7fbf055272841b588073ec120cff3d
push id66924
push userbmo:dakatsuka@mozilla.com
push dateWed, 05 Jul 2017 04:54:52 +0000
reviewershiro, birtles
bugs1371115
milestone56.0a1
Bug 1371115 - Part 12: implements nsStyleImage type properties animatable. r=hiro,r=birtles In this patch, implements following properties: * background-image * border-image-source * mask-image MozReview-Commit-ID: 30RdO0fMNr8
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/ServoBindings.toml
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1529,16 +1529,37 @@ Gecko_CreateGradient(uint8_t aShape,
 
   for (uint32_t i = 0; i < aStopCount; i++) {
     result->mStops.AppendElement(dummyStop);
   }
 
   return result;
 }
 
+const mozilla::css::URLValueData*
+Gecko_GetURLValue(const nsStyleImage* aImage)
+{
+  MOZ_ASSERT(aImage && aImage->GetType() == eStyleImageType_Image);
+  return aImage->GetURLValue();
+}
+
+nsIAtom*
+Gecko_GetImageElement(const nsStyleImage* aImage)
+{
+  MOZ_ASSERT(aImage && aImage->GetType() == eStyleImageType_Element);
+  return const_cast<nsIAtom*>(aImage->GetElementId());
+}
+
+const nsStyleGradient*
+Gecko_GetGradientImageValue(const nsStyleImage* aImage)
+{
+  MOZ_ASSERT(aImage && aImage->GetType() == eStyleImageType_Gradient);
+  return aImage->GetGradientData();
+}
+
 void
 Gecko_SetListStyleImageNone(nsStyleList* aList)
 {
   aList->mListStyleImage = nullptr;
 }
 
 void
 Gecko_SetListStyleImageImageValue(nsStyleList* aList,
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -318,16 +318,20 @@ void Gecko_InitializeImageCropRect(nsSty
 
 nsStyleGradient* Gecko_CreateGradient(uint8_t shape,
                                       uint8_t size,
                                       bool repeating,
                                       bool legacy_syntax,
                                       bool moz_legacy_syntax,
                                       uint32_t stops);
 
+const mozilla::css::URLValueData* Gecko_GetURLValue(const nsStyleImage* image);
+nsIAtom* Gecko_GetImageElement(const nsStyleImage* image);
+const nsStyleGradient* Gecko_GetGradientImageValue(const nsStyleImage* image);
+
 // list-style-image style.
 void Gecko_SetListStyleImageNone(nsStyleList* style_struct);
 void Gecko_SetListStyleImageImageValue(nsStyleList* style_struct,
                                   mozilla::css::ImageValue* aImageValue);
 void Gecko_CopyListStyleImageFrom(nsStyleList* dest, const nsStyleList* src);
 
 // cursor style.
 void Gecko_SetCursorArrayLength(nsStyleUserInterface* ui, size_t len);
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -326,16 +326,17 @@ raw-lines = [
     "type nsACString_internal = nsACString;",
     "type nsAString_internal = nsAString;",
 ]
 whitelist-functions = ["Servo_.*", "Gecko_.*"]
 structs-types = [
     "mozilla::css::GridTemplateAreasValue",
     "mozilla::css::ImageValue",
     "mozilla::css::URLValue",
+    "mozilla::css::URLValueData",
     "mozilla::MallocSizeOf",
     "mozilla::Side",
     "nsIContent",
     "nsIDocument",
     "nsIDocument_DocumentTheme",
     "RawGeckoAnimationPropertySegment",
     "RawGeckoComputedTiming",
     "RawGeckoCSSPropertyIDList",