Commit 444ba0fc authored by Xidorn Quan's avatar Xidorn Quan
Browse files

Bug 1340033 - Remove dependency from StyleAnimationValue.h to ServoBindings.h. r=hiro

MozReview-Commit-ID: 79czvLmftmv

--HG--
extra : rebase_source : 57d7a55ed48a0e9475076fa930226b6ea99a4e22
parent a6378fda
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
#include "mozilla/KeyframeUtils.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/StyleAnimationValueInlines.h"
#include "Layers.h" // For Layer
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetStyleContextForElement
#include "nsContentUtils.h"  // nsContentUtils::ReportToConsole
+2 −1
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/RuleNodeCacheConditions.h"
#include "mozilla/StyleAnimationValueInlines.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
#include "RegionBuilder.h"
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@
#include "mozilla/OperatorNewExtensions.h"
#include "mozilla/PendingAnimationTracker.h"
#include "mozilla/Preferences.h"
#include "mozilla/StyleAnimationValueInlines.h"
#include "mozilla/Telemetry.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
+4 −27
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@
#include "nsCSSValue.h"
#include "nsStyleCoord.h"
#include "nsStyleTransformMatrix.h"
#include "ServoBindings.h"

class nsIFrame;
class nsStyleContext;
@@ -585,37 +584,15 @@ struct AnimationValue

  bool IsNull() const { return mGecko.IsNull() && !mServo; }

  float GetOpacity() const
  {
    return mServo ? Servo_AnimationValue_GetOpacity(mServo)
                  : mGecko.GetFloatValue();
  }
  inline float GetOpacity() const;

  // Returns the scale for mGecko or mServo, which are calculated with
  // reference to aFrame.
  gfxSize GetScaleValue(const nsIFrame* aFrame) const
  {
    if (mServo) {
      RefPtr<nsCSSValueSharedList> list;
      Servo_AnimationValue_GetTransform(mServo, &list);
      return nsStyleTransformMatrix::GetScaleValue(list, aFrame);
    }
    return mGecko.GetScaleValue(aFrame);
  }
  inline gfxSize GetScaleValue(const nsIFrame* aFrame) const;

  // Uncompute this AnimationValue and then serialize it.
  void SerializeSpecifiedValue(nsCSSPropertyID aProperty,
                               nsAString& aString) const
  {
    if (mServo) {
      Servo_AnimationValue_Serialize(mServo, aProperty, &aString);
      return;
    }

    DebugOnly<bool> uncomputeResult =
      StyleAnimationValue::UncomputeValue(aProperty, mGecko, aString);
    MOZ_ASSERT(uncomputeResult, "failed to uncompute StyleAnimationValue");
  }
  inline void SerializeSpecifiedValue(nsCSSPropertyID aProperty,
                                      nsAString& aString) const;
};

struct PropertyStyleAnimationValuePair
+48 −0
Original line number Diff line number Diff line
/* -*- Mode: C++; tab-width: 2; 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_StyleAnimationValueInlines_h_
#define mozilla_StyleAnimationValueInlines_h_

#include "mozilla/StyleAnimationValue.h"
#include "mozilla/ServoBindings.h"

namespace mozilla {

float
AnimationValue::GetOpacity() const
{
  return mServo ? Servo_AnimationValue_GetOpacity(mServo)
                : mGecko.GetFloatValue();
}

gfxSize
AnimationValue::GetScaleValue(const nsIFrame* aFrame) const
{
  if (mServo) {
    RefPtr<nsCSSValueSharedList> list;
    Servo_AnimationValue_GetTransform(mServo, &list);
    return nsStyleTransformMatrix::GetScaleValue(list, aFrame);
  }
  return mGecko.GetScaleValue(aFrame);
}

void
AnimationValue::SerializeSpecifiedValue(nsCSSPropertyID aProperty,
                                        nsAString& aString) const
{
  if (mServo) {
    Servo_AnimationValue_Serialize(mServo, aProperty, &aString);
    return;
  }

  DebugOnly<bool> uncomputeResult =
    StyleAnimationValue::UncomputeValue(aProperty, mGecko, aString);
  MOZ_ASSERT(uncomputeResult, "failed to uncompute StyleAnimationValue");
}

} // namespace mozilla

#endif // mozilla_StyleAnimationValueInlines_h_
Loading