mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Extend whitespace::T with additional helper methods
This commit is contained in:
parent
a5babb89a0
commit
7de7cb4786
5 changed files with 47 additions and 48 deletions
|
@ -2331,7 +2331,42 @@ pub mod longhands {
|
|||
}
|
||||
</%self:longhand>
|
||||
|
||||
${single_keyword("white-space", "normal pre nowrap pre-wrap pre-line")}
|
||||
<%self:single_keyword_computed name="white-space" values="normal pre nowrap pre-wrap pre-line">
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
|
||||
impl SpecifiedValue {
|
||||
pub fn allow_wrap(&self) -> bool {
|
||||
match *self {
|
||||
SpecifiedValue::nowrap |
|
||||
SpecifiedValue::pre => false,
|
||||
SpecifiedValue::normal |
|
||||
SpecifiedValue::pre_wrap |
|
||||
SpecifiedValue::pre_line => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn preserve_newlines(&self) -> bool {
|
||||
match *self {
|
||||
SpecifiedValue::normal |
|
||||
SpecifiedValue::nowrap => false,
|
||||
SpecifiedValue::pre |
|
||||
SpecifiedValue::pre_wrap |
|
||||
SpecifiedValue::pre_line => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn preserve_spaces(&self) -> bool {
|
||||
match *self {
|
||||
SpecifiedValue::normal |
|
||||
SpecifiedValue::nowrap |
|
||||
SpecifiedValue::pre_line => false,
|
||||
SpecifiedValue::pre |
|
||||
SpecifiedValue::pre_wrap => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
</%self:single_keyword_computed>
|
||||
|
||||
// TODO(pcwalton): `full-width`
|
||||
${single_keyword("text-transform", "none capitalize uppercase lowercase")}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue