Auto merge of #16529 - mrobinson:root-scroll, r=glennw

Create proper root ClipId when scrolling from script

WebRender currently makes a distinction between an external ClipId with
id equal to 0 and the root scroll ClipId. We need to detect this
situation and properly form the ClipId for the root.

<!-- 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 _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

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

<!-- 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/16529)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-19 17:01:58 -05:00 committed by GitHub
commit 2d2c82541a
4 changed files with 59 additions and 1 deletions

View file

@ -797,7 +797,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
pipeline_id: PipelineId,
scroll_root_id: ScrollRootId,
point: Point2D<f32>) {
let id = ClipId::new(scroll_root_id.0 as u64, pipeline_id.to_webrender());
let id = if scroll_root_id.0 == 0 {
ClipId::root_scroll_node(pipeline_id.to_webrender())
} else {
ClipId::new(scroll_root_id.0 as u64, pipeline_id.to_webrender())
};
self.webrender_api.scroll_node_with_id(LayoutPoint::from_untyped(&point), id);
}