style: Make word-break: break-word behave like word-break: normal; overflow-wrap: anywhere.

Differential Revision: https://phabricator.services.mozilla.com/D21398
This commit is contained in:
Emilio Cobos Álvarez 2019-03-01 02:33:07 +00:00
parent 7d01114cbf
commit 9e0d38a64f
8 changed files with 36 additions and 7 deletions

View file

@ -95,6 +95,7 @@ include = [
"Perspective",
"ZIndex",
"TransformOrigin",
"WordBreak",
]
item_types = ["enums", "structs", "typedefs"]

View file

@ -347,6 +347,7 @@ class Longhand(object):
"TouchAction",
"TransformStyle",
"UserSelect",
"WordBreak",
"XSpan",
"XTextZoom",
"ZIndex",

View file

@ -1328,6 +1328,7 @@ impl Clone for ${style_struct.gecko_struct_name} {
"TransformOrigin": impl_simple,
"UserSelect": impl_simple,
"url::UrlOrNone": impl_css_url,
"WordBreak": impl_simple,
"ZIndex": impl_simple,
}

View file

@ -74,13 +74,13 @@ ${helpers.predefined_type(
servo_restyle_damage="rebuild_and_reflow",
)}
// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support.
${helpers.single_keyword(
${helpers.predefined_type(
"word-break",
"normal break-all keep-all",
gecko_constant_prefix="NS_STYLE_WORDBREAK",
"WordBreak",
"computed::WordBreak::Normal",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-word-break",
needs_context=False,
servo_restyle_damage="rebuild_and_reflow",
)}

View file

@ -78,7 +78,7 @@ pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
pub use self::table::XSpan;
pub use self::text::{InitialLetter, LetterSpacing, LineHeight};
pub use self::text::{OverflowWrap, TextOverflow, WordSpacing};
pub use self::text::{OverflowWrap, TextOverflow, WordSpacing, WordBreak};
pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle};
pub use self::time::Time;
pub use self::transform::{Rotate, Scale, Transform, TransformOperation};

View file

@ -17,7 +17,7 @@ use crate::values::{CSSFloat, CSSInteger};
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
pub use crate::values::specified::OverflowWrap;
pub use crate::values::specified::{OverflowWrap, WordBreak};
pub use crate::values::specified::TextAlignKeyword as TextAlign;
pub use crate::values::specified::TextEmphasisPosition;

View file

@ -80,7 +80,7 @@ pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
pub use self::svg_path::SVGPathData;
pub use self::table::XSpan;
pub use self::text::{InitialLetter, LetterSpacing, LineHeight, TextAlign};
pub use self::text::{OverflowWrap, TextEmphasisPosition, TextEmphasisStyle};
pub use self::text::{OverflowWrap, TextEmphasisPosition, TextEmphasisStyle, WordBreak};
pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing};
pub use self::time::Time;
pub use self::transform::{Rotate, Scale, Transform};

View file

@ -813,6 +813,32 @@ impl From<TextEmphasisPosition> for u8 {
}
}
/// Values for the `word-break` property.
#[repr(u8)]
#[derive(
Clone,
Copy,
Debug,
Eq,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
)]
#[allow(missing_docs)]
pub enum WordBreak {
Normal,
BreakAll,
KeepAll,
/// The break-word value, needed for compat.
///
/// Specifying `word-break: break-word` makes `overflow-wrap` behave as
/// `anywhere`, and `word-break` behave like `normal`.
BreakWord,
}
/// Values for the `overflow-wrap` property.
#[repr(u8)]
#[derive(