Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / content / xbl / src / nsXBLProtoImplMember.h
blobe1563d84bff226ce1866cd55d7fb271b41ab53ba
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla Communicator client code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * David Hyatt <hyatt@netscape.com> (Original Author)
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef nsXBLProtoImplMember_h__
40 #define nsXBLProtoImplMember_h__
42 #include "nsIAtom.h"
43 #include "nsString.h"
44 #include "jsapi.h"
45 #include "nsIContent.h"
46 #include "nsString.h"
47 #include "nsIJSRuntimeService.h"
48 #include "nsIServiceManager.h"
49 #include "nsReadableUtils.h"
50 #include "nsCycleCollectionParticipant.h"
52 class nsIScriptContext;
53 struct JSRuntime;
54 class nsIJSRuntimeService;
56 struct nsXBLTextWithLineNumber
58 PRUnichar* mText;
59 PRUint32 mLineNumber;
61 nsXBLTextWithLineNumber() :
62 mText(nsnull),
63 mLineNumber(0)
65 MOZ_COUNT_CTOR(nsXBLTextWithLineNumber);
68 ~nsXBLTextWithLineNumber() {
69 MOZ_COUNT_DTOR(nsXBLTextWithLineNumber);
70 if (mText) {
71 nsMemory::Free(mText);
75 void AppendText(const nsAString& aText) {
76 if (mText) {
77 PRUnichar* temp = mText;
78 mText = ToNewUnicode(nsDependentString(temp) + aText);
79 nsMemory::Free(temp);
80 } else {
81 mText = ToNewUnicode(aText);
85 PRUnichar* GetText() {
86 return mText;
89 void SetLineNumber(PRUint32 aLineNumber) {
90 mLineNumber = aLineNumber;
93 PRUint32 GetLineNumber() {
94 return mLineNumber;
98 class nsXBLProtoImplMember
100 public:
101 nsXBLProtoImplMember(const PRUnichar* aName) :mNext(nsnull) { mName = ToNewUnicode(nsDependentString(aName)); }
102 virtual ~nsXBLProtoImplMember() { nsMemory::Free(mName); delete mNext; }
104 nsXBLProtoImplMember* GetNext() { return mNext; }
105 void SetNext(nsXBLProtoImplMember* aNext) { mNext = aNext; }
107 virtual nsresult InstallMember(nsIScriptContext* aContext,
108 nsIContent* aBoundElement,
109 void* aScriptObject,
110 void* aTargetClassObject,
111 const nsCString& aClassStr) = 0;
112 virtual nsresult CompileMember(nsIScriptContext* aContext,
113 const nsCString& aClassStr,
114 void* aClassObject)=0;
116 virtual void Trace(TraceCallback aCallback, void *aClosure) const = 0;
118 protected:
119 friend class nsAutoGCRoot;
121 nsXBLProtoImplMember* mNext; // The members of an implementation are chained.
122 PRUnichar* mName; // The name of the field, method, or property.
125 #endif // nsXBLProtoImplMember_h__