mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #10105 - mbrubeck:dirty-viewport-percentages, r=SimonSapin
Don't re-add stylesheets to recompute vw/vh lengths This is a follow-up to #9876. It avoids clearing and rebuilding SelectorMaps when vh and vw units need to be recomputed. Instead it just dirties all nodes, to force elements to be re-cascaded. Filed #10104 for later follow-up work to dirty only affected nodes. r? @SimonSapin <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10105) <!-- Reviewable:end -->
This commit is contained in:
commit
41060dbdd7
2 changed files with 8 additions and 5 deletions
|
@ -1056,6 +1056,8 @@ impl LayoutThread {
|
|||
};
|
||||
|
||||
// Handle conditions where the entire flow tree is invalid.
|
||||
let mut needs_dirtying = false;
|
||||
|
||||
let viewport_size_changed = self.viewport_size != old_viewport_size;
|
||||
if viewport_size_changed {
|
||||
if let Some(constraints) = constraints {
|
||||
|
@ -1064,11 +1066,15 @@ impl LayoutThread {
|
|||
constellation_chan.send(ConstellationMsg::ViewportConstrained(
|
||||
self.id, constraints)).unwrap();
|
||||
}
|
||||
// FIXME (#10104): Only dirty nodes affected by vh/vw/vmin/vmax styles.
|
||||
if data.document_stylesheets.iter().any(|sheet| sheet.dirty_on_viewport_size_change) {
|
||||
needs_dirtying = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If the entire flow tree is invalid, then it will be reflowed anyhow.
|
||||
let needs_dirtying = rw_data.stylist.update(&data.document_stylesheets,
|
||||
data.stylesheets_changed);
|
||||
needs_dirtying |= rw_data.stylist.update(&data.document_stylesheets,
|
||||
data.stylesheets_changed);
|
||||
let needs_reflow = viewport_size_changed && !needs_dirtying;
|
||||
unsafe {
|
||||
if needs_dirtying {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue