mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1088228 part 1. Introduce an nsINode API for getting the scope chain parent for a given node. r=peterv
This commit is contained in:
parent
e0d9ddc182
commit
38493ba5e9
@ -500,6 +500,13 @@ Element::WrapObject(JSContext *aCx)
|
||||
return obj;
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
nsINode*
|
||||
Element::GetScopeChainParent() const
|
||||
{
|
||||
return OwnerDoc();
|
||||
}
|
||||
|
||||
nsDOMTokenList*
|
||||
Element::ClassList()
|
||||
{
|
||||
|
@ -139,8 +139,8 @@ class DestinationInsertionPointList;
|
||||
|
||||
// IID for the dom::Element interface
|
||||
#define NS_ELEMENT_IID \
|
||||
{ 0xaa79cb98, 0xc785, 0x44c5, \
|
||||
{ 0x80, 0x80, 0x2e, 0x5f, 0x0c, 0xa5, 0xbd, 0x63 } }
|
||||
{ 0x31d3f3fb, 0xcdf8, 0x4e40, \
|
||||
{ 0xb7, 0x09, 0x1a, 0x11, 0x43, 0x93, 0x61, 0x71 } }
|
||||
|
||||
class Element : public FragmentOrElement
|
||||
{
|
||||
@ -961,6 +961,8 @@ public:
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *aCx) MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
nsINode* GetScopeChainParent() const MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Locate an nsIEditor rooted at this content node, if there is one.
|
||||
*/
|
||||
|
@ -136,8 +136,8 @@ typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xbab5b447, 0x7e23, 0x4cdd, \
|
||||
{ 0xac, 0xe5, 0xaa, 0x04, 0x26, 0x87, 0x2b, 0x97 } }
|
||||
{ 0x6bbf1955, 0xd9c4, 0x4d61, \
|
||||
{ 0xbf, 0x75, 0x1b, 0xba, 0x55, 0xf7, 0x99, 0xc2 } }
|
||||
|
||||
// Enum for requesting a particular type of document when creating a doc
|
||||
enum DocumentFlavor {
|
||||
|
@ -2752,3 +2752,8 @@ nsINode::HasBoxQuadsSupport(JSContext* aCx, JSObject* /* unused */)
|
||||
Preferences::GetBool("layout.css.getBoxQuads.enabled");
|
||||
}
|
||||
|
||||
nsINode*
|
||||
nsINode::GetScopeChainParent() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -248,8 +248,8 @@ private:
|
||||
|
||||
// IID for the nsINode interface
|
||||
#define NS_INODE_IID \
|
||||
{ 0x8deda3f4, 0x0f45, 0x497a, \
|
||||
{ 0x89, 0x7c, 0xe6, 0x09, 0x12, 0x8a, 0xad, 0xd8 } }
|
||||
{ 0x66972940, 0x1d1b, 0x4d15, \
|
||||
{ 0x93, 0x11, 0x96, 0x72, 0x84, 0x2e, 0xc7, 0x27 } }
|
||||
|
||||
/**
|
||||
* An internal interface that abstracts some DOMNode-related parts that both
|
||||
@ -396,6 +396,13 @@ protected:
|
||||
public:
|
||||
mozilla::dom::ParentObject GetParentObject() const; // Implemented in nsIDocument.h
|
||||
|
||||
/**
|
||||
* Return the scope chain parent for this node, for use in things
|
||||
* like event handler compilation. Returning null means to use the
|
||||
* global object as the scope chain parent.
|
||||
*/
|
||||
virtual nsINode* GetScopeChainParent() const;
|
||||
|
||||
/**
|
||||
* Return whether the node is an Element node
|
||||
*/
|
||||
|
@ -22,7 +22,7 @@ HTMLLegendElement::~HTMLLegendElement()
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLLegendElement)
|
||||
|
||||
nsIContent*
|
||||
HTMLLegendElement::GetFieldSet()
|
||||
HTMLLegendElement::GetFieldSet() const
|
||||
{
|
||||
nsIContent* parent = GetParent();
|
||||
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
|
||||
|
||||
Element* GetFormElement()
|
||||
Element* GetFormElement() const
|
||||
{
|
||||
nsCOMPtr<nsIFormControl> fieldsetControl = do_QueryInterface(GetFieldSet());
|
||||
|
||||
@ -83,6 +83,12 @@ public:
|
||||
: nsGenericHTMLElement::GetParentObject();
|
||||
}
|
||||
|
||||
nsINode* GetScopeChainParent() const MOZ_OVERRIDE
|
||||
{
|
||||
Element* form = GetFormElement();
|
||||
return form ? form : nsGenericHTMLElement::GetScopeChainParent();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~HTMLLegendElement();
|
||||
|
||||
@ -92,7 +98,7 @@ protected:
|
||||
* Get the fieldset content element that contains this legend.
|
||||
* Returns null if there is no fieldset containing this legend.
|
||||
*/
|
||||
nsIContent* GetFieldSet();
|
||||
nsIContent* GetFieldSet() const;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -1906,6 +1906,12 @@ nsGenericHTMLFormElement::GetParentObject() const
|
||||
return nsGenericHTMLElement::GetParentObject();
|
||||
}
|
||||
|
||||
nsINode*
|
||||
nsGenericHTMLFormElement::GetScopeChainParent() const
|
||||
{
|
||||
return mForm ? mForm : nsGenericHTMLElement::GetScopeChainParent();
|
||||
}
|
||||
|
||||
bool
|
||||
nsGenericHTMLFormElement::IsNodeOfType(uint32_t aFlags) const
|
||||
{
|
||||
|
@ -1247,6 +1247,8 @@ public:
|
||||
|
||||
mozilla::dom::ParentObject GetParentObject() const;
|
||||
|
||||
nsINode* GetScopeChainParent() const MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
|
||||
virtual void SaveSubtreeState() MOZ_OVERRIDE;
|
||||
|
||||
|
@ -616,6 +616,12 @@ public:
|
||||
return nsStyledElement::GetParentObject();
|
||||
}
|
||||
|
||||
nsINode* GetScopeChainParent() const MOZ_OVERRIDE
|
||||
{
|
||||
Element* parent = GetParentElement();
|
||||
return parent ? parent : nsStyledElement::GetScopeChainParent();
|
||||
}
|
||||
|
||||
protected:
|
||||
~nsXULElement();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user