Bug 1719555 Part 3 - Replace virtual & override specifier with final for combobox frames. r=hiro
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 08 Jul 2021 17:58:42 +0000
changeset 585116 6471338e204480fa6f290e5e1c8db363fbdb3174
parent 585115 f97a644bef6aaa9dc77225639beb4da30eab0dca
child 585117 cf5570dac55e3cc41ded7df710ef4de80c473680
push id38596
push usermalexandru@mozilla.com
push dateFri, 09 Jul 2021 03:52:03 +0000
treeherdermozilla-central@9b0fc6f1555b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1719555, 1590278
milestone91.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsComboboxControlFrame.h
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -371,25 +371,25 @@ class nsResizeDropdownAtFinalPosition fi
  public:
   explicit nsResizeDropdownAtFinalPosition(nsComboboxControlFrame* aFrame)
       : mozilla::Runnable("nsResizeDropdownAtFinalPosition"), mFrame(aFrame) {}
 
  protected:
   ~nsResizeDropdownAtFinalPosition() = default;
 
  public:
-  virtual bool ReflowFinished() override {
+  bool ReflowFinished() final {
     Run();
     NS_RELEASE_THIS();
     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()) {
       static_cast<nsComboboxControlFrame*>(mFrame.GetFrame())
           ->AbsolutelyPositionDropDown();
     }
     return NS_OK;
   }
 
   WeakFrame mFrame;
@@ -1217,32 +1217,31 @@ class nsComboboxDisplayFrame final : pub
   NS_DECL_FRAMEARENA_HELPERS(nsComboboxDisplayFrame)
 
   nsComboboxDisplayFrame(ComputedStyle* aStyle,
                          nsComboboxControlFrame* aComboBox)
       : nsBlockFrame(aStyle, aComboBox->PresContext(), kClassID),
         mComboBox(aComboBox) {}
 
 #ifdef DEBUG_FRAME_DUMP
-  nsresult GetFrameName(nsAString& aResult) const override {
+  nsresult GetFrameName(nsAString& aResult) const final {
     return MakeFrameName(u"ComboboxDisplay"_ns, aResult);
   }
 #endif
 
-  virtual bool IsFrameOfType(uint32_t aFlags) const override {
+  bool IsFrameOfType(uint32_t aFlags) const final {
     return nsBlockFrame::IsFrameOfType(aFlags &
                                        ~(nsIFrame::eReplacedContainsBlock));
   }
 
-  virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
-                      const ReflowInput& aReflowInput,
-                      nsReflowStatus& aStatus) override;
+  void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
+              const ReflowInput& aReflowInput, nsReflowStatus& aStatus) final;
 
-  virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
-                                const nsDisplayListSet& aLists) override;
+  void BuildDisplayList(nsDisplayListBuilder* aBuilder,
+                        const nsDisplayListSet& aLists) final;
 
  protected:
   nsComboboxControlFrame* mComboBox;
 };
 
 NS_IMPL_FRAMEARENA_HELPERS(nsComboboxDisplayFrame)
 
 void nsComboboxDisplayFrame::Reflow(nsPresContext* aPresContext,
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -62,82 +62,78 @@ class nsComboboxControlFrame final : pub
   explicit nsComboboxControlFrame(ComputedStyle* aStyle,
                                   nsPresContext* aPresContext);
   ~nsComboboxControlFrame();
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsComboboxControlFrame)
 
   // nsIAnonymousContentCreator
-  virtual nsresult CreateAnonymousContent(
-      nsTArray<ContentInfo>& aElements) override;
-  virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
-                                        uint32_t aFilter) override;
+  nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) final;
+  void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
+                                uint32_t aFilter) final;
 
   nsIContent* GetDisplayNode() const;
   nsIFrame* CreateFrameForDisplayNode();
 
 #ifdef ACCESSIBILITY
-  virtual mozilla::a11y::AccType AccessibleType() override;
+  mozilla::a11y::AccType AccessibleType() final;
 #endif
 
-  virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
-
-  virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
+  nscoord GetMinISize(gfxContext* aRenderingContext) final;
 
-  virtual void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize,
-                      const ReflowInput& aReflowInput,
-                      nsReflowStatus& aStatus) override;
+  nscoord GetPrefISize(gfxContext* aRenderingContext) final;
+
+  void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize,
+              const ReflowInput& aReflowInput, nsReflowStatus& aStatus) final;
 
   MOZ_CAN_RUN_SCRIPT_BOUNDARY
-  virtual nsresult HandleEvent(nsPresContext* aPresContext,
-                               mozilla::WidgetGUIEvent* aEvent,
-                               nsEventStatus* aEventStatus) override;
+  nsresult HandleEvent(nsPresContext* aPresContext,
+                       mozilla::WidgetGUIEvent* aEvent,
+                       nsEventStatus* aEventStatus) final;
 
-  virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
-                                const nsDisplayListSet& aLists) override;
+  void BuildDisplayList(nsDisplayListBuilder* aBuilder,
+                        const nsDisplayListSet& aLists) final;
 
   void PaintFocus(DrawTarget& aDrawTarget, nsPoint aPt);
 
