Skip to content

Commit

Permalink
Bug 916520. Rename nsClientRect(List) to mozilla::dom::DOMRect(List).…
Browse files Browse the repository at this point in the history
… r=khuey

--HG--
rename : content/html/content/src/nsClientRect.cpp => content/base/src/DOMRect.cpp
rename : content/html/content/src/nsClientRect.h => content/base/src/DOMRect.h
rename : dom/webidl/ClientRect.webidl => dom/webidl/DOMRect.webidl
rename : dom/webidl/ClientRectList.webidl => dom/webidl/DOMRectList.webidl
extra : rebase_source : ebe27ef21b38f7df5065f37b971508b740c8cf3c
  • Loading branch information
rocallahan committed Sep 20, 2013
1 parent 2a2b4a5 commit 20613a5
Show file tree
Hide file tree
Showing 39 changed files with 160 additions and 127 deletions.
10 changes: 5 additions & 5 deletions content/base/public/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "nsIScrollableFrame.h"
#include "mozilla/dom/Attr.h"
#include "nsISMILAttr.h"
#include "nsClientRect.h"
#include "mozilla/dom/DOMRect.h"
#include "nsAttrValue.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/BindingDeclarations.h"
Expand All @@ -50,8 +50,6 @@ class nsEventListenerManager;
class nsIScrollableFrame;
class nsAttrValueOrString;
class ContentUnbinder;
class nsClientRect;
class nsClientRectList;
class nsContentList;
class nsDOMTokenList;
struct nsRect;
Expand Down Expand Up @@ -110,6 +108,8 @@ namespace dom {

class Link;
class UndoManager;
class DOMRect;
class DOMRectList;

// IID for the dom::Element interface
#define NS_ELEMENT_IID \
Expand Down Expand Up @@ -647,8 +647,8 @@ class Element : public FragmentOrElement
already_AddRefed<Attr> SetAttributeNodeNS(Attr& aNewAttr,
ErrorResult& aError);

already_AddRefed<nsClientRectList> GetClientRects();
already_AddRefed<nsClientRect> GetBoundingClientRect();
already_AddRefed<DOMRectList> GetClientRects();
already_AddRefed<DOMRect> GetBoundingClientRect();
void ScrollIntoView(bool aTop);
int32_t ScrollTop()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsClientRect.h"
#include "DOMRect.h"

#include "nsPresContext.h"
#include "mozilla/dom/ClientRectListBinding.h"
#include "mozilla/dom/ClientRectBinding.h"
#include "mozilla/dom/DOMRectListBinding.h"
#include "mozilla/dom/DOMRectBinding.h"

using namespace mozilla;
using namespace mozilla::dom;

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(nsClientRect, mParent)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsClientRect)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsClientRect)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsClientRect)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(DOMRect, mParent)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMRect)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMRect)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMRect)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMClientRect)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END

#define FORWARD_GETTER(_name) \
NS_IMETHODIMP \
nsClientRect::Get ## _name(float* aResult) \
DOMRect::Get ## _name(float* aResult) \
{ \
*aResult = _name(); \
return NS_OK; \
Expand All @@ -37,44 +37,44 @@ FORWARD_GETTER(Width)
FORWARD_GETTER(Height)

JSObject*
nsClientRect::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
DOMRect::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
MOZ_ASSERT(mParent);
return ClientRectBinding::Wrap(aCx, aScope, this);
return DOMRectBinding::Wrap(aCx, aScope, this);
}

// -----------------------------------------------------------------------------

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(nsClientRectList, mParent, mArray)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(DOMRectList, mParent, mArray)

NS_INTERFACE_TABLE_HEAD(nsClientRectList)
NS_INTERFACE_TABLE_HEAD(DOMRectList)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_TABLE1(nsClientRectList, nsIDOMClientRectList)
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsClientRectList)
NS_INTERFACE_TABLE1(DOMRectList, nsIDOMClientRectList)
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(DOMRectList)
NS_INTERFACE_MAP_END

NS_IMPL_CYCLE_COLLECTING_ADDREF(nsClientRectList)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsClientRectList)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMRectList)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMRectList)


NS_IMETHODIMP
nsClientRectList::GetLength(uint32_t* aLength)
DOMRectList::GetLength(uint32_t* aLength)
{
*aLength = Length();
return NS_OK;
}

NS_IMETHODIMP
nsClientRectList::Item(uint32_t aIndex, nsIDOMClientRect** aReturn)
DOMRectList::Item(uint32_t aIndex, nsIDOMClientRect** aReturn)
{
NS_IF_ADDREF(*aReturn = Item(aIndex));
return NS_OK;
}

JSObject*
nsClientRectList::WrapObject(JSContext *cx, JS::Handle<JSObject*> scope)
DOMRectList::WrapObject(JSContext *cx, JS::Handle<JSObject*> scope)
{
return mozilla::dom::ClientRectListBinding::Wrap(cx, scope, this);
return mozilla::dom::DOMRectListBinding::Wrap(cx, scope, this);
}

static double
Expand All @@ -84,7 +84,7 @@ RoundFloat(double aValue)
}

void
nsClientRect::SetLayoutRect(const nsRect& aLayoutRect)
DOMRect::SetLayoutRect(const nsRect& aLayoutRect)
{
double scale = 65536.0;
// Round to the nearest 1/scale units. We choose scale so it can be represented
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef NSCLIENTRECT_H_
#define NSCLIENTRECT_H_
#ifndef MOZILLA_DOMRECT_H_
#define MOZILLA_DOMRECT_H_

#include "nsIDOMClientRect.h"
#include "nsIDOMClientRectList.h"
Expand All @@ -17,17 +17,19 @@

struct nsRect;

class nsClientRect MOZ_FINAL : public nsIDOMClientRect
, public nsWrapperCache
namespace mozilla {
namespace dom {

class DOMRect MOZ_FINAL : public nsIDOMClientRect
, public nsWrapperCache
{
public:
nsClientRect(nsISupports* aParent)
DOMRect(nsISupports* aParent)
: mParent(aParent), mX(0.0), mY(0.0), mWidth(0.0), mHeight(0.0)
{
SetIsDOMBinding();
}
virtual ~nsClientRect() {}

virtual ~DOMRect() {}

void SetRect(float aX, float aY, float aWidth, float aHeight) {
mX = aX; mY = aY; mWidth = aWidth; mHeight = aHeight;
Expand All @@ -36,7 +38,7 @@ class nsClientRect MOZ_FINAL : public nsIDOMClientRect


NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsClientRect)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMRect)
NS_DECL_NSIDOMCLIENTRECT


Expand Down Expand Up @@ -84,17 +86,17 @@ class nsClientRect MOZ_FINAL : public nsIDOMClientRect
float mX, mY, mWidth, mHeight;
};

class nsClientRectList MOZ_FINAL : public nsIDOMClientRectList,
public nsWrapperCache
class DOMRectList MOZ_FINAL : public nsIDOMClientRectList,
public nsWrapperCache
{
public:
nsClientRectList(nsISupports *aParent) : mParent(aParent)
DOMRectList(nsISupports *aParent) : mParent(aParent)
{
SetIsDOMBinding();
}

NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsClientRectList)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMRectList)

NS_DECL_NSIDOMCLIENTRECTLIST

Expand All @@ -106,9 +108,9 @@ class nsClientRectList MOZ_FINAL : public nsIDOMClientRectList,
return mParent;
}

void Append(nsClientRect* aElement) { mArray.AppendElement(aElement); }
void Append(DOMRect* aElement) { mArray.AppendElement(aElement); }

static nsClientRectList* FromSupports(nsISupports* aSupports)
static DOMRectList* FromSupports(nsISupports* aSupports)
{
#ifdef DEBUG
{
Expand All @@ -122,18 +124,18 @@ class nsClientRectList MOZ_FINAL : public nsIDOMClientRectList,
}
#endif

return static_cast<nsClientRectList*>(aSupports);
return static_cast<DOMRectList*>(aSupports);
}

uint32_t Length()
{
return mArray.Length();
}
nsClientRect* Item(uint32_t aIndex)
DOMRect* Item(uint32_t aIndex)
{
return mArray.SafeElementAt(aIndex);
}
nsClientRect* IndexedGetter(uint32_t aIndex, bool& aFound)
DOMRect* IndexedGetter(uint32_t aIndex, bool& aFound)
{
aFound = aIndex < mArray.Length();
if (!aFound) {
Expand All @@ -143,10 +145,13 @@ class nsClientRectList MOZ_FINAL : public nsIDOMClientRectList,
}

protected:
virtual ~nsClientRectList() {}
virtual ~DOMRectList() {}

nsTArray< nsRefPtr<nsClientRect> > mArray;
nsTArray< nsRefPtr<DOMRect> > mArray;
nsCOMPtr<nsISupports> mParent;
};

#endif /*NSCLIENTRECT_H_*/
}
}

#endif /*MOZILLA_DOMRECT_H_*/
10 changes: 5 additions & 5 deletions content/base/src/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#include "nsXBLBinding.h"
#include "nsPIDOMWindow.h"
#include "nsPIBoxObject.h"
#include "nsClientRect.h"
#include "mozilla/dom/DOMRect.h"
#include "nsSVGUtils.h"
#include "nsLayoutUtils.h"
#include "nsGkAtoms.h"
Expand Down Expand Up @@ -647,10 +647,10 @@ Element::GetClientAreaRect()
return nsRect(0, 0, 0, 0);
}

already_AddRefed<nsClientRect>
already_AddRefed<DOMRect>
Element::GetBoundingClientRect()
{
nsRefPtr<nsClientRect> rect = new nsClientRect(this);
nsRefPtr<DOMRect> rect = new DOMRect(this);

nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
if (!frame) {
Expand All @@ -665,10 +665,10 @@ Element::GetBoundingClientRect()
return rect.forget();
}

already_AddRefed<nsClientRectList>
already_AddRefed<DOMRectList>
Element::GetClientRects()
{
nsRefPtr<nsClientRectList> rectList = new nsClientRectList(this);
nsRefPtr<DOMRectList> rectList = new DOMRectList(this);

nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
if (!frame) {
Expand Down
1 change: 0 additions & 1 deletion content/base/src/FragmentOrElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
#include "nsXBLBinding.h"
#include "nsPIDOMWindow.h"
#include "nsPIBoxObject.h"
#include "nsClientRect.h"
#include "nsSVGUtils.h"
#include "nsLayoutUtils.h"
#include "nsGkAtoms.h"
Expand Down
2 changes: 2 additions & 0 deletions content/base/src/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ EXPORTS.mozilla.dom += [
'Comment.h',
'DOMImplementation.h',
'DOMParser.h',
'DOMRect.h',
'DocumentFragment.h',
'DocumentType.h',
'EventSource.h',
Expand All @@ -69,6 +70,7 @@ CPP_SOURCES += [
'Attr.cpp',
'Comment.cpp',
'DOMImplementation.cpp',
'DOMRect.cpp',
'DirectionalityUtils.cpp',
'DocumentFragment.cpp',
'DocumentType.cpp',
Expand Down
8 changes: 5 additions & 3 deletions content/base/src/nsDOMCaretPosition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
#include "nsDOMCaretPosition.h"

#include "mozilla/dom/CaretPositionBinding.h"
#include "nsClientRect.h"
#include "mozilla/dom/DOMRect.h"
#include "nsRange.h"

using namespace mozilla::dom;

nsDOMCaretPosition::nsDOMCaretPosition(nsINode* aNode, uint32_t aOffset)
: mOffset(aOffset), mOffsetNode(aNode), mAnonymousContentNode(nullptr)
{
Expand All @@ -23,14 +25,14 @@ nsINode* nsDOMCaretPosition::GetOffsetNode() const
return mOffsetNode;
}

already_AddRefed<nsClientRect>
already_AddRefed<DOMRect>
nsDOMCaretPosition::GetClientRect() const
{
if (!mOffsetNode) {
return nullptr;
}

nsRefPtr<nsClientRect> rect;
nsRefPtr<DOMRect> rect;
nsRefPtr<nsRange> domRange;
nsCOMPtr<nsINode> node;

Expand Down
10 changes: 8 additions & 2 deletions content/base/src/nsDOMCaretPosition.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
#include "nsINode.h"
#include "nsWrapperCache.h"

class nsClientRect;
namespace mozilla {
namespace dom {
class DOMRect;
}
}

/**
* Implementation of a DOM Caret Position, which is a node and offset within
Expand All @@ -23,6 +27,8 @@ class nsClientRect;
class nsDOMCaretPosition : public nsISupports,
public nsWrapperCache
{
typedef mozilla::dom::DOMRect DOMRect;

public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMCaretPosition)
Expand Down Expand Up @@ -55,7 +61,7 @@ class nsDOMCaretPosition : public nsISupports,
* CaretPosition, if one can be successfully determined, otherwise
* nullptr.
*/
already_AddRefed<nsClientRect> GetClientRect() const;
already_AddRefed<DOMRect> GetClientRect() const;

/**
* Set the anonymous content node that is the actual parent of this
Expand Down
1 change: 0 additions & 1 deletion content/base/src/nsINode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "nsAttrValueOrString.h"
#include "nsBindingManager.h"
#include "nsCCUncollectableMarker.h"
#include "nsClientRect.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentList.h"
#include "nsContentUtils.h"
Expand Down
Loading

0 comments on commit 20613a5

Please sign in to comment.