Bug 1921049 - Remove some bindgen includes. r=firefox-style-system-reviewers,boris

Differential Revision: https://phabricator.services.mozilla.com/D223615
This commit is contained in:
Emilio Cobos Álvarez
2024-09-25 17:43:28 +00:00
parent 332101e8c7
commit ef48a336e6
16 changed files with 89 additions and 107 deletions

32
gfx/2d/FontFeature.h Normal file
View File

@@ -0,0 +1,32 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_gfx_FontFeature
#define mozilla_gfx_FontFeature
#include <cstdint>
namespace mozilla::gfx {
// An OpenType feature tag and value pair
struct FontFeature {
// see http://www.microsoft.com/typography/otspec/featuretags.htm
uint32_t mTag;
// 0 = off, 1 = on, larger values may be used as parameters
// to features that select among multiple alternatives
uint32_t mValue;
};
inline bool operator<(const FontFeature& a, const FontFeature& b) {
return (a.mTag < b.mTag) || ((a.mTag == b.mTag) && (a.mValue < b.mValue));
}
inline bool operator==(const FontFeature& a, const FontFeature& b) {
return (a.mTag == b.mTag) && (a.mValue == b.mValue);
}
} // namespace mozilla::gfx
#endif

View File

@@ -29,6 +29,7 @@ EXPORTS.mozilla.gfx += [
"DrawTargetRecording.h", "DrawTargetRecording.h",
"DrawTargetSkia.h", "DrawTargetSkia.h",
"Filters.h", "Filters.h",
"FontFeature.h",
"FontVariation.h", "FontVariation.h",
"Helpers.h", "Helpers.h",
"HelpersCairo.h", "HelpersCairo.h",

View File

@@ -14,7 +14,6 @@
#include "mozilla/StyleColorInlines.h" // for StyleAbsoluteColor #include "mozilla/StyleColorInlines.h" // for StyleAbsoluteColor
#include "nsTArray.h" // for nsTArray #include "nsTArray.h" // for nsTArray
struct gfxFontFeature;
struct gfxFontStyle; struct gfxFontStyle;
// Font structure. // Font structure.

View File

@@ -16,6 +16,7 @@
#include "gfxFontVariations.h" #include "gfxFontVariations.h"
#include "gfxRect.h" #include "gfxRect.h"
#include "gfxTypes.h" #include "gfxTypes.h"
#include "gfxFontFeatures.h"
#include "harfbuzz/hb.h" #include "harfbuzz/hb.h"
#include "mozilla/AlreadyAddRefed.h" #include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
@@ -44,7 +45,6 @@ class gfxSVGGlyphs;
class gfxUserFontData; class gfxUserFontData;
class nsAtom; class nsAtom;
struct FontListSizes; struct FontListSizes;
struct gfxFontFeature;
struct gfxFontStyle; struct gfxFontStyle;
enum class eFontPresentation : uint8_t; enum class eFontPresentation : uint8_t;

View File

@@ -11,24 +11,9 @@
#include "nsTHashtable.h" #include "nsTHashtable.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsString.h" #include "nsString.h"
#include "mozilla/gfx/FontFeature.h"
// An OpenType feature tag and value pair using gfxFontFeature = mozilla::gfx::FontFeature;
struct gfxFontFeature {
uint32_t
mTag; // see http://www.microsoft.com/typography/otspec/featuretags.htm
uint32_t mValue; // 0 = off, 1 = on, larger values may be used as parameters
// to features that select among multiple alternatives
};
inline bool operator<(const gfxFontFeature& a, const gfxFontFeature& b) {
return (a.mTag < b.mTag) || ((a.mTag == b.mTag) && (a.mValue < b.mValue));
}
inline bool operator==(const gfxFontFeature& a, const gfxFontFeature& b) {
return (a.mTag == b.mTag) && (a.mValue == b.mValue);
}
class nsAtom;
class gfxFontFeatureValueSet final { class gfxFontFeatureValueSet final {
public: public:

View File

@@ -36,6 +36,7 @@ class StyleSheet;
enum class PseudoStyleType : uint8_t; enum class PseudoStyleType : uint8_t;
enum class PointerCapabilities : uint8_t; enum class PointerCapabilities : uint8_t;
enum class UpdateAnimationsTasks : uint8_t; enum class UpdateAnimationsTasks : uint8_t;
enum class StyleColorGamut : uint8_t;
struct Keyframe; struct Keyframe;
struct StyleStylesheetContents; struct StyleStylesheetContents;
@@ -44,7 +45,6 @@ class LoaderReusableStyleSheets;
} }
namespace dom { namespace dom {
enum class CompositeOperationOrAuto : uint8_t; enum class CompositeOperationOrAuto : uint8_t;
enum class ScreenColorGamut : uint8_t;
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla
@@ -583,7 +583,7 @@ bool Gecko_MediaFeatures_UseOverlayScrollbars(const mozilla::dom::Document*);
int32_t Gecko_MediaFeatures_GetColorDepth(const mozilla::dom::Document*); int32_t Gecko_MediaFeatures_GetColorDepth(const mozilla::dom::Document*);
int32_t Gecko_MediaFeatures_GetMonochromeBitsPerPixel( int32_t Gecko_MediaFeatures_GetMonochromeBitsPerPixel(
const mozilla::dom::Document*); const mozilla::dom::Document*);
mozilla::dom::ScreenColorGamut Gecko_MediaFeatures_ColorGamut( mozilla::StyleColorGamut Gecko_MediaFeatures_ColorGamut(
const mozilla::dom::Document*); const mozilla::dom::Document*);
void Gecko_MediaFeatures_GetDeviceSize(const mozilla::dom::Document*, void Gecko_MediaFeatures_GetDeviceSize(const mozilla::dom::Document*,

View File

@@ -2,20 +2,16 @@
headers = [ headers = [
"nsStyleStruct.h", "nsStyleStruct.h",
"mozilla/StyleAnimationValue.h", "mozilla/StyleAnimationValue.h",
"gfxFontConstants.h",
"gfxFontFeatures.h",
"COLRFonts.h",
"nsStyleConsts.h", "nsStyleConsts.h",
"mozilla/css/Loader.h", "nsCSSValue.h",
"mozilla/AnimatedPropertyID.h", "mozilla/AnimatedPropertyID.h",
"mozilla/css/SheetLoadData.h", "mozilla/css/SheetLoadData.h",
"mozilla/DeclarationBlock.h", "mozilla/DeclarationBlock.h",
"mozilla/dom/AnimationEffectBinding.h",
"mozilla/dom/HTMLSlotElement.h", "mozilla/dom/HTMLSlotElement.h",
"mozilla/dom/KeyframeEffectBinding.h", "mozilla/dom/KeyframeEffectBinding.h",
"mozilla/dom/MediaList.h", "mozilla/dom/MediaList.h",
"mozilla/dom/ScreenBinding.h",
"mozilla/dom/ShadowRoot.h", "mozilla/dom/ShadowRoot.h",
"mozilla/gfx/FontFeature.h",
"mozilla/ipc/ByteBuf.h", "mozilla/ipc/ByteBuf.h",
"mozilla/AnimationPropertySegment.h", "mozilla/AnimationPropertySegment.h",
"mozilla/ComputedTiming.h", "mozilla/ComputedTiming.h",
@@ -88,7 +84,6 @@ rusty-enums = [
"mozilla::Side", "mozilla::Side",
"mozilla::dom::PlaybackDirection", "mozilla::dom::PlaybackDirection",
"mozilla::dom::FillMode", "mozilla::dom::FillMode",
"mozilla::dom::ScreenColorGamut",
"mozilla::HalfCorner", "mozilla::HalfCorner",
"mozilla::StyleFloatEdge", "mozilla::StyleFloatEdge",
"mozilla::StyleShapeRadius", "mozilla::StyleShapeRadius",
@@ -160,7 +155,6 @@ rusty-enums = [
"mozilla::PseudoStyleType", "mozilla::PseudoStyleType",
"mozilla::LookAndFeel_ColorID", "mozilla::LookAndFeel_ColorID",
"mozilla::LookAndFeel_FontID", "mozilla::LookAndFeel_FontID",
"nsStyleTransformMatrix::MatrixTransformOperator",
"mozilla::StyleGeometryBox", "mozilla::StyleGeometryBox",
"mozilla::SystemColor", "mozilla::SystemColor",
"mozilla::StyleMaskMode", "mozilla::StyleMaskMode",
@@ -189,6 +183,7 @@ allowlist-vars = [
# TODO(emilio): A bunch of types here can go away once we generate bindings and # TODO(emilio): A bunch of types here can go away once we generate bindings and
# structs together. # structs together.
allowlist-types = [ allowlist-types = [
"nsCSSUnit",
"nsFontFaceRuleContainer", "nsFontFaceRuleContainer",
"mozilla::ComputedKeyframeValues", "mozilla::ComputedKeyframeValues",
"mozilla::Keyframe", "mozilla::Keyframe",
@@ -224,13 +219,10 @@ allowlist-types = [
"mozilla::UpdateAnimationsTasks", "mozilla::UpdateAnimationsTasks",
"mozilla::PointerCapabilities", "mozilla::PointerCapabilities",
"mozilla::LookAndFeel", "mozilla::LookAndFeel",
"mozilla::gfx::Float", "mozilla::gfx::FontFeature",
"mozilla::gfx::FontVariation", "mozilla::gfx::FontVariation",
"mozilla::gfx::FontPaletteValueSet", "mozilla::gfx::FontPaletteValueSet",
"mozilla::StyleImageLayerAttachment", "mozilla::StyleImageLayerAttachment",
"gfxFontFeature",
"gfxFontVariation",
"Element",
"GeckoFontMetrics", "GeckoFontMetrics",
"GeckoImplicitShadowRoot", "GeckoImplicitShadowRoot",
"gfxFontFeatureValueSet", "gfxFontFeatureValueSet",
@@ -248,7 +240,6 @@ allowlist-types = [
"nsCSSPropertyID", "nsCSSPropertyID",
"nsCSSPropertyIDSet", "nsCSSPropertyIDSet",
"nsCSSProps", "nsCSSProps",
"nsCSSValue",
"nsFont", "nsFont",
"nsAtom", "nsAtom",
"nsDynamicAtom", "nsDynamicAtom",
@@ -289,11 +280,20 @@ allowlist-types = [
"mozilla::InheritTarget", "mozilla::InheritTarget",
"mozilla::dom::MediaList", "mozilla::dom::MediaList",
"mozilla::StyleRuleInclusion", "mozilla::StyleRuleInclusion",
"nsStyleTransformMatrix::MatrixTransformOperator",
"NodeSelectorFlags", "NodeSelectorFlags",
] ]
opaque-types = [ opaque-types = [
"mozilla::StyleThinArc", # https://github.com/rust-lang/rust-bindgen/issues/1557 "mozilla::StyleThinArc", # https://github.com/rust-lang/rust-bindgen/issues/1557
"mozilla::gfx::.*Point",
"mozilla::gfx::.*Rect",
"mozilla::gfx::.*Size",
"mozilla::gfx::.*Margin",
"mozilla::gfx::.*Matrix",
"mozilla::gfx::.*Typed",
"mozilla::gfx::Matrix4x4TypedFlagged",
"mozilla::gfx::DrawTarget",
"mozilla::TouchManager",
"mozilla::CanvasUsage",
"std::pair__PCCP", "std::pair__PCCP",
"std::namespace::atomic___base", "std::atomic__My_base", "std::namespace::atomic___base", "std::atomic__My_base",
"std::atomic", "std::atomic",
@@ -301,9 +301,7 @@ opaque-types = [
"std::tuple.*", # Causes "Cannot find type _Pred in this scope" error on mac, like rust-skia#571 "std::tuple.*", # Causes "Cannot find type _Pred in this scope" error on mac, like rust-skia#571
"std::.*::tuple.*", "std::.*::tuple.*",
# We want everything but FontVariation and Float to be opaque but we don't "mozilla::dom::Touch",
# have negative regexes.
"mozilla::gfx::(.{0,4}|.{6,12}|.{14,}|([^F][^o][^n][^t][^V][^a][^r][^i][^a][^t][^i][^o][^n])|([^F][^l][^o][^a][^t]))",
"mozilla::dom::Sequence", "mozilla::dom::Sequence",
"mozilla::SmallPointerArray", "mozilla::SmallPointerArray",
"mozilla::dom::Optional", "mozilla::dom::Optional",
@@ -368,6 +366,7 @@ cbindgen-types = [
{ gecko = "StyleComputedFontWeightRange", servo = "crate::font_face::ComputedFontWeightRange" }, { gecko = "StyleComputedFontWeightRange", servo = "crate::font_face::ComputedFontWeightRange" },
{ gecko = "StyleComputedTimingFunction", servo = "crate::values::computed::easing::TimingFunction" }, { gecko = "StyleComputedTimingFunction", servo = "crate::values::computed::easing::TimingFunction" },
{ gecko = "StylePrefersContrast", servo = "crate::gecko::media_features::PrefersContrast" }, { gecko = "StylePrefersContrast", servo = "crate::gecko::media_features::PrefersContrast" },
{ gecko = "StyleColorGamut", servo = "crate::gecko::media_features::ColorGamut" },
{ gecko = "StyleCursorKind", servo = "crate::values::computed::ui::CursorKind" }, { gecko = "StyleCursorKind", servo = "crate::values::computed::ui::CursorKind" },
{ gecko = "StyleDisplay", servo = "crate::values::specified::Display" }, { gecko = "StyleDisplay", servo = "crate::values::specified::Display" },
{ gecko = "StyleDisplayMode", servo = "crate::gecko::media_features::DisplayMode" }, { gecko = "StyleDisplayMode", servo = "crate::gecko::media_features::DisplayMode" },

View File

@@ -46,14 +46,15 @@ class imgRequestProxy;
struct nsCSSValueSharedList; struct nsCSSValueSharedList;
class gfxFontFeatureValueSet; class gfxFontFeatureValueSet;
struct gfxFontFeature;
struct GeckoFontMetrics; struct GeckoFontMetrics;
namespace mozilla { namespace mozilla {
namespace gfx { namespace gfx {
struct FontVariation; struct FontVariation;
struct FontFeature;
} // namespace gfx } // namespace gfx
} // namespace mozilla } // namespace mozilla
typedef mozilla::gfx::FontVariation gfxFontVariation; using gfxFontVariation = mozilla::gfx::FontVariation;
using gfxFontFeature = mozilla::gfx::FontFeature;
enum nsCSSUnit : uint32_t; enum nsCSSUnit : uint32_t;
enum nsChangeHint : uint32_t; enum nsChangeHint : uint32_t;

View File

@@ -9,23 +9,16 @@
#ifndef mozilla_StyleAnimationValue_h_ #ifndef mozilla_StyleAnimationValue_h_
#define mozilla_StyleAnimationValue_h_ #define mozilla_StyleAnimationValue_h_
#include "mozilla/gfx/MatrixFwd.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
#include "mozilla/ServoBindingTypes.h" #include "mozilla/ServoBindingTypes.h"
#include "mozilla/ServoStyleConsts.h" // Servo_AnimationValue_Dump #include "mozilla/ServoStyleConsts.h" // Servo_AnimationValue_Dump
#include "mozilla/DbgMacro.h"
#include "mozilla/AnimatedPropertyID.h" #include "mozilla/AnimatedPropertyID.h"
#include "nsStringFwd.h" #include "nsStringFwd.h"
#include "nsCoord.h"
#include "nsColor.h" #include "nsColor.h"
#include "nsCSSPropertyID.h" #include "nsCSSPropertyID.h"
#include "nsCSSValue.h"
#include "nsStyleConsts.h"
#include "nsStyleTransformMatrix.h" #include "nsStyleTransformMatrix.h"
class nsIFrame; class nsIFrame;
class gfx3DMatrix;
namespace mozilla { namespace mozilla {

View File

@@ -9,34 +9,12 @@
#ifndef nsCSSValue_h___ #ifndef nsCSSValue_h___
#define nsCSSValue_h___ #define nsCSSValue_h___
#include "mozilla/Attributes.h"
#include "mozilla/CORSMode.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/ServoBindingTypes.h"
#include "mozilla/URLExtraData.h"
#include "mozilla/UniquePtr.h"
#include "nsCoord.h" #include "nsCoord.h"
#include "nsTArray.h"
#include <type_traits>
// XXX Avoid including this here by moving function bodies to the cpp file
#include "mozilla/FloatingPoint.h"
class imgRequestProxy;
class nsAtom;
class nsIContent;
class nsIPrincipal;
class nsIURI;
class nsPresContext;
template <class T>
class nsPtrHashKey;
struct RawServoCssUrlData; struct RawServoCssUrlData;
namespace mozilla { namespace mozilla {
struct URLExtraData;
class CSSStyleSheet; class CSSStyleSheet;
} // namespace mozilla } // namespace mozilla

View File

@@ -142,15 +142,20 @@ int32_t Gecko_MediaFeatures_GetMonochromeBitsPerPixel(
return color ? 0 : kDefaultMonochromeBpp; return color ? 0 : kDefaultMonochromeBpp;
} }
dom::ScreenColorGamut Gecko_MediaFeatures_ColorGamut( StyleColorGamut Gecko_MediaFeatures_ColorGamut(const Document* aDocument) {
const Document* aDocument) { auto* dx = GetDeviceContextFor(aDocument);
auto colorGamut = dom::ScreenColorGamut::Srgb; if (!dx || aDocument->ShouldResistFingerprinting(RFPTarget::CSSColorInfo)) {
if (!aDocument->ShouldResistFingerprinting(RFPTarget::CSSColorInfo)) { return StyleColorGamut::Srgb;
if (auto* dx = GetDeviceContextFor(aDocument)) {
colorGamut = dx->GetColorGamut();
} }
switch (dx->GetColorGamut()) {
case dom::ScreenColorGamut::Srgb:
return StyleColorGamut::Srgb;
case dom::ScreenColorGamut::Rec2020:
return StyleColorGamut::Rec2020;
case dom::ScreenColorGamut::P3:
return StyleColorGamut::P3;
} }
return colorGamut; return StyleColorGamut::Srgb;
} }
int32_t Gecko_MediaFeatures_GetColorDepth(const Document* aDocument) { int32_t Gecko_MediaFeatures_GetColorDepth(const Document* aDocument) {

View File

@@ -280,7 +280,7 @@ class Accumulate {
static Matrix4x4 operateByServo(const Matrix4x4& aMatrix1, static Matrix4x4 operateByServo(const Matrix4x4& aMatrix1,
const Matrix4x4& aMatrix2, double aCount) { const Matrix4x4& aMatrix2, double aCount) {
Matrix4x4 result; Matrix4x4 result;
Servo_MatrixTransform_Operate(MatrixTransformOperator::Accumulate, Servo_MatrixTransform_Operate(/* aInterpolate = */ false,
&aMatrix1.components, &aMatrix2.components, &aMatrix1.components, &aMatrix2.components,
aCount, &result.components); aCount, &result.components);
return result; return result;
@@ -318,7 +318,7 @@ class Interpolate {
static Matrix4x4 operateByServo(const Matrix4x4& aMatrix1, static Matrix4x4 operateByServo(const Matrix4x4& aMatrix1,
const Matrix4x4& aMatrix2, double aProgress) { const Matrix4x4& aMatrix2, double aProgress) {
Matrix4x4 result; Matrix4x4 result;
Servo_MatrixTransform_Operate(MatrixTransformOperator::Interpolate, Servo_MatrixTransform_Operate(/* aInterpolate = */ true,
&aMatrix1.components, &aMatrix2.components, &aMatrix1.components, &aMatrix2.components,
aProgress, &result.components); aProgress, &result.components);
return result; return result;

View File

@@ -18,7 +18,6 @@ class nsCSSValue;
class nsIContent; class nsIContent;
class nsIPrincipal; class nsIPrincipal;
class nsIURI; class nsIURI;
struct gfxFontFeature;
struct nsCSSKTableEntry; struct nsCSSKTableEntry;
struct nsCSSValueList; struct nsCSSValueList;
struct nsStylePosition; struct nsStylePosition;

View File

@@ -6,7 +6,6 @@
use crate::gecko_bindings::bindings; use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs; use crate::gecko_bindings::structs;
use crate::gecko_bindings::structs::ScreenColorGamut;
use crate::media_queries::{Device, MediaType}; use crate::media_queries::{Device, MediaType};
use crate::parser::ParserContext; use crate::parser::ParserContext;
use crate::queries::feature::{AllowsRanges, Evaluator, FeatureFlags, QueryFeatureDescription}; use crate::queries::feature::{AllowsRanges, Evaluator, FeatureFlags, QueryFeatureDescription};
@@ -150,7 +149,7 @@ fn eval_monochrome(context: &Context) -> i32 {
/// higher capabilities. /// higher capabilities.
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, PartialOrd, ToCss)] #[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, PartialOrd, ToCss)]
#[repr(u8)] #[repr(u8)]
enum ColorGamut { pub enum ColorGamut {
/// The sRGB gamut. /// The sRGB gamut.
Srgb, Srgb,
/// The gamut specified by the Display P3 Color Space. /// The gamut specified by the Display P3 Color Space.
@@ -168,12 +167,7 @@ fn eval_color_gamut(context: &Context, query_value: Option<ColorGamut>) -> bool
let color_gamut = let color_gamut =
unsafe { bindings::Gecko_MediaFeatures_ColorGamut(context.device().document()) }; unsafe { bindings::Gecko_MediaFeatures_ColorGamut(context.device().document()) };
// Match if our color gamut is at least as wide as the query value // Match if our color gamut is at least as wide as the query value
query_value <= query_value <= color_gamut
match color_gamut {
ScreenColorGamut::Srgb => ColorGamut::Srgb,
ScreenColorGamut::P3 => ColorGamut::P3,
ScreenColorGamut::Rec2020 => ColorGamut::Rec2020,
}
} }
/// https://drafts.csswg.org/mediaqueries-4/#resolution /// https://drafts.csswg.org/mediaqueries-4/#resolution

View File

@@ -105,6 +105,7 @@ include = [
"BoolInteger", "BoolInteger",
"OutlineStyle", "OutlineStyle",
"CaptionSide", "CaptionSide",
"ColorGamut",
"FontSizeAdjust", "FontSizeAdjust",
"FontPalette", "FontPalette",
"FontLanguageOverride", "FontLanguageOverride",

View File

@@ -67,7 +67,6 @@ use style::gecko_bindings::structs::nsCSSFontDesc;
use style::gecko_bindings::structs::nsCSSPropertyID; use style::gecko_bindings::structs::nsCSSPropertyID;
use style::gecko_bindings::structs::nsChangeHint; use style::gecko_bindings::structs::nsChangeHint;
use style::gecko_bindings::structs::nsCompatibility; use style::gecko_bindings::structs::nsCompatibility;
use style::gecko_bindings::structs::nsStyleTransformMatrix::MatrixTransformOperator;
use style::gecko_bindings::structs::nsresult; use style::gecko_bindings::structs::nsresult;
use style::gecko_bindings::structs::CallerType; use style::gecko_bindings::structs::CallerType;
use style::gecko_bindings::structs::CompositeOperation; use style::gecko_bindings::structs::CompositeOperation;
@@ -4768,28 +4767,24 @@ pub extern "C" fn Servo_GetProperties_Overriding_Animation(
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_MatrixTransform_Operate( pub extern "C" fn Servo_MatrixTransform_Operate(
matrix_operator: MatrixTransformOperator, interpolate: bool,
from: *const structs::Matrix4x4Components, from: &structs::Matrix4x4Components,
to: *const structs::Matrix4x4Components, to: &structs::Matrix4x4Components,
progress: f64, progress: f64,
output: *mut structs::Matrix4x4Components, output: &mut structs::Matrix4x4Components,
) { ) {
use self::MatrixTransformOperator::{Accumulate, Interpolate};
use style::values::computed::transform::Matrix3D; use style::values::computed::transform::Matrix3D;
let from = Matrix3D::from(unsafe { from.as_ref() }.expect("not a valid 'from' matrix")); let from = Matrix3D::from(from);
let to = Matrix3D::from(unsafe { to.as_ref() }.expect("not a valid 'to' matrix")); let to = Matrix3D::from(to);
let result = match matrix_operator { let proc = if interpolate {
Interpolate => from.animate(&to, Procedure::Interpolate { progress }), Procedure::Interpolate { progress }
Accumulate => from.animate( } else {
&to,
Procedure::Accumulate { Procedure::Accumulate {
count: progress as u64, count: progress as u64,
}, }
),
}; };
let result = from.animate(&to, proc);
let output = unsafe { output.as_mut() }.expect("not a valid 'output' matrix");
if let Ok(result) = result { if let Ok(result) = result {
*output = result.into(); *output = result.into();
} else if progress < 0.5 { } else if progress < 0.5 {