mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1630676 - Cherry-pick some layout-2020 changes.
This commit is contained in:
parent
785ded933e
commit
51ad515388
@ -345,7 +345,6 @@ ${helpers.predefined_type(
|
||||
"Transform",
|
||||
"generics::transform::Transform::none()",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
extra_prefixes=transform_extra_prefixes,
|
||||
animation_value_type="ComputedValue",
|
||||
flags="CREATES_STACKING_CONTEXT FIXPOS_CB CAN_ANIMATE_ON_COMPOSITOR",
|
||||
@ -549,7 +548,7 @@ ${helpers.predefined_type(
|
||||
"perspective",
|
||||
"Perspective",
|
||||
"computed::Perspective::none()",
|
||||
engines="gecko servo-2013",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
gecko_ffi_name="mChildPerspective",
|
||||
spec="https://drafts.csswg.org/css-transforms/#perspective",
|
||||
extra_prefixes=transform_extra_prefixes,
|
||||
@ -562,7 +561,7 @@ ${helpers.predefined_type(
|
||||
"perspective-origin",
|
||||
"Position",
|
||||
"computed::position::Position::center()",
|
||||
engines="gecko servo-2013",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
boxed=True,
|
||||
extra_prefixes=transform_extra_prefixes,
|
||||
spec="https://drafts.csswg.org/css-transforms-2/#perspective-origin-property",
|
||||
@ -573,7 +572,7 @@ ${helpers.predefined_type(
|
||||
${helpers.single_keyword(
|
||||
"backface-visibility",
|
||||
"visible hidden",
|
||||
engines="gecko servo-2013",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
gecko_enum_prefix="StyleBackfaceVisibility",
|
||||
spec="https://drafts.csswg.org/css-transforms/#backface-visibility-property",
|
||||
extra_prefixes=transform_extra_prefixes,
|
||||
@ -596,7 +595,6 @@ ${helpers.predefined_type(
|
||||
"TransformStyle",
|
||||
"computed::TransformStyle::Flat",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
spec="https://drafts.csswg.org/css-transforms-2/#transform-style-property",
|
||||
needs_context=False,
|
||||
extra_prefixes=transform_extra_prefixes,
|
||||
@ -609,7 +607,7 @@ ${helpers.predefined_type(
|
||||
"transform-origin",
|
||||
"TransformOrigin",
|
||||
"computed::TransformOrigin::initial_value()",
|
||||
engines="gecko servo-2013",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
animation_value_type="ComputedValue",
|
||||
extra_prefixes=transform_extra_prefixes,
|
||||
gecko_ffi_name="mTransformOrigin",
|
||||
|
@ -11,7 +11,6 @@ ${helpers.predefined_type(
|
||||
"Content",
|
||||
"computed::Content::normal()",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
initial_specified_value="specified::Content::normal()",
|
||||
animation_value_type="discrete",
|
||||
spec="https://drafts.csswg.org/css-content/#propdef-content",
|
||||
|
@ -12,7 +12,6 @@ ${helpers.predefined_type(
|
||||
"Opacity",
|
||||
"1.0",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
animation_value_type="ComputedValue",
|
||||
flags="CREATES_STACKING_CONTEXT CAN_ANIMATE_ON_COMPOSITOR",
|
||||
spec="https://drafts.csswg.org/css-color/#transparency",
|
||||
@ -51,7 +50,6 @@ ${helpers.predefined_type(
|
||||
"Filter",
|
||||
None,
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
vector=True,
|
||||
simple_vector_bindings=True,
|
||||
gecko_ffi_name="mFilters",
|
||||
@ -85,7 +83,6 @@ ${helpers.single_keyword(
|
||||
color-burn hard-light soft-light difference exclusion hue
|
||||
saturation color luminosity""",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
gecko_enum_prefix="StyleBlend",
|
||||
animation_value_type="discrete",
|
||||
flags="CREATES_STACKING_CONTEXT",
|
||||
|
@ -60,7 +60,6 @@ ${helpers.predefined_type(
|
||||
"ZIndex",
|
||||
"computed::ZIndex::auto()",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
spec="https://www.w3.org/TR/CSS2/visuren.html#z-index",
|
||||
flags="CREATES_STACKING_CONTEXT",
|
||||
animation_value_type="ComputedValue",
|
||||
@ -314,7 +313,6 @@ ${helpers.single_keyword(
|
||||
"box-sizing",
|
||||
"content-box border-box",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
extra_prefixes="moz:layout.css.prefixes.box-sizing webkit",
|
||||
spec="https://drafts.csswg.org/css-ui/#propdef-box-sizing",
|
||||
gecko_enum_prefix="StyleBoxSizing",
|
||||
|
@ -32,7 +32,6 @@ ${helpers.predefined_type(
|
||||
"TextDecorationLine",
|
||||
"specified::TextDecorationLine::none()",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
initial_specified_value="specified::TextDecorationLine::none()",
|
||||
animation_value_type="discrete",
|
||||
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-line",
|
||||
@ -42,7 +41,7 @@ ${helpers.predefined_type(
|
||||
${helpers.single_keyword(
|
||||
"text-decoration-style",
|
||||
"solid double dotted dashed wavy -moz-none",
|
||||
engines="gecko",
|
||||
engines="gecko servo-2020",
|
||||
animation_value_type="discrete",
|
||||
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-style",
|
||||
)}
|
||||
@ -51,7 +50,7 @@ ${helpers.predefined_type(
|
||||
"text-decoration-color",
|
||||
"Color",
|
||||
"computed_value::T::currentcolor()",
|
||||
engines="gecko",
|
||||
engines="gecko servo-2020",
|
||||
initial_specified_value="specified::Color::currentcolor()",
|
||||
animation_value_type="AnimatedColor",
|
||||
ignored_when_colors_disabled=True,
|
||||
|
@ -5,7 +5,7 @@
|
||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||
|
||||
<%helpers:shorthand name="text-decoration"
|
||||
engines="gecko servo-2013"
|
||||
engines="gecko servo-2013 servo-2020"
|
||||
flags="SHORTHAND_IN_GETCS"
|
||||
sub_properties="text-decoration-line
|
||||
${' text-decoration-style text-decoration-color text-decoration-thickness' if engine == 'gecko' else ''}"
|
||||
|
@ -109,8 +109,19 @@ impl LengthPercentageOrAuto {
|
||||
}
|
||||
}
|
||||
|
||||
computed_length_percentage_or_auto!(LengthPercentage);
|
||||
/// Convert to have a borrow inside the enum
|
||||
pub fn as_ref(&self) -> generics::GenericLengthPercentageOrAuto<&LengthPercentage> {
|
||||
use values::generics::length::LengthPercentageOrAuto::*;
|
||||
match *self {
|
||||
LengthPercentage(ref lp) => LengthPercentage(lp),
|
||||
Auto => Auto,
|
||||
}
|
||||
}
|
||||
|
||||
computed_length_percentage_or_auto!(LengthPercentage);
|
||||
}
|
||||
|
||||
impl generics::GenericLengthPercentageOrAuto<&LengthPercentage> {
|
||||
/// Resolves the percentage.
|
||||
#[inline]
|
||||
pub fn percentage_relative_to(&self, basis: Length) -> LengthOrAuto {
|
||||
|
@ -8,7 +8,7 @@
|
||||
use crate::computed_values::list_style_type::T as ListStyleType;
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::values::generics::CounterStyle;
|
||||
#[cfg(feature = "gecko")]
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
|
||||
use crate::values::specified::Attr;
|
||||
use crate::values::CustomIdent;
|
||||
use std::ops::Deref;
|
||||
@ -212,7 +212,7 @@ pub enum GenericContentItem<ImageUrl> {
|
||||
#[cfg(feature = "gecko")]
|
||||
MozAltContent,
|
||||
/// `attr([namespace? `|`]? ident)`
|
||||
#[cfg(feature = "gecko")]
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
|
||||
Attr(Attr),
|
||||
/// `url(url)`
|
||||
Url(ImageUrl),
|
||||
|
@ -11,7 +11,6 @@ use crate::values::specified::length::Length as SpecifiedLength;
|
||||
use crate::values::specified::length::LengthPercentage as SpecifiedLengthPercentage;
|
||||
use crate::values::{computed, CSSFloat};
|
||||
use crate::Zero;
|
||||
use app_units::Au;
|
||||
use euclid;
|
||||
use euclid::default::{Rect, Transform3D};
|
||||
use std::fmt::{self, Write};
|
||||
@ -329,7 +328,7 @@ where
|
||||
/// Convert a length type into the absolute lengths.
|
||||
pub trait ToAbsoluteLength {
|
||||
/// Returns the absolute length as pixel value.
|
||||
fn to_pixel_length(&self, containing_len: Option<Au>) -> Result<CSSFloat, ()>;
|
||||
fn to_pixel_length(&self, containing_len: Option<ComputedLength>) -> Result<CSSFloat, ()>;
|
||||
}
|
||||
|
||||
impl ToAbsoluteLength for SpecifiedLength {
|
||||
@ -337,7 +336,7 @@ impl ToAbsoluteLength for SpecifiedLength {
|
||||
// parsing a transform list of DOMMatrix because we want to return a DOM Exception
|
||||
// if there is relative length.
|
||||
#[inline]
|
||||
fn to_pixel_length(&self, _containing_len: Option<Au>) -> Result<CSSFloat, ()> {
|
||||
fn to_pixel_length(&self, _containing_len: Option<ComputedLength>) -> Result<CSSFloat, ()> {
|
||||
match *self {
|
||||
SpecifiedLength::NoCalc(len) => len.to_computed_pixel_length_without_context(),
|
||||
SpecifiedLength::Calc(ref calc) => calc.to_computed_pixel_length_without_context(),
|
||||
@ -350,7 +349,7 @@ impl ToAbsoluteLength for SpecifiedLengthPercentage {
|
||||
// parsing a transform list of DOMMatrix because we want to return a DOM Exception
|
||||
// if there is relative length.
|
||||
#[inline]
|
||||
fn to_pixel_length(&self, _containing_len: Option<Au>) -> Result<CSSFloat, ()> {
|
||||
fn to_pixel_length(&self, _containing_len: Option<ComputedLength>) -> Result<CSSFloat, ()> {
|
||||
use self::SpecifiedLengthPercentage::*;
|
||||
match *self {
|
||||
Length(len) => len.to_computed_pixel_length_without_context(),
|
||||
@ -362,16 +361,16 @@ impl ToAbsoluteLength for SpecifiedLengthPercentage {
|
||||
|
||||
impl ToAbsoluteLength for ComputedLength {
|
||||
#[inline]
|
||||
fn to_pixel_length(&self, _containing_len: Option<Au>) -> Result<CSSFloat, ()> {
|
||||
fn to_pixel_length(&self, _containing_len: Option<ComputedLength>) -> Result<CSSFloat, ()> {
|
||||
Ok(self.px())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAbsoluteLength for ComputedLengthPercentage {
|
||||
#[inline]
|
||||
fn to_pixel_length(&self, containing_len: Option<Au>) -> Result<CSSFloat, ()> {
|
||||
fn to_pixel_length(&self, containing_len: Option<ComputedLength>) -> Result<CSSFloat, ()> {
|
||||
match containing_len {
|
||||
Some(relative_len) => Ok(self.to_pixel_length(relative_len).px()),
|
||||
Some(relative_len) => Ok(self.resolve(relative_len).px()),
|
||||
// If we don't have reference box, we cannot resolve the used value,
|
||||
// so only retrieve the length part. This will be used for computing
|
||||
// distance without any layout info.
|
||||
@ -388,7 +387,10 @@ pub trait ToMatrix {
|
||||
fn is_3d(&self) -> bool;
|
||||
|
||||
/// Return the equivalent 3d matrix.
|
||||
fn to_3d_matrix(&self, reference_box: Option<&Rect<Au>>) -> Result<Transform3D<f64>, ()>;
|
||||
fn to_3d_matrix(
|
||||
&self,
|
||||
reference_box: Option<&Rect<ComputedLength>>,
|
||||
) -> Result<Transform3D<f64>, ()>;
|
||||
}
|
||||
|
||||
/// A little helper to deal with both specified and computed angles.
|
||||
@ -434,7 +436,10 @@ where
|
||||
/// However, for specified TransformOperation, we will return Err(()) if there is any relative
|
||||
/// lengths because the only caller, DOMMatrix, doesn't accept relative lengths.
|
||||
#[inline]
|
||||
fn to_3d_matrix(&self, reference_box: Option<&Rect<Au>>) -> Result<Transform3D<f64>, ()> {
|
||||
fn to_3d_matrix(
|
||||
&self,
|
||||
reference_box: Option<&Rect<ComputedLength>>,
|
||||
) -> Result<Transform3D<f64>, ()> {
|
||||
use self::TransformOperation::*;
|
||||
use std::f64;
|
||||
|
||||
@ -537,7 +542,7 @@ impl<T: ToMatrix> Transform<T> {
|
||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||
pub fn to_transform_3d_matrix(
|
||||
&self,
|
||||
reference_box: Option<&Rect<Au>>
|
||||
reference_box: Option<&Rect<ComputedLength>>
|
||||
) -> Result<(Transform3D<CSSFloat>, bool), ()> {
|
||||
let cast_3d_transform = |m: Transform3D<f64>| -> Transform3D<CSSFloat> {
|
||||
use std::{f32, f64};
|
||||
@ -557,7 +562,7 @@ impl<T: ToMatrix> Transform<T> {
|
||||
/// Same as Transform::to_transform_3d_matrix but a f64 version.
|
||||
pub fn to_transform_3d_matrix_f64(
|
||||
&self,
|
||||
reference_box: Option<&Rect<Au>>,
|
||||
reference_box: Option<&Rect<ComputedLength>>,
|
||||
) -> Result<(Transform3D<f64>, bool), ()> {
|
||||
// We intentionally use Transform3D<f64> during computation to avoid error propagation
|
||||
// because using f32 to compute triangle functions (e.g. in create_rotation()) is not
|
||||
|
@ -12,7 +12,7 @@ use crate::values::generics::counters::CounterPair;
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::values::generics::CounterStyle;
|
||||
use crate::values::specified::url::SpecifiedImageUrl;
|
||||
#[cfg(feature = "gecko")]
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
|
||||
use crate::values::specified::Attr;
|
||||
use crate::values::specified::Integer;
|
||||
use crate::values::CustomIdent;
|
||||
@ -134,7 +134,7 @@ impl Parse for Content {
|
||||
let mut content = vec![];
|
||||
let mut has_alt_content = false;
|
||||
loop {
|
||||
#[cfg(feature = "gecko")]
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
|
||||
{
|
||||
if let Ok(url) = input.try(|i| SpecifiedImageUrl::parse(context, i)) {
|
||||
content.push(generics::ContentItem::Url(url));
|
||||
@ -163,7 +163,7 @@ impl Parse for Content {
|
||||
let style = Content::parse_counter_style(context, input);
|
||||
Ok(generics::ContentItem::Counters(name, separator, style))
|
||||
}),
|
||||
#[cfg(feature = "gecko")]
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
|
||||
"attr" => input.parse_nested_block(|input| {
|
||||
Ok(generics::ContentItem::Attr(Attr::parse_function(context, input)?))
|
||||
}),
|
||||
|
@ -217,7 +217,7 @@ impl ToComputedValue for TextOverflow {
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(MallocSizeOf, Serialize, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[value_info(other_values = "none,underline,overline,line-through,blink")]
|
||||
#[repr(C)]
|
||||
/// Specified keyword values for the text-decoration-line property.
|
||||
@ -244,6 +244,12 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TextDecorationLine {
|
||||
fn default() -> Self {
|
||||
TextDecorationLine::NONE
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for TextDecorationLine {
|
||||
/// none | [ underline || overline || line-through || blink ]
|
||||
fn parse<'i, 't>(
|
||||
|
Loading…
Reference in New Issue
Block a user