mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #20012 - alexfjw:avoid_Window-GetComputedStyle_when_checking_for_display-none, r=emilio
Avoid `Window::GetComputedStyle` when checking for `display: none` <!-- Please describe your changes on the following line: --> Refactored Window::GetComputedStyle to use Element::Style. Not sure which tests are relevant, but I've ran the dom, fetch & 2dcontext wpt tests. They don't seem to give errors. --- <!-- 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 #19885. <!-- Either: --> - [x] These changes do not require tests because it's a refactoring task <!-- 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/20012) <!-- Reviewable:end -->
This commit is contained in:
commit
ac162e8f72
5 changed files with 9 additions and 18 deletions
|
@ -350,7 +350,7 @@ impl Element {
|
|||
|
||||
/// style will be `None` for elements in a `display: none` subtree. otherwise, the element has a
|
||||
/// layout box iff it doesn't have `display: none`.
|
||||
fn style(&self) -> Option<Arc<ComputedValues>> {
|
||||
pub fn style(&self) -> Option<Arc<ComputedValues>> {
|
||||
window_from_node(self).style_query(
|
||||
self.upcast::<Node>().to_trusted_node_address()
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue