Bug 1719555 Part 3 - Replace virtual & override specifier with final for combobox frames. r=hiro

This patch is similar to Emilio's cleanup in Bug 1590278.

Differential Revision: https://phabricator.services.mozilla.com/D119341
This commit is contained in:
Ting-Yu Lin 2021-07-08 17:58:42 +00:00
Родитель fffcdeb9e6
Коммит e38cf9beb4
2 изменённых файлов: 51 добавлений и 57 удалений

Просмотреть файл

@ -376,15 +376,15 @@ class nsResizeDropdownAtFinalPosition final : public nsIReflowCallback,
~nsResizeDropdownAtFinalPosition() = default; ~nsResizeDropdownAtFinalPosition() = default;
public: public:
virtual bool ReflowFinished() override { bool ReflowFinished() final {
Run(); Run();
NS_RELEASE_THIS(); NS_RELEASE_THIS();
return false; return false;
} }
virtual void ReflowCallbackCanceled() override { NS_RELEASE_THIS(); } void ReflowCallbackCanceled() final { NS_RELEASE_THIS(); }
NS_IMETHOD Run() override { NS_IMETHOD Run() final {
if (mFrame.IsAlive()) { if (mFrame.IsAlive()) {
static_cast<nsComboboxControlFrame*>(mFrame.GetFrame()) static_cast<nsComboboxControlFrame*>(mFrame.GetFrame())
->AbsolutelyPositionDropDown(); ->AbsolutelyPositionDropDown();
@ -1222,22 +1222,21 @@ class nsComboboxDisplayFrame final : public nsBlockFrame {
mComboBox(aComboBox) {} mComboBox(aComboBox) {}
#ifdef DEBUG_FRAME_DUMP #ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override { nsresult GetFrameName(nsAString& aResult) const final {
return MakeFrameName(u"ComboboxDisplay"_ns, aResult); return MakeFrameName(u"ComboboxDisplay"_ns, aResult);
} }
#endif #endif
virtual bool IsFrameOfType(uint32_t aFlags) const override { bool IsFrameOfType(uint32_t aFlags) const final {
return nsBlockFrame::IsFrameOfType(aFlags & return nsBlockFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplacedContainsBlock)); ~(nsIFrame::eReplacedContainsBlock));
} }
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput, const ReflowInput& aReflowInput, nsReflowStatus& aStatus) final;
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override; const nsDisplayListSet& aLists) final;
protected: protected:
nsComboboxControlFrame* mComboBox; nsComboboxControlFrame* mComboBox;

Просмотреть файл

