зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1552911 - Tweak the internal C++ constructor of ResizeObserverEntry to require aBorderBoxSize and aContentBoxSize. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D32031 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9c6dd560e5
Коммит
d8b7df23dc
|
@ -220,15 +220,13 @@ uint32_t ResizeObserver::BroadcastActiveObservations() {
|
|||
|
||||
for (auto& observation : mActiveTargets) {
|
||||
Element* target = observation->Target();
|
||||
RefPtr<ResizeObserverEntry> entry = new ResizeObserverEntry(this, *target);
|
||||
|
||||
nsSize borderBoxSize =
|
||||
GetTargetSize(target, ResizeObserverBoxOptions::Border_box);
|
||||
entry->SetBorderBoxSize(borderBoxSize);
|
||||
|
||||
nsSize contentBoxSize =
|
||||
GetTargetSize(target, ResizeObserverBoxOptions::Content_box);
|
||||
entry->SetContentRectAndSize(contentBoxSize);
|
||||
RefPtr<ResizeObserverEntry> entry =
|
||||
new ResizeObserverEntry(this, *target, borderBoxSize, contentBoxSize);
|
||||
|
||||
if (!entries.AppendElement(entry.forget(), fallible)) {
|
||||
// Out of memory.
|
||||
|
|
|
@ -175,10 +175,15 @@ class ResizeObserverEntry final : public nsISupports, public nsWrapperCache {
|
|||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObserverEntry)
|
||||
|
||||
ResizeObserverEntry(nsISupports* aOwner, Element& aTarget)
|
||||
ResizeObserverEntry(nsISupports* aOwner, Element& aTarget,
|
||||
const nsSize& aBorderBoxSize,
|
||||
const nsSize& aContentBoxSize)
|
||||
: mOwner(aOwner), mTarget(&aTarget) {
|
||||
MOZ_ASSERT(mOwner, "Need a non-null owner");
|
||||
MOZ_ASSERT(mTarget, "Need a non-null target element");
|
||||
|
||||
SetBorderBoxSize(aBorderBoxSize);
|
||||
SetContentRectAndSize(aContentBoxSize);
|
||||
}
|
||||
|
||||
nsISupports* GetParentObject() const { return mOwner; }
|
||||
|
@ -203,14 +208,14 @@ class ResizeObserverEntry final : public nsISupports, public nsWrapperCache {
|
|||
ResizeObserverSize* BorderBoxSize() const { return mBorderBoxSize; }
|
||||
ResizeObserverSize* ContentBoxSize() const { return mContentBoxSize; }
|
||||
|
||||
private:
|
||||
~ResizeObserverEntry() = default;
|
||||
|
||||
// Set borderBoxSize.
|
||||
void SetBorderBoxSize(const nsSize& aSize);
|
||||
// Set contentRect and contentBoxSize.
|
||||
void SetContentRectAndSize(const nsSize& aSize);
|
||||
|
||||
protected:
|
||||
~ResizeObserverEntry() = default;
|
||||
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<Element> mTarget;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче