Bug 1528098 - Remove content-select code. r=dholbert
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 15 Feb 2019 01:51:33 +0000
changeset 459358 683836b692db76292cc3e4494256578afe69f24e
parent 459357 591ffe90d0edbd8190427f09a14e39a92a327aee
child 459359 2f15c7ef4a7f73f85b6e3e199f80c3c633ef1c25
push id35559
push userrmaries@mozilla.com
push dateFri, 15 Feb 2019 09:55:16 +0000
treeherdermozilla-central@fc01e86f7e80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1528098
milestone67.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 1528098 - Remove content-select code. r=dholbert Differential Revision: https://phabricator.services.mozilla.com/D19869
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/style/res/forms.css
modules/libpref/init/all.js
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2908,40 +2908,34 @@ nsIFrame* nsCSSFrameConstructor::Constru
     // Notify the listbox that it is being used as a dropdown list.
     nsListControlFrame* listControlFrame = do_QueryFrame(listFrame);
     if (listControlFrame) {
       listControlFrame->SetComboboxFrame(comboboxFrame);
     }
     // Notify combobox that it should use the listbox as it's popup
     comboboxFrame->SetDropDown(listFrame);
 
-    if (!nsLayoutUtils::IsContentSelectEnabled()) {
-      // TODO(kuoe0) Remove this assertion when content-select is shipped.
-      NS_ASSERTION(!listFrame->IsAbsPosContainingBlock(),
-                   "Ended up with positioned dropdown list somehow.");
-    }
+    NS_ASSERTION(!listFrame->IsAbsPosContainingBlock(),
+                 "Ended up with positioned dropdown list somehow.");
     NS_ASSERTION(!listFrame->IsFloating(),
                  "Ended up with floating dropdown list somehow.");
 
     // child frames of combobox frame
     nsFrameItems childItems;
 
     // Initialize the scroll frame positioned. Note that it is NOT
     // initialized as absolutely positioned.
     nsContainerFrame* scrolledFrame =
         NS_NewSelectsAreaFrame(mPresShell, computedStyle, flags);
 
     InitializeSelectFrame(aState, listFrame, scrolledFrame, content,
                           comboboxFrame, listStyle, true, aItem.mPendingBinding,
                           childItems);
 
-    if (!nsLayoutUtils::IsContentSelectEnabled()) {
-      // TODO(kuoe0) Remove this assertion when content-select is shipped.
-      NS_ASSERTION(listFrame->GetView(), "ListFrame's view is nullptr");
-    }
+    NS_ASSERTION(listFrame->GetView(), "ListFrame's view is nullptr");
 
     // Create display and button frames from the combobox's anonymous content.
     // The anonymous content is appended to existing anonymous content for this
     // element (the scrollbars).
     //
     // nsComboboxControlFrame needs special frame creation behavior for its
     // first piece of anonymous content, which means that we can't take the
     // normal ProcessChildren path.
@@ -2965,24 +2959,22 @@ nsIFrame* nsCSSFrameConstructor::Constru
     AddFCItemsForAnonymousContent(aState, comboboxFrame, newAnonymousItems,
                                   fcItems);
     ConstructFramesFromItemList(aState, fcItems, comboboxFrame,
                                 /* aParentIsWrapperAnonBox = */ false,
                                 childItems);
 
     comboboxFrame->SetInitialChildList(kPrincipalList, childItems);
 
-    if (!nsLayoutUtils::IsContentSelectEnabled()) {
-      // Initialize the additional popup child list which contains the
-      // dropdown list frame.
-      nsFrameItems popupItems;
-      popupItems.AddChild(listFrame);
-      comboboxFrame->SetInitialChildList(nsIFrame::kSelectPopupList,
-                                         popupItems);
-    }
+    // Initialize the additional popup child list which contains the
+    // dropdown list frame.
+    nsFrameItems popupItems;
+    popupItems.AddChild(listFrame);
+    comboboxFrame->SetInitialChildList(nsIFrame::kSelectPopupList,
+                                       popupItems);
 
     aState.mFrameState = historyState;
     if (aState.mFrameState) {
       // Restore frame state for the entire subtree of |comboboxFrame|.
       RestoreFrameState(comboboxFrame, aState.mFrameState);
     }
     return comboboxFrame;
   }
