Auto merge of #13417 - mrobinson:simplify-stacking-context-collection, r=glennw

Simplify stacking context collection

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Simplify the way that stacking contexts are collected. Instead of
passing the StackingContextId down the tree, pass the parent
StackingContext itself. This will allow future patches to get more
information about the parent stacking context (such as location).

Also remove the return value of collect_stacking_contexts, which was
unused.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13417)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-09-29 09:01:33 -05:00 committed by GitHub
commit 81dfa6a96b
16 changed files with 88 additions and 184 deletions

View file

@ -224,10 +224,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
None
}
fn collect_stacking_contexts(&mut self,
_parent_id: StackingContextId,
_: &mut Vec<Box<StackingContext>>)
-> StackingContextId;
fn collect_stacking_contexts(&mut self, _parent: &mut StackingContext);
/// If this is a float, places it. The default implementation does nothing.
fn place_float_if_applicable<'a>(&mut self) {}
@ -1160,11 +1157,9 @@ impl BaseFlow {
return self as *const BaseFlow as usize;
}
pub fn collect_stacking_contexts_for_children(&mut self,
parent_id: StackingContextId,
contexts: &mut Vec<Box<StackingContext>>) {
pub fn collect_stacking_contexts_for_children(&mut self, parent: &mut StackingContext) {
for kid in self.children.iter_mut() {
kid.collect_stacking_contexts(parent_id, contexts);
kid.collect_stacking_contexts(parent);
}
}