style: Iterate in the expected order in the custom_properties module.

In #18745, I replaced a few manual iterations over `index` with the iterator,
and it changed the behavior of `layout/style/test/test_variables_order.html`,
since it turns out that the iterator iterates right to left.

I think this is just an accident that happened due to inconsistencies in how we
were iterating over it, and that our behavior was inconsistent (since we
iterated rtl in some cases, but ltr in others seems like it'd be inconsistent
depending on the depth of the tree and different stuff).

This brings back the expected behavior again, and ensures we iterate over a
consistent order every time.
This commit is contained in:
Emilio Cobos Álvarez 2017-10-05 13:56:07 +02:00
parent 9bf299bba9
commit 72497330a9
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -190,14 +190,14 @@ where
type Item = (&'a K, &'a V); type Item = (&'a K, &'a V);
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
let ref index = self.inner.index; let key = match self.inner.index.get(self.pos) {
if self.pos >= index.len() { Some(k) => k,
return None; None => return None,
} };
let ref key = index[index.len() - self.pos - 1];
self.pos += 1; self.pos += 1;
let value = &self.inner.values[key]; let value = &self.inner.values[key];
Some((key, value)) Some((key, value))
} }
} }