Bug 1346256 Part 1b: (Gecko) Add FFI interfaces for exposing style sources. draft
authorBrad Werth <bwerth@mozilla.com>
Thu, 06 Apr 2017 10:19:00 -0700
changeset 559516 26a0885cb6133ccebabfcffa1321fb9d9eb9d228
parent 559365 45692c884fdd5136a64fb2f8a61a0c8183b69331
child 559517 1e1145bb4ee21a6d4564ace4930eb97bba86a291
push id53118
push userbwerth@mozilla.com
push dateMon, 10 Apr 2017 08:18:55 +0000
bugs1346256
milestone55.0a1
Bug 1346256 Part 1b: (Gecko) Add FFI interfaces for exposing style sources. MozReview-Commit-ID: FOQCgXD68E9
layout/style/ServoBindingList.h
layout/style/ServoBindingTypes.h
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -291,16 +291,22 @@ SERVO_BINDING_FUNC(Servo_Initialize, voi
 // Shut down Servo components. Should be called exactly once at shutdown.
 SERVO_BINDING_FUNC(Servo_Shutdown, void)
 
 // Gets the snapshot for the element. This will return null if the element
 // has never been styled, since snapshotting in that case is wasted work.
 SERVO_BINDING_FUNC(Servo_Element_GetSnapshot, ServoElementSnapshot*,
                    RawGeckoElementBorrowed element)
 
+// Gets the source style rules for the element. This returns the result via
+// rules, which would include a list of unowned pointers to RawServoStyleRule.
+SERVO_BINDING_FUNC(Servo_Element_GetStyleRuleList, void,
+                   RawGeckoElementBorrowed element,
+                   RawGeckoServoStyleRuleListBorrowedMut rules)
+
 // Restyle and change hints.
 SERVO_BINDING_FUNC(Servo_NoteExplicitHints, void, RawGeckoElementBorrowed element,
                    nsRestyleHint restyle_hint, nsChangeHint change_hint)
 SERVO_BINDING_FUNC(Servo_TakeChangeHint, nsChangeHint, RawGeckoElementBorrowed element)
 SERVO_BINDING_FUNC(Servo_ResolveStyle, ServoComputedValuesStrong,
                    RawGeckoElementBorrowed element,
                    RawServoStyleSetBorrowed set,
                    bool allow_stale)
--- a/layout/style/ServoBindingTypes.h
+++ b/layout/style/ServoBindingTypes.h
@@ -51,16 +51,17 @@ typedef nsPresContext RawGeckoPresContex
 typedef mozilla::URLExtraData RawGeckoURLExtraData;
 typedef nsTArray<mozilla::Keyframe> RawGeckoKeyframeList;
 typedef nsTArray<mozilla::ComputedKeyframeValues> RawGeckoComputedKeyframeValuesList;
 typedef nsTArray<mozilla::PropertyStyleAnimationValuePair> RawGeckoAnimationValueList;
 typedef nsStyleAutoArray<mozilla::StyleAnimation> RawGeckoStyleAnimationList;
 typedef nsTArray<nsFontFaceRuleContainer> RawGeckoFontFaceRuleList;
 typedef mozilla::AnimationPropertySegment RawGeckoAnimationPropertySegment;
 typedef mozilla::ComputedTiming RawGeckoComputedTiming;
+typedef nsTArray<const RawServoStyleRule*> RawGeckoServoStyleRuleList;
 
 // We have these helper types so that we can directly generate
 // things like &T or Borrowed<T> on the Rust side in the function, providing
 // additional safety benefits.
 //
 // FFI has a problem with templated types, so we just use raw pointers here.
 //
 // The "Borrowed" types generate &T or Borrowed<T> in the nullable case.
@@ -130,16 +131,17 @@ DECL_BORROWED_MUT_REF_TYPE_FOR(RawGeckoK
 DECL_BORROWED_REF_TYPE_FOR(RawGeckoKeyframeList)
 DECL_BORROWED_MUT_REF_TYPE_FOR(RawGeckoComputedKeyframeValuesList)
 DECL_BORROWED_REF_TYPE_FOR(RawGeckoStyleAnimationList)
 DECL_BORROWED_MUT_REF_TYPE_FOR(nsTimingFunction)
 DECL_BORROWED_REF_TYPE_FOR(nsTimingFunction)
 DECL_BORROWED_MUT_REF_TYPE_FOR(RawGeckoFontFaceRuleList)
 DECL_BORROWED_REF_TYPE_FOR(RawGeckoAnimationPropertySegment)
 DECL_BORROWED_REF_TYPE_FOR(RawGeckoComputedTiming)
+DECL_BORROWED_MUT_REF_TYPE_FOR(RawGeckoServoStyleRuleList)
 
 #undef DECL_ARC_REF_TYPE_FOR
 #undef DECL_OWNED_REF_TYPE_FOR
 #undef DECL_NULLABLE_OWNED_REF_TYPE_FOR
 #undef DECL_BORROWED_REF_TYPE_FOR
 #undef DECL_NULLABLE_BORROWED_REF_TYPE_FOR
 #undef DECL_BORROWED_MUT_REF_TYPE_FOR
 #undef DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR