Bug 1341758 - add image-orientation related binding functions. draft
authorJeremy Chen <jeremychen@mozilla.com>
Sun, 09 Apr 2017 17:12:00 +0800
changeset 559260 d5aba026e13f524f89be73c6eaee316e0a95cb0c
parent 559154 2a3ecdb7d1ea814708021fee6735b3aedcf03e48
child 559261 f07c8189ba675b59f848aab900bfef35752291ca
push id53029
push userjichen@mozilla.com
push dateSun, 09 Apr 2017 09:15:47 +0000
bugs1341758
milestone55.0a1
Bug 1341758 - add image-orientation related binding functions. For image-orientation property, we use methods of nsStyleImageOrientation struct to create/set its computed value. Adding these binding functions could let us reuse these methods for transferring computed values from Servo side to Gecko. The actual changes for the calling these binding functions to do the glue things for Stylo is in a separate following patch, which should be pure Servo changes. MozReview-Commit-ID: 9MuICVgdxNw
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -904,16 +904,37 @@ Gecko_FontFamilyList_AppendGeneric(FontF
 
 void
 Gecko_CopyFontFamilyFrom(nsFont* dst, const nsFont* src)
 {
   dst->fontlist = src->fontlist;
 }
 
 void
+Gecko_SetImageOrientation(nsStyleVisibility* aVisibility,
+                          double aRadians, bool aFlip)
+{
+  aVisibility->mImageOrientation =
+    nsStyleImageOrientation::CreateAsAngleAndFlip(aRadians, aFlip);
+}
+
+void
+Gecko_SetImageOrientationAsFromImage(nsStyleVisibility* aVisibility)
+{
+  aVisibility->mImageOrientation = nsStyleImageOrientation::CreateAsFromImage();
+}
+
+void
+Gecko_CopyImageOrientationFrom(nsStyleVisibility* aDst,
+                               const nsStyleVisibility* aSrc)
+{
+  aDst->mImageOrientation = aSrc->mImageOrientation;
+}
+
+void
 Gecko_SetListStyleType(nsStyleList* style_struct, uint32_t type)
 {
   // Builtin counter styles are static and use no-op refcounting, and thus are
   // safe to use off-main-thread.
   style_struct->SetCounterStyle(CounterStyleManager::GetBuiltinStyle(type));
 }
 
 void
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -214,16 +214,24 @@ bool Gecko_AtomEqualsUTF8(nsIAtom* aAtom
 bool Gecko_AtomEqualsUTF8IgnoreCase(nsIAtom* aAtom, const char* aString, uint32_t aLength);
 
 // Font style
 void Gecko_FontFamilyList_Clear(FontFamilyList* aList);
 void Gecko_FontFamilyList_AppendNamed(FontFamilyList* aList, nsIAtom* aName, bool aQuoted);
 void Gecko_FontFamilyList_AppendGeneric(FontFamilyList* list, FontFamilyType familyType);
 void Gecko_CopyFontFamilyFrom(nsFont* dst, const nsFont* src);
 
+// Visibility style
+void Gecko_SetImageOrientation(nsStyleVisibility* aVisibility,
+                               double aRadians,
+                               bool aFlip);
+void Gecko_SetImageOrientationAsFromImage(nsStyleVisibility* aVisibility);
+void Gecko_CopyImageOrientationFrom(nsStyleVisibility* aDst,
+                                    const nsStyleVisibility* aSrc);
+
 // Counter style.
 void Gecko_SetListStyleType(nsStyleList* style_struct, uint32_t type);
 void Gecko_CopyListStyleTypeFrom(nsStyleList* dst, const nsStyleList* src);
 
 // background-image style.
 // TODO: support element() and -moz-image()
 void Gecko_SetNullImageValue(nsStyleImage* image);
 void Gecko_SetGradientImageValue(nsStyleImage* image, nsStyleGradient* gradient);