mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-01 04:47:31 +09:00
Revert "Optimise WebExtension implementaion pt.1"
This reverts commit 3be08bc94b.
This commit is contained in:
parent
3be08bc94b
commit
cd6be07458
3 changed files with 19 additions and 22 deletions
|
|
@ -1278,9 +1278,6 @@ CustomElementDefinition::CustomElementDefinition(nsIAtom* aType,
|
||||||
mCallbacks(aCallbacks),
|
mCallbacks(aCallbacks),
|
||||||
mDocOrder(aDocOrder)
|
mDocOrder(aDocOrder)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < mObservedAttributes.Length(); ++i) {
|
|
||||||
mObservedAttributesSet.PutEntry(mObservedAttributes[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@
|
||||||
#include "mozilla/dom/WebComponentsBinding.h"
|
#include "mozilla/dom/WebComponentsBinding.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "nsHashKeys.h"
|
|
||||||
#include "nsTHashtable.h"
|
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
|
|
||||||
class nsDocument;
|
class nsDocument;
|
||||||
|
|
@ -168,9 +166,6 @@ struct CustomElementDefinition
|
||||||
// The list of attributes that this custom element observes.
|
// The list of attributes that this custom element observes.
|
||||||
nsCOMArray<nsIAtom> mObservedAttributes;
|
nsCOMArray<nsIAtom> mObservedAttributes;
|
||||||
|
|
||||||
// Hash set for O(1) lookup of observed attributes.
|
|
||||||
nsTHashtable<nsISupportsHashKey> mObservedAttributesSet;
|
|
||||||
|
|
||||||
// The prototype to use for new custom elements of this type.
|
// The prototype to use for new custom elements of this type.
|
||||||
JS::Heap<JSObject *> mPrototype;
|
JS::Heap<JSObject *> mPrototype;
|
||||||
|
|
||||||
|
|
@ -194,7 +189,7 @@ struct CustomElementDefinition
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mObservedAttributesSet.Contains(aName);
|
return mObservedAttributes.Contains(aName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -162,14 +162,25 @@ ShadowRoot::AddSlot(HTMLSlotElement* aSlot)
|
||||||
|
|
||||||
oldSlot->RemoveAssignedNode(assignedNode);
|
oldSlot->RemoveAssignedNode(assignedNode);
|
||||||
currentSlot->AppendAssignedNode(assignedNode);
|
currentSlot->AppendAssignedNode(assignedNode);
|
||||||
|
|
||||||
|
Element* restyleElement;
|
||||||
|
if (assignedNode->IsElement()) {
|
||||||
|
restyleElement = assignedNode->AsElement();
|
||||||
|
} else {
|
||||||
|
// This is likely a text node. Use the host instead.
|
||||||
|
restyleElement = GetHost();
|
||||||
|
}
|
||||||
|
if (restyleElement) {
|
||||||
|
nsLayoutUtils::PostRestyleEvent(
|
||||||
|
restyleElement, eRestyle_Subtree, nsChangeHint(0));
|
||||||
|
}
|
||||||
|
|
||||||
doEnqueueSlotChange = true;
|
doEnqueueSlotChange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doEnqueueSlotChange) {
|
if (doEnqueueSlotChange) {
|
||||||
oldSlot->EnqueueSlotChangeEvent();
|
oldSlot->EnqueueSlotChangeEvent();
|
||||||
currentSlot->EnqueueSlotChangeEvent();
|
currentSlot->EnqueueSlotChangeEvent();
|
||||||
nsLayoutUtils::PostRestyleEvent(
|
|
||||||
GetHost(), eRestyle_Subtree, nsChangeHint(0));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Otherwise add appropriate nodes to this slot from the host.
|
// Otherwise add appropriate nodes to this slot from the host.
|
||||||
|
|
@ -464,10 +475,7 @@ ShadowRoot::MaybeReassignElement(Element* aElement,
|
||||||
void
|
void
|
||||||
ShadowRoot::DistributionChanged()
|
ShadowRoot::DistributionChanged()
|
||||||
{
|
{
|
||||||
if (mSlotMap.IsEmpty()) {
|
// FIXME(emilio): We could be more granular in a bunch of cases.
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* host = GetHost();
|
auto* host = GetHost();
|
||||||
if (!host || !host->IsInComposedDoc()) {
|
if (!host || !host->IsInComposedDoc()) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -543,11 +551,8 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aElement->GetPrimaryFrame()) {
|
//XXX optimize this!
|
||||||
shell->DestroyFramesForAndRestyle(aElement);
|
shell->DestroyFramesForAndRestyle(aElement);
|
||||||
} else {
|
|
||||||
nsLayoutUtils::PostRestyleEvent(aElement, eRestyle_Subtree, nsChangeHint(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -559,7 +564,7 @@ ShadowRoot::ContentAppended(nsIDocument* aDocument,
|
||||||
for (nsIContent* content = aFirstNewContent;
|
for (nsIContent* content = aFirstNewContent;
|
||||||
content;
|
content;
|
||||||
content = content->GetNextSibling()) {
|
content = content->GetNextSibling()) {
|
||||||
ContentInserted(aDocument, aContainer, content, aNewIndexInContainer);
|
ContentInserted(aDocument, aContainer, aFirstNewContent, aNewIndexInContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue