mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
layout: Regardless of restyle damage, always reflow when viewport changes (#37099)
This fixes an issue where a viewport change did not trigger a reflow, when the restyle damage was was otherwise REPAINT. Viewport changes mean changes to the initial containing block, which is one of the main inputs to layout. This should trigger a reflow always. Testing: Unfortunately, our testing infrastructure is not good enough yet to test changes to layout when resizing the `WebView`, so it is quite difficult to write tests for this change. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
8788248fec
commit
9c0c1cf30f
2 changed files with 21 additions and 34 deletions
|
@ -5,6 +5,8 @@
|
|||
use app_units::Au;
|
||||
use atomic_refcell::AtomicRef;
|
||||
use compositing_traits::display_list::AxesScrollSensitivity;
|
||||
use euclid::Rect;
|
||||
use euclid::default::Size2D as UntypedSize2D;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use script::layout_dom::ServoLayoutNode;
|
||||
use script_layout_interface::wrapper_traits::{
|
||||
|
@ -27,7 +29,7 @@ use crate::flow::inline::InlineItem;
|
|||
use crate::flow::{BlockContainer, BlockFormattingContext, BlockLevelBox};
|
||||
use crate::formatting_contexts::IndependentFormattingContext;
|
||||
use crate::fragment_tree::FragmentTree;
|
||||
use crate::geom::{LogicalVec2, PhysicalPoint, PhysicalRect, PhysicalSize};
|
||||
use crate::geom::{LogicalVec2, PhysicalRect, PhysicalSize};
|
||||
use crate::positioned::{AbsolutelyPositionedBox, PositioningContext};
|
||||
use crate::replaced::ReplacedContents;
|
||||
use crate::style_ext::{Display, DisplayGeneratingBox, DisplayInside};
|
||||
|
@ -348,7 +350,7 @@ impl BoxTree {
|
|||
pub fn layout(
|
||||
&self,
|
||||
layout_context: &LayoutContext,
|
||||
viewport: euclid::Size2D<f32, CSSPixel>,
|
||||
viewport: UntypedSize2D<Au>,
|
||||
) -> FragmentTree {
|
||||
let style = layout_context
|
||||
.style_context
|
||||
|
@ -358,13 +360,8 @@ impl BoxTree {
|
|||
|
||||
// FIXME: use the document’s mode:
|
||||
// https://drafts.csswg.org/css-writing-modes/#principal-flow
|
||||
let physical_containing_block = PhysicalRect::new(
|
||||
PhysicalPoint::zero(),
|
||||
PhysicalSize::new(
|
||||
Au::from_f32_px(viewport.width),
|
||||
Au::from_f32_px(viewport.height),
|
||||
),
|
||||
);
|
||||
let physical_containing_block: Rect<Au, CSSPixel> =
|
||||
PhysicalSize::from_untyped(viewport).into();
|
||||
let initial_containing_block = DefiniteContainingBlock {
|
||||
size: LogicalVec2 {
|
||||
inline: physical_containing_block.size.width,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue