Auto merge of #14084 - mrobinson:scroll_root_2, r=glennw

Don't promote all scrollable regions to stacking contexts

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

Don't promote all scrollable regions to stacking contexts

Instead annotate all flows with their owning ScrollRoots. When
processing the display list items into a flattened display list, we add
PushScrollRoot and PopScrollRoot to signal when scrolling regions start
and end. It is possible for content from different scrolling regions to
intersect and when they do, the stack of scrolling regions is
duplicated.  When these duplicated scrolling regions stacks reach
WebRender, it will scroll them in tandem.

The PushScrollRoot and PopScrollRoot items are currently represented as
StackingContexts in WebRender, but eventually these will be replaced
with special WebRender display items.

---
<!-- 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
- [x] These changes fix #13529 and #13298. (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. -->

<!-- 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/14084)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-07 18:49:53 -06:00 committed by GitHub
commit ef5ca14283
22 changed files with 454 additions and 181 deletions

View file

@ -9,7 +9,7 @@ flat varying vec4 vClipMaskUvRect;
flat varying vec4 vClipMaskLocalRect;
#ifdef WR_VERTEX_SHADER
void write_clip(ClipInfo clip) {
void write_clip(ClipData clip) {
vClipRect = vec4(clip.rect.rect.xy, clip.rect.rect.xy + clip.rect.rect.zw);
vClipRadius = vec4(clip.top_left.outer_inner_radius.x,
clip.top_right.outer_inner_radius.x,
@ -17,8 +17,8 @@ void write_clip(ClipInfo clip) {
clip.bottom_left.outer_inner_radius.x);
//TODO: interpolate the final mask UV
vec2 texture_size = textureSize(sMask, 0);
vClipMaskUvRect = clip.mask_info.uv_rect / texture_size.xyxy;
vClipMaskLocalRect = clip.mask_info.local_rect; //TODO: transform
vClipMaskUvRect = clip.mask_data.uv_rect / texture_size.xyxy;
vClipMaskLocalRect = clip.mask_data.local_rect; //TODO: transform
}
#endif

View file

@ -347,13 +347,13 @@ ClipRect fetch_clip_rect(int index) {
return rect;
}
struct ImageMaskInfo {
struct ImageMaskData {
vec4 uv_rect;
vec4 local_rect;
};
ImageMaskInfo fetch_mask_info(int index) {
ImageMaskInfo info;
ImageMaskData fetch_mask_data(int index) {
ImageMaskData info;
ivec2 uv = get_fetch_uv_2(index);
@ -379,24 +379,24 @@ ClipCorner fetch_clip_corner(int index) {
return corner;
}
struct ClipInfo {
struct ClipData {
ClipRect rect;
ClipCorner top_left;
ClipCorner top_right;
ClipCorner bottom_left;
ClipCorner bottom_right;
ImageMaskInfo mask_info;
ImageMaskData mask_data;
};
ClipInfo fetch_clip(int index) {
ClipInfo clip;
ClipData fetch_clip(int index) {
ClipData clip;
clip.rect = fetch_clip_rect(index + 0);
clip.top_left = fetch_clip_corner(index + 1);
clip.top_right = fetch_clip_corner(index + 2);
clip.bottom_left = fetch_clip_corner(index + 3);
clip.bottom_right = fetch_clip_corner(index + 4);
clip.mask_info = fetch_mask_info(index + 5);
clip.mask_data = fetch_mask_data(index + 5);
return clip;
}

View file

@ -66,6 +66,6 @@ void main(void) {
break;
}
ClipInfo clip = fetch_clip(prim.clip_index);
ClipData clip = fetch_clip(prim.clip_index);
write_clip(clip);
}

View file

@ -23,7 +23,7 @@ void main(void) {
vLocalPos = vi.local_clamped_pos;
#endif
ClipInfo clip = fetch_clip(prim.clip_index);
ClipData clip = fetch_clip(prim.clip_index);
write_clip(clip);
// vUv will contain how many times this image has wrapped around the image size.

View file

@ -22,6 +22,6 @@ void main(void) {
vPos = vi.local_clamped_pos;
#endif
ClipInfo clip = fetch_clip(prim.clip_index);
ClipData clip = fetch_clip(prim.clip_index);
write_clip(clip);
}