Skip to content

Commit

Permalink
Allow using cached client_rect() for paint-only reflow (servo#31219)
Browse files Browse the repository at this point in the history
PR servo#31210 avoided the cache for all kinds of reflow, but it's actually
fine to use it for ReflowTriggerCondition::PaintPostponed.
  • Loading branch information
Loirooriol authored and Taym95 committed Feb 11, 2024
1 parent 9429bae commit 2e64212
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/script/dom/element.rs
Expand Up @@ -94,7 +94,9 @@ use crate::dom::create::create_element;
use crate::dom::customelementregistry::{
CallbackReaction, CustomElementDefinition, CustomElementReaction, CustomElementState,
};
use crate::dom::document::{determine_policy_for_token, Document, LayoutDocumentHelpers};
use crate::dom::document::{
determine_policy_for_token, Document, LayoutDocumentHelpers, ReflowTriggerCondition,
};
use crate::dom::documentfragment::DocumentFragment;
use crate::dom::domrect::DOMRect;
use crate::dom::domtokenlist::DOMTokenList;
Expand Down Expand Up @@ -3380,7 +3382,10 @@ impl Element {
.and_then(|data| data.client_rect.as_ref())
.and_then(|rect| rect.get().ok())
{
if doc.needs_reflow().is_none() {
if matches!(
doc.needs_reflow(),
None | Some(ReflowTriggerCondition::PaintPostponed)
) {
return rect;
}
}
Expand Down

0 comments on commit 2e64212

Please sign in to comment.