mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 777706 - Backout new dom bindings for touchlists. r=smaug
This commit is contained in:
parent
19cd7abe78
commit
3dc27a7f5b
@ -8439,8 +8439,7 @@ NS_IMETHODIMP
|
|||||||
nsDocument::CreateTouchList(nsIVariant* aPoints,
|
nsDocument::CreateTouchList(nsIVariant* aPoints,
|
||||||
nsIDOMTouchList** aRetVal)
|
nsIDOMTouchList** aRetVal)
|
||||||
{
|
{
|
||||||
nsRefPtr<nsDOMTouchList> retval =
|
nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList();
|
||||||
new nsDOMTouchList(static_cast<nsIDocument*>(this));
|
|
||||||
if (aPoints) {
|
if (aPoints) {
|
||||||
PRUint16 type;
|
PRUint16 type;
|
||||||
aPoints->GetDataType(&type);
|
aPoints->GetDataType(&type);
|
||||||
|
@ -128,13 +128,16 @@ nsDOMTouch::Equals(nsIDOMTouch* aTouch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TouchList
|
// TouchList
|
||||||
|
nsDOMTouchList::nsDOMTouchList(nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches)
|
||||||
|
{
|
||||||
|
mPoints.AppendElements(aTouches);
|
||||||
|
}
|
||||||
|
|
||||||
DOMCI_DATA(TouchList, nsDOMTouchList)
|
DOMCI_DATA(TouchList, nsDOMTouchList)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMTouchList)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMTouchList)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouchList)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouchList)
|
||||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTouchList)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMTouchList)
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TouchList)
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TouchList)
|
||||||
@ -142,16 +145,9 @@ NS_INTERFACE_MAP_END
|
|||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMTouchList)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMTouchList)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_OF_NSCOMPTR(mPoints)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_OF_NSCOMPTR(mPoints)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mParent)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMTouchList)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMTouchList)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMTouchList)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mPoints)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mPoints)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mParent)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTouchList)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTouchList)
|
||||||
@ -167,7 +163,7 @@ nsDOMTouchList::GetLength(PRUint32* aLength)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMTouchList::Item(PRUint32 aIndex, nsIDOMTouch** aRetVal)
|
nsDOMTouchList::Item(PRUint32 aIndex, nsIDOMTouch** aRetVal)
|
||||||
{
|
{
|
||||||
NS_IF_ADDREF(*aRetVal = nsDOMTouchList::GetItemAt(aIndex));
|
NS_IF_ADDREF(*aRetVal = mPoints.SafeElementAt(aIndex, nsnull));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,12 +183,6 @@ nsDOMTouchList::IdentifiedTouch(PRInt32 aIdentifier, nsIDOMTouch** aRetVal)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIDOMTouch*
|
|
||||||
nsDOMTouchList::GetItemAt(PRUint32 aIndex)
|
|
||||||
{
|
|
||||||
return mPoints.SafeElementAt(aIndex, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TouchEvent
|
// TouchEvent
|
||||||
|
|
||||||
nsDOMTouchEvent::nsDOMTouchEvent(nsPresContext* aPresContext,
|
nsDOMTouchEvent::nsDOMTouchEvent(nsPresContext* aPresContext,
|
||||||
@ -297,11 +287,9 @@ nsDOMTouchEvent::GetTouches(nsIDOMTouchList** aTouches)
|
|||||||
unchangedTouches.AppendElement(touches[i]);
|
unchangedTouches.AppendElement(touches[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t = new nsDOMTouchList(static_cast<nsIDOMTouchEvent*>(this),
|
t = new nsDOMTouchList(unchangedTouches);
|
||||||
unchangedTouches);
|
|
||||||
} else {
|
} else {
|
||||||
t = new nsDOMTouchList(static_cast<nsIDOMTouchEvent*>(this),
|
t = new nsDOMTouchList(touchEvent->touches);
|
||||||
touchEvent->touches);
|
|
||||||
}
|
}
|
||||||
mTouches = t;
|
mTouches = t;
|
||||||
return CallQueryInterface(mTouches, aTouches);
|
return CallQueryInterface(mTouches, aTouches);
|
||||||
@ -331,8 +319,7 @@ nsDOMTouchEvent::GetTargetTouches(nsIDOMTouchList** aTargetTouches)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mTargetTouches = new nsDOMTouchList(static_cast<nsIDOMTouchEvent*>(this),
|
mTargetTouches = new nsDOMTouchList(targetTouches);
|
||||||
targetTouches);
|
|
||||||
return CallQueryInterface(mTargetTouches, aTargetTouches);
|
return CallQueryInterface(mTargetTouches, aTargetTouches);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,8 +341,7 @@ nsDOMTouchEvent::GetChangedTouches(nsIDOMTouchList** aChangedTouches)
|
|||||||
changedTouches.AppendElement(touches[i]);
|
changedTouches.AppendElement(touches[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mChangedTouches = new nsDOMTouchList(static_cast<nsIDOMTouchEvent*>(this),
|
mChangedTouches = new nsDOMTouchList(changedTouches);
|
||||||
changedTouches);
|
|
||||||
return CallQueryInterface(mChangedTouches, aChangedTouches);
|
return CallQueryInterface(mChangedTouches, aChangedTouches);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
#include "nsIDOMTouchEvent.h"
|
#include "nsIDOMTouchEvent.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "nsIDocument.h"
|
|
||||||
#include "dombindings.h"
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
|
||||||
class nsDOMTouch MOZ_FINAL : public nsIDOMTouch
|
class nsDOMTouch MOZ_FINAL : public nsIDOMTouch
|
||||||
@ -99,46 +97,28 @@ protected:
|
|||||||
bool mPointsInitialized;
|
bool mPointsInitialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsDOMTouchList MOZ_FINAL : public nsIDOMTouchList,
|
class nsDOMTouchList : public nsIDOMTouchList
|
||||||
public nsWrapperCache
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTouchList)
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMTouchList)
|
||||||
NS_DECL_NSIDOMTOUCHLIST
|
NS_DECL_NSIDOMTOUCHLIST
|
||||||
|
|
||||||
nsDOMTouchList(nsISupports *aParent) : mParent(aParent)
|
nsDOMTouchList() { }
|
||||||
{
|
nsDOMTouchList(nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches);
|
||||||
SetIsDOMBinding();
|
|
||||||
}
|
|
||||||
nsDOMTouchList(nsISupports *aParent,
|
|
||||||
nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches)
|
|
||||||
: mPoints(aTouches),
|
|
||||||
mParent(aParent)
|
|
||||||
{
|
|
||||||
SetIsDOMBinding();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
|
||||||
bool *triedToWrap)
|
|
||||||
{
|
|
||||||
return mozilla::dom::binding::TouchList::create(cx, scope, this,
|
|
||||||
triedToWrap);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsISupports *GetParentObject()
|
|
||||||
{
|
|
||||||
return mParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Append(nsIDOMTouch* aPoint)
|
void Append(nsIDOMTouch* aPoint)
|
||||||
{
|
{
|
||||||
mPoints.AppendElement(aPoint);
|
mPoints.AppendElement(aPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsIDOMTouch* GetItemAt(PRUint32 aIndex)
|
||||||
|
{
|
||||||
|
return mPoints.SafeElementAt(aIndex, nsnull);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsTArray<nsCOMPtr<nsIDOMTouch> > mPoints;
|
nsTArray<nsCOMPtr<nsIDOMTouch> > mPoints;
|
||||||
nsCOMPtr<nsISupports> mParent;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsDOMTouchEvent : public nsDOMUIEvent,
|
class nsDOMTouchEvent : public nsDOMUIEvent,
|
||||||
|
@ -1633,8 +1633,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||||||
|
|
||||||
NS_DEFINE_CLASSINFO_DATA(Touch, nsDOMGenericSH,
|
NS_DEFINE_CLASSINFO_DATA(Touch, nsDOMGenericSH,
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||||
NS_DEFINE_CLASSINFO_DATA(TouchList, nsDOMGenericSH,
|
NS_DEFINE_CLASSINFO_DATA(TouchList, nsDOMTouchListSH,
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
ARRAY_SCRIPTABLE_FLAGS)
|
||||||
NS_DEFINE_CLASSINFO_DATA(TouchEvent, nsDOMGenericSH,
|
NS_DEFINE_CLASSINFO_DATA(TouchEvent, nsDOMGenericSH,
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||||
|
|
||||||
@ -4887,6 +4887,14 @@ nsDOMClassInfo::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsISupports*
|
||||||
|
nsDOMTouchListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||||
|
nsWrapperCache **aCache, nsresult *aResult)
|
||||||
|
{
|
||||||
|
nsDOMTouchList* list = static_cast<nsDOMTouchList*>(aNative);
|
||||||
|
return list->GetItemAt(aIndex);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMClassInfo::Convert(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
nsDOMClassInfo::Convert(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||||
JSObject *obj, PRUint32 type, jsval *vp,
|
JSObject *obj, PRUint32 type, jsval *vp,
|
||||||
|
@ -1216,6 +1216,27 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class nsDOMTouchListSH : public nsArraySH
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
nsDOMTouchListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~nsDOMTouchListSH()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||||
|
nsWrapperCache **aCache, nsresult *aResult);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static nsIClassInfo* doCreate(nsDOMClassInfoData* aData)
|
||||||
|
{
|
||||||
|
return new nsDOMTouchListSH(aData);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
// TreeColumns helper
|
// TreeColumns helper
|
||||||
|
|
||||||
|
@ -41,8 +41,7 @@ interface nsIDOMTouch : nsISupports {
|
|||||||
[scriptable, uuid(60706eb7-d50d-4379-b01c-e78e6af84213)]
|
[scriptable, uuid(60706eb7-d50d-4379-b01c-e78e6af84213)]
|
||||||
interface nsIDOMTouchList : nsISupports {
|
interface nsIDOMTouchList : nsISupports {
|
||||||
readonly attribute unsigned long length;
|
readonly attribute unsigned long length;
|
||||||
[getter,forward(getItemAt)] nsIDOMTouch item(in unsigned long index);
|
nsIDOMTouch item(in unsigned long index);
|
||||||
[noscript,notxpcom,nostdcall] nsIDOMTouch getItemAt(in unsigned long index);
|
|
||||||
nsIDOMTouch identifiedTouch(in long identifier);
|
nsIDOMTouch identifiedTouch(in long identifier);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -186,6 +186,7 @@ members = [
|
|||||||
'nsIDOMUIEvent.isChar',
|
'nsIDOMUIEvent.isChar',
|
||||||
|
|
||||||
'nsIDOMTouch.*',
|
'nsIDOMTouch.*',
|
||||||
|
'nsIDOMTouchList.*',
|
||||||
'nsIDOMTouchEvent.*',
|
'nsIDOMTouchEvent.*',
|
||||||
|
|
||||||
# dom/interfaces/geolocation - None.
|
# dom/interfaces/geolocation - None.
|
||||||
|
@ -40,10 +40,6 @@ list_classes = [
|
|||||||
'name': 'PaintRequestList',
|
'name': 'PaintRequestList',
|
||||||
'nativeClass': 'nsPaintRequestList'
|
'nativeClass': 'nsPaintRequestList'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'name': 'TouchList',
|
|
||||||
'nativeClass': 'nsDOMTouchList'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'FileList',
|
'name': 'FileList',
|
||||||
'nativeClass': 'nsDOMFileList'
|
'nativeClass': 'nsDOMFileList'
|
||||||
@ -78,9 +74,6 @@ irregularFilenames = {
|
|||||||
'mozilla::dom::PropertyNodeList': 'HTMLPropertiesCollection',
|
'mozilla::dom::PropertyNodeList': 'HTMLPropertiesCollection',
|
||||||
'nsClientRectList': 'nsClientRect',
|
'nsClientRectList': 'nsClientRect',
|
||||||
'nsPaintRequestList': 'nsPaintRequest',
|
'nsPaintRequestList': 'nsPaintRequest',
|
||||||
'nsIDOMTouch': 'nsIDOMTouchEvent',
|
|
||||||
'nsIDOMTouchList': 'nsIDOMTouchEvent',
|
|
||||||
'nsDOMTouchList': 'nsDOMTouchEvent',
|
|
||||||
'nsDOMFileList': 'nsDOMFile',
|
'nsDOMFileList': 'nsDOMFile',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user