mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
script: Have Document
own Layout
(#32316)
Have `Document` own `Layout`. This makes it impossible to have a `Document` without `Layout`, which was true, but now the compiler checks it. In addition, `Layout` is now released when the `Document` is, avoiding leaking the entire `Layout`.
This commit is contained in:
parent
2af6fe0b30
commit
53c0726ef4
7 changed files with 88 additions and 133 deletions
|
@ -670,7 +670,8 @@ impl HTMLImageElement {
|
|||
) -> Au {
|
||||
let document = document_from_node(self);
|
||||
let quirks_mode = document.quirks_mode();
|
||||
document.with_device(move |device| source_size_list.evaluate(device, quirks_mode))
|
||||
let result = source_size_list.evaluate(document.window().layout().device(), quirks_mode);
|
||||
result
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#matches-the-environment>
|
||||
|
@ -696,7 +697,8 @@ impl HTMLImageElement {
|
|||
let mut parserInput = ParserInput::new(&media_query);
|
||||
let mut parser = Parser::new(&mut parserInput);
|
||||
let media_list = MediaList::parse(&context, &mut parser);
|
||||
document.with_device(move |device| media_list.evaluate(device, quirks_mode))
|
||||
let result = media_list.evaluate(document.window().layout().device(), quirks_mode);
|
||||
result
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#normalise-the-source-densities>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue