mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
780b285e68
Unfortunately, `EventChainVisitor` does not grab the `nsPresContext` with `RefPtr` by itself. Therefore, there is no guarantee of the lifetime without checking the origin when its subclasses are instantiated. This patch changes it and subclasses to `MOZ_STACK_CLASS` since only `EventDispatcher::Dispatch()` creates them in the stack with given `nsPresContext`. Additionally, it's already been marked as MOZ_CAN_RUN_SCRIPT_BOUNDARY`. Therefore, the `nsPresContext` instance has already been guaranteed its lifetime by the caller. For making this fact stronger, this patch marks their constructors as `MOZ_CAN_RUN_SCRIPT`. Therefore, nobody can create those instances without guaranteeing the lifetime of `nsPresContext` and `dom::Event`. Note that it may look like that `mPresContext` of `EventChainPostVisitor` is not guaranteed. However, `EventChainPreVisitor` which gives `nsPresContext` to it is also a stack only class. So, it won't be deleted before `EventChainPostVisitor` instance. Differential Revision: https://phabricator.services.mozilla.com/D30010 --HG-- extra : moz-landing-system : lando
83 lines
2.8 KiB
C++
83 lines
2.8 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
//
|
|
// nsSplitterFrame
|
|
//
|
|
|
|
#ifndef nsSplitterFrame_h__
|
|
#define nsSplitterFrame_h__
|
|
|
|
#include "mozilla/Attributes.h"
|
|
#include "nsBoxFrame.h"
|
|
|
|
class nsSplitterFrameInner;
|
|
|
|
namespace mozilla {
|
|
class PresShell;
|
|
} // namespace mozilla
|
|
|
|
nsIFrame* NS_NewSplitterFrame(mozilla::PresShell* aPresShell,
|
|
mozilla::ComputedStyle* aStyle);
|
|
|
|
class nsSplitterFrame final : public nsBoxFrame {
|
|
public:
|
|
NS_DECL_FRAMEARENA_HELPERS(nsSplitterFrame)
|
|
|
|
explicit nsSplitterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot,
|
|
PostDestroyData& aPostDestroyData) override;
|
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
|
return MakeFrameName(NS_LITERAL_STRING("SplitterFrame"), aResult);
|
|
}
|
|
#endif
|
|
|
|
// nsIFrame overrides
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
|
int32_t aModType) override;
|
|
|
|
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
|
nsIFrame* aPrevInFlow) override;
|
|
|
|
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;
|
|
|
|
NS_IMETHOD HandlePress(nsPresContext* aPresContext,
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
nsEventStatus* aEventStatus) override;
|
|
|
|
NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
nsEventStatus* aEventStatus,
|
|
bool aControlHeld) override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
nsEventStatus* aEventStatus) override;
|
|
|
|
NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
nsEventStatus* aEventStatus) override;
|
|
|
|
virtual nsresult HandleEvent(nsPresContext* aPresContext,
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
nsEventStatus* aEventStatus) override;
|
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
const nsDisplayListSet& aLists) override;
|
|
|
|
virtual void GetInitialOrientation(bool& aIsHorizontal) override;
|
|
|
|
private:
|
|
friend class nsSplitterFrameInner;
|
|
nsSplitterFrameInner* mInner;
|
|
|
|
}; // class nsSplitterFrame
|
|
|
|
#endif
|