-  virtual bool IsFrameOfType(uint32_t aFlags) const override {
+  bool IsFrameOfType(uint32_t aFlags) const final {
     return nsBlockFrame::IsFrameOfType(
         aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
   }
 
-  virtual nsIScrollableFrame* GetScrollTargetFrame() const override;
+  nsIScrollableFrame* GetScrollTargetFrame() const final;
 
 #ifdef DEBUG_FRAME_DUMP
-  virtual nsresult GetFrameName(nsAString& aResult) const override;
+  nsresult GetFrameName(nsAString& aResult) const final;
 #endif
-  virtual void DestroyFrom(nsIFrame* aDestructRoot,
-                           PostDestroyData& aPostDestroyData) override;
-  virtual void SetInitialChildList(ChildListID aListID,
-                                   nsFrameList& aChildList) override;
-  virtual const nsFrameList& GetChildList(ChildListID aListID) const override;
-  virtual void GetChildLists(nsTArray<ChildList>* aLists) const override;
+  void DestroyFrom(nsIFrame* aDestructRoot,
+                   PostDestroyData& aPostDestroyData) final;
+  void SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) final;
+  const nsFrameList& GetChildList(ChildListID aListID) const final;
+  void GetChildLists(nsTArray<ChildList>* aLists) const final;
 
-  virtual nsContainerFrame* GetContentInsertionFrame() override;
+  nsContainerFrame* GetContentInsertionFrame() final;
 
   // Return the dropdown and display frame.
-  void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
+  void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) final;
 
   // nsIFormControlFrame
-  virtual nsresult SetFormProperty(nsAtom* aName,
-                                   const nsAString& aValue) override;
+  nsresult SetFormProperty(nsAtom* aName, const nsAString& aValue) final;
   /**
    * Inform the control that it got (or lost) focus.
    * If it lost focus, the dropdown menu will be rolled up if needed,
    * and FireOnChange() will be called.
    * @param aOn true if got focus, false if lost focus.
    * @param aRepaint if true then force repaint (NOTE: we always force repaint
    *        currently)
    * @note This method might destroy |this|.
    */
   MOZ_CAN_RUN_SCRIPT_BOUNDARY
-  virtual void SetFocus(bool aOn, bool aRepaint) override;
+  void SetFocus(bool aOn, bool aRepaint) final;
 
   bool IsDroppedDown() { return mDroppedDown; }
   MOZ_CAN_RUN_SCRIPT void ShowDropDown(bool aDoDropDown);
   nsIFrame* GetDropDown();
   void SetDropDown(nsListControlFrame* aDropDownFrame);
   MOZ_CAN_RUN_SCRIPT void RollupFromList();
 
   /**
@@ -161,61 +157,60 @@ class nsComboboxControlFrame final : pub
 
   void SetOpenInParentProcess(bool aVal) { mIsOpenInParentProcess = aVal; }
 
   bool IsDroppedDownOrHasParentPopup() {
     return IsDroppedDown() || IsOpenInParentProcess();
   }
 
   // nsISelectControlFrame
-  NS_IMETHOD AddOption(int32_t index) override;
-  NS_IMETHOD RemoveOption(int32_t index) override;
-  NS_IMETHOD DoneAddingChildren(bool aIsDone) override;
-  NS_IMETHOD OnOptionSelected(int32_t aIndex, bool aSelected) override;
+  NS_IMETHOD AddOption(int32_t index) final;
+  NS_IMETHOD RemoveOption(int32_t index) final;
+  NS_IMETHOD DoneAddingChildren(bool aIsDone) final;
+  NS_IMETHOD OnOptionSelected(int32_t aIndex, bool aSelected) final;
   NS_IMETHOD_(void)
-  OnSetSelectedIndex(int32_t aOldIndex, int32_t aNewIndex) override;
+  OnSetSelectedIndex(int32_t aOldIndex, int32_t aNewIndex) final;
 
   // nsIRollupListener
   /**
    * Hide the dropdown menu and stop capturing mouse events.
    * @note This method might destroy |this|.
    */
   MOZ_CAN_RUN_SCRIPT_BOUNDARY
-  virtual bool Rollup(uint32_t aCount, bool aFlush,
-                      const mozilla::LayoutDeviceIntPoint* pos,
-                      nsIContent** aLastRolledUp) override;
-  virtual void NotifyGeometryChange() override;
+  bool Rollup(uint32_t aCount, bool aFlush,
+              const mozilla::LayoutDeviceIntPoint* pos,
+              nsIContent** aLastRolledUp) final;
+  void NotifyGeometryChange() final;
 
   /**
    * A combobox should roll up if a mousewheel event happens outside of
    * 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
    * (eg. X-mouse).
    */
-  virtual bool ShouldRollupOnMouseActivate() override { return false; }
+  bool ShouldRollupOnMouseActivate() final { return false; }
 
-  virtual uint32_t GetSubmenuWidgetChain(
-      nsTArray<nsIWidget*>* aWidgetChain) override {
+  uint32_t GetSubmenuWidgetChain(nsTArray<nsIWidget*>* aWidgetChain) final {
     return 0;
   }
 
-  virtual nsIWidget* GetRollupWidget() override;
+  nsIWidget* GetRollupWidget() final;
 
   // nsIStatefulFrame
-  mozilla::UniquePtr<mozilla::PresState> SaveState() override;
+  mozilla::UniquePtr<mozilla::PresState> SaveState() final;
   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,
-                        nsACString& aKey) override;
+                        nsACString& aKey) final;
 
   static bool ToolkitHasNativePopup();
 
  protected:
   friend class RedisplayTextEvent;
   friend class nsAsyncResize;
   friend class nsResizeDropdownAtFinalPosition;