mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
style: Implement overflow-wrap: anywhere.
Per https://github.com/w3c/csswg-drafts/issues/2682 Differential Revision: https://phabricator.services.mozilla.com/D11328
This commit is contained in:
parent
087ac72f73
commit
fa764fc8e9
8 changed files with 36 additions and 7 deletions
|
@ -49,6 +49,7 @@ include = [
|
|||
"FontDisplay",
|
||||
"FontFaceSourceListComponent",
|
||||
"FontLanguageOverride",
|
||||
"OverflowWrap",
|
||||
"TimingFunction",
|
||||
"PathCommand",
|
||||
"UnicodeRange",
|
||||
|
|
|
@ -324,6 +324,7 @@ class Longhand(object):
|
|||
"Opacity",
|
||||
"OutlineStyle",
|
||||
"OverflowClipBox",
|
||||
"OverflowWrap",
|
||||
"OverscrollBehavior",
|
||||
"Percentage",
|
||||
"Resize",
|
||||
|
|
|
@ -1419,6 +1419,7 @@ impl Clone for ${style_struct.gecko_struct_name} {
|
|||
"NonNegativeNumber": impl_simple,
|
||||
"Number": impl_simple,
|
||||
"Opacity": impl_simple,
|
||||
"OverflowWrap": impl_simple,
|
||||
"Perspective": impl_style_coord,
|
||||
"Position": impl_position,
|
||||
"RGBAColor": impl_rgba_color,
|
||||
|
|
|
@ -61,15 +61,16 @@ ${helpers.predefined_type(
|
|||
servo_restyle_damage = "reflow",
|
||||
)}
|
||||
|
||||
// Also known as "word-wrap" (which is more popular because of IE), but this is the preferred
|
||||
// name per CSS-TEXT 6.2.
|
||||
${helpers.single_keyword(
|
||||
// Also known as "word-wrap" (which is more popular because of IE), but this is
|
||||
// the preferred name per CSS-TEXT 6.2.
|
||||
${helpers.predefined_type(
|
||||
"overflow-wrap",
|
||||
"normal break-word",
|
||||
gecko_constant_prefix="NS_STYLE_OVERFLOWWRAP",
|
||||
"OverflowWrap",
|
||||
"computed::OverflowWrap::Normal",
|
||||
animation_value_type="discrete",
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap",
|
||||
alias="word-wrap",
|
||||
needs_context=False,
|
||||
servo_restyle_damage="rebuild_and_reflow",
|
||||
)}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
|
|||
pub use self::table::XSpan;
|
||||
pub use self::text::{InitialLetter, LetterSpacing, LineHeight, MozTabSize};
|
||||
pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle};
|
||||
pub use self::text::{TextOverflow, WordSpacing};
|
||||
pub use self::text::{TextOverflow, WordSpacing, OverflowWrap};
|
||||
pub use self::time::Time;
|
||||
pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
|
||||
pub use self::transform::{TransformOrigin, TransformStyle, Translate};
|
||||
|
|
|
@ -21,6 +21,7 @@ use style_traits::{CssWriter, ToCss};
|
|||
|
||||
pub use crate::values::specified::TextAlignKeyword as TextAlign;
|
||||
pub use crate::values::specified::TextEmphasisPosition;
|
||||
pub use crate::values::specified::OverflowWrap;
|
||||
|
||||
/// A computed value for the `initial-letter` property.
|
||||
pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>;
|
||||
|
|
|
@ -76,7 +76,7 @@ pub use self::svg_path::SVGPathData;
|
|||
pub use self::table::XSpan;
|
||||
pub use self::text::{InitialLetter, LetterSpacing, LineHeight, MozTabSize, TextAlign};
|
||||
pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing};
|
||||
pub use self::text::{TextEmphasisPosition, TextEmphasisStyle};
|
||||
pub use self::text::{TextEmphasisPosition, TextEmphasisStyle, OverflowWrap};
|
||||
pub use self::time::Time;
|
||||
pub use self::transform::{Rotate, Scale, Transform};
|
||||
pub use self::transform::{TransformOrigin, TransformStyle, Translate};
|
||||
|
|
|
@ -661,6 +661,8 @@ impl ToComputedValue for TextEmphasisStyle {
|
|||
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
|
||||
match *self {
|
||||
TextEmphasisStyle::Keyword(ref keyword) => {
|
||||
// FIXME(emilio): This should set the rule_cache_conditions
|
||||
// properly.
|
||||
let default_shape = if context.style().get_inherited_box().clone_writing_mode() ==
|
||||
SpecifiedWritingMode::HorizontalTb
|
||||
{
|
||||
|
@ -682,6 +684,7 @@ impl ToComputedValue for TextEmphasisStyle {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
||||
match *computed {
|
||||
|
@ -879,3 +882,24 @@ impl Parse for MozTabSize {
|
|||
)?))
|
||||
}
|
||||
}
|
||||
|
||||
/// Values for the `overflow-wrap` property.
|
||||
#[repr(u8)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum OverflowWrap {
|
||||
Normal,
|
||||
BreakWord,
|
||||
Anywhere,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue