Landing fix for bug 198533. Patch by smaug@welho.com. Making nsXULElement inherit nsGenericElement. r=bugmail@sicking.cc, sr=jst@mozilla.org

This commit is contained in:
jst%mozilla.jstenback.com 2005-01-14 19:30:55 +00:00
Родитель fb791fa16f
Коммит 418d87fcec
6 изменённых файлов: 313 добавлений и 1202 удалений

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

@ -1296,7 +1296,14 @@ nsGenericElement::GetAttribute(const nsAString& aName,
const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
if (!name) {
SetDOMStringToNull(aReturn);
if (mNodeInfo->NamespaceID() == kNameSpaceID_XUL) {
// XXX should be SetDOMStringToNull(aReturn);
// See bug 232598
aReturn.Truncate();
}
else {
SetDOMStringToNull(aReturn);
}
return NS_OK;
}

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

@ -63,6 +63,7 @@ class nsDOMAttributeMap;
class nsIURI;
class nsVoidArray;
class nsINodeInfo;
class nsIControllers;
typedef unsigned long PtrBits;
@ -88,8 +89,11 @@ typedef unsigned long PtrBits;
/** Whether this content has had any properties set on it */
#define GENERIC_ELEMENT_HAS_PROPERTIES 0x00000010U
/** Three bits are element type specific. */
#define ELEMENT_TYPE_SPECIFIC_BITS_OFFSET 5
/** The number of bits to shift the bit field to get at the content ID */
#define GENERIC_ELEMENT_CONTENT_ID_BITS_OFFSET 5
#define GENERIC_ELEMENT_CONTENT_ID_BITS_OFFSET 8
/** This mask masks out the bits that are used for the content ID */
#define GENERIC_ELEMENT_CONTENT_ID_MASK \
@ -168,11 +172,18 @@ public:
*/
nsRefPtr<nsDOMAttributeMap> mAttributeMap;
/**
* The nearest enclosing content node with a binding that created us.
* @see nsGenericElement::GetBindingParent
*/
nsIContent* mBindingParent; // [Weak]
union {
/**
* The nearest enclosing content node with a binding that created us.
* @see nsGenericElement::GetBindingParent
*/
nsIContent* mBindingParent; // [Weak]
/**
* The controllers of the XUL Element.
*/
nsIControllers* mControllers; // [OWNER]
};
// DEPRECATED, DON'T USE THIS
PRUint32 mContentID;

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

@ -67,6 +67,7 @@
#include "nsIURI.h"
#include "nsIIOService.h"
#include "nsNetUtil.h"
#include "nsIProgressEventSink.h"
#include "nsIContentViewerContainer.h"
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
@ -3451,6 +3452,16 @@ nsHTMLDocument::CreateAndAddWyciwygChannel(void)
rv = loadGroup->AddRequest(mWyciwygChannel, nsnull);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to add request to load group.");
/*
nsCOMPtr<nsIInterfaceRequestor> interfaceRequestor;
loadGroup->GetNotificationCallbacks(getter_AddRefs(interfaceRequestor));
nsCOMPtr<nsIProgressEventSink> progressSink =
do_GetInterface(interfaceRequestor);
progressSink->OnProgress(mWyciwygChannel, nsnull, 1, -1);
*/
}
return rv;

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

@ -1,117 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Peter Annema <disttsc@bart.nl>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
Private interface to XUL content.
*/
#ifndef nsIXULContent_h__
#define nsIXULContent_h__
#include "nsIXMLContent.h"
class nsIAtom;
class nsIRDFCompositeDataSource;
class nsIXULTemplateBuilder;
class nsString;
// {39C5ECC0-5C47-11d3-BE36-00104BDE6048}
#define NS_IXULCONTENT_IID \
{ 0x316f8e9d, 0x8d1e, 0x433d, { 0xa2, 0xdd, 0xb5, 0xc0, 0x83, 0xb3, 0x56, 0x13 } }
class nsIXULContent : public nsIXMLContent
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXULCONTENT_IID)
/**
* Peek at a XUL element's child count without forcing children to be
* instantiated.
*/
NS_IMETHOD_(PRUint32) PeekChildCount() const = 0;
/**
* These flags are used to maintain bookkeeping information for partially-
* constructed content.
*
* eChildrenMustBeRebuilt
* The element's children are invalid or unconstructed, and should
* be reconstructed.
*
* eTemplateContentsBuilt
* Child content that is built from a XUL template has been
* constructed.
*
* eContainerContentsBuilt
* Child content that is built by following the ``containment''
* property in a XUL template has been built.
*/
enum LazyState {
eChildrenMustBeRebuilt = 0x1,
eTemplateContentsBuilt = 0x2,
eContainerContentsBuilt = 0x4
};
/**
* Set one or more ``lazy state'' flags.
* @aFlags a mask of flags to set
*/
NS_IMETHOD SetLazyState(LazyState aFlags) = 0;
/**
* Clear one or more ``lazy state'' flags.
* @aFlags a mask of flags to clear
*/
NS_IMETHOD ClearLazyState(LazyState aFlags) = 0;
/**
* Get the value of a single ``lazy state'' flag.
* @aFlag a flag to test
* @aResult the result
*/
NS_IMETHOD GetLazyState(LazyState aFlag, PRBool& aResult) = 0;
/**
* Add a script event listener to the element.
*/
NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsAString& aValue) = 0;
};
#endif // nsIXULContent_h__

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -400,7 +400,8 @@ public:
*/
class nsXULElement : public nsIXULContent,
class nsXULElement : public nsGenericElement,
public nsIXULContent,
public nsIDOMXULElement,
public nsIScriptEventHandlerOwner,
public nsIChromeEventHandler
@ -429,24 +430,11 @@ public:
PRBool aIsScriptable, nsIContent** aResult);
// nsISupports
NS_DECL_ISUPPORTS
NS_DECL_ISUPPORTS_INHERITED
// nsIContent (from nsIStyledContent)
nsIDocument *GetDocument() const
{
return mDocument;
}
// nsIContent
virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers);
PRBool IsInDoc() const
{
return !!mDocument;
}
nsIDocument *GetOwnerDoc() const
{
return mDocument ? mDocument : NodeInfo()->GetDocument();
}
virtual void SetParent(nsIContent* aParent);
virtual PRBool IsNativeAnonymous() const;
virtual void SetNativeAnonymous(PRBool aAnonymous);
virtual PRUint32 GetChildCount() const;
@ -457,9 +445,6 @@ public:
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify,
PRBool aDeepSetDocument);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual PRInt32 GetNameSpaceID() const;
virtual nsIAtom *Tag() const;
virtual nsINodeInfo *GetNodeInfo() const;
virtual nsIAtom *GetIDAttributeName() const;
virtual nsIAtom *GetClassAttributeName() const;
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
@ -502,17 +487,8 @@ public:
virtual nsIContent *GetBindingParent() const;
virtual nsresult SetBindingParent(nsIContent* aParent);
virtual PRBool IsContentOfType(PRUint32 aFlags) const;
virtual already_AddRefed<nsIURI> GetBaseURI() const;
virtual nsresult GetListenerManager(nsIEventListenerManager** aResult);
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
virtual void* GetProperty(nsIAtom *aPropertyName,
nsresult *aStatus = nsnull) const;
virtual nsresult SetProperty(nsIAtom *aPropertyName,
void *aValue,
NSPropertyDtorFunc aDtor);
virtual nsresult DeleteProperty(nsIAtom *aPropertyName);
virtual void* UnsetProperty(nsIAtom *aPropertyName,
nsresult *aStatus = nsnull);
// nsIXMLContent
NS_IMETHOD MaybeTriggerAutoLink(nsIDocShell *aShell);
@ -536,11 +512,11 @@ public:
NS_IMETHOD GetLazyState(LazyState aFlag, PRBool& aValue);
NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsAString& aValue);
// nsIDOMNode (from nsIDOMElement)
NS_DECL_NSIDOMNODE
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericElement::)
// nsIDOMElement
NS_DECL_NSIDOMELEMENT
NS_FORWARD_NSIDOMELEMENT(nsGenericElement::)
// nsIDOMXULElement
NS_DECL_NSIDOMXULELEMENT
@ -560,7 +536,7 @@ public:
protected:
nsXULElement();
nsXULElement(nsINodeInfo* aNodeInfo);
nsresult Init();
virtual ~nsXULElement(void);
@ -580,18 +556,9 @@ protected:
nsresult AddPopupListener(nsIAtom* aName);
nsIContent* GetParent() const {
// Override nsIContent::GetParent to be more efficient internally,
// we don't use the low 2 bits of mParentPtrBits for anything.
return NS_REINTERPRET_CAST(nsIContent *, mParentPtrBits);
}
protected:
// Required fields
nsXULPrototypeElement* mPrototype;
nsIDocument* mDocument;
nsAttrAndChildArray mAttrsAndChildren; // [OWNER]
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
/**
@ -600,32 +567,6 @@ protected:
*/
nsIContent* mBindingParent;
/**
* Lazily instantiated if/when object is mutated. mAttributes are
* lazily copied from the prototype when changed.
*/
struct Slots {
Slots();
~Slots();
nsCOMPtr<nsINodeInfo> mNodeInfo; // [OWNER]
nsCOMPtr<nsIControllers> mControllers; // [OWNER]
nsRefPtr<nsDOMCSSDeclaration> mDOMStyle; // [OWNER]
nsRefPtr<nsDOMAttributeMap> mAttributeMap; // [OWNER]
nsRefPtr<nsChildContentList> mChildNodes; // [OWNER]
unsigned mLazyState : 3;
unsigned mHasProperties : 1;
};
friend struct Slots;
Slots* mSlots;
/**
* Ensure that we've got an mSlots object, creating a Slots object
* if necessary.
*/
nsresult EnsureSlots();
/**
* Abandon our prototype linkage, and copy all attributes locally
*/
@ -662,11 +603,12 @@ protected:
const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const;
protected:
// Internal accessors. These shadow the 'Slots', and return
// appropriate default values if there are no slots defined in the
// delegate.
nsINodeInfo *NodeInfo() const { return mSlots ? mSlots->mNodeInfo : mPrototype->mNodeInfo; }
nsIControllers *Controllers() const { return mSlots ? mSlots->mControllers.get() : nsnull; }
// Internal accessor. This shadows the 'Slots', and returns
// appropriate value.
nsIControllers *Controllers() {
nsDOMSlots* slots = GetExistingDOMSlots();
return slots ? slots->mControllers : nsnull;
}
void UnregisterAccessKey(const nsAString& aOldValue);