@@ -3020,17 +3012,17 @@ void nsCSSFrameConstructor::InitializeSe
       aState.GetGeometricParent(*aComputedStyle->StyleDisplay(), aParentFrame);
 
   // We don't call InitAndRestoreFrame for scrollFrame because we can only
   // restore the frame state after its parts have been created (in particular,
   // the scrollable view). So we have to split Init and Restore.
 
   scrollFrame->Init(aContent, geometricParent, nullptr);
 
-  if (!aBuildCombobox || nsLayoutUtils::IsContentSelectEnabled()) {
+  if (!aBuildCombobox) {
     aState.AddChild(scrollFrame, aFrameItems, aContent, aParentFrame);
   }
 
   BuildScrollFrame(aState, aContent, aComputedStyle, scrolledFrame,
                    geometricParent, scrollFrame);
 
   if (aState.mFrameState) {
     // Restore frame state for the scroll frame
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -155,17 +155,16 @@ using namespace mozilla::image;
 using namespace mozilla::layers;
 using namespace mozilla::layout;
 using namespace mozilla::gfx;
 using mozilla::dom::HTMLMediaElement_Binding::HAVE_METADATA;
 using mozilla::dom::HTMLMediaElement_Binding::HAVE_NOTHING;
 
 #define INTERCHARACTER_RUBY_ENABLED_PREF_NAME \
   "layout.css.ruby.intercharacter.enabled"
-#define CONTENT_SELECT_ENABLED_PREF_NAME "dom.select_popup_in_content.enabled"
 
 // The time in number of frames that we estimate for a refresh driver
 // to be quiescent
 #define DEFAULT_QUIESCENT_FRAMES 2
 // The time (milliseconds) we estimate is needed between the end of an
 // idle time and the next Tick.
 #define DEFAULT_IDLE_PERIOD_TIME_LIMIT 1.0f
 
@@ -499,29 +498,16 @@ bool nsLayoutUtils::IsInterCharacterRuby
     sInterCharacterRubyEnabledPrefCached = true;
     Preferences::AddBoolVarCache(&sInterCharacterRubyEnabled,
                                  INTERCHARACTER_RUBY_ENABLED_PREF_NAME, false);
   }
 
   return sInterCharacterRubyEnabled;
 }
 
-bool nsLayoutUtils::IsContentSelectEnabled() {
-  static bool sContentSelectEnabled;
-  static bool sContentSelectEnabledPrefCached = false;
-
-  if (!sContentSelectEnabledPrefCached) {
-    sContentSelectEnabledPrefCached = true;
-    Preferences::AddBoolVarCache(&sContentSelectEnabled,
-                                 CONTENT_SELECT_ENABLED_PREF_NAME, false);
-  }
-
-  return sContentSelectEnabled;
-}
-
 void nsLayoutUtils::UnionChildOverflow(nsIFrame* aFrame,
                                        nsOverflowAreas& aOverflowAreas,
                                        FrameChildListIDs aSkipChildLists) {
   // Iterate over all children except pop-ups.
   FrameChildListIDs skip(aSkipChildLists);
   skip += {nsIFrame::kSelectPopupList, nsIFrame::kPopupList};
 
   for (nsIFrame::ChildListIterator childLists(aFrame); !childLists.IsDone();
@@ -7007,18 +6993,17 @@ static bool IsCornerAdjacentToSide(uint8
       bg->BottomLayer().mClip != StyleGeometryBox::BorderBox)
     return eTransparencyTransparent;
   return eTransparencyOpaque;
 }
 
 static bool IsPopupFrame(const nsIFrame* aFrame) {
   // aFrame is a popup it's the list control frame dropdown for a combobox.
   LayoutFrameType frameType = aFrame->Type();
-  if (!nsLayoutUtils::IsContentSelectEnabled() &&
-      frameType == LayoutFrameType::ListControl) {
+  if (frameType == LayoutFrameType::ListControl) {
     const nsListControlFrame* lcf =
         static_cast<const nsListControlFrame*>(aFrame);
     return lcf->IsInDropDownMode();
   }
 
   // ... or if it's a XUL menupopup frame.
   return frameType == LayoutFrameType::MenuPopup;
 }
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2349,21 +2349,16 @@ class nsLayoutUtils {
    */
   static bool AnimatedImageLayersEnabled();
 
   /**
    * Checks whether support for inter-character ruby is enabled.
    */
   static bool IsInterCharacterRubyEnabled();
 
-  /**
-   * Checks whether content-select is enabled.
-   */
-  static bool IsContentSelectEnabled();
-
   static bool InterruptibleReflowEnabled() {
     return sInterruptibleReflowEnabled;
   }
 
   /**
    * Unions the overflow areas of the children of aFrame with aOverflowAreas.
    * aSkipChildLists specifies any child lists that should be skipped.
    * kSelectPopupList and kPopupList are always skipped.
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -287,18 +287,16 @@ void nsComboboxControlFrame::SetFocus(bo
 
   // This is needed on a temporary basis. It causes the focus
   // rect to be drawn. This is much faster than ReResolvingStyle
   // Bug 32920
   InvalidateFrame();
 }
 
 void nsComboboxControlFrame::ShowPopup(bool aShowPopup) {
-  // TODO(kuoe0) Remove this function when content-select is enabled.
-
   nsView* view = mDropdownFrame->GetView();
   nsViewManager* viewManager = view->GetViewManager();
 
   if (aShowPopup) {
     nsRect rect = mDropdownFrame->GetRect();
     rect.x = rect.y = 0;
     viewManager->ResizeView(view, rect);
     viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
@@ -316,25 +314,16 @@ void nsComboboxControlFrame::ShowPopup(b
                            aShowPopup ? eXULPopupShowing : eXULPopupHiding,
                            nullptr, WidgetMouseEvent::eReal);
 
     shell->HandleDOMEventWithTarget(mContent, &event, &status);
   }
 }
 
 bool nsComboboxControlFrame::ShowList(bool aShowList) {
-  // TODO(kuoe0) Remove this function when content-select is enabled.
-  //
-  // This function is used to handle the widget/view stuff, so we just return
-  // when content-select is enabled. And the following callee, ShowPopup(), will
-  // also be ignored, it is only used to show and hide the widget.
-  if (nsLayoutUtils::IsContentSelectEnabled()) {
-    return true;
-  }
-
   nsView* view = mDropdownFrame->GetView();
   if (aShowList) {
     NS_ASSERTION(
         !view->HasWidget(),
         "We shouldn't have a widget before we need to display the popup");
 
     // Create the widget for the drop-down list
     view->GetViewManager()->SetViewFloating(view, true);
@@ -431,18 +420,17 @@ void nsComboboxControlFrame::ReflowDropd
   nscoord forcedISize =
       aReflowInput.ComputedISize() +
       aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm) -
       kidReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm);
   kidReflowInput.SetComputedISize(
       std::max(kidReflowInput.ComputedISize(), forcedISize));
 
   // ensure we start off hidden
-  if (!nsLayoutUtils::IsContentSelectEnabled() && !mDroppedDown &&
-      GetStateBits() & NS_FRAME_FIRST_REFLOW) {
+  if (!mDroppedDown && GetStateBits() & NS_FRAME_FIRST_REFLOW) {
     nsView* view = mDropdownFrame->GetView();
     nsViewManager* viewManager = view->GetViewManager();
     viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
     nsRect emptyRect(0, 0, 0, 0);
     viewManager->ResizeView(view, emptyRect);
   }
 
   // Allow the child to move/size/change-visibility its view if it's currently
@@ -616,17 +604,17 @@ nsComboboxControlFrame::AbsolutelyPositi
   }
 
   WritingMode wm = GetWritingMode();
   LogicalPoint translation(wm);
   nscoord before, after;
   mLastDropDownAfterScreenBCoord = nscoord_MIN;
   GetAvailableDropdownSpace(wm, &before, &after, &translation);
   if (before <= 0 && after <= 0) {
-    if (!nsLayoutUtils::IsContentSelectEnabled() && IsDroppedDown()) {
+    if (IsDroppedDown()) {
       // Hide the view immediately to minimize flicker.
       nsView* view = mDropdownFrame->GetView();
       view->GetViewManager()->SetViewVisibility(view, nsViewVisibility_kHide);
       NS_DispatchToCurrentThread(new nsAsyncRollup(this));
     }
     return eDropDownPositionSuppressed;
   }
 
@@ -865,20 +853,17 @@ void nsComboboxControlFrame::Reflow(nsPr
 
 #ifdef DEBUG_FRAME_DUMP
 nsresult nsComboboxControlFrame::GetFrameName(nsAString& aResult) const {
   return MakeFrameName(NS_LITERAL_STRING("ComboboxControl"), aResult);
 }
 #endif
 
 void nsComboboxControlFrame::ShowDropDown(bool aDoDropDown) {
-  if (!nsLayoutUtils::IsContentSelectEnabled()) {
-    // TODO(kuoe0) remove this assertion after content-select is enabled
-    MOZ_ASSERT(!XRE_IsContentProcess());
-  }
+  MOZ_ASSERT(!XRE_IsContentProcess());
   mDelayedShowDropDown = false;
   EventStates eventStates = mContent->AsElement()->State();
   if (aDoDropDown && eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
     return;
   }
 
   if (!mDroppedDown && aDoDropDown) {
     nsFocusManager* fm = nsFocusManager::GetFocusManager();
@@ -1316,17 +1301,17 @@ void nsComboboxControlFrame::DestroyFrom
     sFocused = nullptr;
   }
 
   // Revoke any pending RedisplayTextEvent
   mRedisplayTextEvent.Revoke();
 
   nsCheckboxRadioFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
 
-  if (!nsLayoutUtils::IsContentSelectEnabled() && mDroppedDown) {
+  if (mDroppedDown) {
     MOZ_ASSERT(mDropdownFrame, "mDroppedDown without frame");
     nsView* view = mDropdownFrame->GetView();
     MOZ_ASSERT(view);
     nsIWidget* widget = view->GetWidget();
     if (widget) {
       widget->CaptureRollupEvents(this, false);
     }
   }
@@ -1389,18 +1374,17 @@ bool nsComboboxControlFrame::Rollup(uint
   if (!weakFrame.IsAlive()) {
     return consume;
   }
   ShowDropDown(false);  // might destroy us
   if (weakFrame.IsAlive()) {
     mListControlFrame->CaptureMouseEvents(false);
   }
 
-  if (!nsLayoutUtils::IsContentSelectEnabled() && aFlush &&
-      weakFrame.IsAlive()) {
+  if (aFlush && weakFrame.IsAlive()) {
     // The popup's visibility doesn't update until the minimize animation has
     // finished, so call UpdateWidgetGeometry to update it right away.
     nsViewManager* viewManager = mDropdownFrame->GetView()->GetViewManager();
     viewManager->UpdateWidgetGeometry();  // might destroy us
   }
 
   if (!weakFrame.IsAlive()) {
     return consume;
@@ -1408,20 +1392,16 @@ bool nsComboboxControlFrame::Rollup(uint
 
   if (aLastRolledUp) {
     *aLastRolledUp = GetContent();
   }
   return consume;
 }
 
 nsIWidget* nsComboboxControlFrame::GetRollupWidget() {
-  if (nsLayoutUtils::IsContentSelectEnabled()) {
-    return nullptr;
-  }
-
   nsView* view = mDropdownFrame->GetView();
   MOZ_ASSERT(view);
   return view->GetWidget();
 }
 
 void nsComboboxControlFrame::RollupFromList() {
   if (ShowList(false)) mListControlFrame->CaptureMouseEvents(false);
 }
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -114,22 +114,16 @@ nsListControlFrame::nsListControlFrame(C
 
   mControlSelectMode = false;
 }
 
 //---------------------------------------------------------
 nsListControlFrame::~nsListControlFrame() { mComboboxFrame = nullptr; }
 
 static bool ShouldFireDropDownEvent() {
-  // We don't need to fire the event to SelectContentHelper when content-select
-  // is enabled.
-  if (nsLayoutUtils::IsContentSelectEnabled()) {
-    return false;
-  }
-
   return (XRE_IsContentProcess() &&
           Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) ||
          Preferences::GetBool("dom.select_popup_in_parent.enabled", false);
 }
 
 // for Bug 47302 (remove this comment later)
 void nsListControlFrame::DestroyFrom(nsIFrame* aDestructRoot,
                                      PostDestroyData& aPostDestroyData) {
@@ -915,18 +909,17 @@ void nsListControlFrame::SetInitialChild
   }*/
 }
 
 //---------------------------------------------------------
 void nsListControlFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
                               nsIFrame* aPrevInFlow) {
   nsHTMLScrollFrame::Init(aContent, aParent, aPrevInFlow);
 
-  if (!nsLayoutUtils::IsContentSelectEnabled() && IsInDropDownMode()) {
-    // TODO(kuoe0) Remove the following code when content-select is enabled.
+  if (IsInDropDownMode()) {
     AddStateBits(NS_FRAME_IN_POPUP);
     CreateView();
   }
 
   // we shouldn't have to unregister this listener because when
   // our frame goes away all these content node go away as well
   // because our frame is the only one who references them.
   // we need to hook up our listeners before the editor is initialized
--- a/layout/style/res/forms.css
+++ b/layout/style/res/forms.css
@@ -406,23 +406,16 @@ optgroup:before {
    * to make sure that our inline-start border+padding matches the inline-start
    * border+padding of a combobox so that our scrollbar will line up
    * with the dropmarker.  So set our inline-start border to 2px.
    */
   border: 1px outset black !important;
   border-inline-start-width: 2px ! important;
 }
 
-@supports -moz-bool-pref("dom.select_popup_in_content.enabled") {
-  *|*::-moz-dropdown-list {
-    -moz-top-layer: top !important;
-    position: absolute !important;
-  }
-}
-
 input:disabled,
 textarea:disabled,
 option:disabled,
 optgroup:disabled,
 select:disabled:disabled /* Need the pseudo-class twice to have the specificity
                             be at least the same as select[size][multiple] above */
 {
   color: GrayText;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1365,18 +1365,16 @@ pref("dom.forms.selectSearch", false);
 // Allow for webpages to provide custom styling for <select>
 // popups. Disabled on GTK due to bug 1338283.
 #ifdef MOZ_WIDGET_GTK
 pref("dom.forms.select.customstyling", false);
 #else
 pref("dom.forms.select.customstyling", true);
 #endif
 pref("dom.select_popup_in_parent.enabled", false);
-// Bug 1421229 - content-select
-pref("dom.select_popup_in_content.enabled", false);
 
 // Enable Directory API. By default, disabled.
 pref("dom.input.dirpicker", false);
 
 // Enable not moving the cursor to end when a text input or textarea has .value
 // set to the value it already has.  By default, enabled.
 pref("dom.input.skip_cursor_move_for_same_value_set", true);