Oriol Brufau 2024-03-30 14:30:13 +01:00 committed by GitHub
parent a7ad92d9a3
commit fff9ef87e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 97 additions and 181 deletions

View file

@ -777,8 +777,6 @@ impl<'a> BuilderForBoxFragment<'a> {
Image::PaintWorklet(_) => {
// TODO: Add support for PaintWorklet rendering.
},
// Gecko-only value, represented as a (boxed) empty enum on non-Gecko.
Image::Rect(ref rect) => match **rect {},
Image::ImageSet(..) | Image::CrossFade(..) => {
unreachable!("Shouldn't be parsed on Servo for now")
},

View file

@ -84,7 +84,7 @@ use style::logical_geometry::WritingMode;
use style::properties::ComputedValues;
use style::values::computed::Length;
use style::values::generics::box_::VerticalAlignKeyword;
use style::values::generics::text::LineHeight;
use style::values::generics::font::LineHeight;
use style::values::specified::text::{TextAlignKeyword, TextDecorationLine};
use style::values::specified::{TextAlignLast, TextJustify};
use style::Zero;
@ -1829,7 +1829,7 @@ impl InlineContainerState {
// when `line-height` is normal.
let mut ascent = font_metrics.ascent;
let mut descent = font_metrics.descent;
if style.get_inherited_text().line_height == LineHeight::Normal {
if style.get_font().line_height == LineHeight::Normal {
let half_leading_from_line_gap =
(font_metrics.line_gap - descent - ascent).scale_by(0.5);
ascent += half_leading_from_line_gap;
@ -1856,7 +1856,7 @@ impl InlineContainerState {
// zero in this case, the line may get some height when taking them into
// considering with other zero line height boxes that converge on other block axis
// locations when using the above formula.
if style.get_inherited_text().line_height != LineHeight::Normal {
if style.get_font().line_height != LineHeight::Normal {
let half_leading =
(Au::from_f32_px(line_height.px()) - (ascent + descent)).scale_by(0.5);
ascent += half_leading;
@ -2217,8 +2217,9 @@ fn place_pending_floats(ifc: &mut InlineFormattingContextState, line_items: &mut
}
fn line_height(parent_style: &ComputedValues, font_metrics: &FontMetrics) -> Length {
let font_size = parent_style.get_font().font_size.computed_size();
match parent_style.get_inherited_text().line_height {
let font = parent_style.get_font();
let font_size = font.font_size.computed_size();
match font.line_height {
LineHeight::Normal => Length::from(font_metrics.line_gap),
LineHeight::Number(number) => font_size * number.0,
LineHeight::Length(length) => length.0,

View file

@ -12,7 +12,7 @@ use servo_arc::Arc;
use style::properties::ComputedValues;
use style::values::computed::Length;
use style::values::generics::box_::{GenericVerticalAlign, VerticalAlignKeyword};
use style::values::generics::text::LineHeight;
use style::values::generics::font::LineHeight;
use style::values::specified::box_::DisplayOutside;
use style::values::specified::text::TextDecorationLine;
use style::Zero;
@ -581,8 +581,9 @@ impl FloatLineItem {
}
fn line_height(parent_style: &ComputedValues, font_metrics: &FontMetrics) -> Length {
let font_size = parent_style.get_font().font_size.computed_size();
match parent_style.get_inherited_text().line_height {
let font = parent_style.get_font();
let font_size = font.font_size.computed_size();
match font.line_height {
LineHeight::Normal => Length::from(font_metrics.line_gap),
LineHeight::Number(number) => font_size * number.0,
LineHeight::Length(length) => length.0,

View file

@ -39,7 +39,6 @@ where
]),
// XXX: Non-None image types unimplemented.
Image::ImageSet(..) |
Image::Rect(..) |
Image::Gradient(..) |
Image::CrossFade(..) |
Image::PaintWorklet(..) |

View file

@ -29,7 +29,7 @@ use style::shared_lock::SharedRwLock;
use style::stylesheets::{CssRuleType, Origin, UrlExtraData};
use style::stylist::RuleInclusion;
use style::traversal::resolve_style;
use style::values::generics::text::LineHeight;
use style::values::generics::font::LineHeight;
use style_traits::{ParsingMode, ToCss};
use webrender_api::ExternalScrollId;
@ -161,8 +161,9 @@ pub fn process_resolved_style_request<'dom>(
// For line height, the resolved value is the computed value if it
// is "normal" and the used value otherwise.
if longhand_id == LonghandId::LineHeight {
let font_size = style.get_font().font_size.computed_size();
return match style.get_inherited_text().line_height {
let font = style.get_font();
let font_size = font.font_size.computed_size();
return match font.line_height {
LineHeight::Normal => computed_style(),
LineHeight::Number(value) => (font_size * value.0).to_css_string(),
LineHeight::Length(value) => value.0.to_css_string(),