Stop at the viewmanager root when computing offsets for flashing stuff. Bug

188210, r=caillon, sr=kin
This commit is contained in:
bzbarsky%mit.edu 2006-05-17 02:37:45 +00:00
parent 11a7fe7e34
commit 3c752c4794
2 changed files with 12 additions and 1 deletions

View File

@ -148,11 +148,21 @@ inLayoutUtils::GetClientOrigin(nsIPresContext* aPresContext,
nsPoint result(0,0);
nsIView* view;
aFrame->GetOffsetFromView(aPresContext, result, &view);
nsIView* rootView = nsnull;
if (view) {
nsCOMPtr<nsIViewManager> viewManager;
view->GetViewManager(*getter_AddRefs(viewManager));
NS_ASSERTION(viewManager, "View must have a viewmanager");
viewManager->GetRootView(rootView);
}
while (view) {
nscoord x, y;
view->GetPosition(&x, &y);
result.x += x;
result.y += y;
if (view == rootView) {
break;
}
view->GetParent(view);
}
return result;

View File

@ -64,7 +64,8 @@ public:
static PRBool IsDocumentElement(nsIDOMNode* aNode);
/**
* This function returns the offset of a frame with respect to the
* root view (for use by inFlasher::DrawElementOutline and the like
* root view of the aPresContext's viewmanager (for use by
* inFlasher::DrawElementOutline and the like)
*
* @param aFrame the frame whose offset we want
* @param aPresContext the presentation context