Bug 91516. Safeguard view traversal in nsObjectFrame so it doesn't walk out the current document. r=peterl,sr=attinasi

This commit is contained in:
roc+@cs.cmu.edu
2002-02-19 21:22:23 +00:00
parent 5cddeda0e4
commit a31cd181c4
2 changed files with 12 additions and 0 deletions

View File

@@ -1508,11 +1508,17 @@ nsresult nsObjectFrame::GetWindowOriginInPixels(nsIPresContext * aPresContext, P
// it may need to be corrected, like after scrolling
if (aWindowless && parentWithView) {
nsPoint correction(0,0);
nsCOMPtr<nsIViewManager> parentVM;
parentWithView->GetViewManager(*getter_AddRefs(parentVM));
// Walk up all the views and add up their positions. This will give us our
// absolute position which is what we want to give the plugin
nsIView* theView = parentWithView;
while (theView) {
nsCOMPtr<nsIViewManager> vm;
theView->GetViewManager(*getter_AddRefs(vm));
if (vm != parentVM)
break;
theView->GetPosition(&correction.x, &correction.y);
origin += correction;