Bug 1597120 - Remove platform support for XUL mousethrough attribute. r=emilio
authorTim Nguyen <ntim.bugs@gmail.com>
Fri, 22 Nov 2019 13:15:28 +0000
changeset 503408 64b604856d79fd17ff74c45157973911e495a0c4
parent 503407 2e9f758bf8db531a5bf5afc1c411a8b6afed6042
child 503409 394f75b9488a77819cd2b2f381e81961435665c1
push id36833
push userbtara@mozilla.com
push dateFri, 22 Nov 2019 21:40:53 +0000
treeherdermozilla-central@2c912e46295e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1597120
milestone72.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 1597120 - Remove platform support for XUL mousethrough attribute. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D53349
layout/generic/nsFrameStateBits.h
layout/painting/nsDisplayList.cpp
layout/xul/nsBox.h
layout/xul/nsBoxFrame.cpp
layout/xul/nsBoxFrame.h
layout/xul/nsButtonBoxFrame.cpp
layout/xul/nsButtonBoxFrame.h
layout/xul/nsLeafBoxFrame.cpp
layout/xul/nsLeafBoxFrame.h
layout/xul/nsTitleBarFrame.cpp
layout/xul/nsTitleBarFrame.h
xpcom/ds/StaticAtoms.py
--- a/layout/generic/nsFrameStateBits.h
+++ b/layout/generic/nsFrameStateBits.h
@@ -323,18 +323,16 @@ FRAME_STATE_BIT(Box, 21, NS_STATE_STACK_
 FRAME_STATE_BIT(Box, 22, NS_STATE_IS_HORIZONTAL)
 FRAME_STATE_BIT(Box, 23, NS_STATE_AUTO_STRETCH)
 FRAME_STATE_BIT(Box, 24, NS_STATE_IS_ROOT)
 /* Bits 25, 26, and 27 were used for xul debug flags but are now unused */
 FRAME_STATE_BIT(Box, 28, NS_STATE_MENU_HAS_POPUP_LIST)
 FRAME_STATE_BIT(Box, 29, NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK)
 FRAME_STATE_BIT(Box, 30, NS_STATE_EQUAL_SIZE)
 FRAME_STATE_BIT(Box, 31, NS_STATE_IS_DIRECTION_NORMAL)
-FRAME_STATE_BIT(Box, 60, NS_FRAME_MOUSE_THROUGH_ALWAYS)
-FRAME_STATE_BIT(Box, 61, NS_FRAME_MOUSE_THROUGH_NEVER)
 
 // == Frame state bits that apply to flex container frames ====================
 
 FRAME_STATE_GROUP(FlexContainer, nsFlexContainerFrame)
 
 // True iff the normal flow children are already in CSS 'order' in the
 // order they occur in the child frame list.
 FRAME_STATE_BIT(FlexContainer, 20,
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -3336,34 +3336,16 @@ nsDisplayItem* nsDisplayList::RemoveBott
 
 void nsDisplayList::DeleteAll(nsDisplayListBuilder* aBuilder) {
   nsDisplayItem* item;
   while ((item = RemoveBottom()) != nullptr) {
     item->Destroy(aBuilder);
   }
 }
 
-static bool GetMouseThrough(const nsIFrame* aFrame) {
-  if (!aFrame->IsXULBoxFrame()) {
-    return false;
-  }
-
-  const nsIFrame* frame = aFrame;
-  while (frame) {
-    if (frame->GetStateBits() & NS_FRAME_MOUSE_THROUGH_ALWAYS) {
-      return true;
-    }
-    if (frame->GetStateBits() & NS_FRAME_MOUSE_THROUGH_NEVER) {
-      return false;
-    }
-    frame = nsBox::GetParentXULBox(frame);
-  }
-  return false;
-}
-
 static bool IsFrameReceivingPointerEvents(nsIFrame* aFrame) {
   return NS_STYLE_POINTER_EVENTS_NONE !=
          aFrame->StyleUI()->GetEffectivePointerEvents(aFrame);
 }
 
 // A list of frames, and their z depth. Used for sorting
 // the results of hit testing.
 struct FramesWithDepth {
@@ -3488,17 +3470,17 @@ void nsDisplayList::HitTest(nsDisplayLis
 
       for (uint32_t j = 0; j < outFrames.Length(); j++) {
         nsIFrame* f = outFrames.ElementAt(j);
         // Filter out some frames depending on the type of hittest
         // we are doing. For visibility tests, pass through all frames.
         // For pointer tests, only pass through frames that are styled
         // to receive pointer events.
         if (aBuilder->HitTestIsForVisibility() ||
-            (!GetMouseThrough(f) && IsFrameReceivingPointerEvents(f))) {
+            IsFrameReceivingPointerEvents(f)) {
           writeFrames->AppendElement(f);
         }
       }
 
       if (aBuilder->HitTestIsForVisibility() &&
           item->GetOpaqueRegion(aBuilder, &snap).Contains(aRect)) {
         // We're exiting early, so pop the remaining items off the buffer.
         aState->mItemBuffer.SetLength(itemBufferStart);
--- a/layout/xul/nsBox.h
+++ b/layout/xul/nsBox.h
@@ -79,13 +79,11 @@ class nsBox : public nsIFrame {
 
  protected:
   nsresult BeginXULLayout(nsBoxLayoutState& aState);
   NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState);
   nsresult EndXULLayout(nsBoxLayoutState& aState);
 
   static bool gGotTheme;
   static mozilla::StaticRefPtr<nsITheme> gTheme;
-
-  enum eMouseThrough { unset, never, always };
 };
 
 #endif
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -158,41 +158,20 @@ void nsBoxFrame::Init(nsIContent* aConte
   if (GetStateBits() & NS_FRAME_FONT_INFLATION_CONTAINER) {
     AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
   }
 
   MarkIntrinsicISizesDirty();
 
   CacheAttributes();
 
-  UpdateMouseThrough();
-
   // register access key
   RegUnregAccessKey(true);
 }
 
-void nsBoxFrame::UpdateMouseThrough() {
-  static Element::AttrValuesArray strings[] = {nsGkAtoms::never,
-                                               nsGkAtoms::always, nullptr};
-  switch (mContent->AsElement()->FindAttrValueIn(
-      kNameSpaceID_None, nsGkAtoms::mousethrough, strings, eCaseMatters)) {
-    case 0:
-      AddStateBits(NS_FRAME_MOUSE_THROUGH_NEVER);
-      break;
-    case 1:
-      AddStateBits(NS_FRAME_MOUSE_THROUGH_ALWAYS);
-      break;
-    case 2: {
-      RemoveStateBits(NS_FRAME_MOUSE_THROUGH_ALWAYS);
-      RemoveStateBits(NS_FRAME_MOUSE_THROUGH_NEVER);
-      break;
-    }
-  }
-}
-
 void nsBoxFrame::CacheAttributes() {
   /*
   printf("Caching: ");
   XULDumpBox(stdout);
   printf("\n");
    */
 
   mValign = vAlign_Top;
@@ -858,18 +837,17 @@ nsresult nsBoxFrame::AttributeChanged(in
       aAttribute == nsGkAtoms::align || aAttribute == nsGkAtoms::valign ||
       aAttribute == nsGkAtoms::left || aAttribute == nsGkAtoms::top ||
       aAttribute == nsGkAtoms::right || aAttribute == nsGkAtoms::bottom ||
       aAttribute == nsGkAtoms::start || aAttribute == nsGkAtoms::end ||
       aAttribute == nsGkAtoms::minwidth || aAttribute == nsGkAtoms::maxwidth ||
       aAttribute == nsGkAtoms::minheight ||
       aAttribute == nsGkAtoms::maxheight || aAttribute == nsGkAtoms::flex ||
       aAttribute == nsGkAtoms::orient || aAttribute == nsGkAtoms::pack ||
-      aAttribute == nsGkAtoms::dir || aAttribute == nsGkAtoms::mousethrough ||
-      aAttribute == nsGkAtoms::equalsize) {
+      aAttribute == nsGkAtoms::dir || aAttribute == nsGkAtoms::equalsize) {
     if (aAttribute == nsGkAtoms::align || aAttribute == nsGkAtoms::valign ||
         aAttribute == nsGkAtoms::orient || aAttribute == nsGkAtoms::pack ||
         aAttribute == nsGkAtoms::dir) {
       mValign = nsBoxFrame::vAlign_Top;
       mHalign = nsBoxFrame::hAlign_Left;
 
       bool orient = true;
       GetInitialOrientation(orient);
@@ -901,18 +879,16 @@ nsresult nsBoxFrame::AttributeChanged(in
         AddStateBits(NS_STATE_AUTO_STRETCH);
       else
         RemoveStateBits(NS_STATE_AUTO_STRETCH);
     } else if (aAttribute == nsGkAtoms::left || aAttribute == nsGkAtoms::top ||
                aAttribute == nsGkAtoms::right ||
                aAttribute == nsGkAtoms::bottom ||
                aAttribute == nsGkAtoms::start || aAttribute == nsGkAtoms::end) {
       RemoveStateBits(NS_STATE_STACK_NOT_POSITIONED);
-    } else if (aAttribute == nsGkAtoms::mousethrough) {
-      UpdateMouseThrough();
     }
 
     PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
   } else if (aAttribute == nsGkAtoms::ordinal) {
     nsIFrame* parent = GetParentXULBox(this);
     // If our parent is not a box, there's not much we can do... but in that
     // case our ordinal doesn't matter anyway, so that's ok.
--- a/layout/xul/nsBoxFrame.h
+++ b/layout/xul/nsBoxFrame.h
@@ -190,18 +190,16 @@ class nsBoxFrame : public nsContainerFra
                      mozilla::LayoutDeviceIntPoint& aPoint);
 
  protected:
   void RegUnregAccessKey(bool aDoReg);
 
   void CheckBoxOrder();
 
  private:
-  virtual void UpdateMouseThrough();
-
   void CacheAttributes();
 
   // instance variables.
   Halignment mHalign;
   Valignment mValign;
 
 };  // class nsBoxFrame
 
--- a/layout/xul/nsButtonBoxFrame.cpp
+++ b/layout/xul/nsButtonBoxFrame.cpp
@@ -55,19 +55,17 @@ nsIFrame* NS_NewButtonBoxFrame(PresShell
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsButtonBoxFrame)
 
 nsButtonBoxFrame::nsButtonBoxFrame(ComputedStyle* aStyle,
                                    nsPresContext* aPresContext, ClassID aID)
     : nsBoxFrame(aStyle, aPresContext, aID, false),
       mButtonBoxListener(nullptr),
-      mIsHandlingKeyEvent(false) {
-  UpdateMouseThrough();
-}
+      mIsHandlingKeyEvent(false) {}
 
 void nsButtonBoxFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
                             nsIFrame* aPrevInFlow) {
   nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
 
   mButtonBoxListener = new nsButtonBoxListener(this);
 
   mContent->AddSystemEventListener(NS_LITERAL_STRING("blur"),
--- a/layout/xul/nsButtonBoxFrame.h
+++ b/layout/xul/nsButtonBoxFrame.h
@@ -41,20 +41,16 @@ class nsButtonBoxFrame : public nsBoxFra
   void Blurred();
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override {
     return MakeFrameName(NS_LITERAL_STRING("ButtonBoxFrame"), aResult);
   }
 #endif
 
-  void UpdateMouseThrough() override {
-    AddStateBits(NS_FRAME_MOUSE_THROUGH_NEVER);
-  }
-
  private:
   class nsButtonBoxListener final : public nsIDOMEventListener {
    public:
     explicit nsButtonBoxListener(nsButtonBoxFrame* aButtonBoxFrame)
         : mButtonBoxFrame(aButtonBoxFrame) {}
 
     NS_DECL_NSIDOMEVENTLISTENER
 
--- a/layout/xul/nsLeafBoxFrame.cpp
+++ b/layout/xul/nsLeafBoxFrame.cpp
@@ -45,48 +45,16 @@ NS_IMPL_FRAMEARENA_HELPERS(nsLeafBoxFram
  */
 void nsLeafBoxFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
                           nsIFrame* aPrevInFlow) {
   nsLeafFrame::Init(aContent, aParent, aPrevInFlow);
 
   if (GetStateBits() & NS_FRAME_FONT_INFLATION_CONTAINER) {
     AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
   }
-
-  UpdateMouseThrough();
-}
-
-nsresult nsLeafBoxFrame::AttributeChanged(int32_t aNameSpaceID,
-                                          nsAtom* aAttribute,
-                                          int32_t aModType) {
-  nsresult rv =
-      nsLeafFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
-
-  if (aAttribute == nsGkAtoms::mousethrough) UpdateMouseThrough();
-
-  return rv;
-}
-
-void nsLeafBoxFrame::UpdateMouseThrough() {
-  static Element::AttrValuesArray strings[] = {nsGkAtoms::never,
-                                               nsGkAtoms::always, nullptr};
-  switch (mContent->AsElement()->FindAttrValueIn(
-      kNameSpaceID_None, nsGkAtoms::mousethrough, strings, eCaseMatters)) {
-    case 0:
-      AddStateBits(NS_FRAME_MOUSE_THROUGH_NEVER);
-      break;
-    case 1:
-      AddStateBits(NS_FRAME_MOUSE_THROUGH_ALWAYS);
-      break;
-    case 2: {
-      RemoveStateBits(NS_FRAME_MOUSE_THROUGH_ALWAYS);
-      RemoveStateBits(NS_FRAME_MOUSE_THROUGH_NEVER);
-      break;
-    }
-  }
 }
 
 void nsLeafBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                       const nsDisplayListSet& aLists) {
   // REVIEW: GetFrameForPoint used to not report events for the background
   // layer, whereas this code will put an event receiver for this frame in the
   // BlockBorderBackground() list. But I don't see any need to preserve
   // that anomalous behaviour. The important thing I'm preserving is that
--- a/layout/xul/nsLeafBoxFrame.h
+++ b/layout/xul/nsLeafBoxFrame.h
@@ -59,28 +59,22 @@ class nsLeafBoxFrame : public nsLeafFram
       const CharacterDataChangeInfo&) override;
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* asPrevInFlow) override;
 
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override;
 
-  virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
-                                    int32_t aModType) override;
-
   virtual bool ComputesOwnOverflowArea() override { return false; }
 
  protected:
   NS_IMETHOD DoXULLayout(nsBoxLayoutState& aState) override;
 
   virtual nscoord GetIntrinsicISize() override;
 
   explicit nsLeafBoxFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
                           ClassID aID = kClassID)
       : nsLeafFrame(aStyle, aPresContext, aID) {}
 
- private:
-  void UpdateMouseThrough();
-
 };  // class nsLeafBoxFrame
 
 #endif /* nsLeafBoxFrame_h___ */
--- a/layout/xul/nsTitleBarFrame.cpp
+++ b/layout/xul/nsTitleBarFrame.cpp
@@ -32,17 +32,16 @@ nsIFrame* NS_NewTitleBarFrame(PresShell*
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTitleBarFrame)
 
 nsTitleBarFrame::nsTitleBarFrame(ComputedStyle* aStyle,
                                  nsPresContext* aPresContext, ClassID aID)
     : nsBoxFrame(aStyle, aPresContext, aID, false) {
   mTrackingMouseMove = false;
-  UpdateMouseThrough();
 }
 
 void nsTitleBarFrame::BuildDisplayListForChildren(
     nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) {
   // override, since we don't want children to get events
   if (aBuilder->IsForEventDelivery()) {
     if (!mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
                                             nsGkAtoms::allowevents,
--- a/layout/xul/nsTitleBarFrame.h
+++ b/layout/xul/nsTitleBarFrame.h
@@ -29,19 +29,15 @@ class nsTitleBarFrame : public nsBoxFram
 
   virtual nsresult HandleEvent(nsPresContext* aPresContext,
                                mozilla::WidgetGUIEvent* aEvent,
                                nsEventStatus* aEventStatus) override;
 
   MOZ_CAN_RUN_SCRIPT_BOUNDARY
   virtual void MouseClicked(mozilla::WidgetMouseEvent* aEvent);
 
-  void UpdateMouseThrough() override {
-    AddStateBits(NS_FRAME_MOUSE_THROUGH_NEVER);
-  }
-
  protected:
   bool mTrackingMouseMove;
   mozilla::LayoutDeviceIntPoint mLastPoint;
 
 };  // class nsTitleBarFrame
 
 #endif /* nsTitleBarFrame_h___ */
--- a/xpcom/ds/StaticAtoms.py
+++ b/xpcom/ds/StaticAtoms.py
@@ -652,17 +652,16 @@ STATIC_ATOMS = [
     Atom("minwidth", "minwidth"),
     Atom("mixed", "mixed"),
     Atom("messagemanagergroup", "messagemanagergroup"),
     Atom("mod", "mod"),
     Atom("mode", "mode"),
     Atom("modifiers", "modifiers"),
     Atom("monochrome", "monochrome"),
     Atom("mouseover", "mouseover"),
-    Atom("mousethrough", "mousethrough"),
     Atom("mozAccessiblecaret", "moz-accessiblecaret"),
     Atom("mozCustomContentContainer", "moz-custom-content-container"),
     Atom("mozGrabber", "mozGrabber"),
     Atom("mozNativeAnonymous", "-moz-native-anonymous"),
     Atom("mozprivatebrowsing", "mozprivatebrowsing"),
     Atom("mozResizer", "mozResizer"),
     Atom("mozResizingInfo", "mozResizingInfo"),
     Atom("mozResizingShadow", "mozResizingShadow"),