Bug 1062963 patch 2: changes and additions to WritingModes.h. r=jfkthame

This commit is contained in:
Simon Montagu 2014-10-21 15:16:12 -07:00
parent 1c299d429d
commit af76344d0a

View File

@ -507,6 +507,12 @@ public:
aContainerWidth);
}
bool operator==(LogicalPoint aOther) const
{
CHECK_WRITING_MODE(aOther.GetWritingMode());
return mPoint == aOther.mPoint;
}
LogicalPoint operator+(const LogicalPoint& aOther) const
{
CHECK_WRITING_MODE(aOther.GetWritingMode());
@ -518,6 +524,33 @@ public:
mPoint.y + aOther.mPoint.y);
}
LogicalPoint& operator+=(const LogicalPoint& aOther)
{
CHECK_WRITING_MODE(aOther.GetWritingMode());
I() += aOther.I();
B() += aOther.B();
return *this;
}
LogicalPoint operator-(const LogicalPoint& aOther) const
{
CHECK_WRITING_MODE(aOther.GetWritingMode());
// In non-debug builds, LogicalPoint does not store the WritingMode,
// so the first parameter here (which will always be eUnknownWritingMode)
// is ignored.
return LogicalPoint(GetWritingMode(),
mPoint.x - aOther.mPoint.x,
mPoint.y - aOther.mPoint.y);
}
LogicalPoint& operator-=(const LogicalPoint& aOther)
{
CHECK_WRITING_MODE(aOther.GetWritingMode());
I() -= aOther.I();
B() -= aOther.B();
return *this;
}
private:
friend class LogicalRect;
@ -1320,6 +1353,12 @@ public:
void SetEmpty() { mRect.SetEmpty(); }
bool IsEqualEdges(const LogicalRect aOther) const
{
CHECK_WRITING_MODE(aOther.GetWritingMode());
return mRect.IsEqualEdges(aOther.mRect);
}
/* XXX are these correct?
nscoord ILeft(WritingMode aWritingMode) const
{
@ -1432,17 +1471,17 @@ public:
}
}
#if 0 // XXX this would require aContainerWidth as well
/**
* Return a LogicalRect representing this rect in a different writing mode
*/
LogicalRect ConvertTo(WritingMode aToMode, WritingMode aFromMode) const
LogicalRect ConvertTo(WritingMode aToMode, WritingMode aFromMode,
nscoord aContainerWidth) const
{
CHECK_WRITING_MODE(aFromMode);
return aToMode == aFromMode ?
*this : LogicalRect(aToMode, GetPhysicalRect(aFromMode));
*this : LogicalRect(aToMode, GetPhysicalRect(aFromMode, aContainerWidth),
aContainerWidth);
}
#endif
private:
LogicalRect() MOZ_DELETE;