Bug 174397. Support getClientRects and getBoundingClientRect on DOM elements. r=jonas,dbaron; sr=tor, plus help from Anne van Kesteren and Martijn Wargers

This commit is contained in:
roc+@cs.cmu.edu 2007-05-30 15:32:54 -07:00
parent 18223fc22d
commit cf38be799a
15 changed files with 551 additions and 22 deletions

View File

@ -92,7 +92,11 @@
#include "nsPIBoxObject.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSElement.h"
#include "nsTextRectangle.h"
#ifdef MOZ_SVG
#include "nsSVGUtils.h"
#endif
#include "nsLayoutUtils.h"
#include "nsGkAtoms.h"
#include "nsContentUtils.h"
#include "nsIJSContextStack.h"
@ -645,6 +649,137 @@ nsNSElementTearoff::GetElementsByClassName(const nsAString& aClasses,
return nsDocument::GetElementsByClassNameHelper(mContent, aClasses, aReturn);
}
static nsPoint
GetOffsetFromInitialContainingBlock(nsIFrame* aFrame)
{
nsPresContext* presContext = aFrame->PresContext();
nsIPresShell* shell = presContext->PresShell();
nsIFrame* rootScrollFrame = shell->GetRootScrollFrame();
nsPoint pt(0,0);
nsIFrame* child = aFrame;
for (nsIFrame* p = aFrame->GetParent(); p && p != rootScrollFrame;
p = p->GetParent()) {
pt += p->GetPositionOfChildIgnoringScrolling(child);
// coordinates of elements inside a foreignobject are relative to the top-left
// of the nearest foreignobject
if (p->IsFrameOfType(nsIFrame::eSVGForeignObject))
return pt;
child = p;
}
return pt;
}
static double
RoundFloat(double aValue)
{
return floor(aValue + 0.5);
}
static void
SetTextRectangle(const nsRect& aLayoutRect, nsPresContext* aPresContext,
nsTextRectangle* aRect)
{
double scale = 4096.0;
// Round to the nearest 1/scale units. We choose scale so it can be represented
// exactly by machine floating point.
double scaleInv = 1/scale;
double t2pScaled = scale/aPresContext->AppUnitsPerCSSPixel();
aRect->SetRect(RoundFloat(aLayoutRect.x*t2pScaled)*scaleInv,
RoundFloat(aLayoutRect.y*t2pScaled)*scaleInv,
RoundFloat(aLayoutRect.width*t2pScaled)*scaleInv,
RoundFloat(aLayoutRect.height*t2pScaled)*scaleInv);
}
static PRBool
TryGetSVGBoundingRect(nsIFrame* aFrame, nsRect* aRect)
{
#ifdef MOZ_SVG
nsRect r;
nsIFrame* outer = nsSVGUtils::GetOuterSVGFrameAndCoveredRegion(aFrame, &r);
if (!outer)
return PR_FALSE;
// r is in pixels relative to 'outer', get it into twips
// relative to ICB origin
r.ScaleRoundOut(1.0/aFrame->PresContext()->AppUnitsPerCSSPixel());
*aRect = r + GetOffsetFromInitialContainingBlock(outer);
return PR_TRUE;
#else
return PR_FALSE;
#endif
}
NS_IMETHODIMP
nsNSElementTearoff::GetBoundingClientRect(nsIDOMTextRectangle** aResult)
{
// Weak ref, since we addref it below
nsTextRectangle* rect = new nsTextRectangle();
if (!rect)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult = rect);
nsIFrame* frame = mContent->GetPrimaryFrame(Flush_Layout);
if (!frame) {
// display:none, perhaps? Return the empty rect
return NS_OK;
}
nsRect r;
if (TryGetSVGBoundingRect(frame, &r)) {
// Currently SVG frames don't have continuations but I don't want things to
// break if that changes.
nsIFrame* next;
while ((next = frame->GetNextContinuation()) != nsnull) {
frame = next;
nsRect nextRect;
#ifdef DEBUG
PRBool isSVG =
#endif
TryGetSVGBoundingRect(frame, &nextRect);
NS_ASSERTION(isSVG, "SVG frames must have SVG continuations");
r.UnionRect(r, nextRect);
}
} else {
r = nsLayoutUtils::GetAllInFlowBoundingRect(frame) +
GetOffsetFromInitialContainingBlock(frame);
}
SetTextRectangle(r, frame->PresContext(), rect);
return NS_OK;
}
NS_IMETHODIMP
nsNSElementTearoff::GetClientRects(nsIDOMTextRectangleList** aResult)
{
// Weak ref, since we addref it below
nsTextRectangleList* rectList = new nsTextRectangleList();
if (!rectList)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult = rectList);
nsIFrame* frame = mContent->GetPrimaryFrame(Flush_Layout);
if (!frame) {
// display:none, perhaps? Return an empty list
return NS_OK;
}
nsPresContext* presContext = frame->PresContext();
for (nsIFrame* f = frame; f; f = f->GetNextContinuation()) {
nsRefPtr<nsTextRectangle> rect = new nsTextRectangle();
if (!rect)
return NS_ERROR_OUT_OF_MEMORY;
nsRect r;
if (!TryGetSVGBoundingRect(f, &r)) {
r = nsRect(GetOffsetFromInitialContainingBlock(f), f->GetSize());
}
SetTextRectangle(r, presContext, rect);
rectList->Append(rect);
}
return NS_OK;
}
//----------------------------------------------------------------------

View File

@ -142,26 +142,6 @@ private:
nsCOMPtr<nsIContent> mContent;
};
/**
* Yet another tearoff class for nsGenericElement
* to implement additional interfaces
*/
class nsNSElementTearoff : public nsIDOMNSElement
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMNSELEMENT
nsNSElementTearoff(nsIContent *aContent) : mContent(aContent)
{
}
private:
nsCOMPtr<nsIContent> mContent;
};
/**
* A class that implements nsIWeakReference
*/
@ -1088,4 +1068,23 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \
return rv; \
}
/**
* Yet another tearoff class for nsGenericElement
* to implement additional interfaces
*/
class nsNSElementTearoff : public nsIDOMNSElement
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMNSELEMENT
nsNSElementTearoff(nsGenericElement *aContent) : mContent(aContent)
{
}
private:
nsRefPtr<nsGenericElement> mContent;
};
#endif /* nsGenericElement_h___ */

View File

@ -128,6 +128,7 @@ CPPSRCS = \
nsHTMLTableSectionElement.cpp \
nsHTMLTextAreaElement.cpp \
nsHTMLTitleElement.cpp \
nsTextRectangle.cpp \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.

View File

@ -0,0 +1,112 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Novell code.
*
* The Initial Developer of the Original Code is
* Novell Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert O'Callahan <robert@ocallahan.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsTextRectangle.h"
#include "nsContentUtils.h"
#include "nsDOMClassInfoID.h"
NS_INTERFACE_MAP_BEGIN(nsTextRectangle)
NS_INTERFACE_MAP_ENTRY(nsIDOMTextRectangle)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(TextRectangle)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsTextRectangle)
NS_IMPL_RELEASE(nsTextRectangle)
nsTextRectangle::nsTextRectangle()
: mX(0.0), mY(0.0), mWidth(0.0), mHeight(0.0)
{
}
NS_IMETHODIMP
nsTextRectangle::GetLeft(float* aResult)
{
*aResult = mX;
return NS_OK;
}
NS_IMETHODIMP
nsTextRectangle::GetTop(float* aResult)
{
*aResult = mY;
return NS_OK;
}
NS_IMETHODIMP
nsTextRectangle::GetRight(float* aResult)
{
*aResult = mX + mWidth;
return NS_OK;
}
NS_IMETHODIMP
nsTextRectangle::GetBottom(float* aResult)
{
*aResult = mY + mHeight;
return NS_OK;
}
NS_INTERFACE_MAP_BEGIN(nsTextRectangleList)
NS_INTERFACE_MAP_ENTRY(nsIDOMTextRectangleList)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(TextRectangleList)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsTextRectangleList)
NS_IMPL_RELEASE(nsTextRectangleList)
NS_IMETHODIMP
nsTextRectangleList::GetLength(PRUint32* aLength)
{
*aLength = mArray.Count();
return NS_OK;
}
NS_IMETHODIMP
nsTextRectangleList::Item(PRUint32 aIndex, nsIDOMTextRectangle** aReturn)
{
if (aIndex >= PRUint32(mArray.Count())) {
*aReturn = nsnull;
return NS_OK;
}
NS_IF_ADDREF(*aReturn = mArray.ObjectAt(aIndex));
return NS_OK;
}

View File

@ -0,0 +1,80 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Novell code.
*
* The Initial Developer of the Original Code is
* Novell Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert O'Callahan <robert@ocallahan.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef NSTEXTRECTANGLE_H_
#define NSTEXTRECTANGLE_H_
#include "nsIDOMTextRectangle.h"
#include "nsIDOMTextRectangleList.h"
#include "nsCOMArray.h"
class nsTextRectangle : public nsIDOMTextRectangle
{
public:
NS_DECL_ISUPPORTS
nsTextRectangle();
void SetRect(float aX, float aY, float aWidth, float aHeight) {
mX = aX; mY = aY; mWidth = aWidth; mHeight = aHeight;
}
virtual ~nsTextRectangle() {}
NS_DECL_NSIDOMTEXTRECTANGLE
protected:
float mX, mY, mWidth, mHeight;
};
class nsTextRectangleList : public nsIDOMTextRectangleList
{
public:
nsTextRectangleList() {}
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMTEXTRECTANGLELIST
void Append(nsIDOMTextRectangle* aElement) { mArray.AppendObject(aElement); }
protected:
virtual ~nsTextRectangleList() {}
nsCOMArray<nsIDOMTextRectangle> mArray;
};
#endif /*NSTEXTRECTANGLE_H_*/

View File

@ -76,6 +76,8 @@ XPIDLSRCS = \
nsIDOMJSWindow.idl \
nsIDOMChromeWindow.idl \
nsIDOMNSFeatureFactory.idl \
nsIDOMTextRectangle.idl \
nsIDOMTextRectangleList.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -54,6 +54,7 @@ interface nsIDOMElement;
interface nsIDOMEntity;
interface nsIDOMEntityReference;
interface nsIDOMNSDocument;
interface nsIDOMNSElement;
interface nsIDOMNamedNodeMap;
interface nsIDOMNode;
interface nsIDOMNodeList;
@ -62,6 +63,8 @@ interface nsIDOMProcessingInstruction;
interface nsIDOMText;
interface nsIDOMDOMStringList;
interface nsIDOMNameList;
interface nsIDOMTextRectangle;
interface nsIDOMTextRectangleList;
// Needed for raises() in our IDL
interface DOMException;

View File

@ -0,0 +1,48 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Novell code.
*
* The Initial Developer of the Original Code is
* Novell Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert O'Callahan <robert@ocallahan.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
[scriptable, uuid(f8583bbc-c6de-4646-b39f-df7e766442e9)]
interface nsIDOMTextRectangle : nsISupports
{
readonly attribute float left;
readonly attribute float top;
readonly attribute float right;
readonly attribute float bottom;
};

View File

@ -0,0 +1,46 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Novell code.
*
* The Initial Developer of the Original Code is
* Novell Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert O'Callahan <robert@ocallahan.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
[scriptable, uuid(917da19d-62f5-441d-b47e-9e35f05639c9)]
interface nsIDOMTextRectangleList : nsISupports
{
readonly attribute unsigned long length;
nsIDOMTextRectangle item(in unsigned long index);
};

View File

@ -41,7 +41,7 @@
interface nsIDOMNodeList;
[scriptable, uuid(00e28154-cfee-4a85-a6e3-e966fd8ae3bc)]
[scriptable, uuid(cea6f919-7fe6-4bdd-9db6-158d9283f8d3)]
interface nsIDOMNSElement : nsISupports
{
/*
@ -51,4 +51,29 @@ interface nsIDOMNSElement : nsISupports
* See <http://whatwg.org/specs/web-apps/current-work/>
*/
nsIDOMNodeList getElementsByClassName(in DOMString classes);
/*
* Retrieve a list of rectangles, one for each CSS border-box associated with
* the element. The coordinates are in CSS pixels, and relative to
* the top-left of the document's viewport, unless the document
* has an SVG foreignobject ancestor, in which case the coordinates are
* relative to the top-left of the content box of the nearest SVG foreignobject
* ancestor. The coordinates are calculated as if every scrollable element
* is scrolled to its default position.
*
* Note: the boxes of overflowing children do not affect these rectangles.
* Note: some elements have empty CSS boxes. Those return empty rectangles,
* but the coordinates may still be meaningful.
* Note: some elements have no CSS boxes (including display:none elements,
* HTML AREA elements, and SVG elements that do not render). Those return
* an empty list.
*/
nsIDOMTextRectangleList getClientRects();
/**
* Returns the union of all rectangles in the getClientRects() list. Empty
* rectangles are ignored, except that if all rectangles are empty,
* we return an empty rectangle positioned at the top-left of the first
* rectangle in getClientRects().
*/
nsIDOMTextRectangle getBoundingClientRect();
};

View File

@ -380,6 +380,9 @@ enum nsDOMClassInfoID {
eDOMClassInfo_XMLHttpProgressEvent_id,
eDOMClassInfo_XMLHttpRequest_id,
eDOMClassInfo_TextRectangle_id,
eDOMClassInfo_TextRectangleList_id,
// We are now trying to preserve binary compat in classinfo. No more
// putting things in those categories up there. New entries are to be
// added here, which is the end of the things that are currently on by

View File

@ -109,6 +109,8 @@
#include "nsIDOMMediaList.h"
#include "nsIDOMChromeWindow.h"
#include "nsIDOMConstructor.h"
#include "nsIDOMTextRectangle.h"
#include "nsIDOMTextRectangleList.h"
// DOM core includes
#include "nsDOMError.h"
@ -1149,6 +1151,11 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(XMLHttpRequest, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(TextRectangle, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(TextRectangleList, nsTextRectangleListSH,
ARRAY_SCRIPTABLE_FLAGS)
// Define MOZ_SVG_FOREIGNOBJECT here so that when it gets switched on,
// we preserve binary compatibility. New classes should be added
// at the end.
@ -3175,6 +3182,14 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMOfflineResourceList)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(TextRectangle, nsIDOMTextRectangle)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMTextRectangle)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(TextRectangleList, nsIDOMTextRectangleList)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMTextRectangleList)
DOM_CLASSINFO_MAP_END
#ifdef NS_DEBUG
{
PRUint32 i = NS_ARRAY_LENGTH(sClassInfoData);
@ -9673,6 +9688,22 @@ nsCSSRuleListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
return rv;
}
// TextRectangleList scriptable helper
nsresult
nsTextRectangleListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
nsISupports **aResult)
{
nsCOMPtr<nsIDOMTextRectangleList> list(do_QueryInterface(aNative));
NS_ENSURE_TRUE(list, NS_ERROR_UNEXPECTED);
nsIDOMTextRectangle *rule = nsnull; // Weak, transfer the ownership over to aResult
nsresult rv = list->Item(aIndex, &rule);
*aResult = rule;
return rv;
}
#ifdef MOZ_XUL
// TreeColumns helper

View File

@ -1397,6 +1397,31 @@ public:
}
};
// TextRectangleList helper
class nsTextRectangleListSH : public nsArraySH
{
protected:
nsTextRectangleListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
{
}
virtual ~nsTextRectangleListSH()
{
}
// Override nsArraySH::GetItemAt() since our list isn't a
// nsIDOMNodeList
virtual nsresult GetItemAt(nsISupports *aNative, PRUint32 aIndex,
nsISupports **aResult);
public:
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
{
return new nsTextRectangleListSH(aData);
}
};
#ifdef MOZ_XUL
// TreeColumns helper

View File

@ -796,6 +796,17 @@ nsSVGUtils::GetOuterSVGFrame(nsIFrame *aFrame)
return nsnull;
}
nsIFrame*
nsSVGUtils::GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame, nsRect* aRect)
{
nsISVGChildFrame* svg;
CallQueryInterface(aFrame, &svg);
if (!svg)
return nsnull;
*aRect = svg->GetCoveredRegion();
return GetOuterSVGFrame(aFrame);
}
already_AddRefed<nsIDOMSVGMatrix>
nsSVGUtils::GetViewBoxTransform(float aViewportWidth, float aViewportHeight,
float aViewboxX, float aViewboxY,

View File

@ -247,6 +247,14 @@ public:
static nsSVGOuterSVGFrame *
GetOuterSVGFrame(nsIFrame *aFrame);
/**
* Get the covered region for a frame. Return null if it's not an SVG frame.
* @param aRect gets a rectangle in *pixels*
* @return the outer SVG frame which aRect is relative to
*/
static nsIFrame*
GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame, nsRect* aRect);
/* Generate a viewbox to viewport tranformation matrix */
static already_AddRefed<nsIDOMSVGMatrix>