Pick the cascade-effective value between an inline `style` declaration and a stylesheet rule. Precedence (high to low): inline `!important`, stylesheet `!important`, inline, stylesheet.
(
inline: Option<&'a str>,
stylesheet: Option<&'a str>,
)
| 137 | /// Pick the cascade-effective value between an inline `style` declaration and a stylesheet rule. |
| 138 | /// Precedence (high to low): inline `!important`, stylesheet `!important`, inline, stylesheet. |
| 139 | fn effective_dimension<'a>( |
| 140 | inline: Option<&'a str>, |
| 141 | stylesheet: Option<&'a str>, |
| 142 | ) -> Option<&'a str> { |
| 143 | let important = |v: &str| v.trim_end().ends_with("!important"); |
| 144 | if inline.is_some_and(important) { |
| 145 | inline |
| 146 | } else if stylesheet.is_some_and(important) { |
| 147 | stylesheet |
| 148 | } else { |
| 149 | inline.or(stylesheet) |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | #[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)] |
| 154 | pub(crate) fn serialize_to<W: Write>( |