Skip to content

Commit

Permalink
Bug 1036052 - Privatize public destructor of DOMRect. r=baku
Browse files Browse the repository at this point in the history
  • Loading branch information
threebee committed Sep 2, 2014
1 parent d627e90 commit c197954
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
9 changes: 3 additions & 6 deletions content/base/src/DOMRect.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class DOMRect MOZ_FINAL : public DOMRectReadOnly

protected:
double mX, mY, mWidth, mHeight;

private:
~DOMRect() {};
};

class DOMRectList MOZ_FINAL : public nsIDOMClientRectList,
Expand Down Expand Up @@ -210,12 +213,6 @@ class DOMRectList MOZ_FINAL : public nsIDOMClientRectList,

}

template<>
struct HasDangerousPublicDestructor<dom::DOMRect>
{
static const bool value = true;
};

}

#endif /*MOZILLA_DOMRECT_H_*/
8 changes: 4 additions & 4 deletions dom/events/ScrollAreaEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ ScrollAreaEvent::ScrollAreaEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalScrollAreaEvent* aEvent)
: UIEvent(aOwner, aPresContext, aEvent)
, mClientArea(nullptr)
, mClientArea(new DOMRect(nullptr))
{
mClientArea.SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
mClientArea->SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
}

NS_IMPL_ADDREF_INHERITED(ScrollAreaEvent, UIEvent)
Expand Down Expand Up @@ -57,7 +57,7 @@ ScrollAreaEvent::InitScrollAreaEvent(const nsAString& aEventType,
UIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);

mClientArea.SetRect(aX, aY, aWidth, aHeight);
mClientArea->SetRect(aX, aY, aWidth, aHeight);

return NS_OK;
}
Expand Down Expand Up @@ -88,7 +88,7 @@ ScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &y), false);
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &width), false);
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &height), false);
mClientArea.SetRect(x, y, width, height);
mClientArea->SetRect(x, y, width, height);

return true;
}
Expand Down
10 changes: 5 additions & 5 deletions dom/events/ScrollAreaEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ class ScrollAreaEvent : public UIEvent,

float X() const
{
return mClientArea.Left();
return mClientArea->Left();
}

float Y() const
{
return mClientArea.Top();
return mClientArea->Top();
}

float Width() const
{
return mClientArea.Width();
return mClientArea->Width();
}

float Height() const
{
return mClientArea.Height();
return mClientArea->Height();
}

void InitScrollAreaEvent(const nsAString& aType,
Expand All @@ -79,7 +79,7 @@ class ScrollAreaEvent : public UIEvent,
protected:
~ScrollAreaEvent() {}

DOMRect mClientArea;
nsRefPtr<DOMRect> mClientArea;
};

} // namespace dom
Expand Down

0 comments on commit c197954

Please sign in to comment.