Bug 755971 - Add a nsGenericElement::GetPaddingRectSize to return the size of the padding rect. r=bz

This commit is contained in:
Kartikaya Gupta 2012-06-21 09:35:31 -04:00
parent 0cf219076d
commit af54e9aaa6
2 changed files with 21 additions and 0 deletions

View File

@ -2033,6 +2033,20 @@ nsGenericElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
aRect.height = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.height);
}
nsIntSize
nsGenericElement::GetPaddingRectSize()
{
nsIFrame* frame = GetStyledFrame();
if (!frame) {
return nsIntSize(0, 0);
}
NS_ASSERTION(frame->GetParent(), "Styled frame has no parent");
nsRect rcFrame = nsLayoutUtils::GetAllInFlowPaddingRectsUnion(frame, frame->GetParent());
return nsIntSize(nsPresContext::AppUnitsToIntCSSPixels(rcFrame.width),
nsPresContext::AppUnitsToIntCSSPixels(rcFrame.height));
}
nsIScrollableFrame*
nsGenericElement::GetScrollFrame(nsIFrame **aStyledFrame)
{

View File

@ -777,6 +777,13 @@ protected:
*/
virtual void GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent);
/**
* Retrieve the size of the padding rect of this element.
*
* @param aSize the size of the padding rect
*/
nsIntSize GetPaddingRectSize();
nsIFrame* GetStyledFrame();
virtual mozilla::dom::Element* GetNameSpaceElement()