mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
7d01114cbf
commit
9e0d38a64f
8 changed files with 36 additions and 7 deletions
|
@ -95,6 +95,7 @@ include = [
|
|||
"Perspective",
|
||||
"ZIndex",
|
||||
"TransformOrigin",
|
||||
"WordBreak",
|
||||
]
|
||||
item_types = ["enums", "structs", "typedefs"]
|
||||
|
||||
|
|
|
@ -347,6 +347,7 @@ class Longhand(object):
|
|||
"TouchAction",
|
||||
"TransformStyle",
|
||||
"UserSelect",
|
||||
"WordBreak",
|
||||
"XSpan",
|
||||
"XTextZoom",
|
||||
"ZIndex",
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
)}
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue