Bug 1494330 Part 1 - Make NS_NewListControlFrame() return nsListControlFrame*. r=layout-reviewers,boris
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 07 Jul 2021 03:11:06 +0000
changeset 584929 cdae5012ffbdd4609dd7f844afa8ddcbb54d6a37
parent 584928 b493f282a582f558d4e6cd116390f57b04f9a4aa
child 584930 dd89d3803b2034b0a90c8280be72deea2594efe6
push id38589
push userimoraru@mozilla.com
push dateWed, 07 Jul 2021 09:52:09 +0000
treeherdermozilla-central@a2e6beb5031b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslayout-reviewers, boris
bugs1494330
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 1494330 Part 1 - Make NS_NewListControlFrame() return nsListControlFrame*. r=layout-reviewers,boris Also, add nsListControlFrame to the forward declaration list in nsHTMLParts, and sort them alphabetically. Differential Revision: https://phabricator.services.mozilla.com/D119205
layout/base/nsCSSFrameConstructor.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsListControlFrame.h
layout/generic/nsHTMLParts.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2894,23 +2894,22 @@ nsIFrame* nsCSSFrameConstructor::Constru
     aState.AddChild(comboboxFrame, aFrameList, content, aParentFrame);
 
     // Resolve pseudo element style for the dropdown list
     RefPtr<ComputedStyle> listStyle;
     listStyle = mPresShell->StyleSet()->ResolveInheritingAnonymousBoxStyle(
         PseudoStyleType::dropDownList, computedStyle);
 
     // Create a listbox
-    nsContainerFrame* listFrame = NS_NewListControlFrame(mPresShell, listStyle);
+    nsListControlFrame* listFrame =
+        NS_NewListControlFrame(mPresShell, listStyle);
 
     // Notify the listbox that it is being used as a dropdown list.
-    nsListControlFrame* listControlFrame = do_QueryFrame(listFrame);
-    if (listControlFrame) {
-      listControlFrame->SetComboboxFrame(comboboxFrame);
-    }
+    listFrame->SetComboboxFrame(comboboxFrame);
+
     // Notify combobox that it should use the listbox as it's popup
     comboboxFrame->SetDropDown(listFrame);
 
     NS_ASSERTION(!listFrame->IsAbsPosContainingBlock(),
                  "Ended up with positioned dropdown list somehow.");
     NS_ASSERTION(!listFrame->IsFloating(),
                  "Ended up with floating dropdown list somehow.");
 
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -68,18 +68,18 @@ class nsListEventListener final : public
 
  private:
   ~nsListEventListener() = default;
 
   nsListControlFrame* mFrame;
 };
 
 //---------------------------------------------------------
-nsContainerFrame* NS_NewListControlFrame(PresShell* aPresShell,
-                                         ComputedStyle* aStyle) {
+nsListControlFrame* NS_NewListControlFrame(PresShell* aPresShell,
+                                           ComputedStyle* aStyle) {
   nsListControlFrame* it =
       new (aPresShell) nsListControlFrame(aStyle, aPresShell->GetPresContext());
 
   it->AddStateBits(NS_FRAME_INDEPENDENT_SELECTION);
 
   return it;
 }
 
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -47,17 +47,17 @@ class HTMLOptionsCollection;
  */
 
 class nsListControlFrame final : public nsHTMLScrollFrame,
                                  public nsIFormControlFrame,
                                  public nsISelectControlFrame {
  public:
   typedef mozilla::dom::HTMLOptionElement HTMLOptionElement;
 
-  friend nsContainerFrame* NS_NewListControlFrame(
+  friend nsListControlFrame* NS_NewListControlFrame(
       mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsListControlFrame)
 
   // nsIFrame
   nsresult HandleEvent(nsPresContext* aPresContext,
                        mozilla::WidgetGUIEvent* aEvent,
--- a/layout/generic/nsHTMLParts.h
+++ b/layout/generic/nsHTMLParts.h
@@ -8,28 +8,28 @@
 
 #ifndef nsHTMLParts_h___
 #define nsHTMLParts_h___
 
 #include "nscore.h"
 #include "nsFrameState.h"
 #include "nsISupports.h"
 
-class nsContainerFrame;
-class nsComboboxControlFrame;
+class nsAtom;
 class nsCheckboxRadioFrame;
-class nsAtom;
-class nsNodeInfoManager;
+class nsComboboxControlFrame;
+class nsContainerFrame;
+class nsIChannel;
 class nsIContent;
-
+class nsIFragmentContentSink;
 class nsIFrame;
 class nsIHTMLContentSink;
-class nsIFragmentContentSink;
 class nsIURI;
-class nsIChannel;
+class nsListControlFrame;
+class nsNodeInfoManager;
 class nsTableColFrame;
 namespace mozilla {
 class ComputedStyle;
 class PresShell;
 class PrintedSheetFrame;
 class ViewportFrame;
 
 namespace dom {
@@ -135,18 +135,18 @@ nsContainerFrame* NS_NewHTMLButtonContro
 nsContainerFrame* NS_NewFieldSetFrame(mozilla::PresShell* aPresShell,
                                       mozilla::ComputedStyle* aStyle);
 nsIFrame* NS_NewFileControlFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
 nsIFrame* NS_NewColorControlFrame(mozilla::PresShell* aPresShell,
                                   mozilla::ComputedStyle* aStyle);
 nsIFrame* NS_NewTextControlFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
-nsContainerFrame* NS_NewListControlFrame(mozilla::PresShell* aPresShell,
-                                         mozilla::ComputedStyle* aStyle);
+nsListControlFrame* NS_NewListControlFrame(mozilla::PresShell* aPresShell,
+                                           mozilla::ComputedStyle* aStyle);
 nsComboboxControlFrame* NS_NewComboboxControlFrame(
     mozilla::PresShell* aPresShell, mozilla::ComputedStyle* aStyle,
     nsFrameState aFlags);
 nsIFrame* NS_NewProgressFrame(mozilla::PresShell* aPresShell,
                               mozilla::ComputedStyle* aStyle);
 nsIFrame* NS_NewMeterFrame(mozilla::PresShell* aPresShell,
                            mozilla::ComputedStyle* aStyle);
 nsIFrame* NS_NewRangeFrame(mozilla::PresShell* aPresShell,