Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
/*
7
8
The base XUL element class and associates.
9
10
*/
11
12
#ifndef nsXULElement_h__
13
#define nsXULElement_h__
14
15
#include "js/SourceText.h"
16
#include "js/TracingAPI.h"
17
#include "mozilla/Attributes.h"
18
#include "nsAtom.h"
19
#include "mozilla/dom/NodeInfo.h"
20
#include "nsIControllers.h"
21
#include "nsIURI.h"
22
#include "nsLayoutCID.h"
23
#include "AttrArray.h"
24
#include "nsGkAtoms.h"
25
#include "nsStringFwd.h"
26
#include "nsStyledElement.h"
27
#include "mozilla/dom/DOMRect.h"
28
#include "mozilla/dom/Element.h"
29
#include "mozilla/dom/DOMString.h"
30
#include "mozilla/dom/FromParser.h"
31
32
class nsXULPrototypeDocument;
33
34
class nsIObjectInputStream;
35
class nsIObjectOutputStream;
36
class nsIOffThreadScriptReceiver;
37
class nsXULPrototypeNode;
38
typedef nsTArray<RefPtr<nsXULPrototypeNode>> nsPrototypeArray;
39
40
namespace mozilla {
41
class EventChainPreVisitor;
42
class EventListenerManager;
43
namespace css {
44
class StyleRule;
45
} // namespace css
46
namespace dom {
47
class HTMLIFrameElement;
48
class PrototypeDocumentContentSink;
49
enum class CallerType : uint32_t;
50
} // namespace dom
51
} // namespace mozilla
52
53
////////////////////////////////////////////////////////////////////////
54
55
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
56
# define XUL_PROTOTYPE_ATTRIBUTE_METER(counter) \
57
(nsXULPrototypeAttribute::counter++)
58
#else
59
# define XUL_PROTOTYPE_ATTRIBUTE_METER(counter) ((void)0)
60
#endif
61
62
/**
63
64
A prototype attribute for an nsXULPrototypeElement.
65
66
*/
67
68
class nsXULPrototypeAttribute {
69
public:
70
nsXULPrototypeAttribute()
71
: mName(nsGkAtoms::id) // XXX this is a hack, but names have to have a
72
// value
73
{
74
XUL_PROTOTYPE_ATTRIBUTE_METER(gNumAttributes);
75
MOZ_COUNT_CTOR(nsXULPrototypeAttribute);
76
}
77
78
~nsXULPrototypeAttribute();
79
80
nsAttrName mName;
81
nsAttrValue mValue;
82
83
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
84
static uint32_t gNumElements;
85
static uint32_t gNumAttributes;
86
static uint32_t gNumCacheTests;
87
static uint32_t gNumCacheHits;
88
static uint32_t gNumCacheSets;
89
static uint32_t gNumCacheFills;
90
#endif /* !XUL_PROTOTYPE_ATTRIBUTE_METERING */
91
};
92
93
/**
94
95
A prototype content model element that holds the "primordial" values
96
that have been parsed from the original XUL document.
97
98
*/
99
100
class nsXULPrototypeNode {
101
public:
102
enum Type { eType_Element, eType_Script, eType_Text, eType_PI };
103
104
Type mType;
105
106
virtual nsresult Serialize(
107
nsIObjectOutputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
108
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) = 0;
109
virtual nsresult Deserialize(
110
nsIObjectInputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
111
nsIURI* aDocumentURI,
112
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) = 0;
113
114
/**
115
* The prototype document must call ReleaseSubtree when it is going
116
* away. This makes the parents through the tree stop owning their
117
* children, whether or not the parent's reference count is zero.
118
* Individual elements may still own individual prototypes, but
119
* those prototypes no longer remember their children to allow them
120
* to be constructed.
121
*/
122
virtual void ReleaseSubtree() {}
123
124
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsXULPrototypeNode)
125
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsXULPrototypeNode)
126
127
protected:
128
explicit nsXULPrototypeNode(Type aType) : mType(aType) {}
129
virtual ~nsXULPrototypeNode() {}
130
};
131
132
class nsXULPrototypeElement : public nsXULPrototypeNode {
133
public:
134
explicit nsXULPrototypeElement(mozilla::dom::NodeInfo* aNodeInfo = nullptr)
135
: nsXULPrototypeNode(eType_Element),
136
mNodeInfo(aNodeInfo),
137
mHasIdAttribute(false),
138
mHasClassAttribute(false),
139
mHasStyleAttribute(false),
140
mIsAtom(nullptr) {}
141
142
private:
143
virtual ~nsXULPrototypeElement() { Unlink(); }
144
145
public:
146
virtual void ReleaseSubtree() override {
147
for (int32_t i = mChildren.Length() - 1; i >= 0; i--) {
148
if (mChildren[i].get()) mChildren[i]->ReleaseSubtree();
149
}
150
mChildren.Clear();
151
nsXULPrototypeNode::ReleaseSubtree();
152
}
153
154
virtual nsresult Serialize(
155
nsIObjectOutputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
156
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
157
virtual nsresult Deserialize(
158
nsIObjectInputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
159
nsIURI* aDocumentURI,
160
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
161
162
nsresult SetAttrAt(uint32_t aPos, const nsAString& aValue,
163
nsIURI* aDocumentURI);
164
165
void Unlink();
166
167
// Trace all scripts held by this element and its children.
168
void TraceAllScripts(JSTracer* aTrc);
169
170
nsPrototypeArray mChildren;
171
172
RefPtr<mozilla::dom::NodeInfo> mNodeInfo;
173
174
uint32_t mHasIdAttribute : 1;
175
uint32_t mHasClassAttribute : 1;
176
uint32_t mHasStyleAttribute : 1;
177
nsTArray<nsXULPrototypeAttribute> mAttributes; // [OWNER]
178
RefPtr<nsAtom> mIsAtom;
179
};
180
181
class nsXULPrototypeScript : public nsXULPrototypeNode {
182
public:
183
explicit nsXULPrototypeScript(uint32_t aLineNo);
184
185
private:
186
virtual ~nsXULPrototypeScript();
187
188
public:
189
virtual nsresult Serialize(
190
nsIObjectOutputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
191
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
192
nsresult SerializeOutOfLine(nsIObjectOutputStream* aStream,
193
nsXULPrototypeDocument* aProtoDoc);
194
virtual nsresult Deserialize(
195
nsIObjectInputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
196
nsIURI* aDocumentURI,
197
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
198
nsresult DeserializeOutOfLine(nsIObjectInputStream* aInput,
199
nsXULPrototypeDocument* aProtoDoc);
200
201
nsresult Compile(const char16_t* aText, size_t aTextLength,
202
JS::SourceOwnership aOwnership, nsIURI* aURI,
203
uint32_t aLineNo, mozilla::dom::Document* aDocument,
204
nsIOffThreadScriptReceiver* aOffThreadReceiver = nullptr);
205
206
void UnlinkJSObjects();
207
208
void Set(JSScript* aObject);
209
210
bool HasScriptObject() {
211
// Conversion to bool doesn't trigger mScriptObject's read barrier.
212
return mScriptObject;
213
}
214
215
JSScript* GetScriptObject() { return mScriptObject; }
216
217
void TraceScriptObject(JSTracer* aTrc) {
218
JS::TraceEdge(aTrc, &mScriptObject, "active window XUL prototype script");
219
}
220
221
void Trace(const TraceCallbacks& aCallbacks, void* aClosure) {
222
if (mScriptObject) {
223
aCallbacks.Trace(&mScriptObject, "mScriptObject", aClosure);
224
}
225
}
226
227
nsCOMPtr<nsIURI> mSrcURI;
228
uint32_t mLineNo;
229
bool mSrcLoading;
230
bool mOutOfLine;
231
mozilla::dom::PrototypeDocumentContentSink*
232
mSrcLoadWaiters; // [OWNER] but not COMPtr
233
private:
234
JS::Heap<JSScript*> mScriptObject;
235
};
236
237
class nsXULPrototypeText : public nsXULPrototypeNode {
238
public:
239
nsXULPrototypeText() : nsXULPrototypeNode(eType_Text) {}
240
241
private:
242
virtual ~nsXULPrototypeText() {}
243
244
public:
245
virtual nsresult Serialize(
246
nsIObjectOutputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
247
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
248
virtual nsresult Deserialize(
249
nsIObjectInputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
250
nsIURI* aDocumentURI,
251
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
252
253
nsString mValue;
254
};
255
256
class nsXULPrototypePI : public nsXULPrototypeNode {
257
public:
258
nsXULPrototypePI() : nsXULPrototypeNode(eType_PI) {}
259
260
private:
261
virtual ~nsXULPrototypePI() {}
262
263
public:
264
virtual nsresult Serialize(
265
nsIObjectOutputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
266
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
267
virtual nsresult Deserialize(
268
nsIObjectInputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
269
nsIURI* aDocumentURI,
270
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
271
272
nsString mTarget;
273
nsString mData;
274
};
275
276
////////////////////////////////////////////////////////////////////////
277
278
/**
279
280
The XUL element.
281
282
*/
283
284
#define XUL_ELEMENT_FLAG_BIT(n_) \
285
NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
286
287
// XUL element specific bits
288
enum {
289
XUL_ELEMENT_HAS_CONTENTMENU_LISTENER = XUL_ELEMENT_FLAG_BIT(0),
290
XUL_ELEMENT_HAS_POPUP_LISTENER = XUL_ELEMENT_FLAG_BIT(1)
291
};
292
293
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
294
295
#undef XUL_ELEMENT_FLAG_BIT
296
297
class nsXULElement : public nsStyledElement {
298
protected:
299
typedef mozilla::dom::Document Document;
300
301
// Use Construct to construct elements instead of this constructor.
302
explicit nsXULElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
303
304
public:
305
using Element::Blur;
306
using Element::Focus;
307
308
static nsresult CreateFromPrototype(nsXULPrototypeElement* aPrototype,
309
Document* aDocument, bool aIsScriptable,
310
bool aIsRoot,
311
mozilla::dom::Element** aResult);
312
313
// This is the constructor for nsXULElements.
314
static nsXULElement* Construct(
315
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
316
317
NS_IMPL_FROMNODE(nsXULElement, kNameSpaceID_XUL)
318
319
// nsISupports
320
NS_DECL_ISUPPORTS_INHERITED
321
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULElement, nsStyledElement)
322
323
// nsINode
324
void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
325
MOZ_CAN_RUN_SCRIPT_BOUNDARY
326
virtual nsresult PreHandleEvent(
327
mozilla::EventChainVisitor& aVisitor) override;
328
// nsIContent
329
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
330
virtual void UnbindFromTree(bool aNullParent) override;
331
virtual void DestroyContent() override;
332
virtual void DoneAddingChildren(bool aHaveNotified) override;
333
334
#ifdef DEBUG
335
virtual void List(FILE* out, int32_t aIndent) const override;
336
virtual void DumpContent(FILE* out, int32_t aIndent,
337
bool aDumpAll) const override {}
338
#endif
339
340
MOZ_CAN_RUN_SCRIPT int32_t ScreenX();
341
MOZ_CAN_RUN_SCRIPT int32_t ScreenY();
342
343
bool HasMenu();
344
MOZ_CAN_RUN_SCRIPT void OpenMenu(bool aOpenFlag);
345
346
virtual bool PerformAccesskey(bool aKeyCausesActivation,
347
bool aIsTrustedEvent) override;
348
void ClickWithInputSource(uint16_t aInputSource, bool aIsTrustedEvent);
349
350
virtual bool IsNodeOfType(uint32_t aFlags) const override;
351
virtual bool IsFocusableInternal(int32_t* aTabIndex,
352
bool aWithMouse) override;
353
354
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
355
int32_t aModType) const override;
356
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
357
358
virtual nsresult Clone(mozilla::dom::NodeInfo*,
359
nsINode** aResult) const override;
360
361
virtual void RecompileScriptEventListeners() override;
362
363
virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;
364
365
typedef mozilla::dom::DOMString DOMString;
366
void GetXULAttr(nsAtom* aName, DOMString& aResult) const {
367
GetAttr(kNameSpaceID_None, aName, aResult);
368
}
369
void SetXULAttr(nsAtom* aName, const nsAString& aValue,
370
mozilla::ErrorResult& aError) {
371
SetAttr(aName, aValue, aError);
372
}
373
bool GetXULBoolAttr(nsAtom* aName) const {
374
return AttrValueIs(kNameSpaceID_None, aName, NS_LITERAL_STRING("true"),
375
eCaseMatters);
376
}
377
void SetXULBoolAttr(nsAtom* aName, bool aValue) {
378
if (aValue) {
379
SetAttr(kNameSpaceID_None, aName, NS_LITERAL_STRING("true"), true);
380
} else {
381
UnsetAttr(kNameSpaceID_None, aName, true);
382
}
383
}
384
385
// WebIDL API
386
void GetAlign(DOMString& aValue) const {
387
GetXULAttr(nsGkAtoms::align, aValue);
388
}
389
void SetAlign(const nsAString& aValue, mozilla::ErrorResult& rv) {
390
SetXULAttr(nsGkAtoms::align, aValue, rv);
391
}
392
void GetDir(DOMString& aValue) const { GetXULAttr(nsGkAtoms::dir, aValue); }
393
void SetDir(const nsAString& aValue, mozilla::ErrorResult& rv) {
394
SetXULAttr(nsGkAtoms::dir, aValue, rv);
395
}
396
void GetFlex(DOMString& aValue) const { GetXULAttr(nsGkAtoms::flex, aValue); }
397
void SetFlex(const nsAString& aValue, mozilla::ErrorResult& rv) {
398
SetXULAttr(nsGkAtoms::flex, aValue, rv);
399
}
400
void GetOrdinal(DOMString& aValue) const {
401
GetXULAttr(nsGkAtoms::ordinal, aValue);
402
}
403
void SetOrdinal(const nsAString& aValue, mozilla::ErrorResult& rv) {
404
SetXULAttr(nsGkAtoms::ordinal, aValue, rv);
405
}
406
void GetOrient(DOMString& aValue) const {
407
GetXULAttr(nsGkAtoms::orient, aValue);
408
}
409
void SetOrient(const nsAString& aValue, mozilla::ErrorResult& rv) {
410
SetXULAttr(nsGkAtoms::orient, aValue, rv);
411
}
412
void GetPack(DOMString& aValue) const { GetXULAttr(nsGkAtoms::pack, aValue); }
413
void SetPack(const nsAString& aValue, mozilla::ErrorResult& rv) {
414
SetXULAttr(nsGkAtoms::pack, aValue, rv);
415
}
416
bool Hidden() const { return BoolAttrIsTrue(nsGkAtoms::hidden); }
417
void SetHidden(bool aHidden) { SetXULBoolAttr(nsGkAtoms::hidden, aHidden); }
418
bool Collapsed() const { return BoolAttrIsTrue(nsGkAtoms::collapsed); }
419
void SetCollapsed(bool aCollapsed) {
420
SetXULBoolAttr(nsGkAtoms::collapsed, aCollapsed);
421
}
422
void GetObserves(DOMString& aValue) const {
423
GetXULAttr(nsGkAtoms::observes, aValue);
424
}
425
void SetObserves(const nsAString& aValue, mozilla::ErrorResult& rv) {
426
SetXULAttr(nsGkAtoms::observes, aValue, rv);
427
}
428
void GetMenu(DOMString& aValue) const { GetXULAttr(nsGkAtoms::menu, aValue); }
429
void SetMenu(const nsAString& aValue, mozilla::ErrorResult& rv) {
430
SetXULAttr(nsGkAtoms::menu, aValue, rv);
431
}
432
void GetContextMenu(DOMString& aValue) {
433
GetXULAttr(nsGkAtoms::contextmenu, aValue);
434
}
435
void SetContextMenu(const nsAString& aValue, mozilla::ErrorResult& rv) {
436
SetXULAttr(nsGkAtoms::contextmenu, aValue, rv);
437
}
438
void GetTooltip(DOMString& aValue) const {
439
GetXULAttr(nsGkAtoms::tooltip, aValue);
440
}
441
void SetTooltip(const nsAString& aValue, mozilla::ErrorResult& rv) {
442
SetXULAttr(nsGkAtoms::tooltip, aValue, rv);
443
}
444
void GetWidth(DOMString& aValue) const {
445
GetXULAttr(nsGkAtoms::width, aValue);
446
}
447
void SetWidth(const nsAString& aValue, mozilla::ErrorResult& rv) {
448
SetXULAttr(nsGkAtoms::width, aValue, rv);
449
}
450
void GetHeight(DOMString& aValue) { GetXULAttr(nsGkAtoms::height, aValue); }
451
void SetHeight(const nsAString& aValue, mozilla::ErrorResult& rv) {
452
SetXULAttr(nsGkAtoms::height, aValue, rv);
453
}
454
void GetMinWidth(DOMString& aValue) const {
455
GetXULAttr(nsGkAtoms::minwidth, aValue);
456
}
457
void SetMinWidth(const nsAString& aValue, mozilla::ErrorResult& rv) {
458
SetXULAttr(nsGkAtoms::minwidth, aValue, rv);
459
}
460
void GetMinHeight(DOMString& aValue) const {
461
GetXULAttr(nsGkAtoms::minheight, aValue);
462
}
463
void SetMinHeight(const nsAString& aValue, mozilla::ErrorResult& rv) {
464
SetXULAttr(nsGkAtoms::minheight, aValue, rv);
465
}
466
void GetMaxWidth(DOMString& aValue) const {
467
GetXULAttr(nsGkAtoms::maxwidth, aValue);
468
}
469
void SetMaxWidth(const nsAString& aValue, mozilla::ErrorResult& rv) {
470
SetXULAttr(nsGkAtoms::maxwidth, aValue, rv);
471
}
472
void GetMaxHeight(DOMString& aValue) const {
473
GetXULAttr(nsGkAtoms::maxheight, aValue);
474
}
475
void SetMaxHeight(const nsAString& aValue, mozilla::ErrorResult& rv) {
476
SetXULAttr(nsGkAtoms::maxheight, aValue, rv);
477
}
478
void GetLeft(DOMString& aValue) const { GetXULAttr(nsGkAtoms::left, aValue); }
479
void SetLeft(const nsAString& aValue, mozilla::ErrorResult& rv) {
480
SetXULAttr(nsGkAtoms::left, aValue, rv);
481
}
482
void GetTop(DOMString& aValue) const { GetXULAttr(nsGkAtoms::top, aValue); }
483
void SetTop(const nsAString& aValue, mozilla::ErrorResult& rv) {
484
SetXULAttr(nsGkAtoms::top, aValue, rv);
485
}
486
void GetTooltipText(DOMString& aValue) const {
487
GetXULAttr(nsGkAtoms::tooltiptext, aValue);
488
}
489
void SetTooltipText(const nsAString& aValue, mozilla::ErrorResult& rv) {
490
SetXULAttr(nsGkAtoms::tooltiptext, aValue, rv);
491
}
492
void GetSrc(DOMString& aValue) const { GetXULAttr(nsGkAtoms::src, aValue); }
493
void SetSrc(const nsAString& aValue, mozilla::ErrorResult& rv) {
494
SetXULAttr(nsGkAtoms::src, aValue, rv);
495
}
496
bool AllowEvents() const { return BoolAttrIsTrue(nsGkAtoms::allowevents); }
497
void SetAllowEvents(bool aAllowEvents) {
498
SetXULBoolAttr(nsGkAtoms::allowevents, aAllowEvents);
499
}
500
nsIControllers* GetControllers(mozilla::ErrorResult& rv);
501
void Click(mozilla::dom::CallerType aCallerType);
502
MOZ_CAN_RUN_SCRIPT_BOUNDARY void DoCommand();
503
// Style() inherited from nsStyledElement
504
505
nsINode* GetScopeChainParent() const override {
506
// For XUL, the parent is the parent element, if any
507
Element* parent = GetParentElement();
508
return parent ? parent : nsStyledElement::GetScopeChainParent();
509
}
510
511
bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
512
513
void MaybeUpdatePrivateLifetime();
514
515
protected:
516
~nsXULElement();
517
518
// This can be removed if EnsureContentsGenerated dies.
519
friend class nsNSElementTearoff;
520
521
// Implementation methods
522
nsresult EnsureContentsGenerated(void) const;
523
524
nsresult AddPopupListener(nsAtom* aName);
525
526
/**
527
* Abandon our prototype linkage, and copy all attributes locally
528
*/
529
nsresult MakeHeavyweight(nsXULPrototypeElement* aPrototype);
530
531
virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
532
const nsAttrValueOrString* aValue,
533
bool aNotify) override;
534
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
535
const nsAttrValue* aValue,
536
const nsAttrValue* aOldValue,
537
nsIPrincipal* aSubjectPrincipal,
538
bool aNotify) override;
539
540
virtual void UpdateEditableState(bool aNotify) override;
541
542
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
543
const nsAString& aValue,
544
nsIPrincipal* aMaybeScriptedPrincipal,
545
nsAttrValue& aResult) override;
546
547
virtual mozilla::EventListenerManager* GetEventListenerManagerForAttr(
548
nsAtom* aAttrName, bool* aDefer) override;
549
550
/**
551
* Add a listener for the specified attribute, if appropriate.
552
*/
553
void AddListenerForAttributeIfNeeded(const nsAttrName& aName);
554
void AddListenerForAttributeIfNeeded(nsAtom* aLocalName);
555
556
protected:
557
void AddTooltipSupport();
558
void RemoveTooltipSupport();
559
560
// Internal accessor. This shadows the 'Slots', and returns
561
// appropriate value.
562
nsIControllers* Controllers() {
563
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
564
return slots ? slots->mControllers.get() : nullptr;
565
}
566
567
void UnregisterAccessKey(const nsAString& aOldValue);
568
bool BoolAttrIsTrue(nsAtom* aName) const;
569
570
friend nsXULElement* NS_NewBasicXULElement(
571
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
572
573
friend nsresult NS_NewXULElement(mozilla::dom::Element** aResult,
574
mozilla::dom::NodeInfo* aNodeInfo,
575
mozilla::dom::FromParser aFromParser,
576
const nsAString* aIs);
577
friend void NS_TrustedNewXULElement(mozilla::dom::Element** aResult,
578
mozilla::dom::NodeInfo* aNodeInfo);
579
580
static already_AddRefed<nsXULElement> CreateFromPrototype(
581
nsXULPrototypeElement* aPrototype, mozilla::dom::NodeInfo* aNodeInfo,
582
bool aIsScriptable, bool aIsRoot);
583
584
virtual JSObject* WrapNode(JSContext* aCx,
585
JS::Handle<JSObject*> aGivenProto) override;
586
587
bool IsEventStoppedFromAnonymousScrollbar(mozilla::EventMessage aMessage);
588
589
MOZ_CAN_RUN_SCRIPT
590
nsresult DispatchXULCommand(const mozilla::EventChainVisitor& aVisitor,
591
nsAutoString& aCommand);
592
};
593
594
#endif // nsXULElement_h__