Bug 613659 - Add "skip sides" and border/frame size parameters to GetBorderRadii(). Add an inline convenience method for the old signature. r=cam

This commit is contained in:
Mats Palmgren 2014-04-17 12:11:07 +00:00
Родитель c2691dbe6c
Коммит 49ad4f839b
6 изменённых файлов: 39 добавлений и 17 удалений

Просмотреть файл

@ -1277,7 +1277,8 @@ nsIFrame::OutsetBorderRadii(nscoord aRadii[8], const nsMargin &aOffsets)
}
/* virtual */ bool
nsIFrame::GetBorderRadii(nscoord aRadii[8]) const
nsIFrame::GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
int aSkipSides, nscoord aRadii[8]) const
{
if (IsThemed()) {
// When we're themed, the native theme code draws the border and
@ -1292,9 +1293,9 @@ nsIFrame::GetBorderRadii(nscoord aRadii[8]) const
}
return false;
}
nsSize size = GetSize();
return ComputeBorderRadii(StyleBorder()->mBorderRadius, size, size,
GetSkipSides(), aRadii);
return ComputeBorderRadii(StyleBorder()->mBorderRadius,
aFrameSize, aBorderArea,
aSkipSides, aRadii);
}
bool

Просмотреть файл

@ -4366,10 +4366,15 @@ ReduceRadii(nscoord aXBorder, nscoord aYBorder,
* have scrollbars.
*/
bool
ScrollFrameHelper::GetBorderRadii(nscoord aRadii[8]) const
ScrollFrameHelper::GetBorderRadii(const nsSize& aFrameSize,
const nsSize& aBorderArea,
int aSkipSides,
nscoord aRadii[8]) const
{
if (!mOuter->nsContainerFrame::GetBorderRadii(aRadii))
if (!mOuter->nsContainerFrame::GetBorderRadii(aFrameSize, aBorderArea,
aSkipSides, aRadii)) {
return false;
}
// Since we can use GetActualScrollbarSizes (rather than
// GetDesiredScrollbarSizes) since this doesn't affect reflow, we

Просмотреть файл

@ -71,7 +71,8 @@ public:
bool& aCreateLayer,
bool aPositioned);
bool GetBorderRadii(nscoord aRadii[8]) const;
bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
int aSkipSides, nscoord aRadii[8]) const;
// nsIReflowCallback
virtual bool ReflowFinished() MOZ_OVERRIDE;
@ -471,8 +472,9 @@ public:
const nsPoint& aScrollPosition);
nscoord GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext);
virtual bool GetBorderRadii(nscoord aRadii[8]) const MOZ_OVERRIDE {
return mHelper.GetBorderRadii(aRadii);
virtual bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
int aSkipSides, nscoord aRadii[8]) const MOZ_OVERRIDE {
return mHelper.GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii);
}
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
@ -808,8 +810,9 @@ public:
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
virtual nsresult GetPadding(nsMargin& aPadding) MOZ_OVERRIDE;
virtual bool GetBorderRadii(nscoord aRadii[8]) const MOZ_OVERRIDE {
return mHelper.GetBorderRadii(aRadii);
virtual bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
int aSkipSides, nscoord aRadii[8]) const MOZ_OVERRIDE {
return mHelper.GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii);
}
nsresult Layout(nsBoxLayoutState& aState);

Просмотреть файл

@ -1042,12 +1042,19 @@ public:
static void OutsetBorderRadii(nscoord aRadii[8], const nsMargin &aOffsets);
/**
* Fill in border radii for this frame. Return whether any are
* nonzero.
*
* Fill in border radii for this frame. Return whether any are nonzero.
* Indices into aRadii are the NS_CORNER_* constants in nsStyleConsts.h
* aSkipSides is a union of SIDE_BIT_LEFT/RIGHT/TOP/BOTTOM bits that says
* which side(s) to skip.
*/
virtual bool GetBorderRadii(nscoord aRadii[8]) const;
virtual bool GetBorderRadii(const nsSize& aFrameSize,
const nsSize& aBorderArea,
int aSkipSides,
nscoord aRadii[8]) const;
bool GetBorderRadii(nscoord aRadii[8]) const {
nsSize sz = GetSize();
return GetBorderRadii(sz, sz, GetSkipSides(), aRadii);
}
bool GetPaddingBoxBorderRadii(nscoord aRadii[8]) const;
bool GetContentBoxBorderRadii(nscoord aRadii[8]) const;

Просмотреть файл

@ -1103,7 +1103,10 @@ nsBCTableCellFrame::GetUsedBorder() const
}
/* virtual */ bool
nsBCTableCellFrame::GetBorderRadii(nscoord aRadii[8]) const
nsBCTableCellFrame::GetBorderRadii(const nsSize& aFrameSize,
const nsSize& aBorderArea,
int aSkipSides,
nscoord aRadii[8]) const
{
NS_FOR_CSS_HALF_CORNERS(corner) {
aRadii[corner] = 0;

Просмотреть файл

@ -298,7 +298,10 @@ public:
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
virtual nsMargin GetUsedBorder() const MOZ_OVERRIDE;
virtual bool GetBorderRadii(nscoord aRadii[8]) const MOZ_OVERRIDE;
virtual bool GetBorderRadii(const nsSize& aFrameSize,
const nsSize& aBorderArea,
int aSkipSides,
nscoord aRadii[8]) const MOZ_OVERRIDE;
// Get the *inner half of the border only*, in twips.
virtual nsMargin* GetBorderWidth(nsMargin& aBorder) const MOZ_OVERRIDE;