Bug 659350 part 1. Add an nsITouchEventReceiver interface that will hold the touch-related on* properties, make it possible to declare conditional interfaces in classinfo, and make this new interface conditional on the touch event preference for documents. r=smaug,peterv

This commit is contained in:
Boris Zbarsky 2011-08-24 15:49:25 -04:00
Родитель 2c9c9acd1a
Коммит c9098f5a15
4 изменённых файлов: 52 добавлений и 61 удалений

Просмотреть файл

@ -1701,6 +1701,7 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIMutationObserver)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIApplicationCacheContainer)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentTouch)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsITouchEventReceiver)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDocument)

Просмотреть файл

@ -781,6 +781,9 @@ public:
// nsIApplicationCacheContainer
NS_DECL_NSIAPPLICATIONCACHECONTAINER
// nsITouchEventReceiver
NS_DECL_NSITOUCHEVENTRECEIVER
// nsIDOMDocumentTouch
NS_DECL_NSIDOMDOCUMENTTOUCH

Просмотреть файл

@ -2171,10 +2171,28 @@ nsDOMClassInfo::RegisterExternalClasses()
#define DOM_CLASSINFO_MAP_ENTRY(_if) \
&NS_GET_IID(_if),
#define DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(_if, _cond) \
(_cond) ? &NS_GET_IID(_if) : nsnull,
#define DOM_CLASSINFO_MAP_END \
nsnull \
}; \
\
/* Compact the interface list */ \
size_t count = NS_ARRAY_LENGTH(interface_list); \
/* count is the number of array entries, which is one greater than the */ \
/* number of interfaces due to the terminating null */ \
for (size_t i = 0; i < count - 1; ++i) { \
if (!interface_list[i]) { \
memmove(&interface_list[i], &interface_list[i+1], \
sizeof(nsIID*) * (count - i)); \
/* Make sure to examine the new pointer we ended up with at this */ \
/* slot, since it may be null too */ \
--i; \
--count; \
} \
} \
\
d.mInterfaces = interface_list; \
}
@ -2182,7 +2200,9 @@ nsDOMClassInfo::RegisterExternalClasses()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathEvaluator) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeSelector)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeSelector) \
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMDocumentTouch, \
nsDOMTouchEvent::PrefEnabled())
#define DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES \
@ -2354,20 +2374,11 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
DOM_CLASSINFO_MAP_END
if (nsDOMTouchEvent::PrefEnabled()) {
DOM_CLASSINFO_MAP_BEGIN(XMLDocument, nsIDOMXMLDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXMLDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTouch)
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
} else {
DOM_CLASSINFO_MAP_BEGIN(XMLDocument, nsIDOMXMLDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXMLDocument)
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
}
DOM_CLASSINFO_MAP_BEGIN(DocumentType, nsIDOMDocumentType)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentType)
@ -2519,18 +2530,10 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_EVENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
if (nsDOMTouchEvent::PrefEnabled()) {
DOM_CLASSINFO_MAP_BEGIN(HTMLDocument, nsIDOMHTMLDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTouch)
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
} else {
DOM_CLASSINFO_MAP_BEGIN(HTMLDocument, nsIDOMHTMLDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDocument)
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
}
DOM_CLASSINFO_MAP_BEGIN(HTMLOptionsCollection, nsIDOMHTMLOptionsCollection)
// Order is significant. nsIDOMHTMLOptionsCollection.length shadows
@ -2929,20 +2932,11 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_END
#ifdef MOZ_XUL
if (nsDOMTouchEvent::PrefEnabled()) {
DOM_CLASSINFO_MAP_BEGIN(XULDocument, nsIDOMXULDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTouch)
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
} else {
DOM_CLASSINFO_MAP_BEGIN(XULDocument, nsIDOMXULDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULDocument)
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
}
DOM_CLASSINFO_MAP_BEGIN(XULElement, nsIDOMXULElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULElement)
@ -3071,16 +3065,6 @@ nsDOMClassInfo::Init()
// The SVG document
if (nsDOMTouchEvent::PrefEnabled()) {
DOM_CLASSINFO_MAP_BEGIN(SVGDocument, nsIDOMSVGDocument)
// Order is significant. nsIDOMDocument.title shadows
// nsIDOMSVGDocument.title, which is readonly.
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTouch)
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
} else {
DOM_CLASSINFO_MAP_BEGIN(SVGDocument, nsIDOMSVGDocument)
// Order is significant. nsIDOMDocument.title shadows
// nsIDOMSVGDocument.title, which is readonly.
@ -3088,7 +3072,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGDocument)
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
}
// SVG element classes

Просмотреть файл

@ -88,8 +88,12 @@ interface nsIDOMTouchEvent : nsIDOMUIEvent {
in nsIDOMTouchList changedTouches);
};
[scriptable, uuid(804a3851-ea2e-4e5f-bedd-315f37f31ab1)]
interface nsIDOMDocumentTouch : nsISupports {
[scriptable, uuid(6d5484f7-92ac-45f8-9388-39b5bad055ce)]
interface nsITouchEventReceiver : nsISupports {
};
[scriptable, uuid(974cff68-6f0b-4520-8523-fa68b2754656)]
interface nsIDOMDocumentTouch : nsITouchEventReceiver {
nsIDOMTouch createTouch([optional] in nsIDOMWindow view,
[optional] in nsIDOMEventTarget target,
[optional] in long identifier,