mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Allow using cached client_rect() for paint-only reflow (#31219)
PR #31210 avoided the cache for all kinds of reflow, but it's actually fine to use it for ReflowTriggerCondition::PaintPostponed.
This commit is contained in:
parent
a07ad85eaa
commit
a4cc0c563e
1 changed files with 7 additions and 2 deletions
|
@ -94,7 +94,9 @@ use crate::dom::create::create_element;
|
||||||
use crate::dom::customelementregistry::{
|
use crate::dom::customelementregistry::{
|
||||||
CallbackReaction, CustomElementDefinition, CustomElementReaction, CustomElementState,
|
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::documentfragment::DocumentFragment;
|
||||||
use crate::dom::domrect::DOMRect;
|
use crate::dom::domrect::DOMRect;
|
||||||
use crate::dom::domtokenlist::DOMTokenList;
|
use crate::dom::domtokenlist::DOMTokenList;
|
||||||
|
@ -3380,7 +3382,10 @@ impl Element {
|
||||||
.and_then(|data| data.client_rect.as_ref())
|
.and_then(|data| data.client_rect.as_ref())
|
||||||
.and_then(|rect| rect.get().ok())
|
.and_then(|rect| rect.get().ok())
|
||||||
{
|
{
|
||||||
if doc.needs_reflow().is_none() {
|
if matches!(
|
||||||
|
doc.needs_reflow(),
|
||||||
|
None | Some(ReflowTriggerCondition::PaintPostponed)
|
||||||
|
) {
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue