mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Depend on assignment and copy construction of unions in nsStyleCoord. (Bug 730240) r=bzbarsky
This commit is contained in:
parent
ea13f42a2a
commit
095914432d
@ -82,24 +82,6 @@ nsStyleCoord::nsStyleCoord(float aValue, nsStyleUnit aUnit)
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: In C++0x we can rely on the default copy constructor since
|
||||
// default copy construction is defined properly for unions. But when
|
||||
// can we actually use that? (It seems to work in gcc 4.4.)
|
||||
nsStyleCoord& nsStyleCoord::operator=(const nsStyleCoord& aCopy)
|
||||
{
|
||||
mUnit = aCopy.mUnit;
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
else if (IsPointerValue()) {
|
||||
mValue.mPointer = aCopy.mValue.mPointer;
|
||||
}
|
||||
else {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool nsStyleCoord::operator==(const nsStyleCoord& aOther) const
|
||||
{
|
||||
if (mUnit != aOther.mUnit) {
|
||||
|
@ -111,7 +111,12 @@ public:
|
||||
inline nsStyleCoord(const nsStyleCoord& aCopy);
|
||||
inline nsStyleCoord(const nsStyleUnion& aValue, nsStyleUnit aUnit);
|
||||
|
||||
nsStyleCoord& operator=(const nsStyleCoord& aCopy);
|
||||
nsStyleCoord& operator=(const nsStyleCoord& aOther)
|
||||
{
|
||||
mUnit = aOther.mUnit;
|
||||
mValue = aOther.mValue;
|
||||
return *this;
|
||||
}
|
||||
bool operator==(const nsStyleCoord& aOther) const;
|
||||
bool operator!=(const nsStyleCoord& aOther) const;
|
||||
|
||||
@ -273,9 +278,8 @@ inline nsStyleCoord::nsStyleCoord(const nsStyleCoord& aCopy)
|
||||
}
|
||||
|
||||
inline nsStyleCoord::nsStyleCoord(const nsStyleUnion& aValue, nsStyleUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
: mUnit(aUnit), mValue(aValue)
|
||||
{
|
||||
memcpy(&mValue, &aValue, sizeof(nsStyleUnion));
|
||||
}
|
||||
|
||||
inline bool nsStyleCoord::operator!=(const nsStyleCoord& aOther) const
|
||||
@ -343,7 +347,7 @@ inline nsStyleCoord::Calc* nsStyleCoord::GetCalcValue() const
|
||||
|
||||
inline void nsStyleCoord::GetUnionValue(nsStyleUnion& aValue) const
|
||||
{
|
||||
memcpy(&aValue, &mValue, sizeof(nsStyleUnion));
|
||||
aValue = mValue;
|
||||
}
|
||||
|
||||
// -------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user