зеркало из https://github.com/mozilla/pjs.git
Bug 190735. Final patch for deCOMtamination of core nsIFrame methods! rs=dbaron
This commit is contained in:
Родитель
56ed63449f
Коммит
fa51adb8f6
|
@ -145,20 +145,13 @@ inFlasher::RepaintElement(nsIDOMElement* aElement)
|
||||||
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement, presShell);
|
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement, presShell);
|
||||||
if (!frame) return NS_OK;
|
if (!frame) return NS_OK;
|
||||||
|
|
||||||
nsCOMPtr<nsIPresContext> pcontext;
|
nsIFrame* parentWithView = frame->GetAncestorWithView();
|
||||||
presShell->GetPresContext(getter_AddRefs(pcontext));
|
|
||||||
|
|
||||||
nsIFrame* parentWithView = nsnull;
|
|
||||||
frame->GetParentWithView(pcontext, &parentWithView);
|
|
||||||
if (parentWithView) {
|
if (parentWithView) {
|
||||||
nsIView* view = parentWithView->GetViewExternal(pcontext);
|
nsIView* view = parentWithView->GetViewExternal();
|
||||||
if (view) {
|
if (view) {
|
||||||
nsCOMPtr<nsIViewManager> viewManager;
|
nsIViewManager* viewManager = view->GetViewManager();
|
||||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
|
||||||
if (viewManager) {
|
if (viewManager) {
|
||||||
nsRect rect;
|
nsRect rect = parentWithView->GetRect();
|
||||||
parentWithView->GetRect(rect);
|
|
||||||
|
|
||||||
viewManager->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
|
viewManager->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,8 +175,7 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement)
|
||||||
presShell->CreateRenderingContext(frame, getter_AddRefs(rcontext));
|
presShell->CreateRenderingContext(frame, getter_AddRefs(rcontext));
|
||||||
|
|
||||||
// get view bounds in case this frame is being scrolled
|
// get view bounds in case this frame is being scrolled
|
||||||
nsRect rect;
|
nsRect rect = frame->GetRect();
|
||||||
frame->GetRect(rect);
|
|
||||||
nsPoint origin = inLayoutUtils::GetClientOrigin(presContext, frame);
|
nsPoint origin = inLayoutUtils::GetClientOrigin(presContext, frame);
|
||||||
rect.x = origin.x;
|
rect.x = origin.x;
|
||||||
rect.y = origin.y;
|
rect.y = origin.y;
|
||||||
|
|
|
@ -106,10 +106,8 @@ inLayoutUtils::GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell)
|
||||||
already_AddRefed<nsIRenderingContext>
|
already_AddRefed<nsIRenderingContext>
|
||||||
inLayoutUtils::GetRenderingContextFor(nsIPresShell* aShell)
|
inLayoutUtils::GetRenderingContextFor(nsIPresShell* aShell)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIViewManager> viewman;
|
|
||||||
aShell->GetViewManager(getter_AddRefs(viewman));
|
|
||||||
nsCOMPtr<nsIWidget> widget;
|
nsCOMPtr<nsIWidget> widget;
|
||||||
viewman->GetWidget(getter_AddRefs(widget));
|
aShell->GetViewManager()->GetWidget(getter_AddRefs(widget));
|
||||||
return widget->GetRenderingContext(); // AddRefs
|
return widget->GetRenderingContext(); // AddRefs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,20 +148,16 @@ inLayoutUtils::GetClientOrigin(nsIPresContext* aPresContext,
|
||||||
aFrame->GetOffsetFromView(aPresContext, result, &view);
|
aFrame->GetOffsetFromView(aPresContext, result, &view);
|
||||||
nsIView* rootView = nsnull;
|
nsIView* rootView = nsnull;
|
||||||
if (view) {
|
if (view) {
|
||||||
nsCOMPtr<nsIViewManager> viewManager;
|
nsIViewManager* viewManager = view->GetViewManager();
|
||||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
|
||||||
NS_ASSERTION(viewManager, "View must have a viewmanager");
|
NS_ASSERTION(viewManager, "View must have a viewmanager");
|
||||||
viewManager->GetRootView(rootView);
|
viewManager->GetRootView(rootView);
|
||||||
}
|
}
|
||||||
while (view) {
|
while (view) {
|
||||||
nscoord x, y;
|
result += view->GetPosition();
|
||||||
view->GetPosition(&x, &y);
|
|
||||||
result.x += x;
|
|
||||||
result.y += y;
|
|
||||||
if (view == rootView) {
|
if (view == rootView) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
view->GetParent(view);
|
view = view->GetParent();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -190,28 +184,27 @@ inLayoutUtils::GetScreenOrigin(nsIDOMElement* aElement)
|
||||||
|
|
||||||
if (presContext) {
|
if (presContext) {
|
||||||
nsIFrame* frame = nsnull;
|
nsIFrame* frame = nsnull;
|
||||||
nsresult rv = presShell->GetPrimaryFrameFor(content, &frame);
|
presShell->GetPrimaryFrameFor(content, &frame);
|
||||||
|
|
||||||
PRInt32 offsetX = 0;
|
PRInt32 offsetX = 0;
|
||||||
PRInt32 offsetY = 0;
|
PRInt32 offsetY = 0;
|
||||||
nsCOMPtr<nsIWidget> widget;
|
nsIWidget* widget = nsnull;
|
||||||
|
|
||||||
while (frame) {
|
while (frame) {
|
||||||
// Look for a widget so we can get screen coordinates
|
// Look for a widget so we can get screen coordinates
|
||||||
nsIView* view = frame->GetViewExternal(presContext);
|
nsIView* view = frame->GetViewExternal();
|
||||||
if (view) {
|
if (view) {
|
||||||
rv = view->GetWidget(*getter_AddRefs(widget));
|
widget = view->GetWidget();
|
||||||
if (widget)
|
if (widget)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No widget yet, so count up the coordinates of the frame
|
// No widget yet, so count up the coordinates of the frame
|
||||||
nsPoint origin;
|
nsPoint origin = frame->GetPosition();
|
||||||
frame->GetOrigin(origin);
|
|
||||||
offsetX += origin.x;
|
offsetX += origin.x;
|
||||||
offsetY += origin.y;
|
offsetY += origin.y;
|
||||||
|
|
||||||
frame->GetParent(&frame);
|
frame = frame->GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget) {
|
if (widget) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче