diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 501503d20a4..bf1a720fad1 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -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) diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index a4343f6840b..463ad252283 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -781,6 +781,9 @@ public: // nsIApplicationCacheContainer NS_DECL_NSIAPPLICATIONCACHECONTAINER + // nsITouchEventReceiver + NS_DECL_NSITOUCHEVENTRECEIVER + // nsIDOMDocumentTouch NS_DECL_NSIDOMDOCUMENTTOUCH diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 1c79a8d85ac..b12879fa431 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -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(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(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(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,24 +3065,13 @@ 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. - DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGDocument) - DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES - DOM_CLASSINFO_MAP_END - } + 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_DOCUMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END // SVG element classes diff --git a/dom/interfaces/events/nsIDOMTouchEvent.idl b/dom/interfaces/events/nsIDOMTouchEvent.idl index 7001a769595..04ac09b20ce 100644 --- a/dom/interfaces/events/nsIDOMTouchEvent.idl +++ b/dom/interfaces/events/nsIDOMTouchEvent.idl @@ -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,