mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-27 09:37:31 +09:00
Issue #1643 - Part 4: Hook up all the plumbing.
This commit is contained in:
parent
96a75aa648
commit
57d143dc6e
5 changed files with 46 additions and 2 deletions
|
|
@ -61,7 +61,7 @@ ResizeObserver::Constructor(const GlobalObject& aGlobal,
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<ResizeObserver> observer = new ResizeObserver(window.forget(), aCb);
|
RefPtr<ResizeObserver> observer = new ResizeObserver(window.forget(), aCb);
|
||||||
// TODO: Add the new ResizeObserver to document here in the later patch.
|
document->AddResizeObserver(observer);
|
||||||
|
|
||||||
return observer.forget();
|
return observer.forget();
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +86,7 @@ ResizeObserver::Observe(Element* aTarget,
|
||||||
// Per the spec, we need to trigger notification in event loop that
|
// Per the spec, we need to trigger notification in event loop that
|
||||||
// contains ResizeObserver observe call even when resize/reflow does
|
// contains ResizeObserver observe call even when resize/reflow does
|
||||||
// not happen.
|
// not happen.
|
||||||
// TODO: Implement the notification scheduling in the later patch.
|
aTarget->OwnerDoc()->ScheduleResizeObserversNotification();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1681,6 +1681,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
|
||||||
cb.NoteXPCOMChild(mql);
|
cb.NoteXPCOMChild(mql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tmp->mResizeObserverController) {
|
||||||
|
tmp->mResizeObserverController->Traverse(cb);
|
||||||
|
}
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocument)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocument)
|
||||||
|
|
@ -1786,6 +1790,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp->mInUnlinkOrDeletion = false;
|
tmp->mInUnlinkOrDeletion = false;
|
||||||
|
|
||||||
|
if (tmp->mResizeObserverController) {
|
||||||
|
tmp->mResizeObserverController->Unlink();
|
||||||
|
}
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
@ -11823,6 +11831,24 @@ nsDocument::QuerySelectorAll(const nsAString& aSelector, nsIDOMNodeList **aRetur
|
||||||
return nsINode::QuerySelectorAll(aSelector, aReturn);
|
return nsINode::QuerySelectorAll(aSelector, aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocument::AddResizeObserver(ResizeObserver* aResizeObserver)
|
||||||
|
{
|
||||||
|
if (!mResizeObserverController) {
|
||||||
|
mResizeObserverController = MakeUnique<ResizeObserverController>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
mResizeObserverController->AddResizeObserver(aResizeObserver);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDocument::ScheduleResizeObserversNotification() const
|
||||||
|
{
|
||||||
|
if (mResizeObserverController) {
|
||||||
|
mResizeObserverController->ScheduleNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
already_AddRefed<nsIDocument>
|
already_AddRefed<nsIDocument>
|
||||||
nsIDocument::Constructor(const GlobalObject& aGlobal,
|
nsIDocument::Constructor(const GlobalObject& aGlobal,
|
||||||
ErrorResult& rv)
|
ErrorResult& rv)
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "mozilla/PendingAnimationTracker.h"
|
#include "mozilla/PendingAnimationTracker.h"
|
||||||
#include "mozilla/dom/DOMImplementation.h"
|
#include "mozilla/dom/DOMImplementation.h"
|
||||||
|
#include "mozilla/dom/ResizeObserverController.h"
|
||||||
#include "mozilla/dom/ScriptLoader.h"
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/dom/StyleSheetList.h"
|
#include "mozilla/dom/StyleSheetList.h"
|
||||||
#include "nsDataHashtable.h"
|
#include "nsDataHashtable.h"
|
||||||
|
|
@ -1024,6 +1025,10 @@ public:
|
||||||
|
|
||||||
virtual void UnblockDOMContentLoaded() override;
|
virtual void UnblockDOMContentLoaded() override;
|
||||||
|
|
||||||
|
void AddResizeObserver(mozilla::dom::ResizeObserver* aResizeObserver) override;
|
||||||
|
|
||||||
|
void ScheduleResizeObserversNotification() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class nsNodeUtils;
|
friend class nsNodeUtils;
|
||||||
friend class nsDocumentOnStack;
|
friend class nsDocumentOnStack;
|
||||||
|
|
@ -1160,6 +1165,9 @@ protected:
|
||||||
|
|
||||||
nsTArray<nsIObserver*> mCharSetObservers;
|
nsTArray<nsIObserver*> mCharSetObservers;
|
||||||
|
|
||||||
|
mozilla::UniquePtr<mozilla::dom::ResizeObserverController>
|
||||||
|
mResizeObserverController;
|
||||||
|
|
||||||
PLDHashTable *mSubDocuments;
|
PLDHashTable *mSubDocuments;
|
||||||
|
|
||||||
// Array of owning references to all children
|
// Array of owning references to all children
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,7 @@ class ProcessingInstruction;
|
||||||
class Promise;
|
class Promise;
|
||||||
class Selection;
|
class Selection;
|
||||||
class ScriptLoader;
|
class ScriptLoader;
|
||||||
|
class ResizeObserver;
|
||||||
class StyleSheetList;
|
class StyleSheetList;
|
||||||
class SVGDocument;
|
class SVGDocument;
|
||||||
class SVGSVGElement;
|
class SVGSVGElement;
|
||||||
|
|
@ -2853,6 +2854,10 @@ public:
|
||||||
|
|
||||||
bool ModuleScriptsEnabled();
|
bool ModuleScriptsEnabled();
|
||||||
|
|
||||||
|
virtual void AddResizeObserver(mozilla::dom::ResizeObserver* aResizeObserver) = 0;
|
||||||
|
|
||||||
|
virtual void ScheduleResizeObserversNotification() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool GetUseCounter(mozilla::UseCounter aUseCounter)
|
bool GetUseCounter(mozilla::UseCounter aUseCounter)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9060,6 +9060,11 @@ PresShell::DidDoReflow(bool aInterruptible)
|
||||||
docShell->NotifyReflowObservers(aInterruptible, mLastReflowStart, now);
|
docShell->NotifyReflowObservers(aInterruptible, mLastReflowStart, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify resize observers on reflow.
|
||||||
|
if (!mPresContext->HasPendingInterrupt()) {
|
||||||
|
mDocument->ScheduleResizeObserversNotification();
|
||||||
|
}
|
||||||
|
|
||||||
if (sSynthMouseMove) {
|
if (sSynthMouseMove) {
|
||||||
SynthesizeMouseMove(false);
|
SynthesizeMouseMove(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue