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
Add layout RPC query for getting an element's style #19881
Merged
+88
−136
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
Loading status checks…
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.
- Loading branch information
commit fe583fc5d0aa667b40ecddfb1cbff3c5f65649d7
| @@ -82,6 +82,7 @@ use std::mem; | ||
| use std::ops::Range; | ||
| use style::context::QuirksMode; | ||
| use style::dom::OpaqueNode; | ||
| use style::properties::ComputedValues; | ||
| use style::selector_parser::{SelectorImpl, SelectorParser}; | ||
| use style::stylesheets::Stylesheet; | ||
| use style::thread_state; | ||
| @@ -619,6 +620,10 @@ impl Node { | ||
| window_from_node(self).client_rect_query(self.to_trusted_node_address()) | ||
| } | ||
|
|
||
| pub fn style(&self) -> Option<Arc<ComputedValues>> { | ||
emilio
Member
|
||
| window_from_node(self).style_query(self.to_trusted_node_address()) | ||
| } | ||
|
|
||
| // https://drafts.csswg.org/cssom-view/#dom-element-scrollwidth | ||
| // https://drafts.csswg.org/cssom-view/#dom-element-scrollheight | ||
| // https://drafts.csswg.org/cssom-view/#dom-element-scrolltop | ||
Oops, something went wrong.
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
I just noticed this... This unwrap may not be safe, I don't think anything guarantees that the element is not in a display: none subtree... Though it was a pre-existing bug, and I don't know where this code runs.