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-05-05 17:55:54 +00:00
parent e2efe2c0c1
commit a0092289f8
6 changed files with 39 additions and 17 deletions

View File

@ -1275,7 +1275,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
@ -1290,9 +1291,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

View File

@ -4379,10 +4379,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

View File

@ -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;
@ -477,8 +478,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;
@ -820,8 +822,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);

View File

@ -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;

View File

@ -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;

View File

@ -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;