Rename content_rect to rect in TextFragment and ImageFragment

Since they don’t have padding etc.
This commit is contained in:
Simon Sapin 2019-12-07 14:05:37 +01:00
parent ce9fc3e651
commit 6d91d77fba
4 changed files with 7 additions and 7 deletions

View file

@ -53,7 +53,7 @@ impl Fragment {
Fragment::Text(t) => { Fragment::Text(t) => {
is_contentful.0 = true; is_contentful.0 = true;
let rect = t let rect = t
.content_rect .rect
.to_physical(t.parent_style.writing_mode, containing_block) .to_physical(t.parent_style.writing_mode, containing_block)
.translate(&containing_block.top_left); .translate(&containing_block.top_left);
let mut baseline_origin = rect.top_left.clone(); let mut baseline_origin = rect.top_left.clone();
@ -79,7 +79,7 @@ impl Fragment {
use style::computed_values::image_rendering::T as ImageRendering; use style::computed_values::image_rendering::T as ImageRendering;
is_contentful.0 = true; is_contentful.0 = true;
let rect = i let rect = i
.content_rect .rect
.to_physical(i.style.writing_mode, containing_block) .to_physical(i.style.writing_mode, containing_block)
.translate(&containing_block.top_left); .translate(&containing_block.top_left);
let common = CommonItemProperties { let common = CommonItemProperties {

View file

@ -601,7 +601,7 @@ impl TextRun {
LineHeight::Number(n) => font_size * n.0, LineHeight::Number(n) => font_size * n.0,
LineHeight::Length(l) => l.0, LineHeight::Length(l) => l.0,
}; };
let content_rect = Rect { let rect = Rect {
start_corner: Vec2 { start_corner: Vec2 {
block: Length::zero(), block: Length::zero(),
inline: ifc.inline_position - ifc.current_nesting_level.inline_start, inline: ifc.inline_position - ifc.current_nesting_level.inline_start,
@ -619,7 +619,7 @@ impl TextRun {
.fragments_so_far .fragments_so_far
.push(Fragment::Text(TextFragment { .push(Fragment::Text(TextFragment {
parent_style: self.parent_style.clone(), parent_style: self.parent_style.clone(),
content_rect, rect,
ascent: font_ascent.into(), ascent: font_ascent.into(),
font_key, font_key,
glyphs, glyphs,

View file

@ -56,7 +56,7 @@ pub(crate) struct AnonymousFragment {
pub(crate) struct TextFragment { pub(crate) struct TextFragment {
pub parent_style: ServoArc<ComputedValues>, pub parent_style: ServoArc<ComputedValues>,
pub content_rect: Rect<Length>, pub rect: Rect<Length>,
pub ascent: Length, pub ascent: Length,
pub font_key: FontInstanceKey, pub font_key: FontInstanceKey,
pub glyphs: Vec<Arc<GlyphStore>>, pub glyphs: Vec<Arc<GlyphStore>>,
@ -64,7 +64,7 @@ pub(crate) struct TextFragment {
pub(crate) struct ImageFragment { pub(crate) struct ImageFragment {
pub style: ServoArc<ComputedValues>, pub style: ServoArc<ComputedValues>,
pub content_rect: Rect<Length>, pub rect: Rect<Length>,
pub image_key: ImageKey, pub image_key: ImageKey,
} }

View file

@ -45,7 +45,7 @@ impl ReplacedContent {
.map(|image_key| { .map(|image_key| {
Fragment::Image(ImageFragment { Fragment::Image(ImageFragment {
style: style.clone(), style: style.clone(),
content_rect: flow_relative::Rect { rect: flow_relative::Rect {
start_corner: flow_relative::Vec2::zero(), start_corner: flow_relative::Vec2::zero(),
size, size,
}, },