Bug 450930. Fire a DOM event when painting so that content and chrome can track what's being repainted. r=smaug,sr=dbaron
This commit is contained in:
@@ -1289,28 +1289,6 @@ GetContainingBlockForClientRect(nsIFrame* aFrame)
|
||||
return aFrame;
|
||||
}
|
||||
|
||||
static double
|
||||
RoundFloat(double aValue)
|
||||
{
|
||||
return floor(aValue + 0.5);
|
||||
}
|
||||
|
||||
static void
|
||||
SetClientRect(const nsRect& aLayoutRect, nsPresContext* aPresContext,
|
||||
nsClientRect* aRect)
|
||||
{
|
||||
double scale = 65536.0;
|
||||
// Round to the nearest 1/scale units. We choose scale so it can be represented
|
||||
// exactly by machine floating point.
|
||||
double scaleInv = 1/scale;
|
||||
double t2pScaled = scale/aPresContext->AppUnitsPerCSSPixel();
|
||||
double x = RoundFloat(aLayoutRect.x*t2pScaled)*scaleInv;
|
||||
double y = RoundFloat(aLayoutRect.y*t2pScaled)*scaleInv;
|
||||
aRect->SetRect(x, y,
|
||||
RoundFloat(aLayoutRect.XMost()*t2pScaled)*scaleInv - x,
|
||||
RoundFloat(aLayoutRect.YMost()*t2pScaled)*scaleInv - y);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNSElementTearoff::GetBoundingClientRect(nsIDOMClientRect** aResult)
|
||||
{
|
||||
@@ -1330,7 +1308,7 @@ nsNSElementTearoff::GetBoundingClientRect(nsIDOMClientRect** aResult)
|
||||
nsPresContext* presContext = frame->PresContext();
|
||||
nsRect r = nsLayoutUtils::GetAllInFlowRectsUnion(frame,
|
||||
GetContainingBlockForClientRect(frame));
|
||||
SetClientRect(r, presContext, rect);
|
||||
rect->SetLayoutRect(r, presContext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1350,7 +1328,7 @@ struct RectListBuilder : public nsLayoutUtils::RectCallback {
|
||||
return;
|
||||
}
|
||||
|
||||
SetClientRect(aRect, mPresContext, rect);
|
||||
rect->SetLayoutRect(aRect, mPresContext);
|
||||
mRectList->Append(rect);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user