mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Implement -webkit-line-clamp.
Differential Revision: https://phabricator.services.mozilla.com/D20115
This commit is contained in:
parent
81e706469d
commit
ca756a8550
5 changed files with 42 additions and 2 deletions
|
@ -337,6 +337,7 @@ class Longhand(object):
|
||||||
"OverflowWrap",
|
"OverflowWrap",
|
||||||
"OverscrollBehavior",
|
"OverscrollBehavior",
|
||||||
"Percentage",
|
"Percentage",
|
||||||
|
"PositiveIntegerOrNone",
|
||||||
"Resize",
|
"Resize",
|
||||||
"SVGOpacity",
|
"SVGOpacity",
|
||||||
"SVGPaintOrder",
|
"SVGPaintOrder",
|
||||||
|
|
|
@ -2515,7 +2515,7 @@ fn static_assert() {
|
||||||
rotate scroll-snap-points-x scroll-snap-points-y
|
rotate scroll-snap-points-x scroll-snap-points-y
|
||||||
scroll-snap-coordinate -moz-binding will-change
|
scroll-snap-coordinate -moz-binding will-change
|
||||||
offset-path shape-outside
|
offset-path shape-outside
|
||||||
translate scale""" %>
|
translate scale -webkit-line-clamp""" %>
|
||||||
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
|
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn generate_combined_transform(&mut self) {
|
pub fn generate_combined_transform(&mut self) {
|
||||||
|
@ -2924,6 +2924,27 @@ fn static_assert() {
|
||||||
self.copy_offset_path_from(other);
|
self.copy_offset_path_from(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub fn set__webkit_line_clamp(&mut self, v: longhands::_webkit_line_clamp::computed_value::T) {
|
||||||
|
self.gecko.mLineClamp = match v {
|
||||||
|
Either::First(n) => n.0 as u32,
|
||||||
|
Either::Second(None_) => 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
${impl_simple_copy('_webkit_line_clamp', 'mLineClamp')}
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub fn clone__webkit_line_clamp(&self) -> longhands::_webkit_line_clamp::computed_value::T {
|
||||||
|
match self.gecko.mLineClamp {
|
||||||
|
0 => Either::Second(None_),
|
||||||
|
n => {
|
||||||
|
debug_assert!(n <= std::i32::MAX as u32);
|
||||||
|
Either::First((n as i32).into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</%self:impl_trait>
|
</%self:impl_trait>
|
||||||
|
|
||||||
<%def name="simple_image_array_property(name, shorthand, field_name)">
|
<%def name="simple_image_array_property(name, shorthand, field_name)">
|
||||||
|
|
|
@ -670,3 +670,15 @@ ${helpers.predefined_type(
|
||||||
animation_value_type="discrete",
|
animation_value_type="discrete",
|
||||||
spec="https://compat.spec.whatwg.org/#touch-action",
|
spec="https://compat.spec.whatwg.org/#touch-action",
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
// Note that we only implement -webkit-line-clamp as a single, longhand
|
||||||
|
// property for now, but the spec defines line-clamp as a shorthand for separate
|
||||||
|
// max-lines, block-ellipsis, and continue properties.
|
||||||
|
${helpers.predefined_type(
|
||||||
|
"-webkit-line-clamp",
|
||||||
|
"PositiveIntegerOrNone",
|
||||||
|
"Either::Second(None_)",
|
||||||
|
gecko_pref="layout.css.webkit-line-clamp.enabled",
|
||||||
|
animation_value_type="Integer",
|
||||||
|
spec="https://drafts.csswg.org/css-overflow-3/#line-clamp",
|
||||||
|
)}
|
||||||
|
|
|
@ -640,6 +640,9 @@ impl From<CSSInteger> for PositiveInteger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A computed positive `<integer>` value or `none`.
|
||||||
|
pub type PositiveIntegerOrNone = Either<PositiveInteger, None_>;
|
||||||
|
|
||||||
/// rect(...)
|
/// rect(...)
|
||||||
pub type ClipRect = generics::ClipRect<LengthOrAuto>;
|
pub type ClipRect = generics::ClipRect<LengthOrAuto>;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as Generic
|
||||||
use super::generics::grid::{TrackList as GenericTrackList, TrackSize as GenericTrackSize};
|
use super::generics::grid::{TrackList as GenericTrackList, TrackSize as GenericTrackSize};
|
||||||
use super::generics::transform::IsParallelTo;
|
use super::generics::transform::IsParallelTo;
|
||||||
use super::generics::{self, GreaterThanOrEqualToOne, NonNegative};
|
use super::generics::{self, GreaterThanOrEqualToOne, NonNegative};
|
||||||
use super::{Auto, CSSFloat, CSSInteger, Either};
|
use super::{Auto, CSSFloat, CSSInteger, Either, None_};
|
||||||
use crate::context::QuirksMode;
|
use crate::context::QuirksMode;
|
||||||
use crate::parser::{Parse, ParserContext};
|
use crate::parser::{Parse, ParserContext};
|
||||||
use crate::values::serialize_atom_identifier;
|
use crate::values::serialize_atom_identifier;
|
||||||
|
@ -593,6 +593,9 @@ impl Parse for PositiveInteger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A specified positive `<integer>` value or `none`.
|
||||||
|
pub type PositiveIntegerOrNone = Either<PositiveInteger, None_>;
|
||||||
|
|
||||||
/// The specified value of a grid `<track-breadth>`
|
/// The specified value of a grid `<track-breadth>`
|
||||||
pub type TrackBreadth = GenericTrackBreadth<LengthPercentage>;
|
pub type TrackBreadth = GenericTrackBreadth<LengthPercentage>;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue