зеркало из https://github.com/mozilla/gecko-dev.git
Bug 708901 - Migrate to nsTHashSet in layout. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108597
This commit is contained in:
Родитель
82e566bfca
Коммит
c73f87b72b
|
@ -738,8 +738,8 @@ void PresShell::AddWeakFrame(WeakFrame* aWeakFrame) {
|
|||
if (aWeakFrame->GetFrame()) {
|
||||
aWeakFrame->GetFrame()->AddStateBits(NS_FRAME_EXTERNAL_REFERENCE);
|
||||
}
|
||||
MOZ_ASSERT(!mWeakFrames.GetEntry(aWeakFrame));
|
||||
mWeakFrames.PutEntry(aWeakFrame);
|
||||
MOZ_ASSERT(!mWeakFrames.Contains(aWeakFrame));
|
||||
mWeakFrames.Insert(aWeakFrame);
|
||||
}
|
||||
|
||||
void PresShell::RemoveAutoWeakFrame(AutoWeakFrame* aWeakFrame) {
|
||||
|
@ -757,8 +757,8 @@ void PresShell::RemoveAutoWeakFrame(AutoWeakFrame* aWeakFrame) {
|
|||
}
|
||||
|
||||
void PresShell::RemoveWeakFrame(WeakFrame* aWeakFrame) {
|
||||
MOZ_ASSERT(mWeakFrames.GetEntry(aWeakFrame));
|
||||
mWeakFrames.RemoveEntry(aWeakFrame);
|
||||
MOZ_ASSERT(mWeakFrames.Contains(aWeakFrame));
|
||||
mWeakFrames.Remove(aWeakFrame);
|
||||
}
|
||||
|
||||
already_AddRefed<nsFrameSelection> PresShell::FrameSelection() {
|
||||
|
@ -1458,11 +1458,8 @@ void PresShell::Destroy() {
|
|||
while (mAutoWeakFrames) {
|
||||
mAutoWeakFrames->Clear(this);
|
||||
}
|
||||
nsTArray<WeakFrame*> toRemove(mWeakFrames.Count());
|
||||
for (auto iter = mWeakFrames.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
toRemove.AppendElement(iter.Get()->GetKey());
|
||||
}
|
||||
for (WeakFrame* weakFrame : toRemove) {
|
||||
const nsTArray<WeakFrame*> weakFrames = ToArray(mWeakFrames);
|
||||
for (WeakFrame* weakFrame : weakFrames) {
|
||||
weakFrame->Clear(this);
|
||||
}
|
||||
|
||||
|
@ -2242,12 +2239,12 @@ void PresShell::NotifyDestroyingFrame(nsIFrame* aFrame) {
|
|||
}
|
||||
}
|
||||
|
||||
mFramesToDirty.RemoveEntry(aFrame);
|
||||
mFramesToDirty.Remove(aFrame);
|
||||
|
||||
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aFrame);
|
||||
if (scrollableFrame) {
|
||||
mPendingScrollAnchorSelection.RemoveEntry(scrollableFrame);
|
||||
mPendingScrollAnchorAdjustment.RemoveEntry(scrollableFrame);
|
||||
mPendingScrollAnchorSelection.Remove(scrollableFrame);
|
||||
mPendingScrollAnchorAdjustment.Remove(scrollableFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2669,13 +2666,11 @@ void PresShell::VerifyHasDirtyRootAncestor(nsIFrame* aFrame) {
|
|||
|
||||
void PresShell::PostPendingScrollAnchorSelection(
|
||||
mozilla::layout::ScrollAnchorContainer* aContainer) {
|
||||
mPendingScrollAnchorSelection.PutEntry(aContainer->ScrollableFrame());
|
||||
mPendingScrollAnchorSelection.Insert(aContainer->ScrollableFrame());
|
||||
}
|
||||
|
||||
void PresShell::FlushPendingScrollAnchorSelections() {
|
||||
for (auto iter = mPendingScrollAnchorSelection.ConstIter(); !iter.Done();
|
||||
iter.Next()) {
|
||||
nsIScrollableFrame* scroll = iter.Get()->GetKey();
|
||||
for (nsIScrollableFrame* scroll : mPendingScrollAnchorSelection) {
|
||||
scroll->Anchor()->SelectAnchor();
|
||||
}
|
||||
mPendingScrollAnchorSelection.Clear();
|
||||
|
@ -2683,13 +2678,11 @@ void PresShell::FlushPendingScrollAnchorSelections() {
|
|||
|
||||
void PresShell::PostPendingScrollAnchorAdjustment(
|
||||
ScrollAnchorContainer* aContainer) {
|
||||
mPendingScrollAnchorAdjustment.PutEntry(aContainer->ScrollableFrame());
|
||||
mPendingScrollAnchorAdjustment.Insert(aContainer->ScrollableFrame());
|
||||
}
|
||||
|
||||
void PresShell::FlushPendingScrollAnchorAdjustments() {
|
||||
for (auto iter = mPendingScrollAnchorAdjustment.ConstIter(); !iter.Done();
|
||||
iter.Next()) {
|
||||
nsIScrollableFrame* scroll = iter.Get()->GetKey();
|
||||
for (nsIScrollableFrame* scroll : mPendingScrollAnchorAdjustment) {
|
||||
scroll->Anchor()->ApplyAdjustments();
|
||||
}
|
||||
mPendingScrollAnchorAdjustment.Clear();
|
||||
|
@ -2879,7 +2872,7 @@ void PresShell::FrameNeedsToContinueReflow(nsIFrame* aFrame) {
|
|||
NS_ASSERTION(aFrame->HasAnyStateBits(NS_FRAME_IN_REFLOW),
|
||||
"Frame passed in not in reflow?");
|
||||
|
||||
mFramesToDirty.PutEntry(aFrame);
|
||||
mFramesToDirty.Insert(aFrame);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIContent> PresShell::GetContentForScrolling() const {
|
||||
|
@ -3076,8 +3069,7 @@ void PresShell::ClearFrameRefs(nsIFrame* aFrame) {
|
|||
}
|
||||
|
||||
AutoTArray<WeakFrame*, 4> toRemove;
|
||||
for (auto iter = mWeakFrames.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
WeakFrame* weakFrame = iter.Get()->GetKey();
|
||||
for (WeakFrame* weakFrame : mWeakFrames) {
|
||||
if (weakFrame->GetFrame() == aFrame) {
|
||||
toRemove.AppendElement(weakFrame);
|
||||
}
|
||||
|
@ -5831,8 +5823,7 @@ void PresShell::MarkFramesInListApproximatelyVisible(
|
|||
void PresShell::DecApproximateVisibleCount(
|
||||
VisibleFrames& aFrames, const Maybe<OnNonvisible>& aNonvisibleAction
|
||||
/* = Nothing() */) {
|
||||
for (auto iter = aFrames.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
nsIFrame* frame = iter.Get()->GetKey();
|
||||
for (nsIFrame* frame : aFrames) {
|
||||
// Decrement the frame's visible count if we're still tracking its
|
||||
// visibility. (We may not be, if the frame disabled visibility tracking
|
||||
// after we added it to the visible frames list.)
|
||||
|
@ -9658,11 +9649,9 @@ bool PresShell::DoReflow(nsIFrame* target, bool aInterruptible,
|
|||
bool interrupted = mPresContext->HasPendingInterrupt();
|
||||
if (interrupted) {
|
||||
// Make sure target gets reflowed again.
|
||||
for (auto iter = mFramesToDirty.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
for (const auto& key : mFramesToDirty) {
|
||||
// Mark frames dirty until target frame.
|
||||
const nsPtrHashKey<nsIFrame>* p = iter.Get();
|
||||
for (nsIFrame* f = p->GetKey(); f && !f->IsSubtreeDirty();
|
||||
f = f->GetParent()) {
|
||||
for (nsIFrame* f = key; f && !f->IsSubtreeDirty(); f = f->GetParent()) {
|
||||
f->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
if (f->IsFlexItem()) {
|
||||
nsFlexContainerFrame::MarkCachedFlexMeasurementsDirty(f);
|
||||
|
@ -10999,10 +10988,8 @@ nsresult PresShell::UpdateImageLockingState() {
|
|||
if (locked) {
|
||||
// Request decodes for visible image frames; we want to start decoding as
|
||||
// quickly as possible when we get foregrounded to minimize flashing.
|
||||
for (auto iter = mApproximatelyVisibleFrames.ConstIter(); !iter.Done();
|
||||
iter.Next()) {
|
||||
nsImageFrame* imageFrame = do_QueryFrame(iter.Get()->GetKey());
|
||||
if (imageFrame) {
|
||||
for (const auto& key : mApproximatelyVisibleFrames) {
|
||||
if (nsImageFrame* imageFrame = do_QueryFrame(key)) {
|
||||
imageFrame->MaybeDecodeForPredictedSize();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsRefreshObservers.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsStubDocumentObserver.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTHashSet.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
|
@ -157,7 +157,7 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
|
||||
// A set type for tracking visible frames, for use by the visibility code in
|
||||
// PresShell. The set contains nsIFrame* pointers.
|
||||
typedef nsTHashtable<nsPtrHashKey<nsIFrame>> VisibleFrames;
|
||||
typedef nsTHashSet<nsIFrame*> VisibleFrames;
|
||||
|
||||
public:
|
||||
explicit PresShell(Document* aDocument);
|
||||
|
@ -1705,14 +1705,14 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
void RecordAlloc(void* aPtr) {
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mAllocatedPointers.Contains(aPtr));
|
||||
mAllocatedPointers.PutEntry(aPtr);
|
||||
mAllocatedPointers.Insert(aPtr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void RecordFree(void* aPtr) {
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
MOZ_DIAGNOSTIC_ASSERT(mAllocatedPointers.Contains(aPtr));
|
||||
mAllocatedPointers.RemoveEntry(aPtr);
|
||||
mAllocatedPointers.Remove(aPtr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2810,7 +2810,7 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
// We track allocated pointers in a debug-only hashtable to assert against
|
||||
// missing/double frees.
|
||||
nsTHashtable<nsPtrHashKey<void>> mAllocatedPointers;
|
||||
nsTHashSet<void*> mAllocatedPointers;
|
||||
#endif
|
||||
|
||||
// A list of stack weak frames. This is a pointer to the last item in the
|
||||
|
@ -2818,7 +2818,7 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
AutoWeakFrame* mAutoWeakFrames;
|
||||
|
||||
// A hash table of heap allocated weak frames.
|
||||
nsTHashtable<nsPtrHashKey<WeakFrame>> mWeakFrames;
|
||||
nsTHashSet<WeakFrame*> mWeakFrames;
|
||||
|
||||
class DirtyRootsList {
|
||||
public:
|
||||
|
@ -2912,9 +2912,9 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
nsCOMArray<nsIContent> mCurrentEventContentStack;
|
||||
// Set of frames that we should mark with NS_FRAME_HAS_DIRTY_CHILDREN after
|
||||
// we finish reflowing mCurrentReflowRoot.
|
||||
nsTHashtable<nsPtrHashKey<nsIFrame>> mFramesToDirty;
|
||||
nsTHashtable<nsPtrHashKey<nsIScrollableFrame>> mPendingScrollAnchorSelection;
|
||||
nsTHashtable<nsPtrHashKey<nsIScrollableFrame>> mPendingScrollAnchorAdjustment;
|
||||
nsTHashSet<nsIFrame*> mFramesToDirty;
|
||||
nsTHashSet<nsIScrollableFrame*> mPendingScrollAnchorSelection;
|
||||
nsTHashSet<nsIScrollableFrame*> mPendingScrollAnchorAdjustment;
|
||||
|
||||
nsCallbackEventRequest* mFirstCallbackEventRequest = nullptr;
|
||||
nsCallbackEventRequest* mLastCallbackEventRequest = nullptr;
|
||||
|
|
|
@ -1310,7 +1310,7 @@ void RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
|
|||
|
||||
MaybeClearDestroyedFrames maybeClear(mDestroyedFrames);
|
||||
if (!mDestroyedFrames) {
|
||||
mDestroyedFrames = MakeUnique<nsTHashtable<nsPtrHashKey<const nsIFrame>>>();
|
||||
mDestroyedFrames = MakeUnique<nsTHashSet<const nsIFrame*>>();
|
||||
}
|
||||
|
||||
AUTO_PROFILER_LABEL("RestyleManager::ProcessRestyledFrames", LAYOUT);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsPresContextInlines.h" // XXX Shouldn't be included by header though
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
class nsAttrValue;
|
||||
class nsCSSFrameConstructor;
|
||||
|
@ -245,7 +246,7 @@ class RestyleManager {
|
|||
// If ProcessRestyledFrames is tracking frames which have been
|
||||
// destroyed (to avoid re-visiting them), add this one to its set.
|
||||
if (mDestroyedFrames) {
|
||||
mDestroyedFrames->PutEntry(aFrame);
|
||||
mDestroyedFrames->Insert(aFrame);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -515,8 +516,7 @@ class RestyleManager {
|
|||
// Used to keep track of frames that have been destroyed during
|
||||
// ProcessRestyledFrames, so we don't try to touch them again even if
|
||||
// they're referenced again later in the changelist.
|
||||
mozilla::UniquePtr<nsTHashtable<nsPtrHashKey<const nsIFrame>>>
|
||||
mDestroyedFrames;
|
||||
mozilla::UniquePtr<nsTHashSet<const nsIFrame*>> mDestroyedFrames;
|
||||
|
||||
protected:
|
||||
// True if we're in the middle of a nsRefreshDriver refresh
|
||||
|
|
|
@ -1315,10 +1315,10 @@ void nsRefreshDriver::RemovePostRefreshObserver(
|
|||
bool nsRefreshDriver::AddImageRequest(imgIRequest* aRequest) {
|
||||
uint32_t delay = GetFirstFrameDelay(aRequest);
|
||||
if (delay == 0) {
|
||||
mRequests.PutEntry(aRequest);
|
||||
mRequests.Insert(aRequest);
|
||||
} else {
|
||||
auto* const start = mStartTable.GetOrInsertNew(delay);
|
||||
start->mEntries.PutEntry(aRequest);
|
||||
start->mEntries.Insert(aRequest);
|
||||
}
|
||||
|
||||
EnsureTimerStarted();
|
||||
|
@ -1329,12 +1329,12 @@ bool nsRefreshDriver::AddImageRequest(imgIRequest* aRequest) {
|
|||
void nsRefreshDriver::RemoveImageRequest(imgIRequest* aRequest) {
|
||||
// Try to remove from both places, just in case, because we can't tell
|
||||
// whether RemoveEntry() succeeds.
|
||||
mRequests.RemoveEntry(aRequest);
|
||||
mRequests.Remove(aRequest);
|
||||
uint32_t delay = GetFirstFrameDelay(aRequest);
|
||||
if (delay != 0) {
|
||||
ImageStartData* start = mStartTable.Get(delay);
|
||||
if (start) {
|
||||
start->mEntries.RemoveEntry(aRequest);
|
||||
start->mEntries.Remove(aRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2261,9 +2261,8 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) {
|
|||
// images to refresh, and then we refresh each image in that array.
|
||||
nsCOMArray<imgIContainer> imagesToRefresh(mRequests.Count());
|
||||
|
||||
for (auto iter = mRequests.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
const nsISupportsHashKey* entry = iter.Get();
|
||||
auto req = static_cast<imgIRequest*>(entry->GetKey());
|
||||
for (nsISupports* entry : mRequests) {
|
||||
auto* req = static_cast<imgIRequest*>(entry);
|
||||
MOZ_ASSERT(req, "Unable to retrieve the image request");
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
if (NS_SUCCEEDED(req->GetImage(getter_AddRefs(image)))) {
|
||||
|
@ -2411,11 +2410,11 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) {
|
|||
|
||||
void nsRefreshDriver::BeginRefreshingImages(RequestTable& aEntries,
|
||||
mozilla::TimeStamp aDesired) {
|
||||
for (auto iter = aEntries.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
auto req = static_cast<imgIRequest*>(iter.Get()->GetKey());
|
||||
for (const auto& key : aEntries) {
|
||||
auto* req = static_cast<imgIRequest*>(key);
|
||||
MOZ_ASSERT(req, "Unable to retrieve the image request");
|
||||
|
||||
mRequests.PutEntry(req);
|
||||
mRequests.Insert(req);
|
||||
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
if (NS_SUCCEEDED(req->GetImage(getter_AddRefs(image)))) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "mozilla/WeakPtr.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTHashSet.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsRefreshObservers.h"
|
||||
|
@ -414,7 +414,7 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator,
|
|||
typedef nsTArray<RefPtr<VVPResizeEvent>> VisualViewportResizeEventArray;
|
||||
typedef nsTArray<RefPtr<mozilla::Runnable>> ScrollEventArray;
|
||||
typedef nsTArray<RefPtr<VVPScrollEvent>> VisualViewportScrollEventArray;
|
||||
typedef nsTHashtable<nsISupportsHashKey> RequestTable;
|
||||
typedef nsTHashSet<nsCOMPtr<nsISupports>> RequestTable;
|
||||
struct ImageStartData {
|
||||
ImageStartData() = default;
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ static bool IsFrameDescendantOfAny(
|
|||
nsIFrame* aCommonAncestor) {
|
||||
for (nsIFrame* f = aChild; f && f != aCommonAncestor;
|
||||
f = nsLayoutUtils::GetCrossDocParentFrameInProcess(f)) {
|
||||
if (aSetOfFrames.GetEntry(f)) {
|
||||
if (aSetOfFrames.Contains(f)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ void TextOverflow::ExamineFrameSubtree(nsIFrame* aFrame,
|
|||
}
|
||||
if (isAtomic && ((mIStart.mActive && overflowIStart) ||
|
||||
(mIEnd.mActive && overflowIEnd))) {
|
||||
aFramesToHide->PutEntry(aFrame);
|
||||
aFramesToHide->Insert(aFrame);
|
||||
} else if (isAtomic || frameType == LayoutFrameType::Text) {
|
||||
AnalyzeMarkerEdges(aFrame, frameType, aInsideMarkersArea, aFramesToHide,
|
||||
aAlignmentEdges, aFoundVisibleTextOrAtomic,
|
||||
|
@ -472,7 +472,7 @@ void TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
aFramesToHide->PutEntry(aFrame);
|
||||
aFramesToHide->Insert(aFrame);
|
||||
}
|
||||
} else if (!insideIStartEdge || !insideIEndEdge) {
|
||||
// frame is outside
|
||||
|
@ -480,7 +480,7 @@ void TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
|
|||
aAlignmentEdges->AccumulateOuter(mBlockWM, borderRect);
|
||||
}
|
||||
if (IsAtomicElement(aFrame, aFrameType)) {
|
||||
aFramesToHide->PutEntry(aFrame);
|
||||
aFramesToHide->Insert(aFrame);
|
||||
}
|
||||
} else {
|
||||
// frame is inside
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define TextOverflow_h_
|
||||
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTHashSet.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
@ -73,7 +73,7 @@ class TextOverflow final {
|
|||
// Returns whether aBlockFrame needs analysis for text overflow.
|
||||
static bool CanHaveOverflowMarkers(nsIFrame* aBlockFrame);
|
||||
|
||||
typedef nsTHashtable<nsPtrHashKey<nsIFrame>> FrameHashtable;
|
||||
typedef nsTHashSet<nsIFrame*> FrameHashtable;
|
||||
|
||||
private:
|
||||
typedef mozilla::WritingMode WritingMode;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "nsSplittableFrame.h"
|
||||
#include "nsFrameList.h"
|
||||
#include "nsLineBox.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
class nsOverflowContinuationTracker;
|
||||
|
||||
|
@ -774,7 +775,7 @@ class nsContainerFrame : public nsSplittableFrame {
|
|||
*
|
||||
* @return true if any items are moved; false otherwise.
|
||||
*/
|
||||
using FrameHashtable = nsTHashtable<nsPtrHashKey<nsIFrame>>;
|
||||
using FrameHashtable = nsTHashSet<nsIFrame*>;
|
||||
bool PushIncompleteChildren(const FrameHashtable& aPushedItems,
|
||||
const FrameHashtable& aIncompleteItems,
|
||||
const FrameHashtable& aOverflowIncompleteItems);
|
||||
|
|
|
@ -5254,7 +5254,7 @@ std::tuple<nscoord, bool> nsFlexContainerFrame::ReflowChildren(
|
|||
"[frag] Flex item %p needed to be pushed to container's "
|
||||
"next-in-flow due to position below available space's block-end",
|
||||
item.Frame());
|
||||
pushedItems.PutEntry(item.Frame());
|
||||
pushedItems.Insert(item.Frame());
|
||||
} else if (item.NeedsFinalReflow(availableBSizeForItem)) {
|
||||
// The available size must be in item's writing-mode.
|
||||
const WritingMode itemWM = item.GetWritingMode();
|
||||
|
@ -5268,9 +5268,9 @@ std::tuple<nscoord, bool> nsFlexContainerFrame::ReflowChildren(
|
|||
aContainerSize, aHasLineClampEllipsis);
|
||||
|
||||
if (childReflowStatus.IsIncomplete()) {
|
||||
incompleteItems.PutEntry(item.Frame());
|
||||
incompleteItems.Insert(item.Frame());
|
||||
} else if (childReflowStatus.IsOverflowIncomplete()) {
|
||||
overflowIncompleteItems.PutEntry(item.Frame());
|
||||
overflowIncompleteItems.Insert(item.Frame());
|
||||
}
|
||||
} else {
|
||||
MoveFlexItemToFinalPosition(aReflowInput, item, framePos,
|
||||
|
|
|
@ -354,10 +354,10 @@ nsresult nsFloatManager::RemoveTrailingRegions(nsIFrame* aFrameList) {
|
|||
// floats given were at the end of our list, so we could just search
|
||||
// for the head of aFrameList. (But we can't;
|
||||
// layout/reftests/bugs/421710-1.html crashes.)
|
||||
nsTHashtable<nsPtrHashKey<nsIFrame> > frameSet(1);
|
||||
nsTHashSet<nsIFrame*> frameSet(1);
|
||||
|
||||
for (nsIFrame* f = aFrameList; f; f = f->GetNextSibling()) {
|
||||
frameSet.PutEntry(f);
|
||||
frameSet.Insert(f);
|
||||
}
|
||||
|
||||
uint32_t newLength = mFloats.Length();
|
||||
|
|
|
@ -3888,7 +3888,7 @@ void nsGridContainerFrame::AddImplicitNamedAreas(
|
|||
// http://dev.w3.org/csswg/css-grid/#implicit-named-areas
|
||||
// Note: recording these names for fast lookup later is just an optimization.
|
||||
const uint32_t len = std::min(aLineNameLists.Length(), size_t(kMaxLine));
|
||||
nsTHashtable<nsStringHashKey> currentStarts;
|
||||
nsTHashSet<nsString> currentStarts;
|
||||
ImplicitNamedAreas* areas = GetImplicitNamedAreas();
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
for (const auto& nameIdent : aLineNameLists[i].AsSpan()) {
|
||||
|
@ -7636,7 +7636,7 @@ nscoord nsGridContainerFrame::ReflowRowsInFragmentainer(
|
|||
MOZ_ASSERT(child->GetPrevInFlow() ? row < aStartRow : row >= aStartRow,
|
||||
"unexpected child start row");
|
||||
if (row >= aEndRow) {
|
||||
pushedItems.PutEntry(child);
|
||||
pushedItems.Insert(child);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -7761,9 +7761,9 @@ nscoord nsGridContainerFrame::ReflowRowsInFragmentainer(
|
|||
MOZ_ASSERT(!childStatus.IsInlineBreakBefore(),
|
||||
"should've handled InlineBreak::Before above");
|
||||
if (childStatus.IsIncomplete()) {
|
||||
incompleteItems.PutEntry(child);
|
||||
incompleteItems.Insert(child);
|
||||
} else if (!childStatus.IsFullyComplete()) {
|
||||
overflowIncompleteItems.PutEntry(child);
|
||||
overflowIncompleteItems.Insert(child);
|
||||
}
|
||||
if (isColMasonry) {
|
||||
auto childWM = child->GetWritingMode();
|
||||
|
@ -8067,14 +8067,14 @@ nscoord nsGridContainerFrame::MasonryLayout(GridReflowInput& aState,
|
|||
}
|
||||
if (aChildStatus.IsInlineBreakBefore()) {
|
||||
aStatus.SetIncomplete();
|
||||
pushedItems.PutEntry(child);
|
||||
pushedItems.Insert(child);
|
||||
} else if (aChildStatus.IsIncomplete()) {
|
||||
recordAutoPlacement(aItem, gridAxis);
|
||||
aStatus.SetIncomplete();
|
||||
incompleteItems.PutEntry(child);
|
||||
incompleteItems.Insert(child);
|
||||
} else if (!aChildStatus.IsFullyComplete()) {
|
||||
recordAutoPlacement(aItem, gridAxis);
|
||||
overflowIncompleteItems.PutEntry(child);
|
||||
overflowIncompleteItems.Insert(child);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -7903,12 +7903,11 @@ void nsIFrame::List(FILE* out, const char* aPrefix, ListFlags aFlags) const {
|
|||
}
|
||||
|
||||
void nsIFrame::ListTextRuns(FILE* out) const {
|
||||
nsTHashtable<nsVoidPtrHashKey> seen;
|
||||
nsTHashSet<const void*> seen;
|
||||
ListTextRuns(out, seen);
|
||||
}
|
||||
|
||||
void nsIFrame::ListTextRuns(FILE* out,
|
||||
nsTHashtable<nsVoidPtrHashKey>& aSeen) const {
|
||||
void nsIFrame::ListTextRuns(FILE* out, nsTHashSet<const void*>& aSeen) const {
|
||||
for (const auto& childList : ChildLists()) {
|
||||
for (const nsIFrame* kid : childList.mList) {
|
||||
kid->ListTextRuns(out, aSeen);
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
#include "mozilla/gfx/MatrixFwd.h"
|
||||
#include "nsDisplayItemTypes.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
# include "mozilla/a11y/AccTypes.h"
|
||||
|
@ -5443,8 +5444,7 @@ class nsIFrame : public nsQueryFrame {
|
|||
ListFlags aFlags = ListFlags()) const;
|
||||
|
||||
void ListTextRuns(FILE* out = stderr) const;
|
||||
virtual void ListTextRuns(FILE* out,
|
||||
nsTHashtable<nsVoidPtrHashKey>& aSeen) const;
|
||||
virtual void ListTextRuns(FILE* out, nsTHashSet<const void*>& aSeen) const;
|
||||
|
||||
virtual void ListWithMatchedRules(FILE* out = stderr,
|
||||
const char* aPrefix = "") const;
|
||||
|
|
|
@ -108,7 +108,7 @@ void nsLineBox::StealHashTableFrom(nsLineBox* aFromLine,
|
|||
// remove aFromLine's frames that aren't on this line
|
||||
nsIFrame* f = aFromLine->mFirstChild;
|
||||
for (uint32_t i = 0; i < aFromLineNewCount; f = f->GetNextSibling(), ++i) {
|
||||
mFrames->RemoveEntry(f);
|
||||
mFrames->Remove(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,14 +136,14 @@ void nsLineBox::NoteFramesMovedFrom(nsLineBox* aFromLine) {
|
|||
// remove the moved frames from it
|
||||
nsIFrame* f = mFirstChild;
|
||||
for (uint32_t i = 0; i < toCount; f = f->GetNextSibling(), ++i) {
|
||||
aFromLine->mFrames->RemoveEntry(f);
|
||||
aFromLine->mFrames->Remove(f);
|
||||
}
|
||||
} else if (toCount <= fromNewCount) {
|
||||
// This line needs a hash table, allocate a hash table for it since that
|
||||
// means fewer hash ops.
|
||||
nsIFrame* f = mFirstChild;
|
||||
for (uint32_t i = 0; i < toCount; f = f->GetNextSibling(), ++i) {
|
||||
aFromLine->mFrames->RemoveEntry(f); // toCount RemoveEntry
|
||||
aFromLine->mFrames->Remove(f); // toCount RemoveEntry
|
||||
}
|
||||
SwitchToHashtable(); // toCount PutEntry
|
||||
} else {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "nsILineIterator.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
class nsLineBox;
|
||||
|
@ -302,10 +304,9 @@ class nsLineBox final : public nsLineLink {
|
|||
uint32_t minLength =
|
||||
std::max(kMinChildCountForHashtable,
|
||||
uint32_t(PLDHashTable::kDefaultInitialLength));
|
||||
mFrames =
|
||||
new nsTHashtable<nsPtrHashKey<nsIFrame> >(std::max(count, minLength));
|
||||
mFrames = new nsTHashSet<nsIFrame*>(std::max(count, minLength));
|
||||
for (nsIFrame* f = mFirstChild; count-- > 0; f = f->GetNextSibling()) {
|
||||
mFrames->PutEntry(f);
|
||||
mFrames->Insert(f);
|
||||
}
|
||||
}
|
||||
void SwitchToCounter() {
|
||||
|
@ -327,7 +328,7 @@ class nsLineBox final : public nsLineLink {
|
|||
*/
|
||||
void NoteFrameAdded(nsIFrame* aFrame) {
|
||||
if (MOZ_UNLIKELY(mFlags.mHasHashedFrames)) {
|
||||
mFrames->PutEntry(aFrame);
|
||||
mFrames->Insert(aFrame);
|
||||
} else {
|
||||
if (++mChildCount >= kMinChildCountForHashtable) {
|
||||
SwitchToHashtable();
|
||||
|
@ -341,7 +342,7 @@ class nsLineBox final : public nsLineLink {
|
|||
void NoteFrameRemoved(nsIFrame* aFrame) {
|
||||
MOZ_ASSERT(GetChildCount() > 0);
|
||||
if (MOZ_UNLIKELY(mFlags.mHasHashedFrames)) {
|
||||
mFrames->RemoveEntry(aFrame);
|
||||
mFrames->Remove(aFrame);
|
||||
if (mFrames->Count() < kMinChildCountForHashtable) {
|
||||
SwitchToCounter();
|
||||
}
|
||||
|
@ -594,7 +595,7 @@ class nsLineBox final : public nsLineLink {
|
|||
|
||||
// mFlags.mHasHashedFrames says which one to use
|
||||
union {
|
||||
nsTHashtable<nsPtrHashKey<nsIFrame> >* mFrames;
|
||||
nsTHashSet<nsIFrame*>* mFrames;
|
||||
uint32_t mChildCount;
|
||||
};
|
||||
|
||||
|
|
|
@ -10121,11 +10121,11 @@ void nsTextFrame::List(FILE* out, const char* aPrefix, ListFlags aFlags) const {
|
|||
}
|
||||
|
||||
void nsTextFrame::ListTextRuns(FILE* out,
|
||||
nsTHashtable<nsVoidPtrHashKey>& aSeen) const {
|
||||
nsTHashSet<const void*>& aSeen) const {
|
||||
if (!mTextRun || aSeen.Contains(mTextRun)) {
|
||||
return;
|
||||
}
|
||||
aSeen.PutEntry(mTextRun);
|
||||
aSeen.Insert(mTextRun);
|
||||
mTextRun->Dump(out);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -301,8 +301,7 @@ class nsTextFrame : public nsIFrame {
|
|||
ListFlags aFlags = ListFlags()) const final;
|
||||
nsresult GetFrameName(nsAString& aResult) const final;
|
||||
void ToCString(nsCString& aBuf, int32_t* aTotalContentLength) const;
|
||||
void ListTextRuns(FILE* out,
|
||||
nsTHashtable<nsVoidPtrHashKey>& aSeen) const final;
|
||||
void ListTextRuns(FILE* out, nsTHashSet<const void*>& aSeen) const final;
|
||||
#endif
|
||||
|
||||
// Returns this text frame's content's text fragment.
|
||||
|
|
|
@ -78,7 +78,7 @@ void InspectorUtils::GetAllStyleSheets(GlobalObject& aGlobalObject,
|
|||
|
||||
// The non-document stylesheet array can't have duplicates right now, but it
|
||||
// could once we include adopted stylesheets.
|
||||
nsTHashtable<nsPtrHashKey<StyleSheet>> sheetSet;
|
||||
nsTHashSet<StyleSheet*> sheetSet;
|
||||
for (StyleSheet* sheet : nonDocumentSheets) {
|
||||
if (sheetSet.EnsureInserted(sheet)) {
|
||||
aResult.AppendElement(sheet);
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace mozilla {
|
|||
|
||||
class PaintedDisplayItemLayerUserData;
|
||||
|
||||
static nsTHashtable<nsPtrHashKey<DisplayItemData>>* sAliveDisplayItemDatas;
|
||||
static nsTHashSet<DisplayItemData*>* sAliveDisplayItemDatas;
|
||||
|
||||
// DO NOT MODIFY THE ARRAY RETURNED BY THIS FUNCTION.
|
||||
// It might be the static empty array.
|
||||
|
@ -288,10 +288,10 @@ DisplayItemData::DisplayItemData(LayerManagerData* aParent, uint32_t aKey,
|
|||
MOZ_COUNT_CTOR(DisplayItemData);
|
||||
|
||||
if (!sAliveDisplayItemDatas) {
|
||||
sAliveDisplayItemDatas = new nsTHashtable<nsPtrHashKey<DisplayItemData>>();
|
||||
sAliveDisplayItemDatas = new nsTHashSet<DisplayItemData*>();
|
||||
}
|
||||
MOZ_RELEASE_ASSERT(!sAliveDisplayItemDatas->Contains(this));
|
||||
sAliveDisplayItemDatas->PutEntry(this);
|
||||
sAliveDisplayItemDatas->Insert(this);
|
||||
|
||||
MOZ_RELEASE_ASSERT(mLayer);
|
||||
if (aFrame) {
|
||||
|
@ -443,11 +443,8 @@ DisplayItemData::~DisplayItemData() {
|
|||
}
|
||||
|
||||
MOZ_RELEASE_ASSERT(sAliveDisplayItemDatas);
|
||||
nsPtrHashKey<mozilla::DisplayItemData>* entry =
|
||||
sAliveDisplayItemDatas->GetEntry(this);
|
||||
MOZ_RELEASE_ASSERT(entry);
|
||||
|
||||
sAliveDisplayItemDatas->RemoveEntry(entry);
|
||||
const bool removed = sAliveDisplayItemDatas->EnsureRemoved(this);
|
||||
MOZ_RELEASE_ASSERT(removed);
|
||||
|
||||
if (sAliveDisplayItemDatas->Count() == 0) {
|
||||
delete sAliveDisplayItemDatas;
|
||||
|
@ -1669,8 +1666,7 @@ class ContainerState {
|
|||
*/
|
||||
typedef AutoTArray<NewLayerEntry, 1> AutoLayersArray;
|
||||
AutoLayersArray mNewChildLayers;
|
||||
nsTHashtable<nsRefPtrHashKey<PaintedLayer>>
|
||||
mPaintedLayersAvailableForRecycling;
|
||||
nsTHashSet<RefPtr<PaintedLayer>> mPaintedLayersAvailableForRecycling;
|
||||
nscoord mAppUnitsPerDevPixel;
|
||||
bool mSnappingEnabled;
|
||||
|
||||
|
@ -5601,7 +5597,7 @@ void ContainerState::CollectOldLayers() {
|
|||
"Mask layers should not be part of the layer tree.");
|
||||
if (layer->HasUserData(&gPaintedDisplayItemLayerUserData)) {
|
||||
NS_ASSERTION(layer->AsPaintedLayer(), "Wrong layer type");
|
||||
mPaintedLayersAvailableForRecycling.PutEntry(
|
||||
mPaintedLayersAvailableForRecycling.Insert(
|
||||
static_cast<PaintedLayer*>(layer));
|
||||
}
|
||||
|
||||
|
|
|
@ -1871,7 +1871,7 @@ void nsDisplayListBuilder::WeakFrameRegion::RemoveModifiedFramesAndRects() {
|
|||
AnyContentAncestorModified(wrapper.mWeakFrame->GetFrame())) {
|
||||
// To avoid multiple O(n) shifts in the array, move the last element of
|
||||
// the array to the current position and decrease the array length.
|
||||
mFrameSet.RemoveEntry(wrapper.mFrame);
|
||||
mFrameSet.Remove(wrapper.mFrame);
|
||||
mFrames[i] = std::move(mFrames[length - 1]);
|
||||
mRects[i] = std::move(mRects[length - 1]);
|
||||
length--;
|
||||
|
@ -2037,7 +2037,7 @@ bool nsDisplayListBuilder::AddToAGRBudget(nsIFrame* aFrame) {
|
|||
|
||||
if (onBudget) {
|
||||
mUsedAGRBudget += cost;
|
||||
mAGRBudgetSet.PutEntry(aFrame);
|
||||
mAGRBudgetSet.Insert(aFrame);
|
||||
}
|
||||
|
||||
return onBudget;
|
||||
|
@ -7540,9 +7540,9 @@ Matrix4x4 nsDisplayTransform::GetResultingTransformMatrixInternal(
|
|||
// aProperties.HasTransform(), since we still need any
|
||||
// potential parentsChildrenOnlyTransform.
|
||||
Matrix svgTransform, parentsChildrenOnlyTransform;
|
||||
const bool hasSVGTransforms = frame &&
|
||||
frame->HasAnyStateBits(NS_FRAME_MAY_BE_TRANSFORMED) &&
|
||||
frame->IsSVGTransformed(&svgTransform, &parentsChildrenOnlyTransform);
|
||||
const bool hasSVGTransforms =
|
||||
frame && frame->HasAnyStateBits(NS_FRAME_MAY_BE_TRANSFORMED) &&
|
||||
frame->IsSVGTransformed(&svgTransform, &parentsChildrenOnlyTransform);
|
||||
bool shouldRound = nsLayoutUtils::ShouldSnapToGrid(frame);
|
||||
|
||||
/* Transformed frames always have a transform, or are preserving 3d (and might
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTHashSet.h"
|
||||
#include "nsTHashMap.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -1776,7 +1776,7 @@ class nsDisplayListBuilder {
|
|||
void* mFrame;
|
||||
};
|
||||
|
||||
nsTHashtable<nsPtrHashKey<void>> mFrameSet;
|
||||
nsTHashSet<void*> mFrameSet;
|
||||
nsTArray<WeakFrameWrapper> mFrames;
|
||||
nsTArray<pixman_box32_t> mRects;
|
||||
|
||||
|
@ -1786,7 +1786,7 @@ class nsDisplayListBuilder {
|
|||
return;
|
||||
}
|
||||
|
||||
mFrameSet.PutEntry(aFrame);
|
||||
mFrameSet.Insert(aFrame);
|
||||
mFrames.AppendElement(WeakFrameWrapper(aFrame));
|
||||
mRects.AppendElement(nsRegion::RectToBox(aRect));
|
||||
}
|
||||
|
@ -1936,7 +1936,7 @@ class nsDisplayListBuilder {
|
|||
// Area of animated geometry root budget already allocated
|
||||
uint32_t mUsedAGRBudget;
|
||||
// Set of frames already counted in budget
|
||||
nsTHashtable<nsPtrHashKey<nsIFrame>> mAGRBudgetSet;
|
||||
nsTHashSet<nsIFrame*> mAGRBudgetSet;
|
||||
|
||||
nsTHashMap<nsPtrHashKey<RemoteBrowser>, EffectsInfo> mEffectsUpdates;
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ void FontFaceSet::FindMatchingFontFaces(const nsACString& aFont,
|
|||
arrays[1] = &mRuleFaces;
|
||||
|
||||
// Set of FontFaces that we want to return.
|
||||
nsTHashtable<nsPtrHashKey<FontFace>> matchingFaces;
|
||||
nsTHashSet<FontFace*> matchingFaces;
|
||||
|
||||
for (const FontFamilyName& fontFamilyName : familyList->mNames) {
|
||||
if (!fontFamilyName.IsNamed()) {
|
||||
|
@ -290,7 +290,7 @@ void FontFaceSet::FindMatchingFontFaces(const nsACString& aFont,
|
|||
FontFace::Entry* entry = static_cast<FontFace::Entry*>(e);
|
||||
if (HasAnyCharacterInUnicodeRange(entry, aText)) {
|
||||
for (FontFace* f : entry->GetFontFaces()) {
|
||||
matchingFaces.PutEntry(f);
|
||||
matchingFaces.Insert(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ bool FontFaceSet::UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules) {
|
|||
// that not happen, but in the meantime, don't try to insert the same
|
||||
// FontFace object more than once into mRuleFaces. We track which
|
||||
// ones we've handled in this table.
|
||||
nsTHashtable<nsPtrHashKey<RawServoFontFaceRule>> handledRules;
|
||||
nsTHashSet<RawServoFontFaceRule*> handledRules;
|
||||
|
||||
for (size_t i = 0, i_end = aRules.Length(); i < i_end; ++i) {
|
||||
// Insert each FontFace objects for each rule into our list, migrating old
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "mozilla/ProfilerLabels.h"
|
||||
#include "mozilla/SVGObserverUtils.h"
|
||||
#include "mozilla/layers/WebRenderUserData.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
@ -56,7 +57,7 @@ NS_INTERFACE_MAP_END
|
|||
struct ImageTableEntry {
|
||||
// Set of all ImageLoaders that have registered this URL and care for updates
|
||||
// for it.
|
||||
nsTHashtable<nsPtrHashKey<ImageLoader>> mImageLoaders;
|
||||
nsTHashSet<ImageLoader*> mImageLoaders;
|
||||
|
||||
// The amount of style values that are sharing this image.
|
||||
uint32_t mSharedCount = 1;
|
||||
|
@ -352,8 +353,8 @@ void ImageLoader::SetAnimationMode(uint16_t aMode) {
|
|||
aMode == imgIContainer::kLoopOnceAnimMode,
|
||||
"Wrong Animation Mode is being set!");
|
||||
|
||||
for (auto iter = mRequestToFrameMap.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
auto request = static_cast<imgIRequest*>(iter.Key());
|
||||
for (nsISupports* key : mRequestToFrameMap.Keys()) {
|
||||
auto* request = static_cast<imgIRequest*>(key);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
@ -376,8 +377,8 @@ void ImageLoader::SetAnimationMode(uint16_t aMode) {
|
|||
void ImageLoader::ClearFrames(nsPresContext* aPresContext) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
for (auto iter = mRequestToFrameMap.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
auto request = static_cast<imgIRequest*>(iter.Key());
|
||||
for (const auto& key : mRequestToFrameMap.Keys()) {
|
||||
auto* request = static_cast<imgIRequest*>(key);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
@ -651,12 +652,9 @@ void GlobalImageObserver::Notify(imgIRequest* aRequest, int32_t aType,
|
|||
return;
|
||||
}
|
||||
|
||||
auto& loaders = entry.Data()->mImageLoaders;
|
||||
nsTArray<RefPtr<ImageLoader>> loadersToNotify(loaders.Count());
|
||||
for (auto iter = loaders.Iter(); !iter.Done(); iter.Next()) {
|
||||
loadersToNotify.AppendElement(iter.Get()->GetKey());
|
||||
}
|
||||
for (auto& loader : loadersToNotify) {
|
||||
const auto loadersToNotify =
|
||||
ToTArray<nsTArray<RefPtr<ImageLoader>>>(entry.Data()->mImageLoaders);
|
||||
for (const auto& loader : loadersToNotify) {
|
||||
loader->Notify(aRequest, aType, aData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ static nsAnimationManager::OwningCSSAnimationPtrArray BuildAnimations(
|
|||
nsPresContext* aPresContext, const NonOwningAnimationTarget& aTarget,
|
||||
const nsStyleDisplay& aStyleDisplay, ServoCSSAnimationBuilder& aBuilder,
|
||||
nsAnimationManager::CSSAnimationCollection* aCollection,
|
||||
nsTHashtable<nsRefPtrHashKey<nsAtom>>& aReferencedAnimations) {
|
||||
nsTHashSet<RefPtr<nsAtom>>& aReferencedAnimations) {
|
||||
nsAnimationManager::OwningCSSAnimationPtrArray result;
|
||||
|
||||
for (size_t animIdx = aStyleDisplay.mAnimationNameCount; animIdx-- != 0;) {
|
||||
|
@ -291,7 +291,7 @@ static nsAnimationManager::OwningCSSAnimationPtrArray BuildAnimations(
|
|||
continue;
|
||||
}
|
||||
|
||||
aReferencedAnimations.PutEntry(name);
|
||||
aReferencedAnimations.Insert(name);
|
||||
RefPtr<CSSAnimation> dest = BuildAnimation(
|
||||
aPresContext, aTarget, aStyleDisplay, animIdx, aBuilder, aCollection);
|
||||
if (!dest) {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/Keyframe.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
struct nsStyleDisplay;
|
||||
class ServoCSSAnimationBuilder;
|
||||
|
@ -87,7 +88,7 @@ class nsAnimationManager final
|
|||
// It may contain names which are no longer referenced, but it should always
|
||||
// contain names which are currently referenced, so that it is usable for
|
||||
// style invalidation.
|
||||
nsTHashtable<nsRefPtrHashKey<nsAtom>> mMaybeReferencedAnimations;
|
||||
nsTHashSet<RefPtr<nsAtom>> mMaybeReferencedAnimations;
|
||||
|
||||
void DoUpdateAnimations(const mozilla::NonOwningAnimationTarget& aTarget,
|
||||
const nsStyleDisplay& aStyleDisplay,
|
||||
|
|
|
@ -1018,13 +1018,11 @@ class SVGRenderingObserverSet {
|
|||
MOZ_COUNT_DTOR(SVGRenderingObserverSet);
|
||||
}
|
||||
|
||||
void Add(SVGRenderingObserver* aObserver) { mObservers.PutEntry(aObserver); }
|
||||
void Remove(SVGRenderingObserver* aObserver) {
|
||||
mObservers.RemoveEntry(aObserver);
|
||||
}
|
||||
void Add(SVGRenderingObserver* aObserver) { mObservers.Insert(aObserver); }
|
||||
void Remove(SVGRenderingObserver* aObserver) { mObservers.Remove(aObserver); }
|
||||
#ifdef DEBUG
|
||||
bool Contains(SVGRenderingObserver* aObserver) {
|
||||
return (mObservers.GetEntry(aObserver) != nullptr);
|
||||
return mObservers.Contains(aObserver);
|
||||
}
|
||||
#endif
|
||||
bool IsEmpty() { return mObservers.IsEmpty(); }
|
||||
|
@ -1048,7 +1046,7 @@ class SVGRenderingObserverSet {
|
|||
void RemoveAll();
|
||||
|
||||
private:
|
||||
nsTHashtable<nsPtrHashKey<SVGRenderingObserver>> mObservers;
|
||||
nsTHashSet<SVGRenderingObserver*> mObservers;
|
||||
};
|
||||
|
||||
void SVGRenderingObserverSet::InvalidateAll() {
|
||||
|
@ -1056,15 +1054,10 @@ void SVGRenderingObserverSet::InvalidateAll() {
|
|||
return;
|
||||
}
|
||||
|
||||
AutoTArray<SVGRenderingObserver*, 10> observers;
|
||||
const auto observers = std::move(mObservers);
|
||||
|
||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||
observers.AppendElement(it.Get()->GetKey());
|
||||
}
|
||||
mObservers.Clear();
|
||||
|
||||
for (uint32_t i = 0; i < observers.Length(); ++i) {
|
||||
observers[i]->OnNonDOMMutationRenderingChange();
|
||||
for (const auto& observer : observers) {
|
||||
observer->OnNonDOMMutationRenderingChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1075,11 +1068,12 @@ void SVGRenderingObserverSet::InvalidateAllForReflow() {
|
|||
|
||||
AutoTArray<SVGRenderingObserver*, 10> observers;
|
||||
|
||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||
SVGRenderingObserver* obs = it.Get()->GetKey();
|
||||
for (auto it = mObservers.cbegin(), end = mObservers.cend(); it != end;
|
||||
++it) {
|
||||
SVGRenderingObserver* obs = *it;
|
||||
if (obs->ObservesReflow()) {
|
||||
observers.AppendElement(obs);
|
||||
it.Remove();
|
||||
mObservers.Remove(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1089,17 +1083,12 @@ void SVGRenderingObserverSet::InvalidateAllForReflow() {
|
|||
}
|
||||
|
||||
void SVGRenderingObserverSet::RemoveAll() {
|
||||
AutoTArray<SVGRenderingObserver*, 10> observers;
|
||||
|
||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||
observers.AppendElement(it.Get()->GetKey());
|
||||
}
|
||||
mObservers.Clear();
|
||||
const auto observers = std::move(mObservers);
|
||||
|
||||
// Our list is now cleared. We need to notify the observers we've removed,
|
||||
// so they can update their state & remove themselves as mutation-observers.
|
||||
for (uint32_t i = 0; i < observers.Length(); ++i) {
|
||||
observers[i]->NotifyEvictedFromRenderingObserverSet();
|
||||
for (const auto& observer : observers) {
|
||||
observer->NotifyEvictedFromRenderingObserverSet();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,24 +35,23 @@ void SVGOuterSVGFrame::RegisterForeignObject(SVGForeignObjectFrame* aFrame) {
|
|||
NS_ASSERTION(aFrame, "Who on earth is calling us?!");
|
||||
|
||||
if (!mForeignObjectHash) {
|
||||
mForeignObjectHash =
|
||||
MakeUnique<nsTHashtable<nsPtrHashKey<SVGForeignObjectFrame>>>();
|
||||
mForeignObjectHash = MakeUnique<nsTHashSet<SVGForeignObjectFrame*>>();
|
||||
}
|
||||
|
||||
NS_ASSERTION(!mForeignObjectHash->GetEntry(aFrame),
|
||||
NS_ASSERTION(!mForeignObjectHash->Contains(aFrame),
|
||||
"SVGForeignObjectFrame already registered!");
|
||||
|
||||
mForeignObjectHash->PutEntry(aFrame);
|
||||
mForeignObjectHash->Insert(aFrame);
|
||||
|
||||
NS_ASSERTION(mForeignObjectHash->GetEntry(aFrame),
|
||||
NS_ASSERTION(mForeignObjectHash->Contains(aFrame),
|
||||
"Failed to register SVGForeignObjectFrame!");
|
||||
}
|
||||
|
||||
void SVGOuterSVGFrame::UnregisterForeignObject(SVGForeignObjectFrame* aFrame) {
|
||||
NS_ASSERTION(aFrame, "Who on earth is calling us?!");
|
||||
NS_ASSERTION(mForeignObjectHash && mForeignObjectHash->GetEntry(aFrame),
|
||||
NS_ASSERTION(mForeignObjectHash && mForeignObjectHash->Contains(aFrame),
|
||||
"SVGForeignObjectFrame not in registry!");
|
||||
return mForeignObjectHash->RemoveEntry(aFrame);
|
||||
return mForeignObjectHash->Remove(aFrame);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -638,8 +637,8 @@ nsRegion SVGOuterSVGFrame::FindInvalidatedForeignObjectFrameChildren(
|
|||
nsIFrame* aFrame) {
|
||||
nsRegion result;
|
||||
if (mForeignObjectHash && mForeignObjectHash->Count()) {
|
||||
for (auto it = mForeignObjectHash->Iter(); !it.Done(); it.Next()) {
|
||||
result.Or(result, it.Get()->GetKey()->GetInvalidRegion());
|
||||
for (const auto& key : *mForeignObjectHash) {
|
||||
result.Or(result, key->GetInvalidRegion());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/SVGContainerFrame.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
class gfxContext;
|
||||
|
||||
|
@ -196,8 +197,7 @@ class SVGOuterSVGFrame final : public SVGDisplayContainerFrame,
|
|||
// A hash-set containing our SVGForeignObjectFrame descendants. Note we use
|
||||
// a hash-set to avoid the O(N^2) behavior we'd get tearing down an SVG frame
|
||||
// subtree if we were to use a list (see bug 381285 comment 20).
|
||||
UniquePtr<nsTHashtable<nsPtrHashKey<SVGForeignObjectFrame>>>
|
||||
mForeignObjectHash;
|
||||
UniquePtr<nsTHashSet<SVGForeignObjectFrame*>> mForeignObjectHash;
|
||||
|
||||
nsRegion mInvalidRegion;
|
||||
|
||||
|
|
|
@ -489,10 +489,10 @@ void nsTableFrame::ResetRowIndices(
|
|||
RowGroupArray rowGroups;
|
||||
OrderRowGroups(rowGroups);
|
||||
|
||||
nsTHashtable<nsPtrHashKey<nsTableRowGroupFrame> > excludeRowGroups;
|
||||
nsTHashSet<nsTableRowGroupFrame*> excludeRowGroups;
|
||||
nsFrameList::Enumerator excludeRowGroupsEnumerator(aRowGroupsToExclude);
|
||||
while (!excludeRowGroupsEnumerator.AtEnd()) {
|
||||
excludeRowGroups.PutEntry(
|
||||
excludeRowGroups.Insert(
|
||||
static_cast<nsTableRowGroupFrame*>(excludeRowGroupsEnumerator.get()));
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
@ -516,7 +516,7 @@ void nsTableFrame::ResetRowIndices(
|
|||
int32_t rowIndex = 0;
|
||||
for (uint32_t rgIdx = 0; rgIdx < rowGroups.Length(); rgIdx++) {
|
||||
nsTableRowGroupFrame* rgFrame = rowGroups[rgIdx];
|
||||
if (!excludeRowGroups.GetEntry(rgFrame)) {
|
||||
if (!excludeRowGroups.Contains(rgFrame)) {
|
||||
const nsFrameList& rowFrames = rgFrame->PrincipalChildList();
|
||||
for (nsFrameList::Enumerator rows(rowFrames); !rows.AtEnd();
|
||||
rows.Next()) {
|
||||
|
|
|
@ -1908,9 +1908,7 @@ nsresult nsTreeBodyFrame::GetImage(int32_t aRowIndex, nsTreeColumn* aCol,
|
|||
nsTreeImageListener* listener = new nsTreeImageListener(this);
|
||||
if (!listener) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (!mCreatedListeners.PutEntry(listener)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mCreatedListeners.Insert(listener);
|
||||
|
||||
listener->AddCell(aRowIndex, aCol);
|
||||
nsCOMPtr<imgINotificationObserver> imgNotificationObserver = listener;
|
||||
|
@ -4225,7 +4223,7 @@ void nsTreeBodyFrame::DetachImageListeners() { mCreatedListeners.Clear(); }
|
|||
|
||||
void nsTreeBodyFrame::RemoveTreeImageListener(nsTreeImageListener* aListener) {
|
||||
if (aListener) {
|
||||
mCreatedListeners.RemoveEntry(aListener);
|
||||
mCreatedListeners.Remove(aListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nsTreeStyleCache.h"
|
||||
#include "nsTreeColumns.h"
|
||||
#include "nsTHashMap.h"
|
||||
#include "nsTHashSet.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgINotificationObserver.h"
|
||||
#include "nsScrollbarFrame.h"
|
||||
|
@ -606,9 +607,9 @@ class nsTreeBodyFrame final : public nsLeafBoxFrame,
|
|||
// overflow/underflow event handlers
|
||||
bool mCheckingOverflow;
|
||||
|
||||
// Hash table to keep track of which listeners we created and thus
|
||||
// Hash set to keep track of which listeners we created and thus
|
||||
// have pointers to us.
|
||||
nsTHashtable<nsPtrHashKey<nsTreeImageListener> > mCreatedListeners;
|
||||
nsTHashSet<nsTreeImageListener*> mCreatedListeners;
|
||||
|
||||
}; // class nsTreeBodyFrame
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче