Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement `text-align` (except `justify`) #25203

Merged
merged 6 commits into from Dec 10, 2019

Rename content_rect to rect in TextFragment and ImageFragment

Since they don’t have padding etc.
  • Loading branch information
SimonSapin committed Dec 7, 2019
commit 6d91d77fba1e2151f32379bfd7552444b00bdde7
@@ -53,7 +53,7 @@ impl Fragment {
Fragment::Text(t) => {
is_contentful.0 = true;
let rect = t
.content_rect
.rect
.to_physical(t.parent_style.writing_mode, containing_block)
.translate(&containing_block.top_left);
let mut baseline_origin = rect.top_left.clone();
@@ -79,7 +79,7 @@ impl Fragment {
use style::computed_values::image_rendering::T as ImageRendering;
is_contentful.0 = true;
let rect = i
.content_rect
.rect
.to_physical(i.style.writing_mode, containing_block)
.translate(&containing_block.top_left);
let common = CommonItemProperties {
@@ -601,7 +601,7 @@ impl TextRun {
LineHeight::Number(n) => font_size * n.0,
LineHeight::Length(l) => l.0,
};
let content_rect = Rect {
let rect = Rect {
start_corner: Vec2 {
block: Length::zero(),
inline: ifc.inline_position - ifc.current_nesting_level.inline_start,
@@ -619,7 +619,7 @@ impl TextRun {
.fragments_so_far
.push(Fragment::Text(TextFragment {
parent_style: self.parent_style.clone(),
content_rect,
rect,
ascent: font_ascent.into(),
font_key,
glyphs,
@@ -56,15 +56,15 @@ pub(crate) struct AnonymousFragment {

pub(crate) struct TextFragment {
pub parent_style: ServoArc<ComputedValues>,
pub content_rect: Rect<Length>,
pub rect: Rect<Length>,
pub ascent: Length,
pub font_key: FontInstanceKey,
pub glyphs: Vec<Arc<GlyphStore>>,
}

pub(crate) struct ImageFragment {
pub style: ServoArc<ComputedValues>,
pub content_rect: Rect<Length>,
pub rect: Rect<Length>,
pub image_key: ImageKey,
}

@@ -45,7 +45,7 @@ impl ReplacedContent {
.map(|image_key| {
Fragment::Image(ImageFragment {
style: style.clone(),
content_rect: flow_relative::Rect {
rect: flow_relative::Rect {
start_corner: flow_relative::Vec2::zero(),
size,
},
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.