/usr/include/thunderbird/nsClientRect.h is in thunderbird-dev 1:24.4.0+build1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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_
#include "nsIDOMClientRect.h"
#include "nsIDOMClientRectList.h"
#include "nsTArray.h"
#include "nsRect.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h"
class nsClientRect MOZ_FINAL : public nsIDOMClientRect
, public nsWrapperCache
{
public:
nsClientRect(nsISupports* aParent)
: mParent(aParent), mX(0.0), mY(0.0), mWidth(0.0), mHeight(0.0)
{
SetIsDOMBinding();
}
virtual ~nsClientRect() {}
void SetRect(float aX, float aY, float aWidth, float aHeight) {
mX = aX; mY = aY; mWidth = aWidth; mHeight = aHeight;
}
void SetLayoutRect(const nsRect& aLayoutRect);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsClientRect)
NS_DECL_NSIDOMCLIENTRECT
nsISupports* GetParentObject() const
{
MOZ_ASSERT(mParent);
return mParent;
}
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
float Left() const
{
return mX;
}
float Top() const
{
return mY;
}
float Right() const
{
return mX + mWidth;
}
float Bottom() const
{
return mY + mHeight;
}
float Width() const
{
return mWidth;
}
float Height() const
{
return mHeight;
}
protected:
nsCOMPtr<nsISupports> mParent;
float mX, mY, mWidth, mHeight;
};
class nsClientRectList MOZ_FINAL : public nsIDOMClientRectList,
public nsWrapperCache
{
public:
nsClientRectList(nsISupports *aParent) : mParent(aParent)
{
SetIsDOMBinding();
}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsClientRectList)
NS_DECL_NSIDOMCLIENTRECTLIST
virtual JSObject* WrapObject(JSContext *cx,
JS::Handle<JSObject*> scope) MOZ_OVERRIDE;
nsISupports* GetParentObject()
{
return mParent;
}
void Append(nsClientRect* aElement) { mArray.AppendElement(aElement); }
static nsClientRectList* FromSupports(nsISupports* aSupports)
{
#ifdef DEBUG
{
nsCOMPtr<nsIDOMClientRectList> list_qi = do_QueryInterface(aSupports);
// If this assertion fires the QI implementation for the object in
// question doesn't use the nsIDOMClientRectList pointer as the nsISupports
// pointer. That must be fixed, or we'll crash...
NS_ASSERTION(list_qi == static_cast<nsIDOMClientRectList*>(aSupports),
"Uh, fix QI!");
}
#endif
return static_cast<nsClientRectList*>(aSupports);
}
uint32_t Length()
{
return mArray.Length();
}
nsClientRect* Item(uint32_t aIndex)
{
return mArray.SafeElementAt(aIndex);
}
nsClientRect* IndexedGetter(uint32_t aIndex, bool& aFound)
{
aFound = aIndex < mArray.Length();
if (!aFound) {
return nullptr;
}
return mArray[aIndex];
}
protected:
virtual ~nsClientRectList() {}
nsTArray< nsRefPtr<nsClientRect> > mArray;
nsCOMPtr<nsISupports> mParent;
};
#endif /*NSCLIENTRECT_H_*/
|