mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 392761. getClientRects/getBoundingClientRect *do* take scrolling into account, including viewport scrolling. r+sr=dbaron
This commit is contained in:
parent
f3071cd153
commit
3febe0fecf
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user