use app unit in box_fragement (#32349)

This commit is contained in:
atbrakhi 2024-06-21 16:54:21 +02:00 committed by GitHub
parent 66edef8065
commit 26c585a0c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 273 additions and 289 deletions

View file

@ -65,7 +65,7 @@ pub(crate) struct TextFragment {
pub base: BaseFragment,
#[serde(skip_serializing)]
pub parent_style: ServoArc<ComputedValues>,
pub rect: LogicalRect<Length>,
pub rect: LogicalRect<Au>,
pub font_metrics: FontMetrics,
#[serde(skip_serializing)]
pub font_key: FontInstanceKey,
@ -83,7 +83,7 @@ pub(crate) struct ImageFragment {
pub base: BaseFragment,
#[serde(skip_serializing)]
pub style: ServoArc<ComputedValues>,
pub rect: LogicalRect<Length>,
pub rect: LogicalRect<Au>,
#[serde(skip_serializing)]
pub image_key: ImageKey,
}
@ -93,7 +93,7 @@ pub(crate) struct IFrameFragment {
pub base: BaseFragment,
pub pipeline_id: PipelineId,
pub browsing_context_id: BrowsingContextId,
pub rect: LogicalRect<Length>,
pub rect: LogicalRect<Au>,
#[serde(skip_serializing)]
pub style: ServoArc<ComputedValues>,
}
@ -133,7 +133,7 @@ impl Fragment {
}
}
pub fn scrolling_area(&self, containing_block: &PhysicalRect<Length>) -> PhysicalRect<Length> {
pub fn scrolling_area(&self, containing_block: &PhysicalRect<Au>) -> PhysicalRect<Au> {
match self {
Fragment::Box(fragment) | Fragment::Float(fragment) => fragment
.scrollable_overflow(containing_block)
@ -142,10 +142,7 @@ impl Fragment {
}
}
pub fn scrollable_overflow(
&self,
containing_block: &PhysicalRect<Length>,
) -> PhysicalRect<Length> {
pub fn scrollable_overflow(&self, containing_block: &PhysicalRect<Au>) -> PhysicalRect<Au> {
match self {
Fragment::Box(fragment) | Fragment::Float(fragment) => {
fragment.scrollable_overflow_for_parent(containing_block)
@ -166,9 +163,9 @@ impl Fragment {
pub(crate) fn find<T>(
&self,
manager: &ContainingBlockManager<PhysicalRect<Length>>,
manager: &ContainingBlockManager<PhysicalRect<Au>>,
level: usize,
process_func: &mut impl FnMut(&Fragment, usize, &PhysicalRect<Length>) -> Option<T>,
process_func: &mut impl FnMut(&Fragment, usize, &PhysicalRect<Au>) -> Option<T>,
) -> Option<T> {
let containing_block = manager.get_containing_block_for_fragment(self);
if let Some(result) = process_func(self, level, containing_block) {