diff --git a/components/layout/replaced.rs b/components/layout/replaced.rs index af9c7162704..05c5bdf3c40 100644 --- a/components/layout/replaced.rs +++ b/components/layout/replaced.rs @@ -414,54 +414,17 @@ impl ReplacedContents { AspectRatio::from_content_ratio(2.0) } - /// The default object size in the inline axis. - /// - pub(crate) fn default_inline_size(writing_mode: WritingMode) -> Au { - if writing_mode.is_horizontal() { - Au::from_px(300) - } else { - Au::from_px(150) - } - } - - /// The default object size in the block axis. - /// - pub(crate) fn default_block_size(writing_mode: WritingMode) -> Au { - if writing_mode.is_horizontal() { - Au::from_px(150) - } else { - Au::from_px(300) - } - } - - /// The natural size in the inline axis. - /// - pub(crate) fn natural_inline_size(&self, writing_mode: WritingMode) -> Option { - if writing_mode.is_horizontal() { - self.natural_size.width - } else { - self.natural_size.height - } - } - - /// The natural size in the block axis. - /// - pub(crate) fn natural_block_size(&self, writing_mode: WritingMode) -> Option { - if writing_mode.is_horizontal() { - self.natural_size.height - } else { - self.natural_size.width - } - } - /// The inline size that would result from combining the natural size /// and the default object size, but disregarding the specified size. /// /// /// pub(crate) fn fallback_inline_size(&self, writing_mode: WritingMode) -> Au { - self.natural_inline_size(writing_mode) - .unwrap_or_else(|| Self::default_inline_size(writing_mode)) + if writing_mode.is_horizontal() { + self.natural_size.width.unwrap_or_else(|| Au::from_px(300)) + } else { + self.natural_size.height.unwrap_or_else(|| Au::from_px(150)) + } } /// The block size that would result from combining the natural size @@ -470,8 +433,11 @@ impl ReplacedContents { /// /// pub(crate) fn fallback_block_size(&self, writing_mode: WritingMode) -> Au { - self.natural_block_size(writing_mode) - .unwrap_or_else(|| Self::default_block_size(writing_mode)) + if writing_mode.is_horizontal() { + self.natural_size.height.unwrap_or_else(|| Au::from_px(150)) + } else { + self.natural_size.width.unwrap_or_else(|| Au::from_px(300)) + } } #[inline]