diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index 0082689e8cc..bc8d699d7a1 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -83,6 +83,7 @@ #ifdef MOZ_XUL #include "nsXULElement.h" #endif /* MOZ_XUL */ +#include "nsFrameManager.h" #include "nsBindingManager.h" #include "nsXBLBinding.h" @@ -694,19 +695,14 @@ nsNSElementTearoff::GetElementsByClassName(const nsAString& aClasses, static nsPoint GetOffsetFromInitialContainingBlock(nsIFrame* aFrame) { - nsPresContext* presContext = aFrame->PresContext(); - nsIPresShell* shell = presContext->PresShell(); - nsIFrame* rootScrollFrame = shell->GetRootScrollFrame(); + nsIFrame* rootFrame = aFrame->PresContext()->FrameManager()->GetRootFrame(); nsPoint pt(0,0); - nsIFrame* child = aFrame; - for (nsIFrame* p = aFrame->GetParent(); p && p != rootScrollFrame; - p = p->GetParent()) { - pt += p->GetPositionOfChildIgnoringScrolling(child); + for (nsIFrame* p = aFrame; p != rootFrame; p = p->GetParent()) { // coordinates of elements inside a foreignobject are relative to the top-left // of the nearest foreignobject - if (p->IsFrameOfType(nsIFrame::eSVGForeignObject)) + if (p->IsFrameOfType(nsIFrame::eSVGForeignObject) && p != aFrame) return pt; - child = p; + pt += p->GetPosition(); } return pt; }