StyleScrollSnapPoints.cpp [plain text]
#include "config.h"
#include "StyleScrollSnapPoints.h"
#if ENABLE(CSS_SCROLL_SNAP)
namespace WebCore {
ScrollSnapPoints::ScrollSnapPoints()
: repeatOffset(0, Fixed)
, hasRepeat(false)
, usesElements(false)
{
}
bool operator==(const ScrollSnapPoints& a, const ScrollSnapPoints& b)
{
return a.repeatOffset == b.repeatOffset
&& a.hasRepeat == b.hasRepeat
&& a.usesElements == b.usesElements
&& a.offsets == b.offsets;
}
LengthSize defaultScrollSnapDestination()
{
return LengthSize(Length(0, Fixed), Length(0, Fixed));
}
StyleScrollSnapPoints::StyleScrollSnapPoints()
: destination(defaultScrollSnapDestination())
{
}
inline StyleScrollSnapPoints::StyleScrollSnapPoints(const StyleScrollSnapPoints& other)
: RefCounted()
, xPoints(other.xPoints ? std::make_unique<ScrollSnapPoints>(*other.xPoints) : nullptr)
, yPoints(other.yPoints ? std::make_unique<ScrollSnapPoints>(*other.yPoints) : nullptr)
, destination(other.destination)
, coordinates(other.coordinates)
{
}
Ref<StyleScrollSnapPoints> StyleScrollSnapPoints::copy() const
{
return adoptRef(*new StyleScrollSnapPoints(*this));
}
bool operator==(const StyleScrollSnapPoints& a, const StyleScrollSnapPoints& b)
{
return a.xPoints == b.xPoints
&& a.yPoints == b.yPoints
&& a.destination == b.destination
&& a.coordinates == b.coordinates;
}
}
#endif