Back out fixes for bug 560462 to fix orange.

--HG--
extra : rebase_source : afe96ede6fc605c656b746f6388d6144886b18ed
This commit is contained in:
Peter Van der Beken 2010-05-11 19:20:03 +02:00
Родитель e2cb647e9e
Коммит 34f855c0b2
13 изменённых файлов: 174 добавлений и 321 удалений

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

@ -192,8 +192,6 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
// FOR CSP (autogenerated by xpidl)
#include "nsIContentSecurityPolicy.h"
#include "nsHTMLStyleSheet.h"
#include "nsHTMLCSSStyleSheet.h"
#include "mozilla/dom/Link.h"
using namespace mozilla::dom;
@ -3916,47 +3914,26 @@ nsDocument::GetElementByIdInternal(nsIAtom* aID)
return entry;
}
Element*
nsDocument::GetElementById(const nsAString& aElementId, nsresult *aResult)
NS_IMETHODIMP
nsDocument::GetElementById(const nsAString& aElementId,
nsIDOMElement** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsCOMPtr<nsIAtom> idAtom(do_GetAtom(aElementId));
if (!idAtom) {
*aResult = NS_ERROR_OUT_OF_MEMORY;
return nsnull;
}
if (!CheckGetElementByIdArg(idAtom)) {
*aResult = NS_OK;
return nsnull;
}
NS_ENSURE_TRUE(idAtom, NS_ERROR_OUT_OF_MEMORY);
if (!CheckGetElementByIdArg(idAtom))
return NS_OK;
nsIdentifierMapEntry *entry = GetElementByIdInternal(idAtom);
if (!entry) {
*aResult = NS_ERROR_OUT_OF_MEMORY;
NS_ENSURE_TRUE(entry, NS_ERROR_OUT_OF_MEMORY);
return nsnull;
}
Element *e = entry->GetIdElement();
if (!e)
return NS_OK;
*aResult = NS_OK;
return entry->GetIdElement();
}
NS_IMETHODIMP
nsDocument::GetElementById(const nsAString& aId, nsIDOMElement** aReturn)
{
nsresult rv;
Element *content = GetElementById(aId, &rv);
if (content) {
rv = CallQueryInterface(content, aReturn);
}
else {
*aReturn = nsnull;
}
return rv;
return CallQueryInterface(e, aReturn);
}
nsIContent*
@ -4408,65 +4385,43 @@ nsDocument::CreateEntityReference(const nsAString& aName,
return NS_OK;
}
already_AddRefed<nsContentList>
nsDocument::GetElementsByTagName(const nsAString& aTagname)
{
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aTagname);
if (IsHTML()) {
nsAutoString tmp(aTagname);
ToLowerCase(tmp); // HTML elements are lower case internally.
nameAtom = do_GetAtom(tmp);
}
else {
nameAtom = do_GetAtom(aTagname);
}
NS_ENSURE_TRUE(nameAtom, nsnull);
return NS_GetContentList(this, nameAtom, kNameSpaceID_Unknown);
}
NS_IMETHODIMP
nsDocument::GetElementsByTagName(const nsAString& aTagname,
nsIDOMNodeList** aReturn)
{
nsRefPtr<nsContentList> list = GetElementsByTagName(aTagname);
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aTagname);
NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY);
nsContentList *list = NS_GetContentList(this, nameAtom, kNameSpaceID_Unknown).get();
NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY);
// transfer ref to aReturn
*aReturn = list.forget().get();
*aReturn = list;
return NS_OK;
}
already_AddRefed<nsContentList>
nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName)
{
PRInt32 nameSpaceId = kNameSpaceID_Wildcard;
if (!aNamespaceURI.EqualsLiteral("*")) {
nsresult rv =
nsContentUtils::NameSpaceManager()->RegisterNameSpace(aNamespaceURI,
nameSpaceId);
NS_ENSURE_SUCCESS(rv, nsnull);
}
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aLocalName);
NS_ENSURE_TRUE(nameAtom, nsnull);
return NS_GetContentList(this, nameAtom, nameSpaceId);
}
NS_IMETHODIMP
nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
nsIDOMNodeList** aReturn)
{
nsRefPtr<nsContentList> list = GetElementsByTagNameNS(aNamespaceURI,
aLocalName);
PRInt32 nameSpaceId = kNameSpaceID_Wildcard;
if (!aNamespaceURI.EqualsLiteral("*")) {
nsresult rv =
nsContentUtils::NameSpaceManager()->RegisterNameSpace(aNamespaceURI,
nameSpaceId);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aLocalName);
NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY);
nsContentList *list = NS_GetContentList(this, nameAtom, nameSpaceId).get();
NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY);
// transfer ref to aReturn
*aReturn = list.forget().get();
*aReturn = list;
return NS_OK;
}

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

@ -95,7 +95,13 @@
#include "nsGkAtoms.h"
#include "nsIApplicationCache.h"
#include "nsIApplicationCacheContainer.h"
// Put these here so all document impls get them automatically
#include "nsHTMLStyleSheet.h"
#include "nsHTMLCSSStyleSheet.h"
#include "nsStyleSet.h"
#include "nsXMLEventsManager.h"
#include "pldhash.h"
#include "nsAttrAndChildArray.h"
#include "nsDOMAttributeMap.h"
@ -129,9 +135,6 @@ struct nsRadioGroupStruct;
class nsOnloadBlocker;
class nsUnblockOnloadEvent;
class nsChildContentList;
class nsXMLEventsManager;
class nsHTMLStyleSheet;
class nsHTMLCSSStyleSheet;
/**
* Right now our identifier map entries contain information for 'name'
@ -927,15 +930,6 @@ public:
// Only BlockOnload should call this!
void AsyncBlockOnload();
already_AddRefed<nsContentList>
GetElementsByTagName(const nsAString& aTagName);
already_AddRefed<nsContentList>
GetElementsByTagNameNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName);
virtual mozilla::dom::Element *GetElementById(const nsAString& aElementId,
nsresult *aResult);
protected:
friend class nsNodeUtils;
void RegisterNamedItems(nsIContent *aContent);

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

@ -1389,7 +1389,11 @@ NS_IMETHODIMP
nsHTMLDocument::GetElementsByTagName(const nsAString& aTagname,
nsIDOMNodeList** aReturn)
{
return nsDocument::GetElementsByTagName(aTagname, aReturn);
nsAutoString tmp(aTagname);
if (IsHTML()) {
ToLowerCase(tmp); // HTML elements are lower case internally.
}
return nsDocument::GetElementsByTagName(tmp, aReturn);
}
// nsIDOM3Document interface implementation
@ -1577,48 +1581,37 @@ nsHTMLDocument::GetURL(nsAString& aURL)
return NS_OK;
}
nsIContent*
nsHTMLDocument::GetBody(nsresult *aResult)
{
Element* body = GetBodyElement();
*aResult = NS_OK;
if (body) {
// There is a body element, return that as the body.
return body;
}
// The document is most likely a frameset document so look for the
// outer most frameset element
nsRefPtr<nsContentList> nodeList;
if (IsHTML()) {
nodeList = nsDocument::GetElementsByTagName(NS_LITERAL_STRING("frameset"));
} else {
nodeList =
nsDocument::GetElementsByTagNameNS(NS_LITERAL_STRING("http://www.w3.org/1999/xhtml"),
NS_LITERAL_STRING("frameset"));
}
if (!nodeList) {
*aResult = NS_ERROR_OUT_OF_MEMORY;
return nsnull;
}
return nodeList->GetNodeAt(0);
}
NS_IMETHODIMP
nsHTMLDocument::GetBody(nsIDOMHTMLElement** aBody)
{
*aBody = nsnull;
nsresult rv;
nsIContent *body = GetBody(&rv);
Element* body = GetBodyElement();
return body ? CallQueryInterface(body, aBody) : rv;
if (body) {
// There is a body element, return that as the body.
return CallQueryInterface(body, aBody);
}
// The document is most likely a frameset document so look for the
// outer most frameset element
nsCOMPtr<nsIDOMNodeList> nodeList;
nsresult rv;
if (IsHTML()) {
rv = GetElementsByTagName(NS_LITERAL_STRING("frameset"),
getter_AddRefs(nodeList));
} else {
rv = GetElementsByTagNameNS(NS_LITERAL_STRING("http://www.w3.org/1999/xhtml"),
NS_LITERAL_STRING("frameset"),
getter_AddRefs(nodeList));
}
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> node;
nodeList->Item(0, getter_AddRefs(node));
return node ? CallQueryInterface(node, aBody) : NS_OK;
}
NS_IMETHODIMP
@ -2294,11 +2287,18 @@ NS_IMETHODIMP
nsHTMLDocument::GetElementsByName(const nsAString& aElementName,
nsIDOMNodeList** aReturn)
{
nsRefPtr<nsContentList> list = GetElementsByName(aElementName);
NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY);
nsString* elementNameData = new nsString(aElementName);
NS_ENSURE_TRUE(elementNameData, NS_ERROR_OUT_OF_MEMORY);
nsContentList* elements =
NS_GetFuncStringContentList(this,
MatchNameAttribute,
nsContentUtils::DestroyMatchString,
elementNameData,
*elementNameData).get();
NS_ENSURE_TRUE(elements, NS_ERROR_OUT_OF_MEMORY);
// Transfer ownership
list.forget(aReturn);
*aReturn = elements;
return NS_OK;
}

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

@ -160,17 +160,6 @@ public:
nsIDOMNodeList **_retval);
virtual nsresult GetDocumentAllResult(const nsAString& aID,
nsISupports** aResult);
nsIContent *GetBody(nsresult *aResult);
already_AddRefed<nsContentList> GetElementsByName(const nsAString & aName)
{
nsString* elementNameData = new nsString(aName);
return NS_GetFuncStringContentList(this,
MatchNameAttribute,
nsContentUtils::DestroyMatchString,
elementNameData,
*elementNameData);
}
// nsIDOMNSHTMLDocument interface
NS_DECL_NSIDOMNSHTMLDOCUMENT
@ -239,12 +228,6 @@ public:
virtual NS_HIDDEN_(void) RemovedFromDocShell();
virtual mozilla::dom::Element *GetElementById(const nsAString& aElementId,
nsresult *aResult)
{
return nsDocument::GetElementById(aElementId, aResult);
}
protected:
nsresult GetBodySize(PRInt32* aWidth,
PRInt32* aHeight);

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

@ -187,10 +187,10 @@ struct BroadcastListener {
nsCOMPtr<nsIAtom> mAttribute;
};
Element*
nsRefMapEntry::GetFirstElement()
nsIContent*
nsRefMapEntry::GetFirstContent()
{
return static_cast<Element*>(mRefContentList.SafeElementAt(0));
return static_cast<nsIContent*>(mRefContentList.SafeElementAt(0));
}
void
@ -202,17 +202,17 @@ nsRefMapEntry::AppendAll(nsCOMArray<nsIContent>* aElements)
}
PRBool
nsRefMapEntry::AddElement(Element* aElement)
nsRefMapEntry::AddContent(nsIContent* aContent)
{
if (mRefContentList.IndexOf(aElement) >= 0)
if (mRefContentList.IndexOf(aContent) >= 0)
return PR_TRUE;
return mRefContentList.AppendElement(aElement);
return mRefContentList.AppendElement(aContent);
}
PRBool
nsRefMapEntry::RemoveElement(Element* aElement)
nsRefMapEntry::RemoveContent(nsIContent* aContent)
{
mRefContentList.RemoveElement(aElement);
mRefContentList.RemoveElement(aContent);
return mRefContentList.Count() == 0;
}
@ -978,7 +978,7 @@ nsXULDocument::AttributeWillChange(nsIDocument* aDocument,
// See if we need to update our ref map.
if (aAttribute == nsGkAtoms::ref ||
(aAttribute == nsGkAtoms::id && !aContent->GetIDAttributeName())) {
RemoveElementFromRefMap(aContent->AsElement());
RemoveElementFromRefMap(aContent);
}
nsXMLDocument::AttributeWillChange(aDocument, aContent, aNameSpaceID,
@ -1323,7 +1323,7 @@ nsXULDocument::Persist(const nsAString& aID,
nsresult rv;
nsCOMPtr<nsIDOMElement> domelement;
rv = nsDocument::GetElementById(aID, getter_AddRefs(domelement));
rv = GetElementById(aID, getter_AddRefs(domelement));
if (NS_FAILED(rv)) return rv;
if (! domelement)
@ -1660,34 +1660,33 @@ nsXULDocument::GetCommandDispatcher(nsIDOMXULCommandDispatcher** aTracker)
return NS_OK;
}
Element*
nsXULDocument::GetElementById(const nsAString& aId, nsresult *aResult)
NS_IMETHODIMP
nsXULDocument::GetElementById(const nsAString& aId,
nsIDOMElement** aReturn)
{
nsCOMPtr<nsIAtom> atom(do_GetAtom(aId));
if (!atom) {
*aResult = NS_ERROR_OUT_OF_MEMORY;
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
return nsnull;
}
*aResult = NS_OK;
nsCOMPtr<nsIAtom> atom = do_GetAtom(aId);
if (!atom)
return NS_ERROR_OUT_OF_MEMORY;
if (!CheckGetElementByIdArg(atom))
return nsnull;
return NS_OK;
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(atom);
if (entry) {
Element* element = entry->GetIdElement();
if (element)
return element;
return CallQueryInterface(element, aReturn);
}
nsRefMapEntry* refEntry = mRefMap.GetEntry(atom);
if (refEntry) {
NS_ASSERTION(refEntry->GetFirstElement(),
NS_ASSERTION(refEntry->GetFirstContent(),
"nsRefMapEntries should have nonempty content lists");
return refEntry->GetFirstElement();
return CallQueryInterface(refEntry->GetFirstContent(), aReturn);
}
return nsnull;
return NS_OK;
}
nsresult
@ -1899,7 +1898,7 @@ nsXULDocument::GetTemplateBuilderFor(nsIContent* aContent,
}
static void
GetRefMapAttribute(Element* aElement, nsAutoString* aValue)
GetRefMapAttribute(nsIContent* aElement, nsAutoString* aValue)
{
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::ref, *aValue);
if (aValue->IsEmpty() && !aElement->GetIDAttributeName()) {
@ -1908,7 +1907,7 @@ GetRefMapAttribute(Element* aElement, nsAutoString* aValue)
}
nsresult
nsXULDocument::AddElementToRefMap(Element* aElement)
nsXULDocument::AddElementToRefMap(nsIContent* aElement)
{
// Look at the element's 'ref' attribute, and if set,
// add an entry in the resource-to-element map to the element.
@ -1921,7 +1920,7 @@ nsXULDocument::AddElementToRefMap(Element* aElement)
nsRefMapEntry *entry = mRefMap.PutEntry(atom);
if (!entry)
return NS_ERROR_OUT_OF_MEMORY;
if (!entry->AddElement(aElement))
if (!entry->AddContent(aElement))
return NS_ERROR_OUT_OF_MEMORY;
}
@ -1929,7 +1928,7 @@ nsXULDocument::AddElementToRefMap(Element* aElement)
}
void
nsXULDocument::RemoveElementFromRefMap(Element* aElement)
nsXULDocument::RemoveElementFromRefMap(nsIContent* aElement)
{
// Remove the element from the resource-to-element map.
nsAutoString value;
@ -1941,7 +1940,7 @@ nsXULDocument::RemoveElementFromRefMap(Element* aElement)
nsRefMapEntry *entry = mRefMap.GetEntry(atom);
if (!entry)
return;
if (entry->RemoveElement(aElement)) {
if (entry->RemoveContent(aElement)) {
mRefMap.RemoveEntry(atom);
}
}

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

@ -90,17 +90,17 @@ public:
NS_ERROR("Should never be called");
}
mozilla::dom::Element* GetFirstElement();
nsIContent* GetFirstContent();
void AppendAll(nsCOMArray<nsIContent>* aElements);
/**
* @return true if aElement was added, false if we failed due to OOM
* @return true if aContent was added, false if we failed due to OOM
*/
PRBool AddElement(mozilla::dom::Element* aElement);
PRBool AddContent(nsIContent* aContent);
/**
* @return true if aElement was removed and it was the last content for
* @return true if aContent was removed and it was the last content for
* this ref, so this entry should be removed from the map
*/
PRBool RemoveElement(mozilla::dom::Element* aElement);
PRBool RemoveContent(nsIContent* aContent);
private:
nsSmallVoidArray mRefContentList;
@ -165,13 +165,9 @@ public:
// nsIDOMNode interface overrides
NS_IMETHOD CloneNode(PRBool deep, nsIDOMNode **_retval);
// nsDocument interface overrides
NS_IMETHOD GetElementById(const nsAString& aId, nsIDOMElement** aReturn)
{
return nsDocument::GetElementById(aId, aReturn);
}
virtual mozilla::dom::Element* GetElementById(const nsAString & elementId,
nsresult *aResult);
// nsIDOMDocument interface overrides
NS_IMETHOD GetElementById(const nsAString & elementId,
nsIDOMElement **_retval);
// nsIDOMXULDocument interface
NS_DECL_NSIDOMXULDOCUMENT
@ -211,9 +207,9 @@ protected:
nsresult StartLayout(void);
nsresult
AddElementToRefMap(mozilla::dom::Element* aElement);
AddElementToRefMap(nsIContent* aElement);
void
RemoveElementFromRefMap(mozilla::dom::Element* aElement);
RemoveElementFromRefMap(nsIContent* aElement);
nsresult GetViewportSize(PRInt32* aWidth, PRInt32* aHeight);

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

@ -74,20 +74,16 @@ enum nsDOMClassInfoID {
* to that interface from the *canonical* nsISupports!
*/
#define DOMCI_CASTABLE_INTERFACES(_extra) \
DOMCI_CASTABLE_INTERFACE(nsINode, nsINode, 0, _extra) \
DOMCI_CASTABLE_INTERFACE(nsIContent, nsIContent, 1, _extra) \
DOMCI_CASTABLE_INTERFACE(nsIDocument, nsIDocument, 2, _extra) \
DOMCI_CASTABLE_INTERFACE(nsINodeList, nsINodeList, 3, _extra) \
DOMCI_CASTABLE_INTERFACE(nsICSSDeclaration, nsICSSDeclaration, 4, _extra) \
DOMCI_CASTABLE_INTERFACE(nsGenericTextNode, nsGenericTextNode, 5, _extra) \
DOMCI_CASTABLE_INTERFACE(nsDocument, nsIDocument, 6, _extra) \
DOMCI_CASTABLE_INTERFACE(nsGenericHTMLElement, nsGenericHTMLElement, 7, \
_extra) \
DOMCI_CASTABLE_INTERFACE(nsHTMLDocument, nsIDocument, 8, _extra)
DOMCI_CASTABLE_INTERFACE(nsINode, 0, _extra) \
DOMCI_CASTABLE_INTERFACE(nsIContent, 1, _extra) \
DOMCI_CASTABLE_INTERFACE(nsIDocument, 2, _extra) \
DOMCI_CASTABLE_INTERFACE(nsINodeList, 3, _extra) \
DOMCI_CASTABLE_INTERFACE(nsICSSDeclaration, 4, _extra) \
DOMCI_CASTABLE_INTERFACE(nsGenericTextNode, 5, _extra)
// Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
// have been declared.
#define DOMCI_CASTABLE_INTERFACE(_interface, _u1, _u2, _u3) class _interface;
#define DOMCI_CASTABLE_INTERFACE(_interface, _u1, _u2) class _interface;
DOMCI_CASTABLE_INTERFACES(unused)
#undef DOMCI_CASTABLE_INTERFACE
@ -139,7 +135,7 @@ template <typename Interface> struct DOMCI_CastableTo {
/**
* Here we calculate the bitmap for a given class.
*/
#define DOMCI_CASTABLE_INTERFACE(_interface, _base, _bit, _class) \
#define DOMCI_CASTABLE_INTERFACE(_interface, _bit, _class) \
(DOMCI_CASTABLE_TO(_interface, _class) ? 1 << _bit : 0) +
#define DOMCI_DATA(_dom_class, _class) \

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

@ -121,9 +121,6 @@ LOCAL_INCLUDES = \
-I$(topsrcdir)/js/src/nanojit \
-I$(topsrcdir)/caps/include \
-I$(topsrcdir)/content/base/src \
-I$(topsrcdir)/content/html/content/src \
-I$(topsrcdir)/content/html/document/src \
-I$(topsrcdir)/layout/style \
$(NULL)
EXTRA_DSO_LDOPTS += \

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

@ -141,7 +141,8 @@ members = [
'nsIDOMNode.removeChild',
'nsIDOMNode.hasAttributes',
'nsIDOMNode.attributes',
'nsIDOMNodeList.*',
'nsIDOMNodeList.item',
'nsIDOMNodeList.length',
'nsIDOMNodeSelector.querySelector',
'nsIDOMNodeSelector.querySelectorAll',
'nsIDOMText.splitText',
@ -149,7 +150,9 @@ members = [
'nsIDOM3Document.adoptNode',
'nsIDOM3Document.renameNode',
'nsIDOM3Node.*',
'nsIDOMDOMStringList.*',
'nsIDOMDOMStringList.item',
'nsIDOMDOMStringList.length',
'nsIDOMDOMStringList.contains',
'nsIDOMDOMTokenList.*',
'nsIDOMDOMSettableTokenList.*',
'nsIDOMNameList.getName',
@ -180,17 +183,20 @@ members = [
'nsIDOMNSElement.mozMatchesSelector',
# dom/interfaces/css
'nsIDOMElementCSSInlineStyle.*',
'nsIDOMElementCSSInlineStyle.style',
'nsIDOMCSS2Properties.*',
'nsIDOMNSCSS2Properties.*',
'nsIDOMRect.*',
'nsIDOMRect.top',
'nsIDOMRect.right',
'nsIDOMRect.left',
'nsIDOMRect.bottom',
'nsIDOMViewCSS.getComputedStyle',
# dom/interfaces/events
'nsIDOMEventTarget.dispatchEvent',
'nsIDOMEventTarget.removeEventListener',
'nsIDOMNSEventTarget.addEventListener',
'nsIDOMDocumentEvent.*',
'nsIDOMDocumentEvent.createEvent',
'nsIDOMEvent.*',
'nsIDOMMouseEvent.*',
@ -495,11 +501,8 @@ customIncludes = [
'nsIDocument.h',
'nsINodeList.h',
'nsCSSPropertiesQS.h',
'nsDocument.h',
'nsGenericDOMDataNode.h',
'nsGenericElement.h',
'nsGenericHTMLElement.h',
'nsHTMLDocument.h',
'nsDOMQS.h',
]
@ -623,42 +626,17 @@ customMethodCalls = {
' if(NS_FAILED(rv))\n'
' result = nsnull;'
},
'nsIDOMNode_GetNodeType': {
'thisType': 'nsINode',
'canFail': False
},
'nsIDOMNodeList_Item': {
'thisType': 'nsINodeList',
'code': ' nsINode *result = self->GetNodeAt(arg0);',
'canFail': False
},
'nsIDOMNodeList_GetLength': {
'thisType': 'nsINodeList'
},
'nsIDOMHTMLDocument_': {
'thisType': 'nsHTMLDocument'
},
'nsIDOMHTMLDocument_Write': {
'thisType': 'nsHTMLDocument',
'code': nsIDOMHTMLDocument_Write_customMethodCallCode % 'Write'
},
'nsIDOMHTMLDocument_Writeln': {
'thisType': 'nsHTMLDocument',
'code': nsIDOMHTMLDocument_Write_customMethodCallCode % 'Writeln'
},
'nsIDOMHTMLDocument_GetBody': {
'thisType': 'nsHTMLDocument',
'code': ' nsIContent *result = self->GetBody(&rv);'
},
'nsIDOMHTMLDocument_GetElementsByName': {
'thisType': 'nsHTMLDocument',
'code': ' nsRefPtr<nsContentList> result = '
'self->GetElementsByName(arg0);',
'canFail': False
},
'nsIDOMNSHTMLDocument_': {
'thisType': 'nsHTMLDocument'
},
'nsIDOMStorage_Clear': {
'code': nsIDOMStorage_Clear_customMethodCallCode
},
@ -668,7 +646,13 @@ customMethodCalls = {
'nsIDOMCanvasRenderingContext2D_FillStyle': { 'skipgen': True },
'nsIDOMCSS2Properties_': CSS2Properties_,
'nsIDOMNSCSS2Properties_': CSS2Properties_,
'nsIDOMNSElement_': {
'nsIDOMNSElement_GetClientRects': {
'thisType': 'nsGenericElement'
},
'nsIDOMNSElement_GetBoundingClientRect': {
'thisType': 'nsGenericElement'
},
'nsIDOMNSElement_GetElementsByClassName': {
'thisType': 'nsGenericElement'
},
'nsIDOMNSElement_GetScrollWidth': {
@ -709,9 +693,6 @@ customMethodCalls = {
'code': ' PRBool result = self->MozMatchesSelector(arg0);',
'canFail': False
},
'nsIDOM3Text_': {
'thisType': 'nsGenericTextNode'
},
'nsIDOM3Text_IsElementContentWhitespace': {
'thisType': 'nsGenericTextNode',
'code': ' PRBool result = self->IsElementContentWhitespace();',
@ -722,6 +703,9 @@ customMethodCalls = {
'code': ' nsIContent* result = '
'self->ReplaceWholeText(PromiseFlatString(arg0), &rv);'
},
'nsIDOM3Text_WholeText': {
'thisType': 'nsGenericTextNode'
},
'nsIDOMNodeSelector_QuerySelector': {
'thisType': 'nsINode',
'code': ' nsIContent* result = '
@ -733,9 +717,6 @@ customMethodCalls = {
' rv = nsGenericElement::doQuerySelectorAll(self, '
'arg0, getter_AddRefs(result));'
},
'nsIDOM3Node_': {
'thisType': 'nsINode'
},
'nsIDOM3Node_GetBaseURI': {
'thisType': 'nsINode',
'canFail': False
@ -748,6 +729,9 @@ customMethodCalls = {
'thisType': 'nsINode',
'canFail': False
},
'nsIDOM3Node_SetTextContent': {
'thisType': 'nsINode'
},
'nsIDOM3Node_IsSameNode': {
'thisType': 'nsINode',
'arg0Type': 'nsINode',
@ -773,41 +757,16 @@ customMethodCalls = {
'code': ' PRBool result = self->IsEqualNode(arg0);',
'canFail': False
},
'nsIDOM3Node_GetFeature': {
'thisType': 'nsINode'
},
'nsIDOM3Node_GetUserData': {
'thisType': 'nsINode',
'code': ' nsIVariant *result = self->GetUserData(arg0);',
'canFail': False
},
'nsIDOMNSHTMLElement_': {
'thisType': 'nsGenericHTMLElement'
},
'nsIDOMDocument_': {
'thisType': 'nsDocument'
},
'nsIDOMDocument_GetElementById': {
'thisType': 'nsDocument',
'code': ' mozilla::dom::Element *result = self->GetElementById(arg0, &rv);'
},
'nsIDOMDocument_GetElementsByTagName': {
'thisType': 'nsDocument',
'code': ' nsRefPtr<nsContentList> result ='
'self->GetElementsByTagName(arg0);',
'canFail': False
},
'nsIDOMDocument_GetElementsByTagNameNS': {
'thisType': 'nsDocument',
'code': ' nsRefPtr<nsContentList> result ='
'self->GetElementsByTagNameNS(arg0, arg1);',
'canFail': False
},
'nsIDOMNSDocument_': {
'thisType': 'nsDocument'
},
'nsIDOM3Document_': {
'thisType': 'nsDocument'
},
'nsIDOMElement_': {
'thisType': 'nsGenericElement'
'nsIDOM3Node_SetUserData': {
'thisType': 'nsINode'
},
# WebGL
'nsICanvasRenderingContextWebGL_BufferData': CUSTOM_QS,

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

@ -39,7 +39,7 @@
#include "nsDOMClassInfoID.h"
#define DEFINE_UNWRAP_CAST(_interface, _base, _bit) \
#define DEFINE_UNWRAP_CAST(_interface, _bit) \
NS_SPECIALIZE_TEMPLATE \
inline JSBool \
xpc_qsUnwrapThis<_interface>(JSContext *cx, \
@ -56,7 +56,7 @@ xpc_qsUnwrapThis<_interface>(JSContext *cx, \
&rv); \
if(!native) \
return xpc_qsThrow(cx, rv); \
*ppThis = static_cast<_interface*>(static_cast<_base*>(native)); \
*ppThis = static_cast<_interface*>(native); \
return JS_TRUE; \
} \
\
@ -72,12 +72,12 @@ xpc_qsUnwrapArg<_interface>(JSContext *cx, \
nsISupports *native = castNativeArgFromWrapper(cx, v, _bit, ppArgRef, vp, \
&rv); \
if(NS_SUCCEEDED(rv)) \
*ppArg = static_cast<_interface*>(static_cast<_base*>(native)); \
*ppArg = static_cast<_interface*>(native); \
return rv; \
}
#define DOMCI_CASTABLE_INTERFACE(_interface, _base, _bit, _extra) \
DEFINE_UNWRAP_CAST(_interface, _base, _bit)
#define DOMCI_CASTABLE_INTERFACE(_interface, _bit, _extra) \
DEFINE_UNWRAP_CAST(_interface, _bit)
DOMCI_CASTABLE_INTERFACES(unused)
@ -139,10 +139,4 @@ xpc_qsUnwrapArg<nsGenericElement>(JSContext *cx,
return rv;
}
inline nsISupports*
ToSupports(nsContentList *p)
{
return static_cast<nsINodeList*>(p);
}
#endif /* nsDOMQS_h__ */

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

@ -680,9 +680,9 @@ def writeResultConv(f, type, jsvalPtr, jsvalRef):
% jsvalPtr)
return
else:
f.write(" return xpc_qsXPCOMObjectToJsval(lccx, "
"ToSupports(result), xpc_qsGetWrapperCache(result), "
"&NS_GET_IID(%s), &interfaces[k_%s], %s);\n"
f.write(" return xpc_qsXPCOMObjectToJsval(lccx, result, "
"xpc_qsGetWrapperCache(result), &NS_GET_IID(%s), "
"&interfaces[k_%s], %s);\n"
% (type.name, type.name, jsvalPtr))
return
@ -742,16 +742,6 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
if customMethodCall is None:
customMethodCall = customMethodCalls.get(member.iface.name + '_', None)
if customMethodCall is not None:
if isMethod:
code = customMethodCall.get('code', None)
elif isGetter:
code = customMethodCall.get('getter_code', None)
else:
code = customMethodCall.get('setter_code', None)
else:
code = None
if code is not None:
templateName = member.iface.name
if isGetter:
templateName += '_Get'
@ -785,9 +775,15 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
return
customMethodCall[templateGenerated] = True
if isMethod:
code = customMethodCall['code']
elif isGetter:
code = customMethodCall['getter_code']
else:
code = customMethodCall['setter_code']
stubName = templateName
else:
callTemplate = ""
code = None
else:
callTemplate = ""
code = customMethodCall.get('code', None)
@ -907,8 +903,7 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
if debugGetter:
f.write("#ifdef DEBUG\n")
f.write(" nsresult debug_rv;\n")
f.write(" nsCOMPtr<%s> debug_self;\n"
" CallQueryInterface(self, getter_AddRefs(debug_self));\n"
f.write(" nsCOMPtr<%s> debug_self = do_QueryInterface(self);\n"
% member.iface.name);
prefix = 'debug_'
else:
@ -1201,10 +1196,10 @@ def writeTraceableResultConv(f, type):
f.write(" JSBool ok = xpc_qsVariantToJsval(lccx, result, "
"&vp.array[0]);\n")
else:
f.write(" JSBool ok = xpc_qsXPCOMObjectToJsval(lccx, "
"ToSupports(result), xpc_qsGetWrapperCache(result), "
"&NS_GET_IID(%s), &interfaces[k_%s], &vp.array[0]);\n"
% (type.name, type.name))
f.write(" JSBool ok = xpc_qsXPCOMObjectToJsval(lccx, result, "
"xpc_qsGetWrapperCache(result), &NS_GET_IID(%s), "
"&interfaces[k_%s], &vp.array[0]);"
"\n" % (type.name, type.name))
f.write(" if (!ok) {\n");
writeFailure(f, getTraceInfoDefaultReturn(type), 2)
f.write(" return vp.array[0];\n")
@ -1226,12 +1221,6 @@ def writeTraceableQuickStub(f, customMethodCalls, member, stubName):
customMethodCall = customMethodCalls.get(stubName, None)
if customMethodCall is None:
customMethodCall = customMethodCalls.get(member.iface.name + '_', None)
if customMethodCall is not None:
# We don't support traceable templated quickstubs yet
assert not 'code' in customMethodCall
if customMethodCall is not None and customMethodCall.get('skipgen', False):
return

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

@ -560,12 +560,6 @@ xpc_qsVariantToJsval(XPCLazyCallContext &ccx,
nsIVariant *p,
jsval *rval);
inline nsISupports*
ToSupports(nsISupports *p)
{
return p;
}
#ifdef DEBUG
void
xpc_qsAssertContextOK(JSContext *cx);

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

@ -389,7 +389,6 @@ class nsStyleSet
};
#ifdef _IMPL_NS_LAYOUT
inline
void nsRuleNode::AddRef()
{
@ -406,5 +405,3 @@ void nsRuleNode::Release()
}
}
#endif
#endif