@ -67,61 +67,57 @@ class nsComboboxControlFrame final : public nsBlockFrame,
NS_DECL_FRAMEARENA_HELPERS(nsComboboxControlFrame) NS_DECL_FRAMEARENA_HELPERS(nsComboboxControlFrame)
// nsIAnonymousContentCreator // nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent( nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) final;
nsTArray<ContentInfo>& aElements) override; void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements, uint32_t aFilter) final;
uint32_t aFilter) override;
nsIContent* GetDisplayNode() const; nsIContent* GetDisplayNode() const;
nsIFrame* CreateFrameForDisplayNode(); nsIFrame* CreateFrameForDisplayNode();
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override; mozilla::a11y::AccType AccessibleType() final;
#endif #endif
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override; nscoord GetMinISize(gfxContext* aRenderingContext) final;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override; nscoord GetPrefISize(gfxContext* aRenderingContext) final;
virtual void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize, void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput, const ReflowInput& aReflowInput, nsReflowStatus& aStatus) final;
nsReflowStatus& aStatus) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual nsresult HandleEvent(nsPresContext* aPresContext, nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent, mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override; nsEventStatus* aEventStatus) final;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override; const nsDisplayListSet& aLists) final;
void PaintFocus(DrawTarget& aDrawTarget, nsPoint aPt); void PaintFocus(DrawTarget& aDrawTarget, nsPoint aPt);
virtual bool IsFrameOfType(uint32_t aFlags) const override { bool IsFrameOfType(uint32_t aFlags) const final {
return nsBlockFrame::IsFrameOfType( return nsBlockFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
} }
virtual nsIScrollableFrame* GetScrollTargetFrame() const override; nsIScrollableFrame* GetScrollTargetFrame() const final;
#ifdef DEBUG_FRAME_DUMP #ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override; nsresult GetFrameName(nsAString& aResult) const final;
#endif #endif
virtual void DestroyFrom(nsIFrame* aDestructRoot, void DestroyFrom(nsIFrame* aDestructRoot,
PostDestroyData& aPostDestroyData) override; PostDestroyData& aPostDestroyData) final;
virtual void SetInitialChildList(ChildListID aListID, void SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) final;
nsFrameList& aChildList) override; const nsFrameList& GetChildList(ChildListID aListID) const final;
virtual const nsFrameList& GetChildList(ChildListID aListID) const override; void GetChildLists(nsTArray<ChildList>* aLists) const final;
virtual void GetChildLists(nsTArray<ChildList>* aLists) const override;
virtual nsContainerFrame* GetContentInsertionFrame() override; nsContainerFrame* GetContentInsertionFrame() final;
// Return the dropdown and display frame. // Return the dropdown and display frame.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override; void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) final;
// nsIFormControlFrame // nsIFormControlFrame
virtual nsresult SetFormProperty(nsAtom* aName, nsresult SetFormProperty(nsAtom* aName, const nsAString& aValue) final;
const nsAString& aValue) override;
/** /**
* Inform the control that it got (or lost) focus. * Inform the control that it got (or lost) focus.
* If it lost focus, the dropdown menu will be rolled up if needed, * If it lost focus, the dropdown menu will be rolled up if needed,
@ -132,7 +128,7 @@ class nsComboboxControlFrame final : public nsBlockFrame,
* @note This method might destroy |this|. * @note This method might destroy |this|.
*/ */
MOZ_CAN_RUN_SCRIPT_BOUNDARY MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void SetFocus(bool aOn, bool aRepaint) override; void SetFocus(bool aOn, bool aRepaint) final;
bool IsDroppedDown() { return mDroppedDown; } bool IsDroppedDown() { return mDroppedDown; }
MOZ_CAN_RUN_SCRIPT void ShowDropDown(bool aDoDropDown); MOZ_CAN_RUN_SCRIPT void ShowDropDown(bool aDoDropDown);
@ -166,12 +162,12 @@ class nsComboboxControlFrame final : public nsBlockFrame,
} }
// nsISelectControlFrame // nsISelectControlFrame
NS_IMETHOD AddOption(int32_t index) override; NS_IMETHOD AddOption(int32_t index) final;
NS_IMETHOD RemoveOption(int32_t index) override; NS_IMETHOD RemoveOption(int32_t index) final;
NS_IMETHOD DoneAddingChildren(bool aIsDone) override; NS_IMETHOD DoneAddingChildren(bool aIsDone) final;
NS_IMETHOD OnOptionSelected(int32_t aIndex, bool aSelected) override; NS_IMETHOD OnOptionSelected(int32_t aIndex, bool aSelected) final;
NS_IMETHOD_(void) NS_IMETHOD_(void)
OnSetSelectedIndex(int32_t aOldIndex, int32_t aNewIndex) override; OnSetSelectedIndex(int32_t aOldIndex, int32_t aNewIndex) final;
// nsIRollupListener // nsIRollupListener
/** /**
@ -179,38 +175,37 @@ class nsComboboxControlFrame final : public nsBlockFrame,
* @note This method might destroy |this|. * @note This method might destroy |this|.
*/ */
MOZ_CAN_RUN_SCRIPT_BOUNDARY MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool Rollup(uint32_t aCount, bool aFlush, bool Rollup(uint32_t aCount, bool aFlush,
const mozilla::LayoutDeviceIntPoint* pos, const mozilla::LayoutDeviceIntPoint* pos,
nsIContent** aLastRolledUp) override; nsIContent** aLastRolledUp) final;
virtual void NotifyGeometryChange() override; void NotifyGeometryChange() final;
/** /**
* A combobox should roll up if a mousewheel event happens outside of * A combobox should roll up if a mousewheel event happens outside of
* the popup area. * the popup area.
*/ */
virtual bool ShouldRollupOnMouseWheelEvent() override { return true; } bool ShouldRollupOnMouseWheelEvent() final { return true; }
virtual bool ShouldConsumeOnMouseWheelEvent() override { return false; } bool ShouldConsumeOnMouseWheelEvent() final { return false; }
/** /**
* A combobox should not roll up if activated by a mouse activate message * A combobox should not roll up if activated by a mouse activate message
* (eg. X-mouse). * (eg. X-mouse).
*/ */
virtual bool ShouldRollupOnMouseActivate() override { return false; } bool ShouldRollupOnMouseActivate() final { return false; }
virtual uint32_t GetSubmenuWidgetChain( uint32_t GetSubmenuWidgetChain(nsTArray<nsIWidget*>* aWidgetChain) final {
nsTArray<nsIWidget*>* aWidgetChain) override {
return 0; return 0;
} }
virtual nsIWidget* GetRollupWidget() override; nsIWidget* GetRollupWidget() final;
// nsIStatefulFrame // nsIStatefulFrame
mozilla::UniquePtr<mozilla::PresState> SaveState() override; mozilla::UniquePtr<mozilla::PresState> SaveState() final;
MOZ_CAN_RUN_SCRIPT_BOUNDARY MOZ_CAN_RUN_SCRIPT_BOUNDARY
NS_IMETHOD RestoreState(mozilla::PresState* aState) override; NS_IMETHOD RestoreState(mozilla::PresState* aState) final;
void GenerateStateKey(nsIContent* aContent, mozilla::dom::Document* aDocument, void GenerateStateKey(nsIContent* aContent, mozilla::dom::Document* aDocument,
nsACString& aKey) override; nsACString& aKey) final;
static bool ToolkitHasNativePopup(); static bool ToolkitHasNativePopup();