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

Implement Element::has_css_layout_box() and related methods by inspecting the computed style #19811

Closed
jonleighton opened this issue Jan 18, 2018 · 2 comments

Comments

@jonleighton
Copy link
Contributor

This is a follow-up to #19803 suggested by @emilio.

Yeah, this should be enough I think... I was expecting a query that returned an Option<Arc<ComputedValues>>, and we'd just need to check the display value (because nodes under display: none subtrees don't have any style).

That would be useful on its own to implement the other overflow_x / y and other style queries in a fast way, but this also works :)

I'll look into it once that PR is merged.

@jonleighton
Copy link
Contributor Author

@emilio I just had a preliminary look at what this involves, and noticed that there is already a margin_style query which returns a subset of the computed styles. Do you think it would make sense to replace that with a more generic one which returns all the computed styles? Is there a danger of copying around too much data here?

@emilio
Copy link
Member

emilio commented Jan 19, 2018

Yes, I think it makes sense to remove margin_style.

And no, there's not much danger of copying too much data. Styles are stored as an Arc<ComputedValues>, so returning the style is literally just a refcount bump (an arc clone)

jonleighton added a commit to jonleighton/servo that referenced this issue Jan 27, 2018
This enables us to implement Element::has_css_layout_box() in a more
direct way, and also enables us to remove some of the existing more
specific queries.

Fixes servo#19811.
jonleighton added a commit to jonleighton/servo that referenced this issue Jan 27, 2018
This enables us to implement Element::has_css_layout_box() in a more
direct way, and also enables us to remove some of the existing more
specific queries.

Fixes servo#19811.
jonleighton added a commit to jonleighton/servo that referenced this issue Jan 28, 2018
This enables us to implement Element::has_css_layout_box() in a more
direct way, and also enables us to remove some of the existing more
specific queries.

Fixes servo#19811.
bors-servo pushed a commit that referenced this issue Jan 28, 2018
Add layout RPC query for getting an element's style

This enables us to implement Element::has_css_layout_box() in a more
direct way, and also enables us to remove some of the existing more
specific queries.

Fixes #19811.

r? @emilio

<!-- 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/19881)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants