mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-18 12:29:44 +00:00
#375: M1347634 1352235
This commit is contained in:
parent
06fcc091fc
commit
aa6b13c599
|
@ -191,6 +191,14 @@ Element::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
aInstancePtr);
|
aInstancePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Element::SetCustomElementData(CustomElementData* aData)
|
||||||
|
{
|
||||||
|
nsDOMSlots *slots = DOMSlots();
|
||||||
|
MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set.");
|
||||||
|
slots->mCustomElementData = aData;
|
||||||
|
}
|
||||||
|
|
||||||
EventStates
|
EventStates
|
||||||
Element::IntrinsicState() const
|
Element::IntrinsicState() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -361,6 +361,29 @@ public:
|
||||||
|
|
||||||
Directionality GetComputedDirectionality() const;
|
Directionality GetComputedDirectionality() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the custom element data used by web components' custom element.
|
||||||
|
* Custom element data is created at the first attempt to enqueue a callback.
|
||||||
|
*
|
||||||
|
* @return The custom element data or null if none.
|
||||||
|
*/
|
||||||
|
inline CustomElementData* GetCustomElementData() const
|
||||||
|
{
|
||||||
|
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||||
|
if (slots) {
|
||||||
|
return slots->mCustomElementData;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the custom element data, ownership of the
|
||||||
|
* callback data is taken by this element.
|
||||||
|
*
|
||||||
|
* @param aData The custom element data.
|
||||||
|
*/
|
||||||
|
void SetCustomElementData(CustomElementData* aData);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Method to get the _intrinsic_ content state of this element. This is the
|
* Method to get the _intrinsic_ content state of this element. This is the
|
||||||
|
|
|
@ -1116,24 +1116,6 @@ FragmentOrElement::SetXBLInsertionParent(nsIContent* aContent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomElementData*
|
|
||||||
FragmentOrElement::GetCustomElementData() const
|
|
||||||
{
|
|
||||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
|
||||||
if (slots) {
|
|
||||||
return slots->mCustomElementData;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FragmentOrElement::SetCustomElementData(CustomElementData* aData)
|
|
||||||
{
|
|
||||||
nsDOMSlots *slots = DOMSlots();
|
|
||||||
MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set.");
|
|
||||||
slots->mCustomElementData = aData;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
FragmentOrElement::InsertChildAt(nsIContent* aKid,
|
FragmentOrElement::InsertChildAt(nsIContent* aKid,
|
||||||
uint32_t aIndex,
|
uint32_t aIndex,
|
||||||
|
|
|
@ -34,6 +34,7 @@ class nsIURI;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
struct CustomElementData;
|
||||||
class Element;
|
class Element;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -157,9 +158,6 @@ public:
|
||||||
virtual void SetXBLInsertionParent(nsIContent* aContent) override;
|
virtual void SetXBLInsertionParent(nsIContent* aContent) override;
|
||||||
virtual bool IsLink(nsIURI** aURI) const override;
|
virtual bool IsLink(nsIURI** aURI) const override;
|
||||||
|
|
||||||
virtual CustomElementData *GetCustomElementData() const override;
|
|
||||||
virtual void SetCustomElementData(CustomElementData* aData) override;
|
|
||||||
|
|
||||||
virtual void DestroyContent() override;
|
virtual void DestroyContent() override;
|
||||||
virtual void SaveSubtreeState() override;
|
virtual void SaveSubtreeState() override;
|
||||||
|
|
||||||
|
|
|
@ -771,17 +771,6 @@ nsGenericDOMDataNode::SetXBLInsertionParent(nsIContent* aContent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomElementData *
|
|
||||||
nsGenericDOMDataNode::GetCustomElementData() const
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsGenericDOMDataNode::SetCustomElementData(CustomElementData* aData)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsGenericDOMDataNode::IsNodeOfType(uint32_t aFlags) const
|
nsGenericDOMDataNode::IsNodeOfType(uint32_t aFlags) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -163,9 +163,6 @@ public:
|
||||||
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
||||||
virtual bool IsLink(nsIURI** aURI) const override;
|
virtual bool IsLink(nsIURI** aURI) const override;
|
||||||
|
|
||||||
virtual mozilla::dom::CustomElementData* GetCustomElementData() const override;
|
|
||||||
virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) override;
|
|
||||||
|
|
||||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
||||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||||
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||||
|
|
|
@ -25,7 +25,6 @@ namespace mozilla {
|
||||||
class EventChainPreVisitor;
|
class EventChainPreVisitor;
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class ShadowRoot;
|
class ShadowRoot;
|
||||||
struct CustomElementData;
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
namespace widget {
|
namespace widget {
|
||||||
struct IMEState;
|
struct IMEState;
|
||||||
|
@ -703,22 +702,6 @@ public:
|
||||||
*/
|
*/
|
||||||
nsIContent *GetFlattenedTreeParent() const;
|
nsIContent *GetFlattenedTreeParent() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the custom element data used by web components custom element.
|
|
||||||
* Custom element data is created at the first attempt to enqueue a callback.
|
|
||||||
*
|
|
||||||
* @return The custom element data or null if none.
|
|
||||||
*/
|
|
||||||
virtual mozilla::dom::CustomElementData *GetCustomElementData() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the custom element data, ownership of the
|
|
||||||
* callback data is taken by this content.
|
|
||||||
*
|
|
||||||
* @param aCallbackData The custom element data.
|
|
||||||
*/
|
|
||||||
virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API to check if this is a link that's traversed in response to user input
|
* API to check if this is a link that's traversed in response to user input
|
||||||
* (e.g. a click event). Specializations for HTML/SVG/generic XML allow for
|
* (e.g. a click event). Specializations for HTML/SVG/generic XML allow for
|
||||||
|
|
|
@ -111,7 +111,8 @@ nsNodeInfoManager::nsNodeInfoManager()
|
||||||
mNonDocumentNodeInfos(0),
|
mNonDocumentNodeInfos(0),
|
||||||
mTextNodeInfo(nullptr),
|
mTextNodeInfo(nullptr),
|
||||||
mCommentNodeInfo(nullptr),
|
mCommentNodeInfo(nullptr),
|
||||||
mDocumentNodeInfo(nullptr)
|
mDocumentNodeInfo(nullptr),
|
||||||
|
mRecentlyUsedNodeInfos{}
|
||||||
{
|
{
|
||||||
nsLayoutStatics::AddRef();
|
nsLayoutStatics::AddRef();
|
||||||
|
|
||||||
|
@ -232,11 +233,19 @@ nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
||||||
NodeInfo::NodeInfoInner tmpKey(aName, aPrefix, aNamespaceID, aNodeType,
|
NodeInfo::NodeInfoInner tmpKey(aName, aPrefix, aNamespaceID, aNodeType,
|
||||||
aExtraName);
|
aExtraName);
|
||||||
|
|
||||||
|
uint32_t index =
|
||||||
|
GetNodeInfoInnerHashValue(&tmpKey) % RECENTLY_USED_NODEINFOS_SIZE;
|
||||||
|
NodeInfo* ni = mRecentlyUsedNodeInfos[index];
|
||||||
|
if (ni && NodeInfoInnerKeyCompare(&(ni->mInner), &tmpKey)) {
|
||||||
|
RefPtr<NodeInfo> nodeInfo = ni;
|
||||||
|
return nodeInfo.forget();
|
||||||
|
}
|
||||||
|
|
||||||
void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
|
void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
RefPtr<NodeInfo> nodeInfo = static_cast<NodeInfo*>(node);
|
RefPtr<NodeInfo> nodeInfo = static_cast<NodeInfo*>(node);
|
||||||
|
mRecentlyUsedNodeInfos[index] = nodeInfo;
|
||||||
return nodeInfo.forget();
|
return nodeInfo.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,6 +263,7 @@ nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
||||||
NS_IF_ADDREF(mDocument);
|
NS_IF_ADDREF(mDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mRecentlyUsedNodeInfos[index] = newNodeInfo;
|
||||||
return newNodeInfo.forget();
|
return newNodeInfo.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,12 +282,21 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
|
||||||
|
|
||||||
NodeInfo::NodeInfoInner tmpKey(aName, aPrefix, aNamespaceID, aNodeType);
|
NodeInfo::NodeInfoInner tmpKey(aName, aPrefix, aNamespaceID, aNodeType);
|
||||||
|
|
||||||
|
uint32_t index =
|
||||||
|
GetNodeInfoInnerHashValue(&tmpKey) % RECENTLY_USED_NODEINFOS_SIZE;
|
||||||
|
NodeInfo* ni = mRecentlyUsedNodeInfos[index];
|
||||||
|
if (ni && NodeInfoInnerKeyCompare(&(ni->mInner), &tmpKey)) {
|
||||||
|
RefPtr<NodeInfo> nodeInfo = ni;
|
||||||
|
nodeInfo.forget(aNodeInfo);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
|
void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
NodeInfo* nodeInfo = static_cast<NodeInfo *>(node);
|
RefPtr<NodeInfo> nodeInfo = static_cast<NodeInfo*>(node);
|
||||||
|
mRecentlyUsedNodeInfos[index] = nodeInfo;
|
||||||
NS_ADDREF(*aNodeInfo = nodeInfo);
|
nodeInfo.forget(aNodeInfo);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -298,6 +317,7 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
|
||||||
NS_IF_ADDREF(mDocument);
|
NS_IF_ADDREF(mDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mRecentlyUsedNodeInfos[index] = newNodeInfo;
|
||||||
newNodeInfo.forget(aNodeInfo);
|
newNodeInfo.forget(aNodeInfo);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -420,6 +440,12 @@ nsNodeInfoManager::RemoveNodeInfo(NodeInfo *aNodeInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t index =
|
||||||
|
GetNodeInfoInnerHashValue(&aNodeInfo->mInner) % RECENTLY_USED_NODEINFOS_SIZE;
|
||||||
|
if (mRecentlyUsedNodeInfos[index] == aNodeInfo) {
|
||||||
|
mRecentlyUsedNodeInfos[index] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool ret =
|
bool ret =
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,6 +33,8 @@ class NodeInfo;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#define RECENTLY_USED_NODEINFOS_SIZE 31
|
||||||
|
|
||||||
class nsNodeInfoManager final
|
class nsNodeInfoManager final
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -138,6 +140,7 @@ private:
|
||||||
mozilla::dom::NodeInfo * MOZ_NON_OWNING_REF mCommentNodeInfo; // WEAK to avoid circular ownership
|
mozilla::dom::NodeInfo * MOZ_NON_OWNING_REF mCommentNodeInfo; // WEAK to avoid circular ownership
|
||||||
mozilla::dom::NodeInfo * MOZ_NON_OWNING_REF mDocumentNodeInfo; // WEAK to avoid circular ownership
|
mozilla::dom::NodeInfo * MOZ_NON_OWNING_REF mDocumentNodeInfo; // WEAK to avoid circular ownership
|
||||||
RefPtr<nsBindingManager> mBindingManager;
|
RefPtr<nsBindingManager> mBindingManager;
|
||||||
|
mozilla::dom::NodeInfo* mRecentlyUsedNodeInfos[RECENTLY_USED_NODEINFOS_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsNodeInfoManager_h___ */
|
#endif /* nsNodeInfoManager_h___ */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user