mirror of
https://github.com/servo/servo.git
synced 2025-10-01 17:19:16 +01:00
Auto merge of #18058 - servo:compute-squared-distance, r=emilio
Introduce and derive ComputeSquaredDistance This new trait merges the former `Animatable` methods `compute_distance` and `compute_squared_distance`. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18058) <!-- Reviewable:end -->
This commit is contained in:
commit
60c44b072c
26 changed files with 545 additions and 741 deletions
|
@ -131,6 +131,7 @@ use style::traversal_flags::{TraversalFlags, self};
|
|||
use style::values::{CustomIdent, KeyframesName};
|
||||
use style::values::animated::ToAnimatedZero;
|
||||
use style::values::computed::Context;
|
||||
use style::values::distance::ComputeSquaredDistance;
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
||||
use super::error_reporter::ErrorReporter;
|
||||
use super::stylesheet_loader::StylesheetLoader;
|
||||
|
@ -380,7 +381,7 @@ pub extern "C" fn Servo_AnimationValues_ComputeDistance(from: RawServoAnimationV
|
|||
-> f64 {
|
||||
let from_value = AnimationValue::as_arc(&from);
|
||||
let to_value = AnimationValue::as_arc(&to);
|
||||
from_value.compute_distance(to_value).unwrap_or(0.0)
|
||||
from_value.compute_squared_distance(to_value).map(|d| d.sqrt()).unwrap_or(0.0)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue