mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Cleanup and fix interpolation of SVG lengths.
Instead of storing them as LengthPercentage | Number, always store as LengthPercentage, and use the unitless length quirk to parse numbers instead. Further cleanups to use the rust representation can happen as a followup, which will also get rid of the boolean argument (since we can poke at the rust length itself). That's why I didn't bother to convert it to an enum class yet. Differential Revision: https://phabricator.services.mozilla.com/D21804
This commit is contained in:
parent
9e0d38a64f
commit
f1b5d5c06a
7 changed files with 94 additions and 280 deletions
|
@ -782,16 +782,22 @@ impl ClipRectOrAuto {
|
|||
/// Whether quirks are allowed in this context.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub enum AllowQuirks {
|
||||
/// Quirks are allowed.
|
||||
Yes,
|
||||
/// Quirks are not allowed.
|
||||
No,
|
||||
/// Quirks are allowed, in quirks mode.
|
||||
Yes,
|
||||
/// Quirks are always allowed, used for SVG lengths.
|
||||
Always,
|
||||
}
|
||||
|
||||
impl AllowQuirks {
|
||||
/// Returns `true` if quirks are allowed in this context.
|
||||
pub fn allowed(self, quirks_mode: QuirksMode) -> bool {
|
||||
self == AllowQuirks::Yes && quirks_mode == QuirksMode::Quirks
|
||||
match self {
|
||||
AllowQuirks::Always => true,
|
||||
AllowQuirks::No => false,
|
||||
AllowQuirks::Yes => quirks_mode == QuirksMode::Quirks,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue