Bug 1065646: Use GetContentRectRelativeToSelf() instead of GetContentRect() - GetPosition(), in layout code. r=tn

This commit is contained in:
Daniel Holbert 2014-09-11 14:29:59 -07:00
parent 6ff9bb5a5b
commit 0f09db7a97
7 changed files with 12 additions and 8 deletions

View File

@ -2235,7 +2235,7 @@ nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
clipRect = frame->GetPaddingRect() - frame->GetPosition() + aItem->ToReferenceFrame();
break;
case NS_STYLE_BG_CLIP_CONTENT:
clipRect = frame->GetContentRect() - frame->GetPosition() + aItem->ToReferenceFrame();
clipRect = frame->GetContentRectRelativeToSelf() + aItem->ToReferenceFrame();
break;
default:
NS_NOTREACHED("Unknown clip type");

View File

@ -5873,7 +5873,7 @@ nsresult
nsFrame::GetPointFromOffset(int32_t inOffset, nsPoint* outPoint)
{
NS_PRECONDITION(outPoint != nullptr, "Null parameter");
nsRect contentRect = GetContentRect() - GetPosition();
nsRect contentRect = GetContentRectRelativeToSelf();
nsPoint pt = contentRect.TopLeft();
if (mContent)
{

View File

@ -241,6 +241,8 @@ nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
// FIXME taken from nsImageFrame, but then had splittable frame stuff
// removed. That needs to be fixed.
// XXXdholbert As in nsImageFrame, this function's clients should probably
// just be calling GetContentRectRelativeToSelf().
nsRect
nsHTMLCanvasFrame::GetInnerArea() const
{
@ -259,7 +261,7 @@ nsHTMLCanvasFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
nsDisplayItem* aItem,
const ContainerLayerParameters& aContainerParameters)
{
nsRect area = GetContentRect() - GetPosition() + aItem->ToReferenceFrame();
nsRect area = GetContentRectRelativeToSelf() + aItem->ToReferenceFrame();
HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(GetContent());
nsIntSize canvasSize = GetCanvasSize();

View File

@ -812,10 +812,12 @@ nsImageFrame::ComputeSize(nsRenderingContext *aRenderingContext,
aPadding);
}
// XXXdholbert This function's clients should probably just be calling
// GetContentRectRelativeToSelf() directly.
nsRect
nsImageFrame::GetInnerArea() const
{
return GetContentRect() - GetPosition();
return GetContentRectRelativeToSelf();
}
Element*

View File

@ -174,7 +174,7 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
nsDisplayItem* aItem,
const ContainerLayerParameters& aContainerParameters)
{
nsRect area = GetContentRect() - GetPosition() + aItem->ToReferenceFrame();
nsRect area = GetContentRectRelativeToSelf() + aItem->ToReferenceFrame();
HTMLVideoElement* element = static_cast<HTMLVideoElement*>(GetContent());
nsIntSize videoSize;
if (NS_FAILED(element->GetVideoSize(&videoSize)) || area.IsEmpty()) {
@ -393,7 +393,7 @@ public:
{
*aSnap = true;
nsIFrame* f = Frame();
return f->GetContentRect() - f->GetPosition() + ToReferenceFrame();
return f->GetContentRectRelativeToSelf() + ToReferenceFrame();
}
virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,

View File

@ -53,7 +53,7 @@ GetContentRectLayerOffset(nsIFrame* aContainerFrame, nsDisplayListBuilder* aBuil
// we need to be careful here to ensure that we call ToReferenceFrame
// on aContainerFrame and not its parent.
nsPoint frameOffset = aBuilder->ToReferenceFrame(aContainerFrame) +
(aContainerFrame->GetContentRect().TopLeft() - aContainerFrame->GetPosition());
aContainerFrame->GetContentRectRelativeToSelf().TopLeft();
return frameOffset.ToNearestPixels(auPerDevPixel);
}

View File

@ -724,7 +724,7 @@ nsTableCellFrame::GetCellBaseline() const
nscoord result;
if (nsLayoutUtils::GetFirstLineBaseline(GetWritingMode(), inner, &result))
return result + borderPadding;
return inner->GetContentRect().YMost() - inner->GetPosition().y +
return inner->GetContentRectRelativeToSelf().YMost() +
borderPadding;
}