mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Experiment with implementing zoom as a transform + transform-origin shorthand.
This is a gross hack, of course, but has the advantage of not breaking sites that use both zoom and -moz-transform / -moz-transform-origin. There should be no behavior change when the pref is off, of course, and the webcompat team wanted to experiment with this. Differential Revision: https://phabricator.services.mozilla.com/D49792
This commit is contained in:
parent
ca05003ef6
commit
854c480177
7 changed files with 136 additions and 24 deletions
|
@ -33,6 +33,27 @@ pub type TransformOrigin = generic::TransformOrigin<
|
|||
Length,
|
||||
>;
|
||||
|
||||
impl TransformOrigin {
|
||||
/// Returns the initial specified value for `transform-origin`.
|
||||
#[inline]
|
||||
pub fn initial_value() -> Self {
|
||||
Self::new(
|
||||
OriginComponent::Length(LengthPercentage::Percentage(ComputedPercentage(0.5))),
|
||||
OriginComponent::Length(LengthPercentage::Percentage(ComputedPercentage(0.5))),
|
||||
Length::zero(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns the `0 0` value.
|
||||
pub fn zero_zero() -> Self {
|
||||
Self::new(
|
||||
OriginComponent::Length(LengthPercentage::zero()),
|
||||
OriginComponent::Length(LengthPercentage::zero()),
|
||||
Length::zero(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Transform {
|
||||
/// Internal parse function for deciding if we wish to accept prefixed values or not
|
||||
///
|
||||
|
@ -260,7 +281,7 @@ impl Parse for TransformOrigin {
|
|||
let parse_depth = |input: &mut Parser| {
|
||||
input
|
||||
.try(|i| Length::parse(context, i))
|
||||
.unwrap_or(Length::from_px(0.))
|
||||
.unwrap_or(Length::zero())
|
||||
};
|
||||
match input.try(|i| OriginComponent::parse(context, i)) {
|
||||
Ok(x_origin @ OriginComponent::Center) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue