Bug 1309868 part 4 - Use mutable reference for Gecko_GetNextStyleChild. r?heycam draft
authorXidorn Quan <me@upsuper.org>
Fri, 14 Oct 2016 00:15:50 +1100
changeset 424780 29e9f26a3c22119e765fb53064311b43f7a91869
parent 424779 408ec47f7427e5850a4cabe2d2086019f3ae2075
child 424781 00c14f84f2721b81c07a18aa44063954018fc262
push id32246
push userxquan@mozilla.com
push dateThu, 13 Oct 2016 13:37:33 +0000
reviewersheycam
bugs1309868
milestone52.0a1
Bug 1309868 part 4 - Use mutable reference for Gecko_GetNextStyleChild. r?heycam MozReview-Commit-ID: FIrh34PSOZy
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
servo/components/style/gecko/wrapper.rs
servo/components/style/gecko_bindings/bindings.rs
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -141,17 +141,17 @@ Gecko_MaybeCreateStyleChildrenIterator(R
 void
 Gecko_DropStyleChildrenIterator(StyleChildrenIteratorOwned aIterator)
 {
   MOZ_ASSERT(aIterator);
   delete aIterator;
 }
 
 RawGeckoNodeBorrowed
-Gecko_GetNextStyleChild(StyleChildrenIteratorBorrowed aIterator)
+Gecko_GetNextStyleChild(StyleChildrenIteratorBorrowedMut aIterator)
 {
   MOZ_ASSERT(aIterator);
   return aIterator->GetNextChild();
 }
 
 EventStates::ServoType
 Gecko_ElementState(RawGeckoElementBorrowed aElement)
 {
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -171,17 +171,17 @@ RawGeckoElementBorrowedOrNull Gecko_GetD
 // By default, Servo walks the DOM by traversing the siblings of the DOM-view
 // first child. This generally works, but misses anonymous children, which we
 // want to traverse during styling. To support these cases, we create an
 // optional heap-allocated iterator for nodes that need it. If the creation
 // method returns null, Servo falls back to the aforementioned simpler (and
 // faster) sibling traversal.
 StyleChildrenIteratorOwnedOrNull Gecko_MaybeCreateStyleChildrenIterator(RawGeckoNodeBorrowed node);
 void Gecko_DropStyleChildrenIterator(StyleChildrenIteratorOwned it);
-RawGeckoNodeBorrowedOrNull Gecko_GetNextStyleChild(StyleChildrenIteratorBorrowed it);
+RawGeckoNodeBorrowedOrNull Gecko_GetNextStyleChild(StyleChildrenIteratorBorrowedMut it);
 
 // Selector Matching.
 uint8_t Gecko_ElementState(RawGeckoElementBorrowed element);
 bool Gecko_IsHTMLElementInHTMLDocument(RawGeckoElementBorrowed element);
 bool Gecko_IsLink(RawGeckoElementBorrowed element);
 bool Gecko_IsTextNode(RawGeckoNodeBorrowed node);
 bool Gecko_IsVisitedLink(RawGeckoElementBorrowed element);
 bool Gecko_IsUnvisitedLink(RawGeckoElementBorrowed element);
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -409,18 +409,18 @@ impl<'a> Iterator for GeckoChildrenItera
     type Item = GeckoNode<'a>;
     fn next(&mut self) -> Option<GeckoNode<'a>> {
         match *self {
             GeckoChildrenIterator::Current(curr) => {
                 let next = curr.and_then(|node| node.next_sibling());
                 *self = GeckoChildrenIterator::Current(next);
                 curr
             },
-            GeckoChildrenIterator::GeckoIterator(ref it) => unsafe {
-                Gecko_GetNextStyleChild(&it).map(GeckoNode)
+            GeckoChildrenIterator::GeckoIterator(ref mut it) => unsafe {
+                Gecko_GetNextStyleChild(it).map(GeckoNode)
             }
         }
     }
 }
 
 #[derive(Clone, Copy)]
 pub struct GeckoDocument<'ld>(pub &'ld RawGeckoDocument);
 
--- a/servo/components/style/gecko_bindings/bindings.rs
+++ b/servo/components/style/gecko_bindings/bindings.rs
@@ -240,17 +240,17 @@ extern "C" {
 extern "C" {
     pub fn Gecko_MaybeCreateStyleChildrenIterator(node: RawGeckoNodeBorrowed)
      -> StyleChildrenIteratorOwnedOrNull;
 }
 extern "C" {
     pub fn Gecko_DropStyleChildrenIterator(it: StyleChildrenIteratorOwned);
 }
 extern "C" {
-    pub fn Gecko_GetNextStyleChild(it: StyleChildrenIteratorBorrowed)
+    pub fn Gecko_GetNextStyleChild(it: StyleChildrenIteratorBorrowedMut)
      -> RawGeckoNodeBorrowedOrNull;
 }
 extern "C" {
     pub fn Gecko_ElementState(element: RawGeckoElementBorrowed) -> u8;
 }
 extern "C" {
     pub fn Gecko_IsHTMLElementInHTMLDocument(element: RawGeckoElementBorrowed)
      -> bool;