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:
Emilio Cobos Álvarez 2018-11-08 22:39:34 +00:00
parent 087ac72f73
commit fa764fc8e9
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 36 additions and 7 deletions

View file

@ -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};

View file

@ -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>;

View file

@ -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};

View file

@ -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,
}