зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1265342 Part 5d: Move EllipseShapeInfo class definition ahead of RoundedBoxShapeInfo so it can be referenced by rounded boxes. r=dholbert
MozReview-Commit-ID: G8qdPlnh8kY --HG-- extra : rebase_source : 2917054937f488c601394f1d244151c9c3df7596
This commit is contained in:
Родитель
eb8a0661ae
Коммит
b935ad1265
|
@ -635,77 +635,6 @@ protected:
|
|||
const nscoord aTargetY);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// RoundedBoxShapeInfo
|
||||
//
|
||||
// Implements shape-outside: <shape-box> and shape-outside: inset().
|
||||
//
|
||||
class nsFloatManager::RoundedBoxShapeInfo final : public nsFloatManager::ShapeInfo
|
||||
{
|
||||
public:
|
||||
RoundedBoxShapeInfo(const nsRect& aRect,
|
||||
UniquePtr<nscoord[]> aRadii)
|
||||
: mRect(aRect)
|
||||
, mRadii(Move(aRadii))
|
||||
{}
|
||||
|
||||
nscoord LineLeft(const nscoord aBStart,
|
||||
const nscoord aBEnd) const override;
|
||||
nscoord LineRight(const nscoord aBStart,
|
||||
const nscoord aBEnd) const override;
|
||||
nscoord BStart() const override { return mRect.y; }
|
||||
nscoord BEnd() const override { return mRect.YMost(); }
|
||||
bool IsEmpty() const override { return mRect.IsEmpty(); };
|
||||
|
||||
void Translate(nscoord aLineLeft, nscoord aBlockStart) override
|
||||
{
|
||||
mRect.MoveBy(aLineLeft, aBlockStart);
|
||||
}
|
||||
|
||||
private:
|
||||
// The rect of the rounded box shape in the float manager's coordinate
|
||||
// space.
|
||||
nsRect mRect;
|
||||
// The half corner radii of the reference box. It's an nscoord[8] array
|
||||
// in the float manager's coordinate space. If there are no radii, it's
|
||||
// nullptr.
|
||||
UniquePtr<nscoord[]> mRadii;
|
||||
};
|
||||
|
||||
nscoord
|
||||
nsFloatManager::RoundedBoxShapeInfo::LineLeft(const nscoord aBStart,
|
||||
const nscoord aBEnd) const
|
||||
{
|
||||
if (!mRadii) {
|
||||
return mRect.x;
|
||||
}
|
||||
|
||||
nscoord lineLeftDiff =
|
||||
ComputeEllipseLineInterceptDiff(
|
||||
mRect.y, mRect.YMost(),
|
||||
mRadii[eCornerTopLeftX], mRadii[eCornerTopLeftY],
|
||||
mRadii[eCornerBottomLeftX], mRadii[eCornerBottomLeftY],
|
||||
aBStart, aBEnd);
|
||||
return mRect.x + lineLeftDiff;
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFloatManager::RoundedBoxShapeInfo::LineRight(const nscoord aBStart,
|
||||
const nscoord aBEnd) const
|
||||
{
|
||||
if (!mRadii) {
|
||||
return mRect.XMost();
|
||||
}
|
||||
|
||||
nscoord lineRightDiff =
|
||||
ComputeEllipseLineInterceptDiff(
|
||||
mRect.y, mRect.YMost(),
|
||||
mRadii[eCornerTopRightX], mRadii[eCornerTopRightY],
|
||||
mRadii[eCornerBottomRightX], mRadii[eCornerBottomRightY],
|
||||
aBStart, aBEnd);
|
||||
return mRect.XMost() - lineRightDiff;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// EllipseShapeInfo
|
||||
//
|
||||
|
@ -1073,6 +1002,77 @@ nsFloatManager::EllipseShapeInfo::LineRight(const nscoord aBStart,
|
|||
return LineEdge(aBStart, aBEnd, false);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// RoundedBoxShapeInfo
|
||||
//
|
||||
// Implements shape-outside: <shape-box> and shape-outside: inset().
|
||||
//
|
||||
class nsFloatManager::RoundedBoxShapeInfo final : public nsFloatManager::ShapeInfo
|
||||
{
|
||||
public:
|
||||
RoundedBoxShapeInfo(const nsRect& aRect,
|
||||
UniquePtr<nscoord[]> aRadii)
|
||||
: mRect(aRect)
|
||||
, mRadii(Move(aRadii))
|
||||
{}
|
||||
|
||||
nscoord LineLeft(const nscoord aBStart,
|
||||
const nscoord aBEnd) const override;
|
||||
nscoord LineRight(const nscoord aBStart,
|
||||
const nscoord aBEnd) const override;
|
||||
nscoord BStart() const override { return mRect.y; }
|
||||
nscoord BEnd() const override { return mRect.YMost(); }
|
||||
bool IsEmpty() const override { return mRect.IsEmpty(); };
|
||||
|
||||
void Translate(nscoord aLineLeft, nscoord aBlockStart) override
|
||||
{
|
||||
mRect.MoveBy(aLineLeft, aBlockStart);
|
||||
}
|
||||
|
||||
private:
|
||||
// The rect of the rounded box shape in the float manager's coordinate
|
||||
// space.
|
||||
nsRect mRect;
|
||||
// The half corner radii of the reference box. It's an nscoord[8] array
|
||||
// in the float manager's coordinate space. If there are no radii, it's
|
||||
// nullptr.
|
||||
UniquePtr<nscoord[]> mRadii;
|
||||
};
|
||||
|
||||
nscoord
|
||||
nsFloatManager::RoundedBoxShapeInfo::LineLeft(const nscoord aBStart,
|
||||
const nscoord aBEnd) const
|
||||
{
|
||||
if (!mRadii) {
|
||||
return mRect.x;
|
||||
}
|
||||
|
||||
nscoord lineLeftDiff =
|
||||
ComputeEllipseLineInterceptDiff(
|
||||
mRect.y, mRect.YMost(),
|
||||
mRadii[eCornerTopLeftX], mRadii[eCornerTopLeftY],
|
||||
mRadii[eCornerBottomLeftX], mRadii[eCornerBottomLeftY],
|
||||
aBStart, aBEnd);
|
||||
return mRect.x + lineLeftDiff;
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFloatManager::RoundedBoxShapeInfo::LineRight(const nscoord aBStart,
|
||||
const nscoord aBEnd) const
|
||||
{
|
||||
if (!mRadii) {
|
||||
return mRect.XMost();
|
||||
}
|
||||
|
||||
nscoord lineRightDiff =
|
||||
ComputeEllipseLineInterceptDiff(
|
||||
mRect.y, mRect.YMost(),
|
||||
mRadii[eCornerTopRightX], mRadii[eCornerTopRightY],
|
||||
mRadii[eCornerBottomRightX], mRadii[eCornerBottomRightY],
|
||||
aBStart, aBEnd);
|
||||
return mRect.XMost() - lineRightDiff;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// PolygonShapeInfo
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче