#ifndef TransformOperations_h
#define TransformOperations_h
#include "platform/geometry/LayoutSize.h"
#include "platform/transforms/TransformOperation.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
namespace WebCore {
class PLATFORM_EXPORT TransformOperations {
    WTF_MAKE_FAST_ALLOCATED;
public:
    explicit TransformOperations(bool makeIdentity = false);
    bool operator==(const TransformOperations& o) const;
    bool operator!=(const TransformOperations& o) const
    {
        return !(*this == o);
    }
    void apply(const FloatSize& sz, TransformationMatrix& t) const
    {
        for (unsigned i = 0; i < m_operations.size(); ++i)
            m_operations[i]->apply(t, sz);
    }
    
    
    bool has3DOperation() const
    {
        for (unsigned i = 0; i < m_operations.size(); ++i)
            if (m_operations[i]->is3DOperation())
                return true;
        return false;
    }
    bool dependsOnBoxSize() const
    {
        for (unsigned i = 0; i < m_operations.size(); ++i) {
            if (m_operations[i]->dependsOnBoxSize())
                return true;
        }
        return false;
    }
    bool operationsMatch(const TransformOperations&) const;
    void clear()
    {
        m_operations.clear();
    }
    Vector<RefPtr<TransformOperation> >& operations() { return m_operations; }
    const Vector<RefPtr<TransformOperation> >& operations() const { return m_operations; }
    size_t size() const { return m_operations.size(); }
    const TransformOperation* at(size_t index) const { return index < m_operations.size() ? m_operations.at(index).get() : 0; }
    TransformOperations blendByMatchingOperations(const TransformOperations& from, const double& progress) const;
    TransformOperations blendByUsingMatrixInterpolation(const TransformOperations& from, double progress) const;
    TransformOperations blend(const TransformOperations& from, double progress) const;
    TransformOperations add(const TransformOperations& addend) const;
private:
    Vector<RefPtr<TransformOperation> > m_operations;
};
} 
#endif