Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast (Unblurred) Shadows Mishandle Clips #1928

Closed
Gankra opened this issue Oct 24, 2017 · 4 comments
Closed

Fast (Unblurred) Shadows Mishandle Clips #1928

Gankra opened this issue Oct 24, 2017 · 4 comments

Comments

@Gankra
Copy link
Contributor

@Gankra Gankra commented Oct 24, 2017

Copying from my comment elsewhere:

Basically, gecko likes doing some cute tricks where it draws parts of the text multiple times with different clips to create the illusion of a single glyph/line across multiple runs with possible style changes.

Mostly this works fine, and can be naively lowered with no problem. However this causes a problem for fast shadows, because they inherit the clip from the original element. Therefore fast shadows with an offset will be clipped incorrectly and render broken.

So as a level-1 problem, when we clone the display item to push it in as a fast shadow, we also need to clone its clip and apply the shadow offset. However this creates a level-2 problem: translating the clip isn't always correct to do -- you don't want to translate a clip used for, say, overflow:hidden.

Under the current architecture there's a simple heuristic we can apply: clips that are pushed inside a shadow should be cloned and translated when pushing fast-shadows. These clips are necessarily just "part of drawing that part of the text", and not "real" clips.

Slow shadows appear to be unaffected.

@Gankra
Copy link
Contributor Author

@Gankra Gankra commented Oct 24, 2017

I'm happy to fix this, but I'm not really sure how mutating the clip-scroll-tree is supposed to work.

@glennw
Copy link
Member

@glennw glennw commented Oct 24, 2017

I think the right answer here might be that we want to adjust the local clip rect on the item only, and leave any clips in the clip-scroll tree as-is. But @gankro is working on some test case(s) that we can use to investigate further.

Gankra added a commit to Gankra/webrender that referenced this issue Oct 25, 2017
@Gankra
Copy link
Contributor Author

@Gankra Gankra commented Oct 25, 2017

Another option would be to abandon fast-shadows if internal clips are found, but that's probably too aggressive?

@Gankra Gankra changed the title Fast Shadows Mishandle Clips Fast (Unblurred) Shadows Mishandle Clips Nov 1, 2017
@staktrace
Copy link
Contributor

@staktrace staktrace commented Nov 3, 2017

bors-servo added a commit that referenced this issue Jan 17, 2018
… r=Gankro

Adjust the clip region for shadow elements.

This patch is intend to fix #1928.

In webrender, shadow elements inherit the same clip with the original elements which leads the shadow to apply the wrong clip region when doing fast-shadow.
To fix this, when adding a shadow line primitive, I adjust PrimitiveInfo's local_clip_rect to fit the correct clip region and apply the clip outside of the shadow to the shadow line primitive.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2278)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.