Merge mozilla-central to inbound. a=merge CLOSED TREE
authorshindli <shindli@mozilla.com>
Wed, 05 Dec 2018 23:38:42 +0200
changeset 505942 0bbffdf069f1
parent 505941 05dbd9368700 (current diff)
parent 505920 643a4a6bbfe9 (diff)
child 505943 92080f90bad8
push id10301
push userarchaeopteryx@coole-files.de
push dateThu, 06 Dec 2018 16:36:14 +0000
treeherdermozilla-beta@7d2f3c71997c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone65.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
Merge mozilla-central to inbound. a=merge CLOSED TREE
--- a/accessible/android/AccessibleWrap.cpp
+++ b/accessible/android/AccessibleWrap.cpp
@@ -182,16 +182,31 @@ void AccessibleWrap::Shutdown() {
       ReleaseID(mID);
       mID = 0;
     }
   }
 
   Accessible::Shutdown();
 }
 
+bool AccessibleWrap::DoAction(uint8_t aIndex) const {
+  if (ActionCount()) {
+    return Accessible::DoAction(aIndex);
+  }
+
+  if (mContent) {
+    // We still simulate a click on an accessible even if there is no
+    // known actions. For the sake of bad markup.
+    DoCommand();
+    return true;
+  }
+
+  return false;
+}
+
 int32_t AccessibleWrap::AcquireID() { return sIDSet.GetID(); }
 
 void AccessibleWrap::ReleaseID(int32_t aID) { sIDSet.ReleaseID(aID); }
 
 void AccessibleWrap::SetTextContents(const nsAString& aText) {
   if (IsHyperText()) {
     AsHyperText()->ReplaceText(aText);
   }
@@ -209,17 +224,18 @@ bool AccessibleWrap::GetSelectionBounds(
                                         int32_t* aEndOffset) {
   if (IsHyperText()) {
     return AsHyperText()->SelectionBoundsAt(0, aStartOffset, aEndOffset);
   }
 
   return false;
 }
 
-uint32_t AccessibleWrap::GetFlags(role aRole, uint64_t aState) {
+uint32_t AccessibleWrap::GetFlags(role aRole, uint64_t aState,
+                                  uint8_t aActionCount) {
   uint32_t flags = 0;
   if (aState & states::CHECKABLE) {
     flags |= java::SessionAccessibility::FLAG_CHECKABLE;
   }
 
   if (aState & states::CHECKED) {
     flags |= java::SessionAccessibility::FLAG_CHECKED;
   }
@@ -227,17 +243,17 @@ uint32_t AccessibleWrap::GetFlags(role a
   if (aState & states::INVALID) {
     flags |= java::SessionAccessibility::FLAG_CONTENT_INVALID;
   }
 
   if (aState & states::EDITABLE) {
     flags |= java::SessionAccessibility::FLAG_EDITABLE;
   }
 
-  if (aState & states::SENSITIVE) {
+  if (aActionCount && aRole != roles::TEXT_LEAF) {
     flags |= java::SessionAccessibility::FLAG_CLICKABLE;
   }
 
   if (aState & states::ENABLED) {
     flags |= java::SessionAccessibility::FLAG_ENABLED;
   }
 
   if (aState & states::FOCUSABLE) {
@@ -391,39 +407,40 @@ mozilla::java::GeckoBundle::LocalRef Acc
   double curValue = UnspecifiedNaN<double>();
   double minValue = UnspecifiedNaN<double>();
   double maxValue = UnspecifiedNaN<double>();
   double step = UnspecifiedNaN<double>();
   WrapperRangeInfo(&curValue, &minValue, &maxValue, &step);
 
   nsCOMPtr<nsIPersistentProperties> attributes = Attributes();
 
-  return ToBundle(State(), Bounds(), name, textValue, nodeID, curValue,
-                  minValue, maxValue, step, attributes);
+  return ToBundle(State(), Bounds(), ActionCount(), name, textValue, nodeID,
+                  curValue, minValue, maxValue, step, attributes);
 }
 
 mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle(
-    const uint64_t aState, const nsIntRect& aBounds, const nsString& aName,
-    const nsString& aTextValue, const nsString& aDOMNodeID,
-    const double& aCurVal, const double& aMinVal, const double& aMaxVal,
-    const double& aStep, nsIPersistentProperties* aAttributes) {
+    const uint64_t aState, const nsIntRect& aBounds, const uint8_t aActionCount,
+    const nsString& aName, const nsString& aTextValue,
+    const nsString& aDOMNodeID, const double& aCurVal, const double& aMinVal,
+    const double& aMaxVal, const double& aStep,
+    nsIPersistentProperties* aAttributes) {
   if (!IsProxy() && IsDefunct()) {
     return nullptr;
   }
 
   GECKOBUNDLE_START(nodeInfo);
   GECKOBUNDLE_PUT(nodeInfo, "id", java::sdk::Integer::ValueOf(VirtualViewID()));
 
   AccessibleWrap* parent = WrapperParent();
   GECKOBUNDLE_PUT(
       nodeInfo, "parentId",
       java::sdk::Integer::ValueOf(parent ? parent->VirtualViewID() : 0));
 
   role role = WrapperRole();
-  uint32_t flags = GetFlags(role, aState);
+  uint32_t flags = GetFlags(role, aState, aActionCount);
   GECKOBUNDLE_PUT(nodeInfo, "flags", java::sdk::Integer::ValueOf(flags));
   GECKOBUNDLE_PUT(nodeInfo, "className",
                   java::sdk::Integer::ValueOf(AndroidClass()));
 
   if (aState & states::EDITABLE) {
     GECKOBUNDLE_PUT(nodeInfo, "hint", jni::StringParam(aName));
     GECKOBUNDLE_PUT(nodeInfo, "text", jni::StringParam(aTextValue));
   } else {
@@ -551,30 +568,31 @@ mozilla::java::GeckoBundle::LocalRef Acc
   GECKOBUNDLE_PUT(nodeInfo, "children",
                   jni::IntArray::New(children.Elements(), children.Length()));
   GECKOBUNDLE_FINISH(nodeInfo);
 
   return nodeInfo;
 }
 
 mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToSmallBundle() {
-  return ToSmallBundle(State(), Bounds());
+  return ToSmallBundle(State(), Bounds(), ActionCount());
 }
 
 mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToSmallBundle(
-    const uint64_t aState, const nsIntRect& aBounds) {
+    const uint64_t aState, const nsIntRect& aBounds,
+    const uint8_t aActionCount) {
   GECKOBUNDLE_START(nodeInfo);
   GECKOBUNDLE_PUT(nodeInfo, "id", java::sdk::Integer::ValueOf(VirtualViewID()));
 
   AccessibleWrap* parent = WrapperParent();
   GECKOBUNDLE_PUT(
       nodeInfo, "parentId",
       java::sdk::Integer::ValueOf(parent ? parent->VirtualViewID() : 0));
 
-  uint32_t flags = GetFlags(WrapperRole(), aState);
+  uint32_t flags = GetFlags(WrapperRole(), aState, aActionCount);
   GECKOBUNDLE_PUT(nodeInfo, "flags", java::sdk::Integer::ValueOf(flags));
   GECKOBUNDLE_PUT(nodeInfo, "className",
                   java::sdk::Integer::ValueOf(AndroidClass()));
 
   const int32_t data[4] = {aBounds.x, aBounds.y, aBounds.x + aBounds.width,
                            aBounds.y + aBounds.height};
   GECKOBUNDLE_PUT(nodeInfo, "bounds", jni::IntArray::New(data, 4));
 
--- a/accessible/android/AccessibleWrap.h
+++ b/accessible/android/AccessibleWrap.h
@@ -15,36 +15,41 @@ namespace mozilla {
 namespace a11y {
 
 class AccessibleWrap : public Accessible {
  public:
   AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~AccessibleWrap();
 
   virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
+
   virtual void Shutdown() override;
 
+  virtual bool DoAction(uint8_t aIndex) const override;
+
   int32_t VirtualViewID() const { return mID; }
 
   virtual void SetTextContents(const nsAString& aText);
 
   virtual void GetTextContents(nsAString& aText);
 
   virtual bool GetSelectionBounds(int32_t* aStartOffset, int32_t* aEndOffset);
 
   mozilla::java::GeckoBundle::LocalRef ToBundle();
 
   mozilla::java::GeckoBundle::LocalRef ToBundle(
-      const uint64_t aState, const nsIntRect& aBounds, const nsString& aName,
+      const uint64_t aState, const nsIntRect& aBounds,
+      const uint8_t aActionCount, const nsString& aName,
       const nsString& aTextValue, const nsString& aDOMNodeID,
       const double& aCurVal, const double& aMinVal, const double& aMaxVal,
       const double& aStep, nsIPersistentProperties* aAttributes);
 
-  mozilla::java::GeckoBundle::LocalRef ToSmallBundle(const uint64_t aState,
-                                                     const nsIntRect& aBounds);
+  mozilla::java::GeckoBundle::LocalRef ToSmallBundle(
+      const uint64_t aState, const nsIntRect& aBounds,
+      const uint8_t aActionCount);
 
   mozilla::java::GeckoBundle::LocalRef ToSmallBundle();
 
   virtual void WrapperDOMNodeID(nsString& aDOMNodeID);
 
   int32_t AndroidClass() {
     return mID == kNoID ? java::SessionAccessibility::CLASSNAME_WEBVIEW
                         : GetAndroidClass(WrapperRole());
@@ -73,17 +78,17 @@ class AccessibleWrap : public Accessible
 
   virtual bool WrapperRangeInfo(double* aCurVal, double* aMinVal,
                                 double* aMaxVal, double* aStep);
 
   virtual role WrapperRole() { return Role(); }
 
   static void GetRoleDescription(role aRole, nsAString& aGeckoRole,
                                  nsAString& aRoleDescription);
-  static uint32_t GetFlags(role aRole, uint64_t aState);
+  static uint32_t GetFlags(role aRole, uint64_t aState, uint8_t aActionCount);
 };
 
 static inline AccessibleWrap* WrapperFor(const ProxyAccessible* aProxy) {
   return reinterpret_cast<AccessibleWrap*>(aProxy->GetWrapper());
 }
 
 }  // namespace a11y
 }  // namespace mozilla
--- a/accessible/android/DocAccessibleWrap.cpp
+++ b/accessible/android/DocAccessibleWrap.cpp
@@ -129,20 +129,20 @@ void DocAccessibleWrap::CacheViewportCal
     nsTArray<BatchData> cacheData(inViewAccs.Count());
     for (auto iter = inViewAccs.Iter(); !iter.Done(); iter.Next()) {
       Accessible* accessible = iter.Data();
       auto uid = accessible->IsDoc() && accessible->AsDoc()->IPCDoc()
                      ? 0
                      : reinterpret_cast<uint64_t>(accessible->UniqueID());
       cacheData.AppendElement(
           BatchData(accessible->Document()->IPCDoc(), uid, accessible->State(),
-                    accessible->Bounds(), nsString(), nsString(), nsString(),
+                    accessible->Bounds(), accessible->ActionCount(), nsString(),
+                    nsString(), nsString(), UnspecifiedNaN<double>(),
                     UnspecifiedNaN<double>(), UnspecifiedNaN<double>(),
-                    UnspecifiedNaN<double>(), UnspecifiedNaN<double>(),
-                    nsTArray<Attribute>()));
+                    UnspecifiedNaN<double>(), nsTArray<Attribute>()));
     }
 
     ipcDoc->SendBatch(eBatch_Viewport, cacheData);
   } else if (SessionAccessibility* sessionAcc =
                  SessionAccessibility::GetInstanceFor(docAcc)) {
     nsTArray<AccessibleWrap*> accessibles(inViewAccs.Count());
     for (auto iter = inViewAccs.Iter(); !iter.Done(); iter.Next()) {
       accessibles.AppendElement(
@@ -194,20 +194,20 @@ void DocAccessibleWrap::CacheFocusPath(A
       acc->Name(name);
       nsAutoString textValue;
       acc->Value(textValue);
       nsAutoString nodeID;
       acc->WrapperDOMNodeID(nodeID);
       nsCOMPtr<nsIPersistentProperties> props = acc->Attributes();
       nsTArray<Attribute> attributes;
       nsAccUtils::PersistentPropertiesToArray(props, &attributes);
-      cacheData.AppendElement(
-          BatchData(acc->Document()->IPCDoc(), uid, acc->State(), acc->Bounds(),
-                    name, textValue, nodeID, acc->CurValue(), acc->MinValue(),
-                    acc->MaxValue(), acc->Step(), attributes));
+      cacheData.AppendElement(BatchData(
+          acc->Document()->IPCDoc(), uid, acc->State(), acc->Bounds(),
+          acc->ActionCount(), name, textValue, nodeID, acc->CurValue(),
+          acc->MinValue(), acc->MaxValue(), acc->Step(), attributes));
       mFocusPath.Put(acc->UniqueID(), acc);
     }
 
     ipcDoc->SendBatch(eBatch_FocusPath, cacheData);
   } else if (SessionAccessibility* sessionAcc =
                  SessionAccessibility::GetInstanceFor(this)) {
     nsTArray<AccessibleWrap*> accessibles;
     for (AccessibleWrap* acc = aAccessible; acc && acc != this->Parent();
@@ -228,17 +228,17 @@ void DocAccessibleWrap::UpdateFocusPathB
     DocAccessibleChild* ipcDoc = IPCDoc();
     nsTArray<BatchData> boundsData(mFocusPath.Count());
     for (auto iter = mFocusPath.Iter(); !iter.Done(); iter.Next()) {
       Accessible* accessible = iter.Data();
       auto uid = accessible->IsDoc() && accessible->AsDoc()->IPCDoc()
                      ? 0
                      : reinterpret_cast<uint64_t>(accessible->UniqueID());
       boundsData.AppendElement(BatchData(
-          accessible->Document()->IPCDoc(), uid, 0, accessible->Bounds(),
+          accessible->Document()->IPCDoc(), uid, 0, accessible->Bounds(), 0,
           nsString(), nsString(), nsString(), UnspecifiedNaN<double>(),
           UnspecifiedNaN<double>(), UnspecifiedNaN<double>(),
           UnspecifiedNaN<double>(), nsTArray<Attribute>()));
     }
 
     ipcDoc->SendBatch(eBatch_BoundsUpdate, boundsData);
   } else if (SessionAccessibility* sessionAcc =
                  SessionAccessibility::GetInstanceFor(this)) {
--- a/accessible/android/ProxyAccessibleWrap.cpp
+++ b/accessible/android/ProxyAccessibleWrap.cpp
@@ -75,16 +75,28 @@ void ProxyAccessibleWrap::Value(nsString
 uint64_t ProxyAccessibleWrap::State() { return Proxy()->State(); }
 
 nsIntRect ProxyAccessibleWrap::Bounds() const { return Proxy()->Bounds(); }
 
 void ProxyAccessibleWrap::ScrollTo(uint32_t aHow) const {
   Proxy()->ScrollTo(aHow);
 }
 
+uint8_t
+ProxyAccessibleWrap::ActionCount() const
+{
+  return Proxy()->ActionCount();
+}
+
+bool
+ProxyAccessibleWrap::DoAction(uint8_t aIndex) const
+{
+  return Proxy()->DoAction(aIndex);
+}
+
 // Other
 
 void ProxyAccessibleWrap::SetTextContents(const nsAString& aText) {
   Proxy()->ReplaceText(PromiseFlatString(aText));
 }
 
 void ProxyAccessibleWrap::GetTextContents(nsAString& aText) {
   nsAutoString text;
--- a/accessible/android/ProxyAccessibleWrap.h
+++ b/accessible/android/ProxyAccessibleWrap.h
@@ -40,16 +40,20 @@ class ProxyAccessibleWrap : public Acces
   virtual void Value(nsString& aValue) const override;
 
   virtual uint64_t State() override;
 
   virtual nsIntRect Bounds() const override;
 
   virtual void ScrollTo(uint32_t aHow) const override;
 
+  virtual uint8_t ActionCount() const override;
+
+  virtual bool DoAction(uint8_t aIndex) const override;
+
   // AccessibleWrap
 
   virtual void SetTextContents(const nsAString& aText) override;
 
   virtual void GetTextContents(nsAString& aText) override;
 
   virtual bool GetSelectionBounds(int32_t* aStartOffset,
                                   int32_t* aEndOffset) override;
--- a/accessible/android/SessionAccessibility.cpp
+++ b/accessible/android/SessionAccessibility.cpp
@@ -101,16 +101,27 @@ void SessionAccessibility::SetText(int32
     if (!acc) {
       return;
     }
 
     acc->SetTextContents(aText->ToString());
   }
 }
 
+void SessionAccessibility::Click(int32_t aID) {
+  if (RootAccessibleWrap* rootAcc = GetRoot()) {
+    AccessibleWrap* acc = rootAcc->FindAccessibleById(aID);
+    if (!acc) {
+      return;
+    }
+
+    acc->DoAction(0);
+  }
+}
+
 SessionAccessibility* SessionAccessibility::GetInstanceFor(
     ProxyAccessible* aAccessible) {
   auto tab = static_cast<dom::TabParent*>(aAccessible->Document()->Manager());
   dom::Element* frame = tab->GetOwnerElement();
   MOZ_ASSERT(frame);
   if (!frame) {
     return nullptr;
   }
@@ -316,17 +327,17 @@ void SessionAccessibility::SendSelectedE
 void SessionAccessibility::ReplaceViewportCache(
     const nsTArray<AccessibleWrap*>& aAccessibles,
     const nsTArray<BatchData>& aData) {
   auto infos = jni::ObjectArray::New<java::GeckoBundle>(aAccessibles.Length());
   for (size_t i = 0; i < aAccessibles.Length(); i++) {
     AccessibleWrap* acc = aAccessibles.ElementAt(i);
     if (aData.Length() == aAccessibles.Length()) {
       const BatchData& data = aData.ElementAt(i);
-      auto bundle = acc->ToSmallBundle(data.State(), data.Bounds());
+      auto bundle = acc->ToSmallBundle(data.State(), data.Bounds(), data.ActionCount());
       infos->SetElement(i, bundle);
     } else {
       infos->SetElement(i, acc->ToSmallBundle());
     }
   }
 
   mSessionAccessibility->ReplaceViewportCache(infos);
 }
@@ -336,20 +347,20 @@ void SessionAccessibility::ReplaceFocusP
     const nsTArray<BatchData>& aData) {
   auto infos = jni::ObjectArray::New<java::GeckoBundle>(aAccessibles.Length());
   for (size_t i = 0; i < aAccessibles.Length(); i++) {
     AccessibleWrap* acc = aAccessibles.ElementAt(i);
     if (aData.Length() == aAccessibles.Length()) {
       const BatchData& data = aData.ElementAt(i);
       nsCOMPtr<nsIPersistentProperties> props =
           AccessibleWrap::AttributeArrayToProperties(data.Attributes());
-      auto bundle =
-          acc->ToBundle(data.State(), data.Bounds(), data.Name(),
-                        data.TextValue(), data.DOMNodeID(), data.CurValue(),
-                        data.MinValue(), data.MaxValue(), data.Step(), props);
+      auto bundle = acc->ToBundle(
+          data.State(), data.Bounds(), data.ActionCount(), data.Name(),
+          data.TextValue(), data.DOMNodeID(), data.CurValue(), data.MinValue(),
+          data.MaxValue(), data.Step(), props);
       infos->SetElement(i, bundle);
     } else {
       infos->SetElement(i, acc->ToBundle());
     }
   }
 
   mSessionAccessibility->ReplaceFocusPathCache(infos);
 }
@@ -357,17 +368,17 @@ void SessionAccessibility::ReplaceFocusP
 void SessionAccessibility::UpdateCachedBounds(
     const nsTArray<AccessibleWrap*>& aAccessibles,
     const nsTArray<BatchData>& aData) {
   auto infos = jni::ObjectArray::New<java::GeckoBundle>(aAccessibles.Length());
   for (size_t i = 0; i < aAccessibles.Length(); i++) {
     AccessibleWrap* acc = aAccessibles.ElementAt(i);
     if (aData.Length() == aAccessibles.Length()) {
       const BatchData& data = aData.ElementAt(i);
-      auto bundle = acc->ToSmallBundle(data.State(), data.Bounds());
+      auto bundle = acc->ToSmallBundle(data.State(), data.Bounds(), data.ActionCount());
       infos->SetElement(i, bundle);
     } else {
       infos->SetElement(i, acc->ToSmallBundle());
     }
   }
 
   mSessionAccessibility->UpdateCachedBounds(infos);
 }
--- a/accessible/android/SessionAccessibility.h
+++ b/accessible/android/SessionAccessibility.h
@@ -70,16 +70,17 @@ class SessionAccessibility final
   static SessionAccessibility* GetInstanceFor(ProxyAccessible* aAccessible);
   static SessionAccessibility* GetInstanceFor(Accessible* aAccessible);
 
   // Native implementations
   using Base::AttachNative;
   using Base::DisposeNative;
   jni::Object::LocalRef GetNodeInfo(int32_t aID);
   void SetText(int32_t aID, jni::String::Param aText);
+  void Click(int32_t aID);
   void StartNativeAccessibility();
 
   // Event methods
   void SendFocusEvent(AccessibleWrap* aAccessible);
   void SendScrollingEvent(AccessibleWrap* aAccessible, int32_t aScrollX,
                           int32_t aScrollY, int32_t aMaxScrollX,
                           int32_t aMaxScrollY);
   void SendAccessibilityFocusedEvent(AccessibleWrap* aAccessible);
--- a/accessible/ipc/other/PDocAccessible.ipdl
+++ b/accessible/ipc/other/PDocAccessible.ipdl
@@ -31,16 +31,17 @@ union OriginDocument
 };
 
 struct BatchData
 {
   OriginDocument Document;
   uint64_t ID;
   uint64_t State;
   nsIntRect Bounds;
+  uint8_t ActionCount;
   nsString Name;
   nsString TextValue;
   nsString DOMNodeID;
   double CurValue;
   double MinValue;
   double MaxValue;
   double Step;
   Attribute[] Attributes;
--- a/accessible/jsat/AccessFu.jsm
+++ b/accessible/jsat/AccessFu.jsm
@@ -21,17 +21,16 @@ const GECKOVIEW_MESSAGE = {
   CLIPBOARD: "GeckoView:AccessibilityClipboard",
   CURSOR_TO_FOCUSED: "GeckoView:AccessibilityCursorToFocused",
   EXPLORE_BY_TOUCH: "GeckoView:AccessibilityExploreByTouch",
   LONG_PRESS: "GeckoView:AccessibilityLongPress",
   NEXT: "GeckoView:AccessibilityNext",
   PREVIOUS: "GeckoView:AccessibilityPrevious",
   SCROLL_BACKWARD: "GeckoView:AccessibilityScrollBackward",
   SCROLL_FORWARD: "GeckoView:AccessibilityScrollForward",
-  SELECT: "GeckoView:AccessibilitySelect",
   SET_SELECTION: "GeckoView:AccessibilitySetSelection",
   VIEW_FOCUSED: "GeckoView:AccessibilityViewFocused",
 };
 
 const ACCESSFU_MESSAGE = {
   DOSCROLL: "AccessFu:DoScroll",
 };
 
@@ -187,19 +186,16 @@ var AccessFu = {
         this.Input.moveToPoint("Simple", ...data.coordinates);
         break;
       case GECKOVIEW_MESSAGE.SET_SELECTION:
         this.Input.setSelection(data);
         break;
       case GECKOVIEW_MESSAGE.CLIPBOARD:
         this.Input.clipboard(data);
         break;
-      case GECKOVIEW_MESSAGE.SELECT:
-        this.Input.selectCurrent(data);
-        break;
     }
   },
 
   observe: function observe(aSubject, aTopic, aData) {
     switch (aTopic) {
       case "domwindowopened": {
         let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
         win.addEventListener("load", () => {
@@ -296,21 +292,16 @@ var Input = {
     mm.sendAsyncMessage("AccessFu:Clipboard", aDetails);
   },
 
   activateCurrent: function activateCurrent(aData) {
     let mm = Utils.getMessageManager();
     mm.sendAsyncMessage("AccessFu:Activate", { offset: 0 });
   },
 
-  selectCurrent: function selectCurrent(aData) {
-    let mm = Utils.getMessageManager();
-    mm.sendAsyncMessage("AccessFu:Select", aData);
-  },
-
   doScroll: function doScroll(aDetails, aBrowser) {
     let horizontal = aDetails.horizontal;
     let page = aDetails.page;
     let win = aBrowser.ownerGlobal;
     let winUtils = win.windowUtils;
     let p = AccessFu.screenToClientBounds(aDetails.bounds, win).center();
     winUtils.sendWheelEvent(p.x, p.y,
       horizontal ? page : 0, horizontal ? 0 : page, 0,
--- a/accessible/jsat/ContentControl.jsm
+++ b/accessible/jsat/ContentControl.jsm
@@ -34,17 +34,16 @@ this.ContentControl.prototype = {
   messagesOfInterest: ["AccessFu:Activate",
                        "AccessFu:AndroidScroll",
                        "AccessFu:AutoMove",
                        "AccessFu:ClearCursor",
                        "AccessFu:Clipboard",
                        "AccessFu:MoveByGranularity",
                        "AccessFu:MoveCursor",
                        "AccessFu:MoveToPoint",
-                       "AccessFu:Select",
                        "AccessFu:SetSelection"],
 
   start: function cc_start() {
     let cs = this._contentScope.get();
     for (let message of this.messagesOfInterest) {
       cs.addMessageListener(message, this);
     }
   },
@@ -171,26 +170,16 @@ this.ContentControl.prototype = {
     }
     this.document.activeElement.blur();
   },
 
   handleAutoMove: function cc_handleAutoMove(aMessage) {
     this.autoMove(null, aMessage.json);
   },
 
-  handleSelect: function cc_handleSelect(aMessage) {
-    const vc = this.vc;
-    if (!this.sendToChild(vc, aMessage, null, true)) {
-      const acc = vc.position;
-      if (Utils.getState(acc).contains(States.SELECTABLE)) {
-        this.handleActivate(aMessage);
-      }
-    }
-  },
-
   handleActivate: function cc_handleActivate(aMessage) {
     let activateAccessible = (aAccessible) => {
       Logger.debug(() => {
         return ["activateAccessible", Logger.accessibleToString(aAccessible)];
       });
 
       if (aAccessible.actionCount > 0) {
         aAccessible.doAction(0);
--- a/build/debian-packages/valgrind-wheezy.diff
+++ b/build/debian-packages/valgrind-wheezy.diff
@@ -1,12 +1,19 @@
 diff -Nru valgrind-3.14.0/debian/changelog valgrind-3.14.0/debian/changelog
 --- valgrind-3.14.0/debian/changelog	2018-11-15 09:21:43.000000000 +0900
-+++ valgrind-3.14.0/debian/changelog	2018-11-15 11:45:25.000000000 +0900
-@@ -1,3 +1,14 @@
++++ valgrind-3.14.0/debian/changelog	2018-11-30 15:20:10.000000000 +0900
+@@ -1,3 +1,21 @@
++valgrind (1:3.14.0-1.deb7moz2) wheezy; urgency=medium
++
++  * debian/patches/vg401112: Cherry-pick upstream revision
++    f2c03ce3babe51eecbf03735f726c4028a162857.
++
++ -- Mike Hommey <glandium@debian.org>  Fri, 30 Nov 2018 15:20:10 +0900
++
 +valgrind (1:3.14.0-1.deb7moz1) wheezy; urgency=medium
 +
 +  * Mozilla backport for wheezy.
 +  * debian/control, debian/compat: Drop debhelper compat back to 7, which
 +    requires adding back an explicit dependency on dh-autoreconf.
 +  * debian/rules: Debhelper only defaulted to --parallel in compat >= 10, so
 +    add --parallel back.
 +  * debian/valgrind-mpi.install: Use non-multiarch path.
@@ -30,16 +37,175 @@ diff -Nru valgrind-3.14.0/debian/control
  Priority: optional
  Maintainer: Alessandro Ghedini <ghedo@debian.org>
 -Build-Depends: debhelper (>= 11),
 +Build-Depends: debhelper (>= 7.0.50~),
 + dh-autoreconf,
   gdb,
   gcc-multilib [amd64],
   libc6-dev-i386 [amd64],
+diff -Nru valgrind-3.14.0/debian/patches/series valgrind-3.14.0/debian/patches/series
+--- valgrind-3.14.0/debian/patches/series	2018-11-15 09:21:43.000000000 +0900
++++ valgrind-3.14.0/debian/patches/series	2018-11-30 15:19:14.000000000 +0900
+@@ -5,3 +5,4 @@
+ 08_fix-spelling-in-manpage.patch
+ 09_fix-armhf-detect.patch
+ 10_mpi-pkg-config.patch
++vg401112
+diff -Nru valgrind-3.14.0/debian/patches/vg401112 valgrind-3.14.0/debian/patches/vg401112
+--- valgrind-3.14.0/debian/patches/vg401112	1970-01-01 09:00:00.000000000 +0900
++++ valgrind-3.14.0/debian/patches/vg401112	2018-11-30 15:19:46.000000000 +0900
+@@ -0,0 +1,147 @@
++From f2c03ce3babe51eecbf03735f726c4028a162857 Mon Sep 17 00:00:00 2001
++From: Julian Seward <jseward@acm.org>
++Date: Wed, 28 Nov 2018 14:15:06 +0100
++Subject: [PATCH] Bug 401112 - LLVM 5.0 generates comparison against partially
++ initialized data.
++
++This generalises the existing spec rules for W of 32 bits:
++
++             W  <u   0---(N-1)---0 1 0---0  or
++
++(that is, B/NB after SUBL, where dep2 has the above form), to also cover
++
++             W  <=u  0---(N-1)---0 0 1---1
++
++(that is, BE/NBE after SUBL, where dept2 has the specified form).
++
++Patch from Nicolas B. Pierron (nicolas.b.pierron@nbp.name).
++---
++ VEX/priv/guest_amd64_helpers.c | 90 ++++++++++++++++++++++++++++++------------
++ 2 files changed, 66 insertions(+), 25 deletions(-)
++
++diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c
++index a2b0789..30e82db 100644
++--- a/VEX/priv/guest_amd64_helpers.c
+++++ b/VEX/priv/guest_amd64_helpers.c
++@@ -1013,13 +1013,10 @@ static inline Bool isU64 ( IRExpr* e, ULong n )
++           && e->Iex.Const.con->Ico.U64 == n;
++ }
++ 
++-/* Returns N if E is an immediate of the form 1 << N for N in 1 to 31,
+++/* Returns N if W64 is a value of the form 1 << N for N in 1 to 31,
++    and zero in any other case. */
++-static Int isU64_1_shl_N ( IRExpr* e )
+++static Int isU64_1_shl_N_literal ( ULong w64 )
++ {
++-   if (e->tag != Iex_Const || e->Iex.Const.con->tag != Ico_U64)
++-      return 0;
++-   ULong w64 = e->Iex.Const.con->Ico.U64;
++    if (w64 < (1ULL << 1) || w64 > (1ULL << 31))
++       return 0;
++    if ((w64 & (w64 - 1)) != 0)
++@@ -1036,6 +1033,30 @@ static Int isU64_1_shl_N ( IRExpr* e )
++    return 0;
++ }
++ 
+++/* Returns N if E is an immediate of the form 1 << N for N in 1 to 31,
+++   and zero in any other case. */
+++static Int isU64_1_shl_N ( IRExpr* e )
+++{
+++   if (e->tag != Iex_Const || e->Iex.Const.con->tag != Ico_U64)
+++      return 0;
+++   ULong w64 = e->Iex.Const.con->Ico.U64;
+++   return isU64_1_shl_N_literal(w64);
+++}
+++
+++/* Returns N if E is an immediate of the form (1 << N) - 1 for N in 1 to 31,
+++   and zero in any other case. */
+++static Int isU64_1_shl_N_minus_1 ( IRExpr* e )
+++{
+++  if (e->tag != Iex_Const || e->Iex.Const.con->tag != Ico_U64)
+++    return 0;
+++  ULong w64 = e->Iex.Const.con->Ico.U64;
+++  // This isn't actually necessary since isU64_1_shl_N_literal will return
+++  // zero given a zero argument, but still ..
+++  if (w64 == 0xFFFFFFFFFFFFFFFFULL)
+++     return 0;
+++  return isU64_1_shl_N_literal(w64 + 1);
+++}
+++
++ IRExpr* guest_amd64_spechelper ( const HChar* function_name,
++                                  IRExpr** args,
++                                  IRStmt** precedingStmts,
++@@ -1258,32 +1279,51 @@ IRExpr* guest_amd64_spechelper ( const HChar* function_name,
++         /* It appears that LLVM 5.0 and later have a new way to find out
++            whether the top N bits of a word W are all zero, by computing
++ 
++-             W  <u  0---(N-1)---0 1 0---0
+++             W  <u   0---(N-1)---0 1 0---0  or
+++             W  <=u  0---(N-1)---0 0 1---1
++ 
++            In particular, the result will be defined if the top N bits of W
++            are defined, even if the trailing bits -- those corresponding to
++-           the 0---0 section -- are undefined.  Rather than make Memcheck
++-           more complex, we detect this case where we can and shift out the
++-           irrelevant and potentially undefined bits. */
+++           the rightmost 0---0 / 1---1 section -- are undefined.  Rather than
+++           make Memcheck more complex, we detect this case where we can and
+++           shift out the irrelevant and potentially undefined bits. */
++         Int n = 0;
++-        if (isU64(cc_op, AMD64G_CC_OP_SUBL)
++-            && (isU64(cond, AMD64CondB) || isU64(cond, AMD64CondNB))
++-            && (n = isU64_1_shl_N(cc_dep2)) > 0) {
++-           /* long sub/cmp, then B (unsigned less than),
++-              where dep2 is a power of 2:
++-                -> CmpLT32(dep1, 1 << N)
++-                -> CmpEQ32(dep1 >>u N, 0)
++-              and
++-              long sub/cmp, then NB (unsigned greater than or equal),
++-              where dep2 is a power of 2:
++-                -> CmpGE32(dep1, 1 << N)
++-                -> CmpNE32(dep1 >>u N, 0)
++-              This avoids CmpLT32U/CmpGE32U being applied to potentially
++-              uninitialised bits in the area being shifted out. */
+++        Bool is_NB_or_NBE = False;
+++        if (isU64(cc_op, AMD64G_CC_OP_SUBL)) {
+++           if (isU64(cond, AMD64CondB) || isU64(cond, AMD64CondNB)) {
+++              /* long sub/cmp, then B (unsigned less than),
+++                 where dep2 is a power of 2:
+++                   -> CmpLT32U(dep1, 1 << N)
+++                   -> CmpEQ32(dep1 >>u N, 0)
+++                 and
+++                 long sub/cmp, then NB (unsigned greater than or equal),
+++                 where dep2 is a power of 2:
+++                   -> CmpGE32U(dep1, 1 << N)
+++                   -> CmpNE32(dep1 >>u N, 0)
+++                 This avoids CmpLT32U/CmpGE32U being applied to potentially
+++                 uninitialised bits in the area being shifted out. */
+++              n = isU64_1_shl_N(cc_dep2);
+++              is_NB_or_NBE = isU64(cond, AMD64CondNB);
+++           } else if (isU64(cond, AMD64CondBE) || isU64(cond, AMD64CondNBE)) {
+++              /* long sub/cmp, then BE (unsigned less than or equal),
+++                 where dep2 is a power of 2 minus 1:
+++                  -> CmpLE32U(dep1, (1 << N) - 1)
+++                  -> CmpEQ32(dep1 >>u N, 0)
+++                 and
+++                 long sub/cmp, then NBE (unsigned greater than),
+++                 where dep2 is a power of 2 minus 1:
+++                   -> CmpGT32U(dep1, (1 << N) - 1)
+++                   -> CmpNE32(dep1 >>u N, 0)
+++                 This avoids CmpLE32U/CmpGT32U being applied to potentially
+++                 uninitialised bits in the area being shifted out. */
+++              n = isU64_1_shl_N_minus_1(cc_dep2);
+++              is_NB_or_NBE = isU64(cond, AMD64CondNBE);
+++           }
+++        }
+++        if (n > 0) {
++            vassert(n >= 1 && n <= 31);
++-           Bool isNB = isU64(cond, AMD64CondNB);
++            return unop(Iop_1Uto64,
++-                       binop(isNB ? Iop_CmpNE32 : Iop_CmpEQ32,
+++                       binop(is_NB_or_NBE ? Iop_CmpNE32 : Iop_CmpEQ32,
++                              binop(Iop_Shr32, unop(Iop_64to32, cc_dep1),
++                                               mkU8(n)),
++                              mkU32(0)));
++-- 
++2.9.3
++
 diff -Nru valgrind-3.14.0/debian/rules valgrind-3.14.0/debian/rules
 --- valgrind-3.14.0/debian/rules	2018-11-15 09:21:43.000000000 +0900
 +++ valgrind-3.14.0/debian/rules	2018-11-15 11:45:25.000000000 +0900
 @@ -11,7 +11,7 @@
  LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
  
  %:
 -	dh $@ --with=autoreconf
--- a/dom/locales/en-US/chrome/plugins.properties
+++ b/dom/locales/en-US/chrome/plugins.properties
@@ -1,34 +1,12 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-# LOCALIZATION NOTE:
-#    Those strings are inserted into an HTML page, so all HTML characters
-#    have to be escaped in a way that they show up correctly in HTML!
-
-title_label=About Plugins
-installedplugins_label=Installed plugins
-nopluginsareinstalled_label=No installed plugins found
-findpluginupdates_label=Find updates for installed plugins at
-file_label=File:
-path_label=Path:
-version_label=Version:
-state_label=State:
-state_enabled=Enabled
-state_disabled=Disabled
-mimetype_label=MIME Type
-description_label=Description
-suffixes_label=Suffixes
-learn_more_label=Learn More
-
-deprecation_description=Missing something? Some plugins are no longer supported.
-deprecation_learn_more=Learn More.
-
 # GMP Plugins
 gmp_license_info=License information
 gmp_privacy_info=Privacy Information
 
 openH264_name=OpenH264 Video Codec provided by Cisco Systems, Inc.
 openH264_description2=This plugin is automatically installed by Mozilla to comply with the WebRTC specification and to enable WebRTC calls with devices that require the H.264 video codec. Visit http://www.openh264.org/ to view the codec source code and learn more about the implementation.
 
 cdm_description2=This plugin enables playback of encrypted media in compliance with the Encrypted Media Extensions specification. Encrypted media is typically used by sites to protect against copying of premium media content. Visit https://www.w3.org/TR/encrypted-media/ for more information on Encrypted Media Extensions.
--- a/dom/media/mp4/DecoderData.cpp
+++ b/dom/media/mp4/DecoderData.cpp
@@ -82,23 +82,22 @@ void MP4AudioInfo::Update(const Mp4parse
     mMimeType = NS_LITERAL_CSTRING("audio/flac");
   } else if (track->codec == MP4PARSE_CODEC_MP3) {
     mMimeType = NS_LITERAL_CSTRING("audio/mpeg");
   }
 
   mRate = audio->sample_rate;
   mChannels = audio->channels;
   mBitDepth = audio->bit_depth;
-  mExtendedProfile = audio->profile;
+  mExtendedProfile = audio->extended_profile;
   mDuration = TimeUnit::FromMicroseconds(track->duration);
   mMediaTime = TimeUnit::FromMicroseconds(track->media_time);
   mTrackId = track->track_id;
 
   // In stagefright, mProfile is kKeyAACProfile, mExtendedProfile is kKeyAACAOT.
-  // Both are from audioObjectType in AudioSpecificConfig.
   if (audio->profile <= 4) {
     mProfile = audio->profile;
   }
 
   if (audio->extra_data.length > 0) {
     mExtraData->AppendElements(audio->extra_data.data,
                                audio->extra_data.length);
   }
--- a/dom/push/test/test_has_permissions.html
+++ b/dom/push/test/test_has_permissions.html
@@ -5,16 +5,17 @@ Bug 1038811: Push tests.
 
 Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/licenses/publicdomain/
 
 -->
 <head>
   <title>Test for Bug 1038811</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/AddTask.js"></script>
   <script type="text/javascript" src="/tests/dom/push/test/test_utils.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
 </head>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1038811">Mozilla Bug 1038811</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
@@ -23,62 +24,30 @@ http://creativecommons.org/licenses/publ
 </pre>
 
 <script class="testbody" type="text/javascript">
 
   function debug(str) {
   // console.log(str + "\n");
   }
 
-  function start() {
-    return navigator.serviceWorker.register("worker.js" + "?" + (Math.random()), {scope: "."})
-    .then((swr) => {
-      registration = swr;
-      return waitForActive(registration);
-    });
-  }
+  add_task(async function start() {
+    await setupPrefsAndMockSocket(new MockWebSocket());
 
-  function unregister() {
-    return registration.unregister().then(function(result) {
-      ok(result, "Unregister should return true.");
-    }, function(e) {
-      dump("Unregistering the SW failed with " + e + "\n");
-    });
-  }
+    var url = "worker.js" + "?" + Math.random();
+    registration = await navigator.serviceWorker.register(url, {scope: "."});
+    await waitForActive(registration);
+  });
 
-  function hasPermission(swr) {
-    var p = new Promise(function(res, rej) {
-      swr.pushManager.permissionState().then(
-        function(state) {
-          debug("state: " + state);
-          ok(["granted", "denied", "prompt"].includes(state), "permissionState() returned a valid state.");
-          res(swr);
-        }, function(error) {
-          ok(false, "permissionState() failed.");
-          res(swr);
-        }
-        );
-    });
-    return p;
-  }
+  add_task(async function hasPermission() {
+    var state = await registration.pushManager.permissionState();
+    debug("state: " + state);
+    ok(["granted", "denied", "prompt"].includes(state), "permissionState() returned a valid state.");
+  });
 
-  function runTest() {
-    start()
-    .then(hasPermission)
-    .then(unregister)
-    .catch(function(e) {
-      ok(false, "Some test failed with error " + e);
-    }).then(SimpleTest.finish);
-  }
-
-  SpecialPowers.addPermission("desktop-notification", false, document);
-  SpecialPowers.pushPrefEnv({"set": [
-    ["dom.push.enabled", true],
-    ["dom.push.connection.enabled", true],
-    ["dom.serviceWorkers.exemptFromPerDomainMax", true],
-    ["dom.serviceWorkers.enabled", true],
-    ["dom.serviceWorkers.testing.enabled", true]
-    ]}, runTest);
-  SimpleTest.waitForExplicitFinish();
+  add_task(async function unregister() {
+    var result = await registration.unregister();
+    ok(result, "Unregister should return true.");
+  });
 
 </script>
 </body>
 </html>
--- a/layout/base/MobileViewportManager.cpp
+++ b/layout/base/MobileViewportManager.cpp
@@ -275,36 +275,32 @@ void MobileViewportManager::UpdateResolu
       // visible within the display width. Note that "actual content" may be
       // different with respect to CSS pixels because of the CSS viewport size
       // changing.
       //
       // aDisplayWidthChangeRatio is non-empty if:
       // (a) The meta-viewport tag information changes, and so the CSS viewport
       //     might change as a result. If this happens after the content has
       //     been painted, we want to adjust the zoom to compensate. OR
-      // (b) The display size changed from a nonzero value to another nonzero
-      // value.
-      //     This covers the case where e.g. the device was rotated, and again
-      //     we want to adjust the zoom to compensate.
+      // (b) The display size changed from a nonzero value to another
+      //     nonzero value. This covers the case where e.g. the device was
+      //     rotated, and again we want to adjust the zoom to compensate.
       // Note in particular that aDisplayWidthChangeRatio will be None if all
       // that happened was a change in the full-zoom. In this case, we still
       // want to compute a new CSS viewport, but we don't want to update the
       // resolution.
       //
       // Given the above, the algorithm below accounts for all types of changes
       // I can conceive of:
       // 1. screen size changes, CSS viewport does not (pages with no meta
-      // viewport
-      //    or a fixed size viewport)
+      //    viewport or a fixed size viewport)
       // 2. screen size changes, CSS viewport also does (pages with a
-      // device-width
-      //    viewport)
+      //    device-width viewport)
       // 3. screen size remains constant, but CSS viewport changes (meta
-      // viewport
-      //    tag is added or removed)
+      //    viewport tag is added or removed)
       // 4. neither screen size nor CSS viewport changes
       if (aDisplayWidthChangeRatio) {
         newZoom = Some(
             ScaleZoomWithDisplayWidth(zoom, aDisplayWidthChangeRatio.value(),
                                       viewportSize, mMobileViewportSize));
       }
     }
   } else {  // aType == UpdateType::ContentSize
--- a/layout/base/MobileViewportManager.h
+++ b/layout/base/MobileViewportManager.h
@@ -131,18 +131,18 @@ class MobileViewportManager final : publ
   /*
    * Shrink the content to fit it to the display width if no initial-scale is
    * specified and if the content is still wider than the display width.
    */
   void ShrinkToDisplaySizeIfNeeded(nsViewportInfo& aViewportInfo,
                                    const mozilla::ScreenIntSize& aDisplaySize);
 
   nsCOMPtr<nsIDocument> mDocument;
-  nsIPresShell* MOZ_NON_OWNING_REF
-      mPresShell;  // raw ref since the presShell owns this
+  // raw ref since the presShell owns this
+  nsIPresShell* MOZ_NON_OWNING_REF mPresShell;
   nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;
   bool mIsFirstPaint;
   bool mPainted;
   mozilla::LayoutDeviceIntSize mDisplaySize;
   mozilla::CSSSize mMobileViewportSize;
   mozilla::Maybe<float> mRestoreResolution;
   mozilla::Maybe<mozilla::ScreenIntSize> mRestoreDisplaySize;
 };
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -359,21 +359,21 @@ class ReflowCountMgr {
 
   void PaintCount(const char* aName, gfxContext* aRenderingContext,
                   nsPresContext* aPresContext, nsIFrame* aFrame,
                   const nsPoint& aOffset, uint32_t aColor);
 
   FILE* GetOutFile() { return mFD; }
 
   void SetPresContext(nsPresContext* aPresContext) {
-    mPresContext = aPresContext;
-  }  // weak reference
+    mPresContext = aPresContext;  // weak reference
+  }
   void SetPresShell(nsIPresShell* aPresShell) {
-    mPresShell = aPresShell;
-  }  // weak reference
+    mPresShell = aPresShell;  // weak reference
+  }
 
   void SetDumpFrameCounts(bool aVal) { mDumpFrameCounts = aVal; }
   void SetDumpFrameByFrameCounts(bool aVal) { mDumpFrameByFrameCounts = aVal; }
   void SetPaintFrameCounts(bool aVal) { mPaintFrameByFrameCounts = aVal; }
 
   bool IsPaintingFrameCounts() { return mPaintFrameByFrameCounts; }
 
  protected:
@@ -701,26 +701,23 @@ static uint32_t sNextPresShellId;
     return true;
   }
   // Otherwise, disabled.
   return false;
 }
 
 nsIPresShell::nsIPresShell()
     : mViewManager(nullptr),
-      mFrameManager(nullptr)
+      mFrameManager(nullptr),
 #ifdef ACCESSIBILITY
-      ,
-      mDocAccessible(nullptr)
+      mDocAccessible(nullptr),
 #endif
 #ifdef DEBUG
-      ,
-      mDrawEventTargetFrame(nullptr)
+      mDrawEventTargetFrame(nullptr),
 #endif
-      ,
       mPaintCount(0),
       mAutoWeakFrames(nullptr),
       mCanvasBackgroundColor(NS_RGBA(0, 0, 0, 0)),
       mSelectionFlags(0),
       mChangeNestCount(0),
       mRenderFlags(0),
       mDidInitialize(false),
       mIsDestroying(false),
@@ -749,27 +746,24 @@ nsIPresShell::nsIPresShell()
       mFontSizeInflationEnabled(false),
       mPaintingIsFrozen(false),
       mIsNeverPainting(false),
       mInFlush(false),
       mCurrentEventFrame(nullptr) {
 }
 
 PresShell::PresShell()
-    : mCaretEnabled(false)
+    : mCaretEnabled(false),
 #ifdef DEBUG
-      ,
       mInVerifyReflow(false),
-      mCurrentReflowRoot(nullptr)
+      mCurrentReflowRoot(nullptr),
 #endif
 #ifdef MOZ_REFLOW_PERF
-      ,
-      mReflowCountMgr(nullptr)
+      mReflowCountMgr(nullptr),
 #endif
-      ,
       mMouseLocation(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
       mFirstCallbackEventRequest(nullptr),
       mLastCallbackEventRequest(nullptr),
       mLastReflowStart(0.0),
       mLastAnchorScrollPositionY(0),
       mActiveSuppressDisplayport(0),
       mAPZFocusSequenceNumber(0),
       mDocumentLoading(false),
@@ -3912,22 +3906,32 @@ void PresShell::DoFlushPendingNotificati
    * method, make sure to add the relevant SetNeedLayoutFlush or
    * SetNeedStyleFlush calls on the shell.
    */
   FlushType flushType = aFlush.mFlushType;
 
   MOZ_ASSERT(NeedFlush(flushType), "Why did we get called?");
 
 #ifdef MOZ_GECKO_PROFILER
+  // clang-format off
   static const EnumeratedArray<FlushType, FlushType::Count, const char*>
-      flushTypeNames = {"", "Event", "Content", "ContentAndNotify",
-                        // As far as the profiler is concerned,
-                        // EnsurePresShellInitAndFrames and Frames are the same
-                        "Style", "Style", "InterruptibleLayout", "Layout",
-                        "Display"};
+      flushTypeNames = {
+    "",
+    "Event",
+    "Content",
+    "ContentAndNotify",
+    // As far as the profiler is concerned, EnsurePresShellInitAndFrames and
+    // Frames are the same
+    "Style",
+    "Style",
+    "InterruptibleLayout",
+    "Layout",
+    "Display"
+  };
+  // clang-format on
   AUTO_PROFILER_LABEL_DYNAMIC_CSTR("PresShell::DoFlushPendingNotifications",
                                    LAYOUT, flushTypeNames[flushType]);
 #endif
 
 #ifdef ACCESSIBILITY
 #ifdef DEBUG
   if (nsAccessibilityService* accService = GetAccService()) {
     NS_ASSERTION(!accService->IsProcessingRefreshDriverNotification(),
@@ -9852,18 +9856,17 @@ void PresShell::UpdateViewportOverridden
         // Setting the initial viewport will trigger a reflow.
         mMobileViewportManager->SetInitialViewport();
       }
     }
     return;
   }
 
   MOZ_ASSERT(mMobileViewportManager,
-             "Shouldn't reach this without a "
-             "MobileViewportManager.");
+             "Shouldn't reach this without a MobileViewportManager.");
   mMobileViewportManager->Destroy();
   mMobileViewportManager = nullptr;
 
   if (aAfterInitialization) {
     // Force a reflow to our correct size by going back to the docShell
     // and asking it to reassert its size. This is necessary because
     // everything underneath the docShell, like the ViewManager, has been
     // altered by the MobileViewportManager in an irreversible way.
--- a/layout/base/StaticPresData.cpp
+++ b/layout/base/StaticPresData.cpp
@@ -32,19 +32,27 @@ StaticPresData* StaticPresData::Get() {
 StaticPresData::StaticPresData() {
   mLangService = nsLanguageAtomService::GetService();
 }
 
 #define MAKE_FONT_PREF_KEY(_pref, _s0, _s1) \
   _pref.Assign(_s0);                        \
   _pref.Append(_s1);
 
+// clang-format off
 static const char* const kGenericFont[] = {
-    ".variable.",  ".fixed.",   ".serif.",  ".sans-serif.",
-    ".monospace.", ".cursive.", ".fantasy."};
+  ".variable.",
+  ".fixed.",
+  ".serif.",
+  ".sans-serif.",
+  ".monospace.",
+  ".cursive.",
+  ".fantasy."
+};
+// clang-format on
 
 // These are private, use the list in nsFont.h if you want a public list.
 enum {
   eDefaultFont_Variable,
   eDefaultFont_Fixed,
   eDefaultFont_Serif,
   eDefaultFont_SansSerif,
   eDefaultFont_Monospace,
@@ -56,22 +64,34 @@ enum {
 void LangGroupFontPrefs::Initialize(nsAtom* aLangGroupAtom) {
   mLangGroup = aLangGroupAtom;
 
   /* Fetch the font prefs to be used -- see bug 61883 for details.
      Not all prefs are needed upfront. Some are fallback prefs intended
      for the GFX font sub-system...
 
   -- attributes for generic fonts --------------------------------------
-  font.default.[langGroup] = serif | sans-serif - fallback generic font
-  font.name.[generic].[langGroup] = current user' selected font on the pref
-  dialog font.name-list.[generic].[langGroup] = fontname1, fontname2, ...
-  [factory pre-built list] font.size.[generic].[langGroup] = integer - settable
-  by the user font.size-adjust.[generic].[langGroup] = "float" - settable by the
-  user font.minimum-size.[langGroup] = integer - settable by the user
+
+  font.default.[langGroup] = serif | sans-serif
+    fallback generic font
+
+  font.name.[generic].[langGroup]
+    current user' selected font on the pref dialog
+
+  font.name-list.[generic].[langGroup] = fontname1, fontname2, ...
+    [factory pre-built list]
+
+  font.size.[generic].[langGroup] = integer
+    settable by the user
+
+  font.size-adjust.[generic].[langGroup] = "float"
+    settable by the user
+
+  font.minimum-size.[langGroup] = integer
+    settable by the user
   */
 
   nsAutoCString langGroup;
   aLangGroupAtom->ToUTF8String(langGroup);
 
   mDefaultVariableFont.size = nsPresContext::CSSPixelsToAppUnits(16);
   mDefaultFixedFont.size = nsPresContext::CSSPixelsToAppUnits(13);
 
@@ -79,20 +99,27 @@ void LangGroupFontPrefs::Initialize(nsAt
 
   // get font.minimum-size.[langGroup]
 
   MAKE_FONT_PREF_KEY(pref, "font.minimum-size.", langGroup);
 
   int32_t size = Preferences::GetInt(pref.get());
   mMinimumFontSize = nsPresContext::CSSPixelsToAppUnits(size);
 
-  nsFont* fontTypes[] = {&mDefaultVariableFont,  &mDefaultFixedFont,
-                         &mDefaultSerifFont,     &mDefaultSansSerifFont,
-                         &mDefaultMonospaceFont, &mDefaultCursiveFont,
-                         &mDefaultFantasyFont};
+  // clang-format off
+  nsFont* fontTypes[] = {
+    &mDefaultVariableFont,
+    &mDefaultFixedFont,
+    &mDefaultSerifFont,
+    &mDefaultSansSerifFont,
+    &mDefaultMonospaceFont,
+    &mDefaultCursiveFont,
+    &mDefaultFantasyFont
+  };
+  // clang-format on
   static_assert(MOZ_ARRAY_LENGTH(fontTypes) == eDefaultFont_COUNT,
                 "FontTypes array count is not correct");
 
   // Get attributes specific to each generic font. We do not get the user's
   // generic-font-name-to-specific-family-name preferences because its the
   // generic name that should be fed into the cascade. It is up to the GFX
   // code to look up the font prefs to convert generic names to specific
   // family names as necessary.
--- a/layout/base/ZoomConstraintsClient.h
+++ b/layout/base/ZoomConstraintsClient.h
@@ -38,15 +38,15 @@ class ZoomConstraintsClient final : publ
   void Init(nsIPresShell* aPresShell, nsIDocument* aDocument);
   void Destroy();
   void ScreenSizeChanged();
 
  private:
   void RefreshZoomConstraints();
 
   nsCOMPtr<nsIDocument> mDocument;
-  nsIPresShell* MOZ_NON_OWNING_REF
-      mPresShell;  // raw ref since the presShell owns this
+  // raw ref since the presShell owns this
+  nsIPresShell* MOZ_NON_OWNING_REF mPresShell;
   nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;
   mozilla::Maybe<mozilla::layers::ScrollableLayerGuid> mGuid;
 };
 
 #endif
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -46,18 +46,18 @@ static const char16_t kLRE = 0x202A;
 static const char16_t kRLE = 0x202B;
 static const char16_t kLRO = 0x202D;
 static const char16_t kRLO = 0x202E;
 static const char16_t kPDF = 0x202C;
 static const char16_t kLRI = 0x2066;
 static const char16_t kRLI = 0x2067;
 static const char16_t kFSI = 0x2068;
 static const char16_t kPDI = 0x2069;
+// All characters with Bidi type Segment Separator or Block Separator
 static const char16_t kSeparators[] = {
-    // All characters with Bidi type Segment Separator or Block Separator
     char16_t('\t'), char16_t('\r'),   char16_t('\n'), char16_t(0xb),
     char16_t(0x1c), char16_t(0x1d),   char16_t(0x1e), char16_t(0x1f),
     char16_t(0x85), char16_t(0x2029), char16_t(0)};
 
 #define NS_BIDI_CONTROL_FRAME ((nsIFrame*)0xfffb1d1)
 
 static bool IsIsolateControl(char16_t aChar) {
   return aChar == kLRI || aChar == kRLI || aChar == kFSI;
--- a/layout/base/nsBidiPresUtils.h
+++ b/layout/base/nsBidiPresUtils.h
@@ -422,33 +422,33 @@ class nsBidiPresUtils {
    * @param aIsEvenLevel         TRUE means the embedding level of this frame
    *                             is even (LTR)
    * @param aStartOrEnd          The distance to the start or the end of aFrame
    *                             without considering its inline margin. If the
    *                             container is reordering frames in reverse
    *                             direction, it's the distance to the end,
    *                             otherwise, it's the distance to the start.
    * @param aContinuationStates  A map from nsIFrame* to
-   * nsFrameContinuationState
+   *                             nsFrameContinuationState
    * @return                     The isize aFrame takes, including margins.
    */
   static nscoord RepositionFrame(
       nsIFrame* aFrame, bool aIsEvenLevel, nscoord aStartOrEnd,
       const nsContinuationStates* aContinuationStates,
       mozilla::WritingMode aContainerWM, bool aContainerReverseOrder,
       const nsSize& aContainerSize);
 
   /*
    * Initialize the continuation state(nsFrameContinuationState) to
    * (nullptr, 0) for aFrame and its descendants.
    *
    * @param aFrame               The frame which itself and its descendants will
    *                             be initialized
    * @param aContinuationStates  A map from nsIFrame* to
-   * nsFrameContinuationState
+   *                             nsFrameContinuationState
    */
   static void InitContinuationStates(nsIFrame* aFrame,
                                      nsContinuationStates* aContinuationStates);
 
   /*
    * Determine if aFrame is first or last, and set aIsFirst and
    * aIsLast values. Also set continuation states of
    * aContinuationStates.
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -315,19 +315,17 @@ static void AssertAnonymousFlexOrGridIte
                "of flex container frames");
   } else {
     MOZ_ASSERT(aParent->IsGridContainerFrame(),
                "anonymous grid items should only exist as children "
                "of grid container frames");
   }
 }
 #else
-#define AssertAnonymousFlexOrGridItemParent(x, y) \
-  do { /* nothing */                              \
-  } while (0)
+#define AssertAnonymousFlexOrGridItemParent(x, y) PR_BEGIN_MACRO PR_END_MACRO
 #endif
 
 static inline nsContainerFrame* GetFieldSetBlockFrame(
     nsIFrame* aFieldsetFrame) {
   // Depends on the fieldset child frame order - see ConstructFieldSetFrame()
   // below.
   nsIFrame* firstChild = aFieldsetFrame->PrincipalChildList().FirstChild();
   nsIFrame* inner = firstChild && firstChild->GetNextSibling()
@@ -2571,31 +2569,29 @@ void nsCSSFrameConstructor::SetUpDocElem
   [fixed-cb]: the default containing block for fixed-pos content
   [abs-cb]: the default containing block for abs-pos content
 
   Meaning of nsCSSFrameConstructor fields:
     mRootElementFrame is "root element frame".  This is the primary frame for
       the root element.
     mDocElementContainingBlock is the parent of mRootElementFrame
       (i.e. nsCanvasFrame or nsRootBoxFrame)
-
     mPageSequenceFrame is the nsSimplePageSequenceFrame, or null if there isn't
-  one
+      one
   */
 
   // --------- CREATE ROOT FRAME -------
 
   // Create the root frame. The document element's frame is a child of the
   // root frame.
   //
   // The root frame serves two purposes:
   // - reserves space for any margins needed for the document element's frame
   // - renders the document element's background. This ensures the background
-  // covers
-  //   the entire canvas as specified by the CSS2 spec
+  //   covers the entire canvas as specified by the CSS2 spec
 
   nsPresContext* presContext = mPresShell->GetPresContext();
   bool isPaginated = presContext->IsRootPaginatedDocument();
   nsContainerFrame* viewportFrame =
       static_cast<nsContainerFrame*>(GetRootFrame());
   ComputedStyle* viewportPseudoStyle = viewportFrame->Style();
 
   nsContainerFrame* rootFrame = nullptr;
@@ -4180,48 +4176,50 @@ already_AddRefed<ComputedStyle> nsCSSFra
 void nsCSSFrameConstructor::FinishBuildingScrollFrame(
     nsContainerFrame* aScrollFrame, nsIFrame* aScrolledFrame) {
   nsFrameList scrolled(aScrolledFrame, aScrolledFrame);
   aScrollFrame->AppendFrames(kPrincipalList, scrolled);
 }
 
 /**
  * Called to wrap a gfx scrollframe around a frame. The hierarchy will look like
- *this
+ * this
  *
  * ------- for gfx scrollbars ------
  *
  *
  *            ScrollFrame
  *                 ^
  *                 |
  *               Frame (scrolled frame you passed in)
  *
  *
- *-----------------------------------
+ * -----------------------------------
  * LEGEND:
  *
  * ScrollFrame: This is a frame that manages gfx cross platform frame based
- *scrollbars.
+ * scrollbars.
  *
  * @param aContent the content node of the child to wrap.
+
  * @param aScrolledFrame The frame of the content to wrap. This should not be
- *                    Initialized. This method will initialize it with a
- *scrolled pseudo and no nsIContent. The content will be attached to the
- *scrollframe returned.
+ * Initialized. This method will initialize it with a scrolled pseudo and no
+ * nsIContent. The content will be attached to the scrollframe returned.
+
  * @param aContentStyle the style that has already been resolved for the content
- *                      being passed in.
+ * being passed in.
  *
  * @param aParentFrame The parent to attach the scroll frame to
  *
  * @param aNewFrame The new scrollframe or gfx scrollframe that we create. It
- *will contain the scrolled frame you passed in. (returned) If this is not null,
- *we'll just use it
+ * will contain the scrolled frame you passed in. (returned) If this is not
+ * null,  we'll just use it
+ *
  * @param aScrolledContentStyle the style that was resolved for the scrolled
- *frame. (returned)
+ * frame. (returned)
  */
 void nsCSSFrameConstructor::BuildScrollFrame(nsFrameConstructorState& aState,
                                              nsIContent* aContent,
                                              ComputedStyle* aContentStyle,
                                              nsIFrame* aScrolledFrame,
                                              nsContainerFrame* aParentFrame,
                                              nsContainerFrame*& aNewFrame) {
   RefPtr<ComputedStyle> scrolledContentStyle = BeginBuildingScrollFrame(
@@ -8687,82 +8685,82 @@ void nsCSSFrameConstructor::ShouldHaveSp
     bool* aHaveFirstLetterStyle, bool* aHaveFirstLineStyle) {
   *aHaveFirstLetterStyle = ShouldHaveFirstLetterStyle(aContent, aComputedStyle);
   *aHaveFirstLineStyle = ShouldHaveFirstLineStyle(aContent, aComputedStyle);
 }
 
 /* static */
 const nsCSSFrameConstructor::PseudoParentData
     nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = {
-        {// Cell
-         FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
+        // Cell
+        {FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
                               FCDATA_USE_CHILD_ITEMS |
                               FCDATA_IS_WRAPPER_ANON_BOX |
                               FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow),
                           &nsCSSFrameConstructor::ConstructTableCell),
          nsCSSAnonBoxes::tableCell()},
-        {// Row
-         FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
+        // Row
+        {FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
                               FCDATA_USE_CHILD_ITEMS |
                               FCDATA_IS_WRAPPER_ANON_BOX |
                               FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup),
                           &nsCSSFrameConstructor::ConstructTableRowOrRowGroup),
          nsCSSAnonBoxes::tableRow()},
-        {// Row group
-         FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
+        // Row group
+        {FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
                               FCDATA_USE_CHILD_ITEMS |
                               FCDATA_IS_WRAPPER_ANON_BOX |
                               FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
                           &nsCSSFrameConstructor::ConstructTableRowOrRowGroup),
          nsCSSAnonBoxes::tableRowGroup()},
-        {// Column group
-         FCDATA_DECL(
+        // Column group
+        {FCDATA_DECL(
              FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
                  FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_USE_CHILD_ITEMS |
                  FCDATA_SKIP_ABSPOS_PUSH |
                  // Not FCDATA_IS_WRAPPER_ANON_BOX, because we don't need to
                  // restyle these: they have non-inheriting styles.
                  FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
              NS_NewTableColGroupFrame),
          nsCSSAnonBoxes::tableColGroup()},
-        {// Table
-         FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS |
+        // Table
+        {FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS |
                               FCDATA_IS_WRAPPER_ANON_BOX,
                           &nsCSSFrameConstructor::ConstructTable),
          nsCSSAnonBoxes::table()},
-        {// Ruby
-         FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT | FCDATA_USE_CHILD_ITEMS |
+        // Ruby
+        {FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT | FCDATA_USE_CHILD_ITEMS |
                          FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_SKIP_FRAMESET,
                      NS_NewRubyFrame),
          nsCSSAnonBoxes::ruby()},
-        {// Ruby Base
-         FCDATA_DECL(
+        // Ruby Base
+        {FCDATA_DECL(
              FCDATA_USE_CHILD_ITEMS | FCDATA_IS_LINE_PARTICIPANT |
                  FCDATA_IS_WRAPPER_ANON_BOX |
                  FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRubyBaseContainer) |
                  FCDATA_SKIP_FRAMESET,
              NS_NewRubyBaseFrame),
          nsCSSAnonBoxes::rubyBase()},
-        {// Ruby Base Container
-         FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | FCDATA_IS_LINE_PARTICIPANT |
+        // Ruby Base Container
+        {FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | FCDATA_IS_LINE_PARTICIPANT |
                          FCDATA_IS_WRAPPER_ANON_BOX |
                          FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby) |
                          FCDATA_SKIP_FRAMESET,
                      NS_NewRubyBaseContainerFrame),
          nsCSSAnonBoxes::rubyBaseContainer()},
-        {// Ruby Text
-         FCDATA_DECL(
+        // Ruby Text
+        {FCDATA_DECL(
              FCDATA_USE_CHILD_ITEMS | FCDATA_IS_LINE_PARTICIPANT |
                  FCDATA_IS_WRAPPER_ANON_BOX |
                  FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRubyTextContainer) |
                  FCDATA_SKIP_FRAMESET,
              NS_NewRubyTextFrame),
          nsCSSAnonBoxes::rubyText()},
-        {// Ruby Text Container
-         FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX |
+        // Ruby Text Container
+        {FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX |
                          FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby) |
                          FCDATA_SKIP_FRAMESET,
                      NS_NewRubyTextContainerFrame),
          nsCSSAnonBoxes::rubyTextContainer()}};
 
 void nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
     nsFrameConstructorState& aState, FrameConstructionItemList& aItems,
     nsIFrame* aParentFrame) {
@@ -10918,20 +10916,19 @@ nsIFrame* nsCSSFrameConstructor::Constru
   nsIContent* const content = aItem.mContent;
   ComputedStyle* const computedStyle = aItem.mComputedStyle;
 
   nsInlineFrame* newFrame = NS_NewInlineFrame(mPresShell, computedStyle);
 
   // Initialize the frame
   InitAndRestoreFrame(aState, content, aParentFrame, newFrame);
 
-  nsFrameConstructorSaveState
-      absoluteSaveState;  // definition cannot be inside next block
-                          // because the object's destructor is significant
-                          // this is part of the fix for bug 42372
+  // definition cannot be inside next block because the object's destructor is
+  // significant. this is part of the fix for bug 42372
+  nsFrameConstructorSaveState absoluteSaveState;
 
   bool isAbsPosCB = newFrame->IsAbsPosContainingBlock();
   newFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
   if (isAbsPosCB) {
     // Relatively positioned frames becomes a container for child
     // frames that are positioned
     aState.PushAbsoluteContainingBlock(newFrame, newFrame, absoluteSaveState);
   }
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -1201,18 +1201,17 @@ class nsCSSFrameConstructor final : publ
     void* operator new(size_t) = delete;
     void* operator new[](size_t) = delete;
 #ifdef _MSC_VER /* Visual Studio */
     void operator delete(void*) { MOZ_CRASH("FrameConstructionItem::delete"); }
 #else
     void operator delete(void*) = delete;
 #endif
     void operator delete[](void*) = delete;
-    FrameConstructionItem(const FrameConstructionItem& aOther) =
-        delete; /* not implemented */
+    FrameConstructionItem(const FrameConstructionItem& aOther) = delete;
     // Not allocated from the stack!
     ~FrameConstructionItem() {
       MOZ_COUNT_DTOR(FrameConstructionItem);
       MOZ_ASSERT(mChildItems.IsEmpty(), "leaking");
     }
   };
 
   /**
@@ -1977,17 +1976,16 @@ class nsCSSFrameConstructor final : publ
   void WrapFramesInFirstLetterFrame(
       nsContainerFrame* aBlockFrame, nsContainerFrame* aBlockContinuation,
       nsContainerFrame* aParentFrame, nsIFrame* aParentFrameList,
       nsContainerFrame** aModifiedParent, nsIFrame** aTextFrame,
       nsIFrame** aPrevFrame, nsFrameItems& aLetterFrames, bool* aStopLooking);
 
   void RecoverLetterFrames(nsContainerFrame* aBlockFrame);
 
-  //
   void RemoveLetterFrames(nsIPresShell* aPresShell,
                           nsContainerFrame* aBlockFrame);
 
   // Recursive helper for RemoveLetterFrames
   void RemoveFirstLetterFrames(nsIPresShell* aPresShell,
                                nsContainerFrame* aFrame,
                                nsContainerFrame* aBlockFrame,
                                bool* aStopLooking);
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -664,25 +664,24 @@ nsresult nsCaret::GetCaretFrameForNodeOf
         levelBefore = levels.mLevelBefore;
         levelAfter = levels.mLevelAfter;
 
         if ((levelBefore != levelAfter) || (aBidiLevel != levelBefore)) {
           aBidiLevel = std::max(aBidiLevel,
                                 std::min(levelBefore, levelAfter));  // rule c3
           aBidiLevel = std::min(aBidiLevel,
                                 std::max(levelBefore, levelAfter));  // rule c4
-          if (aBidiLevel == levelBefore                              // rule c1
-              || (aBidiLevel > levelBefore && aBidiLevel < levelAfter &&
-                  IS_SAME_DIRECTION(aBidiLevel, levelBefore))  // rule c5
-              || (aBidiLevel < levelBefore && aBidiLevel > levelAfter &&
-                  IS_SAME_DIRECTION(aBidiLevel, levelBefore)))  // rule c9
+          if (aBidiLevel == levelBefore ||                           // rule c1
+              (aBidiLevel > levelBefore && aBidiLevel < levelAfter &&
+               IS_SAME_DIRECTION(aBidiLevel, levelBefore)) ||  // rule c5
+              (aBidiLevel < levelBefore && aBidiLevel > levelAfter &&
+               IS_SAME_DIRECTION(aBidiLevel, levelBefore)))  // rule c9
           {
             if (theFrame != frameBefore) {
-              if (frameBefore)  // if there is a frameBefore, move into it
-              {
+              if (frameBefore) {  // if there is a frameBefore, move into it
                 theFrame = frameBefore;
                 theFrame->GetOffsets(start, end);
                 theFrameOffset = end;
               } else {
                 // if there is no frameBefore, we must be at the beginning of
                 // the line so we stay with the current frame. Exception: when
                 // the first frame on the line has a different Bidi level from
                 // the paragraph level, there is no real frame for the caret to
@@ -694,20 +693,19 @@ nsresult nsCaret::GetCaretFrameForNodeOf
                                          true, false);
                   if (NS_SUCCEEDED(frameAfter->PeekOffset(&pos))) {
                     theFrame = pos.mResultFrame;
                     theFrameOffset = pos.mContentOffset;
                   }
                 }
               }
             }
-          } else if (aBidiLevel == levelAfter  // rule c2
-                     || (aBidiLevel > levelBefore && aBidiLevel < levelAfter &&
-                         IS_SAME_DIRECTION(aBidiLevel, levelAfter))  // rule c6
-                     ||
+          } else if (aBidiLevel == levelAfter ||  // rule c2
+                     (aBidiLevel > levelBefore && aBidiLevel < levelAfter &&
+                      IS_SAME_DIRECTION(aBidiLevel, levelAfter)) ||  // rule c6
                      (aBidiLevel < levelBefore && aBidiLevel > levelAfter &&
                       IS_SAME_DIRECTION(aBidiLevel, levelAfter)))  // rule c10
           {
             if (theFrame != frameAfter) {
               if (frameAfter) {
                 // if there is a frameAfter, move into it
                 theFrame = frameAfter;
                 theFrame->GetOffsets(start, end);
@@ -727,45 +725,37 @@ nsresult nsCaret::GetCaretFrameForNodeOf
                   if (NS_SUCCEEDED(frameBefore->PeekOffset(&pos))) {
                     theFrame = pos.mResultFrame;
                     theFrameOffset = pos.mContentOffset;
                   }
                 }
               }
             }
           } else if (aBidiLevel > levelBefore &&
-                     aBidiLevel < levelAfter  // rule c7/8
-                     &&
-                     IS_SAME_DIRECTION(
-                         levelBefore,
-                         levelAfter)  // before and after have the same parity
-                     &&
-                     !IS_SAME_DIRECTION(
-                         aBidiLevel, levelAfter))  // caret has different parity
-          {
+                     aBidiLevel < levelAfter &&  // rule c7/8
+                     // before and after have the same parity
+                     IS_SAME_DIRECTION(levelBefore, levelAfter) &&
+                     // caret has different parity
+                     !IS_SAME_DIRECTION(aBidiLevel, levelAfter)) {
             if (NS_SUCCEEDED(aFrameSelection->GetFrameFromLevel(
                     frameAfter, eDirNext, aBidiLevel, &theFrame))) {
               theFrame->GetOffsets(start, end);
               levelAfter = theFrame->GetEmbeddingLevel();
               if (IS_LEVEL_RTL(aBidiLevel))  // c8: caret to the right of the
                                              // rightmost character
                 theFrameOffset = IS_LEVEL_RTL(levelAfter) ? start : end;
               else  // c7: caret to the left of the leftmost character
                 theFrameOffset = IS_LEVEL_RTL(levelAfter) ? end : start;
             }
           } else if (aBidiLevel < levelBefore &&
-                     aBidiLevel > levelAfter  // rule c11/12
-                     &&
-                     IS_SAME_DIRECTION(
-                         levelBefore,
-                         levelAfter)  // before and after have the same parity
-                     &&
-                     !IS_SAME_DIRECTION(
-                         aBidiLevel, levelAfter))  // caret has different parity
-          {
+                     aBidiLevel > levelAfter &&  // rule c11/12
+                     // before and after have the same parity
+                     IS_SAME_DIRECTION(levelBefore, levelAfter) &&
+                     // caret has different parity
+                     !IS_SAME_DIRECTION(aBidiLevel, levelAfter)) {
             if (NS_SUCCEEDED(aFrameSelection->GetFrameFromLevel(
                     frameBefore, eDirPrevious, aBidiLevel, &theFrame))) {
               theFrame->GetOffsets(start, end);
               levelBefore = theFrame->GetEmbeddingLevel();
               if (IS_LEVEL_RTL(aBidiLevel))  // c12: caret to the left of the
                                              // leftmost character
                 theFrameOffset = IS_LEVEL_RTL(levelBefore) ? end : start;
               else  // c11: caret to the right of the rightmost character
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2133,18 +2133,18 @@ nsDocumentViewer::Show(void) {
     nsAutoScriptBlocker scriptBlocker;
 
     NS_ASSERTION(!mWindow, "Window already created but no presshell?");
 
     nsCOMPtr<nsIBaseWindow> base_win(mContainer);
     if (base_win) {
       base_win->GetParentWidget(&mParentWidget);
       if (mParentWidget) {
-        mParentWidget
-            ->Release();  // GetParentWidget AddRefs, but mParentWidget is weak
+        // GetParentWidget AddRefs, but mParentWidget is weak
+        mParentWidget->Release();
       }
     }
 
     nsView* containerView = FindContainerView();
 
     nsresult rv = CreateDeviceContext(containerView);
     NS_ENSURE_SUCCESS(rv, rv);
 
@@ -2553,19 +2553,19 @@ nsresult nsDocumentViewer::CreateDeviceC
 mozilla::dom::Selection* nsDocumentViewer::GetDocumentSelection() {
   if (!mPresShell) {
     return nullptr;
   }
 
   return mPresShell->GetCurrentSelection(SelectionType::eNormal);
 }
 
-/* ========================================================================================
+/* ============================================================================
  * nsIContentViewerEdit
- * ========================================================================================
+ * ============================================================================
  */
 
 NS_IMETHODIMP nsDocumentViewer::ClearSelection() {
   // use nsCopySupport::GetSelectionForCopy() ?
   RefPtr<mozilla::dom::Selection> selection = GetDocumentSelection();
   if (!selection) {
     return NS_ERROR_FAILURE;
   }
--- a/layout/base/nsFrameTraversal.h
+++ b/layout/base/nsFrameTraversal.h
@@ -1,13 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
 #ifndef NSFRAMETRAVERSAL_H
 #define NSFRAMETRAVERSAL_H
 
 #include "mozilla/Attributes.h"
 #include "nsIFrameTraversal.h"
 
 class nsIFrame;
 
--- a/layout/base/nsIDocumentViewerPrint.h
+++ b/layout/base/nsIDocumentViewerPrint.h
@@ -1,13 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
 #ifndef nsIDocumentViewerPrint_h___
 #define nsIDocumentViewerPrint_h___
 
 #include "nsISupports.h"
 #include "mozilla/UniquePtr.h"
 
 class nsIDocument;
 namespace mozilla {
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -693,48 +693,47 @@ class nsIPresShell : public nsStubDocume
     SCROLL_IF_NOT_VISIBLE,
     SCROLL_IF_NOT_FULLY_VISIBLE
   };
   typedef struct ScrollAxis {
     int16_t mWhereToScroll;
     WhenToScroll mWhenToScroll : 8;
     bool mOnlyIfPerceivedScrollableDirection : 1;
     /**
-     * @param aWhere: Either a percentage or a special value.
-     *                nsIPresShell defines:
-     *                * (Default) SCROLL_MINIMUM = -1: The visible area is
-     * scrolled the minimum amount to show as much as possible of the frame.
-     *                This won't hide any initially visible part of the frame.
-     *                * SCROLL_TOP = 0: The frame's upper edge is aligned with
-     * the top edge of the visible area.
-     *                * SCROLL_BOTTOM = 100: The frame's bottom edge is aligned
-     *                with the bottom edge of the visible area.
-     *                * SCROLL_LEFT = 0: The frame's left edge is aligned with
-     * the left edge of the visible area.
-     *                * SCROLL_RIGHT = 100: The frame's right edge is aligned
-     * with the right edge of the visible area.
-     *                * SCROLL_CENTER = 50: The frame is centered along the axis
-     *                the ScrollAxis is used for.
+     * aWhere:
+     *   Either a percentage or a special value. nsIPresShell defines:
+     *   * (Default) SCROLL_MINIMUM = -1: The visible area is scrolled the
+     *     minimum amount to show as much as possible of the frame. This won't
+     *     hide any initially visible part of the frame.
+     *   * SCROLL_TOP = 0: The frame's upper edge is aligned with the top edge
+     *     of the visible area.
+     *   * SCROLL_BOTTOM = 100: The frame's bottom edge is aligned with the
+     *     bottom edge of the visible area.
+     *   * SCROLL_LEFT = 0: The frame's left edge is aligned with the left edge
+     *     of the visible area.
+     *   * SCROLL_RIGHT = 100: The frame's right edge is aligned* with the right
+     *     edge of the visible area.
+     *   * SCROLL_CENTER = 50: The frame is centered along the axis the
+     *     ScrollAxis is used for.
      *
-     *                Other values are treated as a percentage, and the point
-     *                "percent" down the frame is placed at the point "percent"
-     *                down the visible area.
-     * @param aWhen:
-     *                * (Default) SCROLL_IF_NOT_FULLY_VISIBLE: Move the frame
-     * only if it is not fully visible (including if it's not visible at all).
-     * Note that in this case if the frame is too large to fit in view, it will
-     * only be scrolled if more of it can fit than is already in view.
-     *                * SCROLL_IF_NOT_VISIBLE: Move the frame only if none of it
-     *                is visible.
-     *                * SCROLL_ALWAYS: Move the frame regardless of its current
-     *                visibility.
-     * @param aOnlyIfPerceivedScrollableDirection:
-     *                If the direction is not a perceived scrollable direction
-     * (i.e. no scrollbar showing and less than one device pixel of scrollable
-     * distance), don't scroll. Defaults to false.
+     *   Other values are treated as a percentage, and the point*"percent"
+     *   down the frame is placed at the point "percent" down the visible area.
+     *
+     * aWhen:
+     *   * (Default) SCROLL_IF_NOT_FULLY_VISIBLE: Move the frame only if it is
+     *     not fully visible (including if it's not visible at all). Note that
+     *     in this case if the frame is too large to fit in view, it will only
+     *     be scrolled if more of it can fit than is already in view.
+     *   * SCROLL_IF_NOT_VISIBLE: Move the frame only if none of it is visible.
+     *   * SCROLL_ALWAYS: Move the frame regardless of its current visibility.
+     *
+     * aOnlyIfPerceivedScrollableDirection:
+     *   If the direction is not a perceived scrollable direction (i.e. no
+     *   scrollbar showing and less than one device pixel of scrollable
+     *   distance), don't scroll. Defaults to false.
      */
     explicit ScrollAxis(int16_t aWhere = SCROLL_MINIMUM,
                         WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE,
                         bool aOnlyIfPerceivedScrollableDirection = false)
         : mWhereToScroll(aWhere),
           mWhenToScroll(aWhen),
           mOnlyIfPerceivedScrollableDirection(
               aOnlyIfPerceivedScrollableDirection) {}
@@ -1209,25 +1208,29 @@ class nsIPresShell : public nsStubDocume
   virtual void UpdateCanvasBackground() = 0;
 
   /**
    * Add a solid color item to the bottom of aList with frame aFrame and bounds
    * aBounds. Checks first if this needs to be done by checking if aFrame is a
    * canvas frame (if the FORCE_DRAW flag is passed then this check is skipped).
    * aBackstopColor is composed behind the background color of the canvas, it is
    * transparent by default.
+   *
    * We attempt to make the background color part of the scrolled canvas (to
    * reduce transparent layers), and if async scrolling is enabled (and the
    * background is opaque) then we add a second, unscrolled item to handle the
-   * checkerboarding case. ADD_FOR_SUBDOC shoud be specified when calling this
-   * for a subdocument, and LayoutUseContainersForRootFrame might cause the
-   * whole list to be scrolled. In that case the second unscrolled item will be
-   * elided. APPEND_UNSCROLLED_ONLY only attempts to add the unscrolled item, so
-   * that we can add it manually after LayoutUseContainersForRootFrame has built
-   * the scrolling ContainerLayer.
+   * checkerboarding case.
+   *
+   * ADD_FOR_SUBDOC should be specified when calling this for a subdocument, and
+   * LayoutUseContainersForRootFrame might cause the whole list to be scrolled.
+   * In that case the second unscrolled item will be elided.
+   *
+   * APPEND_UNSCROLLED_ONLY only attempts to add the unscrolled item, so that
+   * we can add it manually after LayoutUseContainersForRootFrame has built the
+   * scrolling ContainerLayer.
    */
   enum {
     FORCE_DRAW = 0x01,
     ADD_FOR_SUBDOC = 0x02,
     APPEND_UNSCROLLED_ONLY = 0x04,
   };
   virtual void AddCanvasBackgroundColorItem(
       nsDisplayListBuilder& aBuilder, nsDisplayList& aList, nsIFrame* aFrame,
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2201,48 +2201,46 @@ static void ConstrainToCoordValues(gfxFl
     excess /= 2;
 
     aStart -= excess;
     aSize = nscoord_MIN;
   }
 }
 
 nsRect nsLayoutUtils::RoundGfxRectToAppRect(const Rect& aRect, float aFactor) {
-  /* Get a new Rect whose units are app units by scaling by the specified
-   * factor. */
+  // Get a new Rect whose units are app units by scaling by the specified
+  // factor.
   Rect scaledRect = aRect;
   scaledRect.ScaleRoundOut(aFactor);
 
-  /* We now need to constrain our results to the max and min values for coords.
-   */
+  // We now need to constrain our results to the max and min values for coords.
   ConstrainToCoordValues(scaledRect.x, scaledRect.width);
   ConstrainToCoordValues(scaledRect.y, scaledRect.height);
 
-  /* Now typecast everything back.  This is guaranteed to be safe. */
+  // Now typecast everything back.  This is guaranteed to be safe.
   if (aRect.IsEmpty()) {
     return nsRect(nscoord(scaledRect.X()), nscoord(scaledRect.Y()), 0, 0);
   } else {
     return nsRect(nscoord(scaledRect.X()), nscoord(scaledRect.Y()),
                   nscoord(scaledRect.Width()), nscoord(scaledRect.Height()));
   }
 }
 
 nsRect nsLayoutUtils::RoundGfxRectToAppRect(const gfxRect& aRect,
                                             float aFactor) {
-  /* Get a new gfxRect whose units are app units by scaling by the specified
-   * factor. */
+  // Get a new gfxRect whose units are app units by scaling by the specified
+  // factor.
   gfxRect scaledRect = aRect;
   scaledRect.ScaleRoundOut(aFactor);
 
-  /* We now need to constrain our results to the max and min values for coords.
-   */
+  // We now need to constrain our results to the max and min values for coords.
   ConstrainToCoordValues(scaledRect.x, scaledRect.width);
   ConstrainToCoordValues(scaledRect.y, scaledRect.height);
 
-  /* Now typecast everything back.  This is guaranteed to be safe. */
+  // Now typecast everything back.  This is guaranteed to be safe.
   if (aRect.IsEmpty()) {
     return nsRect(nscoord(scaledRect.X()), nscoord(scaledRect.Y()), 0, 0);
   } else {
     return nsRect(nscoord(scaledRect.X()), nscoord(scaledRect.Y()),
                   nscoord(scaledRect.Width()), nscoord(scaledRect.Height()));
   }
 }
 
@@ -6660,20 +6658,20 @@ static ImgDrawResult DrawImageInternal(
   nsRect fill;
   fill.IntersectRect(aDest, dest);
   return DrawImageInternal(aContext, aPresContext, image, aSamplingFilter, dest,
                            fill, aAnchorPoint ? *aAnchorPoint : fill.TopLeft(),
                            aDirty, aSVGContext, aImageFlags);
 }
 
 /* static */ void nsLayoutUtils::ComputeSizeForDrawing(
-    imgIContainer* aImage, CSSIntSize& aImageSize, /*outparam*/
-    nsSize& aIntrinsicRatio,                       /*outparam*/
-    bool& aGotWidth,                               /*outparam*/
-    bool& aGotHeight /*outparam*/) {
+    imgIContainer* aImage, /* outparam */ CSSIntSize& aImageSize,
+    /* outparam */ nsSize& aIntrinsicRatio,
+    /* outparam */ bool& aGotWidth,
+    /* outparam */ bool& aGotHeight) {
   aGotWidth = NS_SUCCEEDED(aImage->GetWidth(&aImageSize.width));
   aGotHeight = NS_SUCCEEDED(aImage->GetHeight(&aImageSize.height));
   bool gotRatio = NS_SUCCEEDED(aImage->GetIntrinsicRatio(&aIntrinsicRatio));
 
   if (!(aGotWidth && aGotHeight) && !gotRatio) {
     // We hit an error (say, because the image failed to load or couldn't be
     // decoded) and should return zero size.
     aGotWidth = aGotHeight = true;
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -848,23 +848,27 @@ class nsLayoutUtils {
   /**
    * Transform aRect relative to aFrame up to the coordinate system of
    * aAncestor. Computes the bounding-box of the true quadrilateral.
    * Pass non-null aPreservesAxisAlignedRectangles and it will be set to true if
    * we only need to use a 2d transform that PreservesAxisAlignedRectangles().
    *
    * |aMatrixCache| allows for optimizations in recomputing the same matrix over
    * and over. The argument can be one of the following values:
+   *
    * nullptr (the default) - No optimization; the transform matrix is computed
-   * on every call to this function. non-null pointer to an empty
-   * Maybe<Matrix4x4> - Upon return, the Maybe is filled with the transform
-   * matrix that was computed. This can then be passed in to subsequent calls
-   * with the same source and destination frames to avoid recomputing the
-   * matrix. non-null pointer to a non-empty Matrix4x4 - The provided matrix
-   * will be used as the transform matrix and applied to the rect.
+   * on every call to this function.
+   *
+   * non-null pointer to an empty Maybe<Matrix4x4> - Upon return, the Maybe is
+   * filled with the transform matrix that was computed. This can then be passed
+   * in to subsequent calls with the same source and destination frames to avoid
+   * recomputing the matrix.
+   *
+   * non-null pointer to a non-empty Matrix4x4 - The provided matrix will be
+   * used as the transform matrix and applied to the rect.
    */
   static nsRect TransformFrameRectToAncestor(
       const nsIFrame* aFrame, const nsRect& aRect, const nsIFrame* aAncestor,
       bool* aPreservesAxisAlignedRectangles = nullptr,
       mozilla::Maybe<Matrix4x4Flagged>* aMatrixCache = nullptr,
       bool aStopAtStackingContextAndDisplayPortAndOOFFrame = false,
       nsIFrame** aOutAncestor = nullptr);
 
@@ -1738,40 +1742,45 @@ class nsLayoutUtils {
   /* N.B. The only difference between variants of the Draw*Image
    * functions below is the type of the aImage argument.
    */
 
   /**
    * Draw a background image.  The image's dimensions are as specified in aDest;
    * the image itself is not consulted to determine a size.
    * See https://wiki.mozilla.org/Gecko:Image_Snapping_and_Rendering
-   *   @param aContext          The context to draw to, already set up with an
-   *                            appropriate scale and transform for drawing in
-   *                            app units.
-   *   @param aForFrame         The nsIFrame that we're drawing this image for.
-   *   @param aImage            The image.
-   *   @param aImageSize        The unscaled size of the image being drawn.
-   *                            (This might be the image's size if no scaling
-   *                            occurs, or it might be the image's size if
-   *                            the image is a vector image being rendered at
-   *                            that size.)
-   *   @param aDest             The position and scaled area where one copy of
-   *                            the image should be drawn. This area represents
-   *                            the image itself in its correct position as
-   * defined with the background-position css property.
-   *   @param aFill             The area to be filled with copies of the image.
-   *   @param aRepeatSize       The distance between the positions of two
-   * subsequent repeats of the image. Sizes larger than aDest.Size() create gaps
-   * between the images.
-   *   @param aAnchor           A point in aFill which we will ensure is
-   *                            pixel-aligned in the output.
-   *   @param aDirty            Pixels outside this area may be skipped.
-   *   @param aImageFlags       Image flags of the imgIContainer::FLAG_*
-   * variety.
-   *   @param aExtendMode       How to extend the image over the dest rect.
+   *
+   * @param aContext
+   *   The context to draw to, already set up with an appropriate scale and
+   *   transform for drawing in app units.
+   * @param aForFrame
+   *   The nsIFrame that we're drawing this image for.
+   * @param aImage
+   *   The image.
+   * @param aImageSize
+   *  The unscaled size of the image being drawn. (This might be the image's
+   *  size if no scaling occurs, or it might be the image's size if the image is
+   *  a vector image being rendered at that size.)
+   * @param aDest
+   *  The position and scaled area where one copy of the image should be drawn.
+   *  This area represents the image itself in its correct position as defined
+   *  with the background-position css property.
+   * @param aFill
+   *  The area to be filled with copies of the image.
+   * @param aRepeatSize
+   *  The distance between the positions of two subsequent repeats of the image.
+   *  Sizes larger than aDest.Size() create gaps between the images.
+   * @param aAnchor
+   *  A point in aFill which we will ensure is pixel-aligned in the output.
+   * @param aDirty
+   *   Pixels outside this area may be skipped.
+   * @param aImageFlags
+   *   Image flags of the imgIContainer::FLAG_* variety.
+   * @param aExtendMode
+   *   How to extend the image over the dest rect.
    */
   static ImgDrawResult DrawBackgroundImage(
       gfxContext& aContext, nsIFrame* aForFrame, nsPresContext* aPresContext,
       imgIContainer* aImage, const CSSIntSize& aImageSize,
       SamplingFilter aSamplingFilter, const nsRect& aDest, const nsRect& aFill,
       const nsSize& aRepeatSize, const nsPoint& aAnchor, const nsRect& aDirty,
       uint32_t aImageFlags, ExtendMode aExtendMode, float aOpacity);
 
@@ -2907,23 +2916,25 @@ class nsLayoutUtils {
                                             const nsRect& aOverflow,
                                             const nsSize& aPrerenderSize);
 
   /*
    * Checks whether a node is an invisible break.
    * If not, returns the first frame on the next line if such a next line
    * exists.
    *
-   * @return  true if the node is an invisible break.
-   *          aNextLineFrame is returned null in this case.
-   *          false if the node causes a visible break or if the node is no
-   * break.
+   * @return
+   *   true if the node is an invisible break. aNextLineFrame is returned null
+   *   in this case.
    *
-   * @param   aNextLineFrame  assigned to first frame on the next line if such a
-   *                          next line exists, null otherwise.
+   *   false if the node causes a visible break or if the node is no break.
+   *
+   * @param aNextLineFrame
+   *   assigned to first frame on the next line if such a next line exists, null
+   *   otherwise.
    */
   static bool IsInvisibleBreak(nsINode* aNode,
                                nsIFrame** aNextLineFrame = nullptr);
 
   static nsRect ComputeGeometryBox(nsIFrame* aFrame,
                                    StyleGeometryBox aGeometryBox);
 
   static nsPoint ComputeOffsetToUserSpace(nsDisplayListBuilder* aBuilder,
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -97,20 +97,21 @@ enum nsPresContext_CachedBoolPrefType {
 enum nsPresContext_CachedIntPrefType {
   kPresContext_ScrollbarSide = 1,
   kPresContext_BidiDirection
 };
 
 // IDs for the default variable and fixed fonts (not to be changed, see
 // nsFont.h) To be used for Get/SetDefaultFont(). The other IDs in nsFont.h are
 // also supported.
-const uint8_t kPresContext_DefaultVariableFont_ID =
-    0x00;  // kGenericFont_moz_variable
-const uint8_t kPresContext_DefaultFixedFont_ID =
-    0x01;  // kGenericFont_moz_fixed
+//
+// kGenericFont_moz_variable
+const uint8_t kPresContext_DefaultVariableFont_ID = 0x00;
+// kGenericFont_moz_fixed
+const uint8_t kPresContext_DefaultFixedFont_ID = 0x01;
 
 #ifdef DEBUG
 struct nsAutoLayoutPhase;
 
 enum nsLayoutPhase {
   eLayoutPhase_Paint,
   eLayoutPhase_DisplayListBuilding,  // sometimes a subset of the paint phase
   eLayoutPhase_Reflow,
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -22,16 +22,17 @@
 #include "nsCSSKeywords.h"
 #include "nsCSSProps.h"
 #include "nsCSSPseudoElements.h"
 #include "nsCSSRendering.h"
 #include "nsGenericHTMLFrameElement.h"
 #include "mozilla/dom/Attr.h"
 #include "mozilla/EventListenerManager.h"
 #include "nsFrame.h"
+#include "nsFrameState.h"
 #include "nsGlobalWindow.h"
 #include "nsGkAtoms.h"
 #include "nsImageFrame.h"
 #include "nsLayoutStylesheetCache.h"
 #include "nsRange.h"
 #include "nsRegion.h"
 #include "nsRepeatService.h"
 #include "nsFloatManager.h"
@@ -137,16 +138,17 @@ nsresult nsLayoutStatics::Initialize() {
 
   nsCSSKeywords::AddRefTable();
   nsCSSProps::AddRefTable();
   nsColorNames::AddRefTable();
 
 #ifdef DEBUG
   nsCSSPseudoElements::AssertAtoms();
   nsCSSAnonBoxes::AssertAtoms();
+  DebugVerifyFrameStateBits();
 #endif
 
   StartupJSEnvironment();
   nsJSContext::EnsureStatics();
 
   nsGlobalWindowInner::Init();
   nsGlobalWindowOuter::Init();
   Navigator::Init();
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -34,18 +34,17 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // Constants
-const uint32_t kMaxDropDownRows =
-    20;  // This matches the setting for 4.x browsers
+const uint32_t kMaxDropDownRows = 20;  // matches the setting for 4.x browsers
 const int32_t kNothingSelected = -1;
 
 // Static members
 nsListControlFrame* nsListControlFrame::mFocused = nullptr;
 nsString* nsListControlFrame::sIncrementalString = nullptr;
 
 // Using for incremental typing navigation
 #define INCREMENTAL_SEARCH_KEYPRESS_TIME 1000
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -756,18 +756,17 @@ void nsTextControlFrame::SetFocus(bool a
 
   if (!docSel->IsCollapsed()) {
     docSel->RemoveAllRanges(IgnoreErrors());
   }
 }
 
 nsresult nsTextControlFrame::SetFormProperty(nsAtom* aName,
                                              const nsAString& aValue) {
-  if (!mIsProcessing)  // some kind of lock.
-  {
+  if (!mIsProcessing) {  // some kind of lock.
     mIsProcessing = true;
     if (nsGkAtoms::select == aName) {
       // Select all the text.
       //
       // XXX: This is lame, we can't call editor's SelectAll method
       //      because that triggers AutoCopies in unix builds.
       //      Instead, we have to call our own homegrown version
       //      of select all which merely builds a range that selects
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -54,19 +54,18 @@ enum eNormalLineHeightControl {
 static eNormalLineHeightControl sNormalLineHeightControl = eUninitialized;
 
 // Initialize a <b>root</b> reflow state with a rendering context to
 // use for measuring things.
 ReflowInput::ReflowInput(nsPresContext* aPresContext, nsIFrame* aFrame,
                          gfxContext* aRenderingContext,
                          const LogicalSize& aAvailableSpace, uint32_t aFlags)
     : SizeComputationInput(aFrame, aRenderingContext),
-      mCBReflowInput(
-          nullptr)  // will be setup properly later in InitCBReflowInput
-      ,
+      // will be setup properly later in InitCBReflowInput
+      mCBReflowInput(nullptr),
       mBlockDelta(0),
       mOrthogonalLimit(NS_UNCONSTRAINEDSIZE),
       mAvailableWidth(0),
       mAvailableHeight(0),
       mContainingBlockSize(mWritingMode),
       mReflowDepth(0) {
   MOZ_ASSERT(aRenderingContext, "no rendering context");
   MOZ_ASSERT(aPresContext, "no pres context");
@@ -171,19 +170,18 @@ SizeComputationInput::SizeComputationInp
 // is copied from the parent reflow state; the remaining state is
 // computed.
 ReflowInput::ReflowInput(nsPresContext* aPresContext,
                          const ReflowInput& aParentReflowInput,
                          nsIFrame* aFrame, const LogicalSize& aAvailableSpace,
                          const LogicalSize* aContainingBlockSize,
                          uint32_t aFlags)
     : SizeComputationInput(aFrame, aParentReflowInput.mRenderingContext),
-      mCBReflowInput(
-          nullptr)  // will be setup properly later in InitCBReflowInput
-      ,
+      // will be setup properly later in InitCBReflowInput
+      mCBReflowInput(nullptr),
       mBlockDelta(0),
       mOrthogonalLimit(NS_UNCONSTRAINEDSIZE),
       mAvailableWidth(0),
       mAvailableHeight(0),
       mContainingBlockSize(mWritingMode),
       mFlags(aParentReflowInput.mFlags),
       mReflowDepth(aParentReflowInput.mReflowDepth + 1) {
   MOZ_ASSERT(aPresContext, "no pres context");
--- a/layout/generic/ReflowInput.h
+++ b/layout/generic/ReflowInput.h
@@ -180,65 +180,84 @@ struct SizeComputationInput {
         mWritingMode(aFrame->GetWritingMode()) {}
 
   SizeComputationInput(nsIFrame* aFrame, gfxContext* aRenderingContext,
                        mozilla::WritingMode aContainingBlockWritingMode,
                        nscoord aContainingBlockISize);
 
   struct ReflowInputFlags {
     ReflowInputFlags() { memset(this, 0, sizeof(*this)); }
-    bool mSpecialBSizeReflow : 1;   // used by tables to communicate special
-                                    // reflow (in process) to handle percent
-                                    // bsize frames inside cells which may not
-                                    // have computed bsizes
-    bool mNextInFlowUntouched : 1;  // nothing in the frame's next-in-flow (or
-                                    // its descendants) is changing
-    bool mIsTopOfPage : 1;          // Is the current context at the top of a
-                                    // page?  When true, we force something
-                                    // that's too tall for a page/column to
-                                    // fit anyway to avoid infinite loops.
-    bool mAssumingHScrollbar : 1;   // parent frame is an nsIScrollableFrame and
-                                    // it is assuming a horizontal scrollbar
-    bool mAssumingVScrollbar : 1;   // parent frame is an nsIScrollableFrame and
-                                    // it is assuming a vertical scrollbar
+
+    // used by tables to communicate special reflow (in process) to handle
+    // percent bsize frames inside cells which may not have computed bsizes
+    bool mSpecialBSizeReflow : 1;
+
+    // nothing in the frame's next-in-flow (or its descendants) is changing
+    bool mNextInFlowUntouched : 1;
+
+    // Is the current context at the top of a page?  When true, we force
+    // something that's too tall for a page/column to fit anyway to avoid
+    // infinite loops.
+    bool mIsTopOfPage : 1;
 
-    bool mIsIResize : 1;  // Is frame (a) not dirty and (b) a
-                          // different inline-size than before?
+    // parent frame is an nsIScrollableFrame and it is assuming a horizontal
+    // scrollbar
+    bool mAssumingHScrollbar : 1;
+
+    // parent frame is an nsIScrollableFrame and it is assuming a vertical
+    // scrollbar
+    bool mAssumingVScrollbar : 1;
+
+    // Is frame (a) not dirty and (b) a different inline-size than before?
+    bool mIsIResize : 1;
+
+    // Is frame (a) not dirty and (b) a different block-size than before or
+    // (potentially) in a context where percent block-sizes have a different
+    // basis?
+    bool mIsBResize : 1;
+
+    // tables are splittable, this should happen only inside a page and never
+    // insider a column frame
+    bool mTableIsSplittable : 1;
 
-    bool mIsBResize : 1;          // Is frame (a) not dirty and (b) a
-                                  // different block-size than before or
-                                  // (potentially) in a context where
-                                  // percent block-sizes have a different
-                                  // basis?
-    bool mTableIsSplittable : 1;  // tables are splittable, this should happen
-                                  // only inside a page and never insider a
-                                  // column frame
-    bool mHeightDependsOnAncestorCell : 1;  // Does frame height depend on
-                                            // an ancestor table-cell?
-    bool mIsColumnBalancing : 1;  // nsColumnSetFrame is balancing columns
-    bool mIsFlexContainerMeasuringBSize : 1;  // nsFlexContainerFrame is
-                                              // reflowing this child to
-                                              // measure its intrinsic BSize.
-    bool mDummyParentReflowInput : 1;         // a "fake" reflow state made
-                                              // in order to be the parent
-                                              // of a real one
-    bool mMustReflowPlaceholders : 1;  // Should this frame reflow its place-
-                                       // holder children? If the available
-                                       // height of this frame didn't change,
-                                       // but its in a paginated environment
-                                       // (e.g. columns), it should always
-                                       // reflow its placeholder children.
-    bool mShrinkWrap : 1;    // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag
-    bool mUseAutoBSize : 1;  // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag
-    bool mStaticPosIsCBOrigin : 1;     // the STATIC_POS_IS_CB_ORIGIN ctor flag
-    bool mIClampMarginBoxMinSize : 1;  // the I_CLAMP_MARGIN_BOX_MIN_SIZE ctor
-                                       // flag
-    bool mBClampMarginBoxMinSize : 1;  // the B_CLAMP_MARGIN_BOX_MIN_SIZE ctor
-                                       // flag
-    bool mApplyAutoMinSize : 1;        // the I_APPLY_AUTO_MIN_SIZE ctor flag
+    // Does frame height depend on an ancestor table-cell?
+    bool mHeightDependsOnAncestorCell : 1;
+
+    // nsColumnSetFrame is balancing columns
+    bool mIsColumnBalancing : 1;
+
+    // nsFlexContainerFrame is reflowing this child to measure its intrinsic
+    // BSize.
+    bool mIsFlexContainerMeasuringBSize : 1;
+
+    // a "fake" reflow state made in order to be the parent of a real one
+    bool mDummyParentReflowInput : 1;
+
+    // Should this frame reflow its place-holder children? If the available
+    // height of this frame didn't change, but its in a paginated environment
+    // (e.g. columns), it should always reflow its placeholder children.
+    bool mMustReflowPlaceholders : 1;
+
+    // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag
+    bool mShrinkWrap : 1;
+
+    // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag
+    bool mUseAutoBSize : 1;
+
+    // the STATIC_POS_IS_CB_ORIGIN ctor flag
+    bool mStaticPosIsCBOrigin : 1;
+
+    // the I_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag
+    bool mIClampMarginBoxMinSize : 1;
+
+    // the B_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag
+    bool mBClampMarginBoxMinSize : 1;
+
+    // the I_APPLY_AUTO_MIN_SIZE ctor flag
+    bool mApplyAutoMinSize : 1;
 
     // If set, the following two flags indicate that:
     // (1) this frame is absolutely-positioned (or fixed-positioned).
     // (2) this frame's static position depends on the CSS Box Alignment.
     // (3) we do need to compute the static position, because the frame's
     //     {Inline and/or Block} offsets actually depend on it.
     // When these bits are set, the offset values (IStart/IEnd, BStart/BEnd)
     // represent the "start" edge of the frame's CSS Box Alignment container
@@ -833,17 +852,17 @@ struct ReflowInput : public SizeComputat
     return aHeight - aConsumed;
   }
 
   /**
    * Apply the mComputed(Min/Max)BSize constraints to the content
    * size computed so far.
    *
    * @param aBSize The block-size that we've computed an to which we want to
-   * apply min/max constraints.
+   *        apply min/max constraints.
    * @param aConsumed The amount of the computed block-size that was consumed by
    *        our prev-in-flows.
    */
   nscoord ApplyMinMaxBSize(nscoord aBSize, nscoord aConsumed = 0) const {
     aBSize += aConsumed;
 
     if (NS_UNCONSTRAINEDSIZE != ComputedMaxBSize()) {
       aBSize = std::min(aBSize, ComputedMaxBSize());
--- a/layout/generic/ScrollSnap.cpp
+++ b/layout/generic/ScrollSnap.cpp
@@ -52,18 +52,18 @@ class CalcSnapPoints : public SnappingEd
   void AddEdgeInterval(nscoord aInterval, nscoord aMinPos, nscoord aMaxPos,
                        nscoord aOffset, nscoord aDestination, nscoord aStartPos,
                        nscoord aScrollingDirection, nscoord* aBestEdge,
                        bool* aEdgeFound);
   nsPoint GetBestEdge() const;
 
  protected:
   nsIScrollableFrame::ScrollUnit mUnit;
-  nsPoint
-      mDestination;   // gives the position after scrolling but before snapping
+  nsPoint mDestination;  // gives the position after scrolling but before
+                         // snapping
   nsPoint mStartPos;  // gives the position before scrolling
   nsIntPoint mScrollingDirection;  // always -1, 0, or 1
   nsPoint mBestEdge;  // keeps track of the position of the current best edge
   bool mHorizontalEdgeFound;  // true if mBestEdge.x is storing a valid
                               // horizontal edge
   bool mVerticalEdgeFound;    // true if mBestEdge.y is storing a valid vertical
                               // edge
 };
--- a/layout/generic/ViewportFrame.cpp
+++ b/layout/generic/ViewportFrame.cpp
@@ -146,18 +146,18 @@ void ViewportFrame::BuildDisplayListForT
         continue;
       }
       MOZ_ASSERT(ShouldInTopLayerForFullscreen(elem));
       // Inner SVG, MathML elements, as well as children of some XUL
       // elements are not allowed to be out-of-flow. They should not
       // be handled as top layer element here.
       if (!(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
         MOZ_ASSERT(!elem->GetParent()->IsHTMLElement(),
-                   "HTML element "
-                   "should always be out-of-flow if in the top layer");
+                   "HTML element should always be out-of-flow if in the top "
+                   "layer");
         continue;
       }
       if (nsIFrame* backdropPh =
               frame->GetChildList(kBackdropList).FirstChild()) {
         MOZ_ASSERT(backdropPh->IsPlaceholderFrame());
         MOZ_ASSERT(!backdropPh->GetNextSibling(), "more than one ::backdrop?");
         MOZ_ASSERT(backdropPh->HasAnyStateBits(NS_FRAME_FIRST_REFLOW),
                    "did you intend to reflow ::backdrop placeholders?");
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -371,57 +371,59 @@ class WritingMode {
   }
 
   /**
    * Returns the logical side corresponding to the specified physical side,
    * given the current writing mode.
    * (This is the inverse of the PhysicalSide() method above.)
    */
   LogicalSide LogicalSideForPhysicalSide(mozilla::Side aSide) const {
+    // clang-format off
     // indexes are four-bit values:
     //   bit 0 = the eOrientationMask value
     //   bit 1 = the eInlineFlowMask value
     //   bit 2 = the eBlockFlowMask value
     //   bit 3 = the eLineOrientMask value
     static const LogicalSide kPhysicalToLogicalSides[][4] = {
-        // top                right
-        // bottom             left
-        {eLogicalSideBStart, eLogicalSideIEnd, eLogicalSideBEnd,
-         eLogicalSideIStart},  // horizontal-tb         ltr
-        {eLogicalSideIStart, eLogicalSideBStart, eLogicalSideIEnd,
-         eLogicalSideBEnd},  // vertical-rl           ltr
-        {eLogicalSideBStart, eLogicalSideIStart, eLogicalSideBEnd,
-         eLogicalSideIEnd},  // horizontal-tb         rtl
-        {eLogicalSideIEnd, eLogicalSideBStart, eLogicalSideIStart,
-         eLogicalSideBEnd},  // vertical-rl           rtl
-        {eLogicalSideBEnd, eLogicalSideIStart, eLogicalSideBStart,
-         eLogicalSideIEnd},  // (horizontal-bt) (inv) ltr
-        {eLogicalSideIStart, eLogicalSideBEnd, eLogicalSideIEnd,
-         eLogicalSideBStart},  // vertical-lr   sw-left rtl
-        {eLogicalSideBEnd, eLogicalSideIEnd, eLogicalSideBStart,
-         eLogicalSideIStart},  // (horizontal-bt) (inv) rtl
-        {eLogicalSideIEnd, eLogicalSideBEnd, eLogicalSideIStart,
-         eLogicalSideBStart},  // vertical-lr   sw-left ltr
-        {eLogicalSideBStart, eLogicalSideIEnd, eLogicalSideBEnd,
-         eLogicalSideIStart},  // horizontal-tb   (inv) rtl
-        {eLogicalSideIStart, eLogicalSideBStart, eLogicalSideIEnd,
-         eLogicalSideBEnd},  // vertical-rl   sw-left rtl
-        {eLogicalSideBStart, eLogicalSideIStart, eLogicalSideBEnd,
-         eLogicalSideIEnd},  // horizontal-tb   (inv) ltr
-        {eLogicalSideIEnd, eLogicalSideBStart, eLogicalSideIStart,
-         eLogicalSideBEnd},  // vertical-rl   sw-left ltr
-        {eLogicalSideBEnd, eLogicalSideIEnd, eLogicalSideBStart,
-         eLogicalSideIStart},  // (horizontal-bt)       ltr
-        {eLogicalSideIStart, eLogicalSideBEnd, eLogicalSideIEnd,
-         eLogicalSideBStart},  // vertical-lr           ltr
-        {eLogicalSideBEnd, eLogicalSideIStart, eLogicalSideBStart,
-         eLogicalSideIEnd},  // (horizontal-bt)       rtl
-        {eLogicalSideIEnd, eLogicalSideBEnd, eLogicalSideIStart,
-         eLogicalSideBStart},  // vertical-lr           rtl
+      // top                right
+      // bottom             left
+      { eLogicalSideBStart, eLogicalSideIEnd,
+        eLogicalSideBEnd,   eLogicalSideIStart },  // horizontal-tb         ltr
+      { eLogicalSideIStart, eLogicalSideBStart,
+        eLogicalSideIEnd,   eLogicalSideBEnd   },  // vertical-rl           ltr
+      { eLogicalSideBStart, eLogicalSideIStart,
+        eLogicalSideBEnd,   eLogicalSideIEnd   },  // horizontal-tb         rtl
+      { eLogicalSideIEnd,   eLogicalSideBStart,
+        eLogicalSideIStart, eLogicalSideBEnd   },  // vertical-rl           rtl
+      { eLogicalSideBEnd,   eLogicalSideIStart,
+        eLogicalSideBStart, eLogicalSideIEnd   },  // (horizontal-bt) (inv) ltr
+      { eLogicalSideIStart, eLogicalSideBEnd,
+        eLogicalSideIEnd,   eLogicalSideBStart },  // vertical-lr   sw-left rtl
+      { eLogicalSideBEnd,   eLogicalSideIEnd,
+        eLogicalSideBStart, eLogicalSideIStart },  // (horizontal-bt) (inv) rtl
+      { eLogicalSideIEnd,   eLogicalSideBEnd,
+        eLogicalSideIStart, eLogicalSideBStart },  // vertical-lr   sw-left ltr
+      { eLogicalSideBStart, eLogicalSideIEnd,
+        eLogicalSideBEnd,   eLogicalSideIStart },  // horizontal-tb   (inv) rtl
+      { eLogicalSideIStart, eLogicalSideBStart,
+        eLogicalSideIEnd,   eLogicalSideBEnd   },  // vertical-rl   sw-left rtl
+      { eLogicalSideBStart, eLogicalSideIStart,
+        eLogicalSideBEnd,   eLogicalSideIEnd   },  // horizontal-tb   (inv) ltr
+      { eLogicalSideIEnd,   eLogicalSideBStart,
+        eLogicalSideIStart, eLogicalSideBEnd   },  // vertical-rl   sw-left ltr
+      { eLogicalSideBEnd,   eLogicalSideIEnd,
+        eLogicalSideBStart, eLogicalSideIStart },  // (horizontal-bt)       ltr
+      { eLogicalSideIStart, eLogicalSideBEnd,
+        eLogicalSideIEnd,   eLogicalSideBStart },  // vertical-lr           ltr
+      { eLogicalSideBEnd,   eLogicalSideIStart,
+        eLogicalSideBStart, eLogicalSideIEnd   },  // (horizontal-bt)       rtl
+      { eLogicalSideIEnd,   eLogicalSideBEnd,
+        eLogicalSideIStart, eLogicalSideBStart },  // vertical-lr           rtl
     };
+    // clang-format on
 
     static_assert(eOrientationMask == 0x01 && eInlineFlowMask == 0x02 &&
                       eBlockFlowMask == 0x04 && eLineOrientMask == 0x08,
                   "unexpected mask values");
     int index = mWritingMode & 0x0F;
     return kPhysicalToLogicalSides[index][aSide];
   }
 
@@ -609,22 +611,23 @@ class WritingMode {
    */
   explicit WritingMode(uint8_t aValue) : mWritingMode(aValue) {}
 
   uint8_t mWritingMode;
 
   enum Masks {
     // Masks for our bits; true chosen as opposite of commonest case
     eOrientationMask = 0x01,  // true means vertical text
-    eInlineFlowMask =
-        0x02,  // true means absolute RTL/BTT (against physical coords)
-    eBlockFlowMask =
-        0x04,  // true means vertical-LR (or horizontal-BT if added)
-    eLineOrientMask = 0x08,  // true means over != block-start
-    eBidiMask = 0x10,        // true means line-relative RTL (bidi RTL)
+    eInlineFlowMask = 0x02,   // true means absolute RTL/BTT (against physical
+                              // coords)
+    eBlockFlowMask = 0x04,    // true means vertical-LR (or horizontal-BT if
+                              // added)
+    eLineOrientMask = 0x08,   // true means over != block-start
+    eBidiMask = 0x10,         // true means line-relative RTL (bidi RTL)
+
     // Note: We have one excess bit of info; WritingMode can pack into 4 bits.
     // But since we have space, we're caching interesting things for fast
     // access.
 
     eSidewaysMask = 0x20,  // true means text is being rendered vertically
                            // using rotated glyphs (i.e. writing-mode is
                            // sideways-*, or writing-mode is vertical-* AND
                            // text-orientation is sideways),
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -678,23 +678,23 @@ void nsAbsoluteContainingBlock::ReflowAb
     margin.IStart(outerWM) = margin.IEnd(outerWM) = 0;
   }
   if (kidReflowInput.mFlags.mBOffsetsNeedCSSAlign) {
     margin.BStart(outerWM) = margin.BEnd(outerWM) = 0;
   }
 
   bool constrainBSize =
       (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE) &&
-      (aFlags & AbsPosReflowFlags::eConstrainHeight)
+      (aFlags & AbsPosReflowFlags::eConstrainHeight) &&
       // Don't split if told not to (e.g. for fixed frames)
-      && !aDelegatingFrame->IsInlineFrame()
+      !aDelegatingFrame->IsInlineFrame() &&
       // XXX we don't handle splitting frames for inline absolute containing
       // blocks yet
-      && (aKidFrame->GetLogicalRect(aContainingBlock.Size()).BStart(wm) <=
-          aReflowInput.AvailableBSize());
+      (aKidFrame->GetLogicalRect(aContainingBlock.Size()).BStart(wm) <=
+       aReflowInput.AvailableBSize());
   // Don't split things below the fold. (Ideally we shouldn't *have*
   // anything totally below the fold, but we can't position frames
   // across next-in-flow breaks yet.
   if (constrainBSize) {
     kidReflowInput.AvailableBSize() =
         aReflowInput.AvailableBSize() -
         border.ConvertTo(wm, outerWM).BStart(wm) -
         kidReflowInput.ComputedLogicalMargin().BStart(wm);
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -524,20 +524,22 @@ class nsBlockFrame : public nsContainerF
 
   void ReparentFloats(nsIFrame* aFirstFrame, nsBlockFrame* aOldParent,
                       bool aReparentSiblings, ReparentingDirection aDirection);
 
   virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
 
   virtual void UnionChildOverflow(nsOverflowAreas& aOverflowAreas) override;
 
-  /** Load all of aFrame's floats into the float manager iff aFrame is not a
-   *  block formatting context. Handles all necessary float manager
-   * translations; assumes float manager is in aFrame's parent's coord system.
-   *  Safe to call on non-blocks (does nothing).
+  /**
+   * Load all of aFrame's floats into the float manager iff aFrame is not a
+   * block formatting context. Handles all necessary float manager translations;
+   * assumes float manager is in aFrame's parent's coord system.
+   *
+   * Safe to call on non-blocks (does nothing).
    */
   static void RecoverFloatsFor(nsIFrame* aFrame, nsFloatManager& aFloatManager,
                                mozilla::WritingMode aWM,
                                const nsSize& aContainerSize);
 
   /**
    * Determine if we have any pushed floats from a previous continuation.
    *
@@ -668,21 +670,24 @@ class nsBlockFrame : public nsContainerF
 
   /** Mark a given line dirty due to reflow being interrupted on or before it */
   void MarkLineDirtyForInterrupt(nsLineBox* aLine);
 
   //----------------------------------------
   // Methods for line reflow
   /**
    * Reflow a line.
-   * @param aState           the current reflow state
-   * @param aLine            the line to reflow.  can contain a single block
-   * frame or contain 1 or more inline frames.
-   * @param aKeepReflowGoing [OUT] indicates whether the caller should continue
-   * to reflow more lines
+   *
+   * @param aState
+   *   the current reflow state
+   * @param aLine
+   *   the line to reflow.  can contain a single block frame or contain 1 or
+   *   more inline frames.
+   * @param aKeepReflowGoing [OUT]
+   *   indicates whether the caller should continue to reflow more lines
    */
   void ReflowLine(BlockReflowInput& aState, LineIterator aLine,
                   bool* aKeepReflowGoing);
 
   // Return false if it needs another reflow because of reduced space
   // between floats that are next to it (but not next to its top), and
   // return true otherwise.
   bool PlaceLine(BlockReflowInput& aState, nsLineLayout& aLineLayout,
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -1732,18 +1732,18 @@ bool nsContainerFrame::RenumberList() {
   }
 
   return fif->RenumberChildFrames(&ordinal, 0, increment, false);
 }
 
 // add in a sanity check for absurdly deep frame trees.  See bug 42138
 // can't just use IsFrameTreeTooDeep() because that method has side effects we
 // don't want
-#define MAX_DEPTH_FOR_LIST_RENUMBERING \
-  200  // 200 open displayable tags is pretty unrealistic
+// 200 open displayable tags is pretty unrealistic
+#define MAX_DEPTH_FOR_LIST_RENUMBERING 200
 
 bool nsContainerFrame::RenumberFrameAndDescendants(int32_t* aOrdinal,
                                                    int32_t aDepth,
                                                    int32_t aIncrement,
                                                    bool aForCounting) {
   MOZ_ASSERT(aOrdinal, "null params are immoral!");
 
   // add in a sanity check for absurdly deep frame trees.  See bug 42138
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1996,18 +1996,17 @@ FlexItem::FlexItem(nsIFrame* aChildFrame
       // just share container's WM for simplicity:
       mWM(aContainerWM),
       mIsFrozen(true),
       mHadMinViolation(false),
       mHadMaxViolation(false),
       mHadMeasuringReflow(false),
       mIsStretched(false),
       mIsStrut(true),  // (this is the constructor for making struts, after all)
-      mIsInlineAxisMainAxis(
-          true),  // (doesn't matter b/c we're not doing layout)
+      mIsInlineAxisMainAxis(true),  // (doesn't matter, we're not doing layout)
       mNeedsMinSizeAutoResolution(false),
       mHasAnyAutoMargin(false),
       mAlignSelf(NS_STYLE_ALIGN_FLEX_START) {
   MOZ_ASSERT(mFrame, "expecting a non-null child frame");
   MOZ_ASSERT(
       NS_STYLE_VISIBILITY_COLLAPSE == mFrame->StyleVisibility()->mVisible,
       "Should only make struts for children with 'visibility:collapse'");
   MOZ_ASSERT(!mFrame->IsPlaceholderFrame(),
@@ -2862,18 +2861,18 @@ void FlexLine::ResolveFlexibleLengths(ns
 #endif  // DEBUG
 }
 
 MainAxisPositionTracker::MainAxisPositionTracker(
     const FlexboxAxisTracker& aAxisTracker, const FlexLine* aLine,
     uint8_t aJustifyContent, nscoord aContentBoxMainSize)
     : PositionTracker(aAxisTracker.GetMainAxis(),
                       aAxisTracker.IsMainAxisReversed()),
-      mPackingSpaceRemaining(
-          aContentBoxMainSize),  // we chip away at this below
+      // we chip away at this below
+      mPackingSpaceRemaining(aContentBoxMainSize),
       mNumAutoMarginsInMainAxis(0),
       mNumPackingSpacesRemaining(0),
       mJustifyContent(aJustifyContent) {
   // Extract the flag portion of mJustifyContent and strip off the flag bits
   // NOTE: This must happen before any assignment to mJustifyContent to
   // avoid overwriting the flag bits.
   uint8_t justifyContentFlags = mJustifyContent & NS_STYLE_JUSTIFY_FLAG_BITS;
   mJustifyContent &= ~NS_STYLE_JUSTIFY_FLAG_BITS;
@@ -3844,18 +3843,18 @@ void nsFlexContainerFrame::GenerateFlexL
 
     nscoord itemInnerHypotheticalMainSize = item->GetMainSize();
     nscoord itemOuterHypotheticalMainSize =
         item->GetOuterMainSize(aAxisTracker.GetMainAxis());
 
     // Check if we need to wrap |item| to a new line
     // (i.e. check if its outer hypothetical main size pushes our line over
     // the threshold)
-    if (wrapThreshold !=
-            NS_UNCONSTRAINEDSIZE &&  // Don't wrap if unconstrained.
+    if (wrapThreshold != NS_UNCONSTRAINEDSIZE &&  // Don't wrap if
+                                                  // unconstrained.
         !curLine->IsEmpty()) {  // Don't wrap if this will be line's first item.
       // If the line will be longer than wrapThreshold after adding this item,
       // then wrap to a new line before inserting this item.
       // NOTE: We have to account for the fact that
       // itemOuterHypotheticalMainSize might be huge, if our item is (or
       // contains) a table with "table-layout:fixed". So we use AddChecked()
       // rather than (possibly-overflowing) normal addition, to be sure we don't
       // make the wrong judgement about whether the item fits on this line.
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -875,24 +875,23 @@ nsFloatManager::EllipseShapeInfo::Ellips
         //
         // X should be set to the minimum of the values of all of the numbered
         // neighbors summed with the value in that chamfer cell.
         MOZ_ASSERT(index - iSize - 2 < (iSize * bSize) &&
                        index - (iSize * 2) - 1 < (iSize * bSize),
                    "Our distance field most extreme indices should be "
                    "in-bounds.");
 
-        df[index] = std::min<dfType>(
-            df[index - 1] + 5,
-            std::min<dfType>(
-                df[index - iSize] + 5,
-                std::min<dfType>(
-                    df[index - iSize - 1] + 7,
+        // clang-format off
+        df[index] = std::min<dfType>(df[index - 1] + 5,
+                    std::min<dfType>(df[index - iSize] + 5,
+                    std::min<dfType>(df[index - iSize - 1] + 7,
                     std::min<dfType>(df[index - iSize - 2] + 11,
-                                     df[index - (iSize * 2) - 1] + 11))));
+                    df[index - (iSize * 2) - 1] + 11))));
+        // clang-format on
 
         // Check the df value and see if it's less than or equal to the
         // usedMargin5X value.
         if (df[index] <= usedMargin5X) {
           MOZ_ASSERT(iMax < (int32_t)i);
           iMax = i;
         } else {
           // Since we're computing the bottom-right quadrant, there's no way
@@ -1421,32 +1420,27 @@ nsFloatManager::PolygonShapeInfo::Polygo
         // X should be set to the minimum of MAX_MARGIN_5X and the
         // values of all of the numbered neighbors summed with the
         // value in that chamfer cell.
         MOZ_ASSERT(index - (iSize * 2) - 1 < (iSize * bSize) &&
                        index - iSize - 2 < (iSize * bSize),
                    "Our distance field most extreme indices should be "
                    "in-bounds.");
 
-        df[index] = std::min<dfType>(
-            MAX_MARGIN_5X,
-            std::min<dfType>(
-                df[index - (iSize * 2) - 1] + 11,
-                std::min<dfType>(
-                    df[index - (iSize * 2) + 1] + 11,
-                    std::min<dfType>(
-                        df[index - iSize - 2] + 11,
-                        std::min<dfType>(
-                            df[index - iSize - 1] + 7,
-                            std::min<dfType>(
-                                df[index - iSize] + 5,
-                                std::min<dfType>(
-                                    df[index - iSize + 1] + 7,
-                                    std::min<dfType>(df[index - iSize + 2] + 11,
-                                                     df[index - 1] + 5))))))));
+        // clang-format off
+        df[index] = std::min<dfType>(MAX_MARGIN_5X,
+                    std::min<dfType>(df[index - (iSize * 2) - 1] + 11,
+                    std::min<dfType>(df[index - (iSize * 2) + 1] + 11,
+                    std::min<dfType>(df[index - iSize - 2] + 11,
+                    std::min<dfType>(df[index - iSize - 1] + 7,
+                    std::min<dfType>(df[index - iSize] + 5,
+                    std::min<dfType>(df[index - iSize + 1] + 7,
+                    std::min<dfType>(df[index - iSize + 2] + 11,
+                                     df[index - 1] + 5))))))));
+        // clang-format on
       }
     }
   }
 
   // Okay, time for the second pass. This pass is in reverse order from
   // the first pass. All of our opaque pixels have been set to 0, and all
   // of our expanded region pixels have been set to MAX_MARGIN_5X. Other
   // pixels have been set to some value between those two (inclusive) but
@@ -1494,32 +1488,27 @@ nsFloatManager::PolygonShapeInfo::Polygo
         // X should be set to the minimum of its current value and
         // the values of all of the numbered neighbors summed with
         // the value in that chamfer cell.
         MOZ_ASSERT(index + (iSize * 2) + 1 < (iSize * bSize) &&
                        index + iSize + 2 < (iSize * bSize),
                    "Our distance field most extreme indices should be "
                    "in-bounds.");
 
-        df[index] = std::min<dfType>(
-            df[index],
-            std::min<dfType>(
-                df[index + (iSize * 2) + 1] + 11,
-                std::min<dfType>(
-                    df[index + (iSize * 2) - 1] + 11,
-                    std::min<dfType>(
-                        df[index + iSize + 2] + 11,
-                        std::min<dfType>(
-                            df[index + iSize + 1] + 7,
-                            std::min<dfType>(
-                                df[index + iSize] + 5,
-                                std::min<dfType>(
-                                    df[index + iSize - 1] + 7,
-                                    std::min<dfType>(df[index + iSize - 2] + 11,
-                                                     df[index + 1] + 5))))))));
+        // clang-format off
+        df[index] = std::min<dfType>(df[index],
+                    std::min<dfType>(df[index + (iSize * 2) + 1] + 11,
+                    std::min<dfType>(df[index + (iSize * 2) - 1] + 11,
+                    std::min<dfType>(df[index + iSize + 2] + 11,
+                    std::min<dfType>(df[index + iSize + 1] + 7,
+                    std::min<dfType>(df[index + iSize] + 5,
+                    std::min<dfType>(df[index + iSize - 1] + 7,
+                    std::min<dfType>(df[index + iSize - 2] + 11,
+                                     df[index + 1] + 5))))))));
+        // clang-format on
       }
 
       // Finally, we can check the df value and see if it's less than
       // or equal to the usedMargin5X value.
       if (df[index] <= usedMargin5X) {
         if (iMax == -1) {
           iMax = i;
         }
@@ -1976,33 +1965,27 @@ nsFloatManager::ImageShapeInfo::ImageSha
             // values of all of the numbered neighbors summed with the
             // value in that chamfer cell.
             MOZ_ASSERT(index - wEx - 2 < (iSize * bSize) &&
                            index + wEx - 2 < (iSize * bSize) &&
                            index - (wEx * 2) - 1 < (iSize * bSize),
                        "Our distance field most extreme indices should be "
                        "in-bounds.");
 
-            df[index] = std::min<dfType>(
-                MAX_MARGIN_5X,
-                std::min<dfType>(
-                    df[index - wEx - 2] + 11,
-                    std::min<dfType>(
-                        df[index + wEx - 2] + 11,
-                        std::min<dfType>(
-                            df[index - (wEx * 2) - 1] + 11,
-                            std::min<dfType>(
-                                df[index - wEx - 1] + 7,
-                                std::min<dfType>(
-                                    df[index - 1] + 5,
-                                    std::min<dfType>(
-                                        df[index + wEx - 1] + 7,
-                                        std::min<dfType>(
-                                            df[index + (wEx * 2) - 1] + 11,
-                                            df[index - wEx] + 5))))))));
+            // clang-format off
+            df[index] = std::min<dfType>(MAX_MARGIN_5X,
+                        std::min<dfType>(df[index - wEx - 2] + 11,
+                        std::min<dfType>(df[index + wEx - 2] + 11,
+                        std::min<dfType>(df[index - (wEx * 2) - 1] + 11,
+                        std::min<dfType>(df[index - wEx - 1] + 7,
+                        std::min<dfType>(df[index - 1] + 5,
+                        std::min<dfType>(df[index + wEx - 1] + 7,
+                        std::min<dfType>(df[index + (wEx * 2) - 1] + 11,
+                                         df[index - wEx] + 5))))))));
+            // clang-format on
           } else {
             // Row-by-row, starting at the top, each row left-to-right.
             // Backward-looking neighborhood distance from target pixel X
             // with chamfer 5-7-11 looks like:
             //
             // +--+--+--+--+--+
             // |  |11|  |11|  |   ----+
             // +--+--+--+--+--+      /
@@ -2014,33 +1997,27 @@ nsFloatManager::ImageShapeInfo::ImageSha
             // X should be set to the minimum of MAX_MARGIN_5X and the
             // values of all of the numbered neighbors summed with the
             // value in that chamfer cell.
             MOZ_ASSERT(index - (wEx * 2) - 1 < (iSize * bSize) &&
                            index - wEx - 2 < (iSize * bSize),
                        "Our distance field most extreme indices should be "
                        "in-bounds.");
 
-            df[index] = std::min<dfType>(
-                MAX_MARGIN_5X,
-                std::min<dfType>(
-                    df[index - (wEx * 2) - 1] + 11,
-                    std::min<dfType>(
-                        df[index - (wEx * 2) + 1] + 11,
-                        std::min<dfType>(
-                            df[index - wEx - 2] + 11,
-                            std::min<dfType>(
-                                df[index - wEx - 1] + 7,
-                                std::min<dfType>(
-                                    df[index - wEx] + 5,
-                                    std::min<dfType>(
-                                        df[index - wEx + 1] + 7,
-                                        std::min<dfType>(
-                                            df[index - wEx + 2] + 11,
-                                            df[index - 1] + 5))))))));
+            // clang-format off
+            df[index] = std::min<dfType>(MAX_MARGIN_5X,
+                        std::min<dfType>(df[index - (wEx * 2) - 1] + 11,
+                        std::min<dfType>(df[index - (wEx * 2) + 1] + 11,
+                        std::min<dfType>(df[index - wEx - 2] + 11,
+                        std::min<dfType>(df[index - wEx - 1] + 7,
+                        std::min<dfType>(df[index - wEx] + 5,
+                        std::min<dfType>(df[index - wEx + 1] + 7,
+                        std::min<dfType>(df[index - wEx + 2] + 11,
+                                         df[index - 1] + 5))))))));
+            // clang-format on
           }
         }
       }
     }
 
     // Okay, time for the second pass. This pass is in reverse order from
     // the first pass. All of our opaque pixels have been set to 0, and all
     // of our expanded region pixels have been set to MAX_MARGIN_5X. Other
@@ -2103,33 +2080,27 @@ nsFloatManager::ImageShapeInfo::ImageSha
             // the values of all of the numbered neighbors summed with
             // the value in that chamfer cell.
             MOZ_ASSERT(index + wEx + 2 < (wEx * hEx) &&
                            index + (wEx * 2) + 1 < (wEx * hEx) &&
                            index - (wEx * 2) + 1 < (wEx * hEx),
                        "Our distance field most extreme indices should be "
                        "in-bounds.");
 
-            df[index] = std::min<dfType>(
-                df[index],
-                std::min<dfType>(
-                    df[index + wEx + 2] + 11,
-                    std::min<dfType>(
-                        df[index - wEx + 2] + 11,
-                        std::min<dfType>(
-                            df[index + (wEx * 2) + 1] + 11,
-                            std::min<dfType>(
-                                df[index + wEx + 1] + 7,
-                                std::min<dfType>(
-                                    df[index + 1] + 5,
-                                    std::min<dfType>(
-                                        df[index - wEx + 1] + 7,
-                                        std::min<dfType>(
-                                            df[index - (wEx * 2) + 1] + 11,
-                                            df[index + wEx] + 5))))))));
+            // clang-format off
+            df[index] = std::min<dfType>(df[index],
+                        std::min<dfType>(df[index + wEx + 2] + 11,
+                        std::min<dfType>(df[index - wEx + 2] + 11,
+                        std::min<dfType>(df[index + (wEx * 2) + 1] + 11,
+                        std::min<dfType>(df[index + wEx + 1] + 7,
+                        std::min<dfType>(df[index + 1] + 5,
+                        std::min<dfType>(df[index - wEx + 1] + 7,
+                        std::min<dfType>(df[index - (wEx * 2) + 1] + 11,
+                                         df[index + wEx] + 5))))))));
+            // clang-format on
           } else {
             // Row-by-row, starting at the bottom, each row right-to-left.
             // Forward-looking neighborhood distance from target pixel X
             // with chamfer 5-7-11 looks like:
             //
             // +--+--+--+--+--+
             // |  |  | X| 5|  |    <--+
             // +--+--+--+--+--+      /
@@ -2141,33 +2112,27 @@ nsFloatManager::ImageShapeInfo::ImageSha
             // X should be set to the minimum of its current value and
             // the values of all of the numbered neighbors summed with
             // the value in that chamfer cell.
             MOZ_ASSERT(index + (wEx * 2) + 1 < (wEx * hEx) &&
                            index + wEx + 2 < (wEx * hEx),
                        "Our distance field most extreme indices should be "
                        "in-bounds.");
 
-            df[index] = std::min<dfType>(
-                df[index],
-                std::min<dfType>(
-                    df[index + (wEx * 2) + 1] + 11,
-                    std::min<dfType>(
-                        df[index + (wEx * 2) - 1] + 11,
-                        std::min<dfType>(
-                            df[index + wEx + 2] + 11,
-                            std::min<dfType>(
-                                df[index + wEx + 1] + 7,
-                                std::min<dfType>(
-                                    df[index + wEx] + 5,
-                                    std::min<dfType>(
-                                        df[index + wEx - 1] + 7,
-                                        std::min<dfType>(
-                                            df[index + wEx - 2] + 11,
-                                            df[index + 1] + 5))))))));
+            // clang-format off
+            df[index] = std::min<dfType>(df[index],
+                        std::min<dfType>(df[index + (wEx * 2) + 1] + 11,
+                        std::min<dfType>(df[index + (wEx * 2) - 1] + 11,
+                        std::min<dfType>(df[index + wEx + 2] + 11,
+                        std::min<dfType>(df[index + wEx + 1] + 7,
+                        std::min<dfType>(df[index + wEx] + 5,
+                        std::min<dfType>(df[index + wEx - 1] + 7,
+                        std::min<dfType>(df[index + wEx - 2] + 11,
+                                         df[index + 1] + 5))))))));
+            // clang-format on
           }
         }
 
         // Finally, we can check the df value and see if it's less than
         // or equal to the usedMargin5X value.
         if (df[index] <= usedMargin5X) {
           if (iMax == -1) {
             iMax = i;
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -7534,18 +7534,18 @@ nsresult nsFrame::GetNextPrevLineFromeBl
             searchingLine >= (countLines - 1))) {
     // we need to jump to new block frame.
     return NS_ERROR_FAILURE;
   }
   int32_t lineFrameCount;
   nsIFrame* resultFrame = nullptr;
   nsIFrame* farStoppingFrame = nullptr;  // we keep searching until we find a
                                          // "this" frame then we go to next line
-  nsIFrame* nearStoppingFrame =
-      nullptr;  // if we are backing up from edge, stop here
+  nsIFrame* nearStoppingFrame = nullptr;  // if we are backing up from edge,
+                                          // stop here
   nsIFrame* firstFrame;
   nsIFrame* lastFrame;
   nsRect rect;
   bool isBeforeFirstFrame, isAfterLastFrame;
   bool found = false;
 
   nsresult result = NS_OK;
   while (!found) {
@@ -9538,31 +9538,28 @@ void nsFrame::FillCursorInformationFromS
 
 NS_IMETHODIMP
 nsFrame::RefreshSizeCache(nsBoxLayoutState& aState) {
   // XXXbz this comment needs some rewriting to make sense in the
   // post-reflow-branch world.
 
   // Ok we need to compute our minimum, preferred, and maximum sizes.
   // 1) Maximum size. This is easy. Its infinite unless it is overloaded by CSS.
-  // 2) Preferred size. This is a little harder. This is the size the block
-  // would be
-  //      if it were laid out on an infinite canvas. So we can get this by
-  //      reflowing the block with and INTRINSIC width and height. We can also
-  //      do a nice optimization for incremental reflow. If the reflow is
-  //      incremental then we can pass a flag to have the block compute the
-  //      preferred width for us! Preferred height can just be the minimum
-  //      height;
+  // 2) Preferred size. This is a little harder. This is the size the
+  //    block would be if it were laid out on an infinite canvas. So we can
+  //    get this by reflowing the block with and INTRINSIC width and height. We
+  //    can also do a nice optimization for incremental reflow. If the reflow is
+  //    incremental then we can pass a flag to have the block compute the
+  //    preferred width for us! Preferred height can just be the minimum height;
   // 3) Minimum size. This is a toughy. We can pass the block a flag asking for
-  // the max element
-  //    size. That would give us the width. Unfortunately you can only ask for a
-  //    maxElementSize during an incremental reflow. So on other reflows we will
-  //    just have to use 0. The min height on the other hand is fairly easy we
-  //    need to get the largest line height. This can be done with the line
-  //    iterator.
+  //    the max element size. That would give us the width. Unfortunately you
+  //    can only ask for a maxElementSize during an incremental reflow. So on
+  //    other reflows we will just have to use 0. The min height on the other
+  //    hand is fairly easy we need to get the largest line height. This can be
+  //    done with the line iterator.
 
   // if we do have a rendering context
   gfxContext* rendContext = aState.GetRenderingContext();
   if (rendContext) {
     nsPresContext* presContext = aState.PresContext();
 
     // If we don't have any HTML constraints and it's a resize, then nothing in
     // the block could have changed, so no refresh is necessary.
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -632,19 +632,18 @@ nsresult nsFrameSelection::MoveCaret(nsD
 
   if (!mShell) {
     return NS_OK;
   }
 
   nsPresContext* context = mShell->GetPresContext();
   if (!context) return NS_ERROR_FAILURE;
 
-  nsPoint desiredPos(
-      0,
-      0);  // we must keep this around and revalidate it when its just UP/DOWN
+  // we must keep this around and revalidate it when its just UP/DOWN
+  nsPoint desiredPos(0, 0);
 
   int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   RefPtr<Selection> sel = mDomSelections[index];
   if (!sel) return NS_ERROR_NULL_POINTER;
 
   int32_t scrollFlags = Selection::SCROLL_FOR_CARET_MOVE;
   const bool isEditorSelection = sel->IsEditorSelection();
   if (isEditorSelection) {
@@ -960,26 +959,27 @@ nsresult nsFrameSelection::MaintainSelec
     mMaintainRange = anchorFocusRange->CloneRange();
     return NS_OK;
   }
 
   mMaintainRange = nullptr;
   return NS_OK;
 }
 
-/** After moving the caret, its Bidi level is set according to the following
+/**
+ * After moving the caret, its Bidi level is set according to the following
  * rules:
  *
- *  After moving over a character with left/right arrow, set to the Bidi level
+ * After moving over a character with left/right arrow, set to the Bidi level
  * of the last moved over character. After Home and End, set to the paragraph
  * embedding level. After up/down arrow, PageUp/Down, set to the lower level of
  * the 2 surrounding characters. After mouse click, set to the level of the
  * current frame.
  *
- *  The following two methods use GetPrevNextBidiLevels to determine the new
+ * The following two methods use GetPrevNextBidiLevels to determine the new
  * Bidi level. BidiLevelFromMove is called when the caret is moved in response
  * to a keyboard event
  *
  * @param aPresShell is the presentation shell
  * @param aNode is the content node
  * @param aContentOffset is the new caret position, as an offset into aNode
  * @param aAmount is the amount of the move that gave the caret its new position
  * @param aHint is the hint indicating in what logical direction the caret moved
@@ -1240,18 +1240,18 @@ nsresult nsFrameSelection::TakeFocus(nsI
 
       RefPtr<nsRange> newRange = new nsRange(aNewFocus);
 
       newRange->CollapseTo(aNewFocus, aContentOffset);
       mDomSelections[index]->AddRange(*newRange, IgnoreErrors());
       mBatching = batching;
       mChangesDuringBatching = changes;
     } else {
-      bool oldDesiredPosSet =
-          mDesiredPosSet;  // need to keep old desired position if it was set.
+      bool oldDesiredPosSet = mDesiredPosSet;  // need to keep old desired
+                                               // position if it was set.
       mDomSelections[index]->Collapse(aNewFocus, aContentOffset);
       mDesiredPosSet = oldDesiredPosSet;  // now reset desired pos back.
       mBatching = batching;
       mChangesDuringBatching = changes;
     }
     if (aContentEndOffset != aContentOffset) {
       mDomSelections[index]->Extend(aNewFocus, aContentEndOffset);
     }
--- a/layout/generic/nsFrameSelection.h
+++ b/layout/generic/nsFrameSelection.h
@@ -76,91 +76,95 @@ struct MOZ_STACK_CLASS nsPeekOffsetStruc
 
   // Note: Most arguments (input and output) are only used with certain values
   // of mAmount. These values are indicated for each argument below.
   // Arguments with no such indication are used with all values of mAmount.
 
   /*** Input arguments ***/
   // Note: The value of some of the input arguments may be changed upon exit.
 
-  // mAmount: The type of movement requested (by character, word, line, etc.)
+  // The type of movement requested (by character, word, line, etc.)
   nsSelectionAmount mAmount;
 
-  // mDirection: eDirPrevious or eDirNext.
-  //             * Note for visual bidi movement:
-  //             eDirPrevious means 'left-then-up' if the containing block is
-  //             LTR, 'right-then-up' if it is RTL. eDirNext means
-  //             'right-then-down' if the containing block is LTR,
-  //             'left-then-down' if it is RTL.
-  //             Between paragraphs, eDirPrevious means "go to the visual end of
-  //             the previous paragraph", and eDirNext means "go to the visual
-  //             beginning of the next paragraph". Used with: eSelectCharacter,
-  //             eSelectWord, eSelectLine, eSelectParagraph.
+  // eDirPrevious or eDirNext.
+  //
+  // Note for visual bidi movement:
+  //   * eDirPrevious means 'left-then-up' if the containing block is LTR,
+  //     'right-then-up' if it is RTL.
+  //   * eDirNext means 'right-then-down' if the containing block is LTR,
+  //     'left-then-down' if it is RTL.
+  //   * Between paragraphs, eDirPrevious means "go to the visual end of
+  //     the previous paragraph", and eDirNext means "go to the visual
+  //     beginning of the next paragraph".
+  //
+  // Used with: eSelectCharacter, eSelectWord, eSelectLine, eSelectParagraph.
   nsDirection mDirection;
 
-  // mStartOffset: Offset into the content of the current frame where the peek
-  // starts.
-  //               Used with: eSelectCharacter, eSelectWord
+  // Offset into the content of the current frame where the peek starts.
+  //
+  // Used with: eSelectCharacter, eSelectWord
   int32_t mStartOffset;
 
-  // mDesiredPos: The desired inline coordinate for the caret
-  //              (one of .x or .y will be used, depending on line's writing
-  //              mode) Used with: eSelectLine.
+  // The desired inline coordinate for the caret (one of .x or .y will be used,
+  // depending on line's writing mode)
+  //
+  // Used with: eSelectLine.
   nsPoint mDesiredPos;
 
-  // mWordMovementType: An enum that determines whether to prefer the start or
-  // end of a word
-  //                    or to use the default beahvior, which is a combination
-  //                    of direction and the platform-based pref
-  //                    "layout.word_select.eat_space_to_next_word"
+  // An enum that determines whether to prefer the start or end of a word or to
+  // use the default beahvior, which is a combination of direction and the
+  // platform-based pref "layout.word_select.eat_space_to_next_word"
   mozilla::EWordMovementType mWordMovementType;
 
-  // mJumpLines: Whether to allow jumping across line boundaries.
-  //             Used with: eSelectCharacter, eSelectWord.
+  // Whether to allow jumping across line boundaries.
+  //
+  // Used with: eSelectCharacter, eSelectWord.
   bool mJumpLines;
 
-  // mScrollViewStop: Whether to stop when reaching a scroll view boundary.
-  //                  Used with: eSelectCharacter, eSelectWord, eSelectLine.
+  // Whether to stop when reaching a scroll view boundary.
+  //
+  // Used with: eSelectCharacter, eSelectWord, eSelectLine.
   bool mScrollViewStop;
 
-  // mIsKeyboardSelect: Whether the peeking is done in response to a keyboard
-  // action.
-  //                    Used with: eSelectWord.
+  // Whether the peeking is done in response to a keyboard action.
+  //
+  // Used with: eSelectWord.
   bool mIsKeyboardSelect;
 
-  // mVisual: Whether bidi caret behavior is visual (true) or logical (false).
-  //          Used with: eSelectCharacter, eSelectWord, eSelectBeginLine,
-  //          eSelectEndLine.
+  // Whether bidi caret behavior is visual (true) or logical (false).
+  //
+  // Used with: eSelectCharacter, eSelectWord, eSelectBeginLine, eSelectEndLine.
   bool mVisual;
 
-  // mExtend: Whether the selection is being extended or moved.
+  // Whether the selection is being extended or moved.
   bool mExtend;
 
-  // mForceEditableRegion: If true, the offset has to end up in an editable
-  // node, otherwise we'll keep searching.
+  // If true, the offset has to end up in an editable node, otherwise we'll keep
+  // searching.
   const bool mForceEditableRegion;
 
   /*** Output arguments ***/
 
-  // mResultContent: Content reached as a result of the peek.
+  // Content reached as a result of the peek.
   nsCOMPtr<nsIContent> mResultContent;
 
-  // mResultFrame: Frame reached as a result of the peek.
-  //               Used with: eSelectCharacter, eSelectWord.
+  // Frame reached as a result of the peek.
+  //
+  // Used with: eSelectCharacter, eSelectWord.
   nsIFrame* mResultFrame;
 
-  // mContentOffset: Offset into content reached as a result of the peek.
+  // Offset into content reached as a result of the peek.
   int32_t mContentOffset;
 
-  // mAttachForward: When the result position is between two frames,
-  //                 indicates which of the two frames the caret should be
-  //                 painted in. false means "the end of the frame logically
-  //                 before the caret", true means "the beginning of the frame
-  //                 logically after the caret". Used with: eSelectLine,
-  //                 eSelectBeginLine, eSelectEndLine.
+  // When the result position is between two frames, indicates which of the two
+  // frames the caret should be painted in. false means "the end of the frame
+  // logically before the caret", true means "the beginning of the frame
+  // logically after the caret".
+  //
+  // Used with: eSelectLine, eSelectBeginLine, eSelectEndLine.
   mozilla::CaretAssociationHint mAttach;
 };
 
 struct nsPrevNextBidiLevels {
   void SetData(nsIFrame* aFrameBefore, nsIFrame* aFrameAfter,
                nsBidiLevel aLevelBefore, nsBidiLevel aLevelAfter) {
     mFrameBefore = aFrameBefore;
     mFrameAfter = aFrameAfter;
@@ -204,71 +208,95 @@ class nsFrameSelection final {
  public:
   typedef mozilla::CaretAssociationHint CaretAssociateHint;
 
   /*interfaces for addref and release and queryinterface*/
 
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsFrameSelection)
   NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsFrameSelection)
 
-  /** Init will initialize the frame selector with the necessary pres shell to
-   *  be used by most of the methods
-   *  @param aShell is the parameter to be used for most of the other calls for
+  /**
+   * Init will initialize the frame selector with the necessary pres shell to
+   * be used by most of the methods
+   *
+   * @param aShell is the parameter to be used for most of the other calls for
    * callbacks etc
-   *  @param aLimiter limits the selection to nodes with aLimiter parents
-   *  @param aAccessibleCaretEnabled true if we should enable the accessible
+   *
+   * @param aLimiter limits the selection to nodes with aLimiter parents
+   *
+   * @param aAccessibleCaretEnabled true if we should enable the accessible
    * caret.
    */
   void Init(nsIPresShell* aShell, nsIContent* aLimiter,
             bool aAccessibleCaretEnabled);
 
-  /** HandleClick will take the focus to the new frame at the new offset and
-   *  will either extend the selection from the old anchor, or replace the old
+  /**
+   * HandleClick will take the focus to the new frame at the new offset and
+   * will either extend the selection from the old anchor, or replace the old
    * anchor. the old anchor and focus position may also be used to deselect
    * things
-   *  @param aNewfocus is the content that wants the focus
-   *  @param aContentOffset is the content offset of the parent aNewFocus
-   *  @param aContentOffsetEnd is the content offset of the parent aNewFocus and
+   *
+   * @param aNewfocus is the content that wants the focus
+   *
+   * @param aContentOffset is the content offset of the parent aNewFocus
+   *
+   * @param aContentOffsetEnd is the content offset of the parent aNewFocus and
    * is specified different when you need to select to and include both start
    * and end points
-   *  @param aContinueSelection is the flag that tells the selection to keep the
+   *
+   * @param aContinueSelection is the flag that tells the selection to keep the
    * old anchor point or not.
-   *  @param aMultipleSelection will tell the frame selector to replace /or not
+   *
+   * @param aMultipleSelection will tell the frame selector to replace /or not
    * the old selection. cannot coexist with aContinueSelection
-   *  @param aHint will tell the selection which direction geometrically to
+   *
+   * @param aHint will tell the selection which direction geometrically to
    * actually show the caret on. 1 = end of this line 0 = beginning of this line
    */
   MOZ_CAN_RUN_SCRIPT_BOUNDARY
   nsresult HandleClick(nsIContent* aNewFocus, uint32_t aContentOffset,
                        uint32_t aContentEndOffset, bool aContinueSelection,
                        bool aMultipleSelection, CaretAssociateHint aHint);
 
-  /** HandleDrag extends the selection to contain the frame closest to aPoint.
-   *  @param aPresContext is the context to use when figuring out what frame
+  /**
+   * HandleDrag extends the selection to contain the frame closest to aPoint.
+   *
+   * @param aPresContext is the context to use when figuring out what frame
    * contains the point.
-   *  @param aFrame is the parent of all frames to use when searching for the
+   *
+   * @param aFrame is the parent of all frames to use when searching for the
    * closest frame to the point.
-   *  @param aPoint is relative to aFrame
+   *
+   * @param aPoint is relative to aFrame
    */
   /*unsafe*/
   void HandleDrag(nsIFrame* aFrame, const nsPoint& aPoint);
 
-  /** HandleTableSelection will set selection to a table, cell, etc
-   *   depending on information contained in aFlags
-   *  @param aParentContent is the paretent of either a table or cell that user
+  /**
+   * HandleTableSelection will set selection to a table, cell, etc
+   * depending on information contained in aFlags
+   *
+   * @param aParentContent is the paretent of either a table or cell that user
    * clicked or dragged the mouse in
-   *  @param aContentOffset is the offset of the table or cell
-   *  @param aTarget indicates what to select
-   *    TableSelection::Cell     We should select a cell (content points to the
-   * cell) TableSelection::Row      We should select a row (content points to
-   * any cell in row) TableSelection::Column   We should select a row (content
-   * points to any cell in column) TableSelection::Table    We should select a
-   * table (content points to the table) TableSelection::AllCells We should
-   * select all cells (content points to any cell in table)
-   *  @param aMouseEvent         passed in so we can get where event occurred
+   *
+   * @param aContentOffset is the offset of the table or cell
+   *
+   * @param aTarget indicates what to select
+   *   * TableSelection::Cell
+   *       We should select a cell (content points to the cell)
+   *   * TableSelection::Row
+   *       We should select a row (content points to any cell in row)
+   *   * TableSelection::Column
+   *       We should select a row (content points to any cell in column)
+   *   * TableSelection::Table
+   *       We should select a table (content points to the table)
+   *   * TableSelection::AllCells
+   *       We should select all cells (content points to any cell in table)
+   *
+   * @param aMouseEvent passed in so we can get where event occurred
    * and what keys are pressed
    */
   /*unsafe*/
   nsresult HandleTableSelection(nsINode* aParentContent, int32_t aContentOffset,
                                 mozilla::TableSelection aTarget,
                                 mozilla::WidgetMouseEvent* aMouseEvent);
 
   /**
@@ -314,104 +342,118 @@ class nsFrameSelection final {
    * @param  aEndRowIndex       [in] row index where the cells range ends
    * @param  aEndColumnIndex    [in] column index where the cells range ends
    */
   nsresult RestrictCellsToSelection(nsIContent* aTable, int32_t aStartRowIndex,
                                     int32_t aStartColumnIndex,
                                     int32_t aEndRowIndex,
                                     int32_t aEndColumnIndex);
 
-  /** StartAutoScrollTimer is responsible for scrolling frames so that
-   *  aPoint is always visible, and for selecting any frame that contains
-   *  aPoint. The timer will also reset itself to fire again if we have
-   *  not scrolled to the end of the document.
-   *  @param aFrame is the outermost frame to use when searching for
-   *  the closest frame for the point, i.e. the frame that is capturing
-   *  the mouse
-   *  @param aPoint is relative to aFrame.
-   *  @param aDelay is the timer's interval.
+  /**
+   * StartAutoScrollTimer is responsible for scrolling frames so that
+   * aPoint is always visible, and for selecting any frame that contains
+   * aPoint. The timer will also reset itself to fire again if we have
+   * not scrolled to the end of the document.
+   *
+   * @param aFrame is the outermost frame to use when searching for
+   * the closest frame for the point, i.e. the frame that is capturing
+   * the mouse
+   *
+   * @param aPoint is relative to aFrame.
+   *
+   * @param aDelay is the timer's interval.
    */
   /*unsafe*/
   nsresult StartAutoScrollTimer(nsIFrame* aFrame, const nsPoint& aPoint,
                                 uint32_t aDelay);
 
-  /** StopAutoScrollTimer stops any active auto scroll timer.
+  /**
+   * Stops any active auto scroll timer.
    */
   void StopAutoScrollTimer();
 
-  /** Lookup Selection
-   *  returns in frame coordinates the selection beginning and ending with the
+  /**
+   * Returns in frame coordinates the selection beginning and ending with the
    * type of selection given
+   *
    * @param aContent is the content asking
    * @param aContentOffset is the starting content boundary
    * @param aContentLength is the length of the content piece asking
    * @param aSlowCheck will check using slow method with no shortcuts
    */
   mozilla::UniquePtr<SelectionDetails> LookUpSelection(nsIContent* aContent,
                                                        int32_t aContentOffset,
                                                        int32_t aContentLength,
                                                        bool aSlowCheck) const;
 
-  /** SetDragState(bool);
-   *  sets the drag state to aState for resons of drag state.
+  /**
+   * Sets the drag state to aState for resons of drag state.
+   *
    * @param aState is the new state of drag
    */
   MOZ_CAN_RUN_SCRIPT_BOUNDARY
   void SetDragState(bool aState);
 
-  /** GetDragState(bool *);
-   *  gets the drag state to aState for resons of drag state.
+  /**
+   * Gets the drag state to aState for resons of drag state.
+   *
    * @param aState will hold the state of drag
    */
   bool GetDragState() const { return mDragState; }
 
   /**
-    if we are in table cell selection mode. aka ctrl click in table cell
+   * If we are in table cell selection mode. aka ctrl click in table cell
    */
   bool GetTableCellSelection() const {
     return mSelectingTableCellMode != mozilla::TableSelection::None;
   }
   void ClearTableCellSelection() {
     mSelectingTableCellMode = mozilla::TableSelection::None;
   }
 
-  /** GetSelection
-   * no query interface for selection. must use this method now.
+  /**
+   * No query interface for selection. must use this method now.
+   *
    * @param aSelectionType The selection type what you want.
    */
   mozilla::dom::Selection* GetSelection(
       mozilla::SelectionType aSelectionType) const;
 
   /**
    * ScrollSelectionIntoView scrolls a region of the selection,
    * so that it is visible in the scrolled view.
    *
    * @param aSelectionType the selection to scroll into view.
+   *
    * @param aRegion the region inside the selection to scroll into view.
+   *
    * @param aFlags the scroll flags.  Valid bits include:
-   * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view
-   * before returning. If not set, posts a request which is processed
-   * at some point after the method returns.
-   * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be
-   * scrolled into view.
-   *
+   *   * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view
+   *     before returning. If not set, posts a request which is processed
+   *     at some point after the method returns.
+   *   * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be
+   *     scrolled into view.
    */
   /*unsafe*/
   nsresult ScrollSelectionIntoView(mozilla::SelectionType aSelectionType,
                                    SelectionRegion aRegion,
                                    int16_t aFlags) const;
 
-  /** RepaintSelection repaints the selected frames that are inside the
+  /**
+   * RepaintSelection repaints the selected frames that are inside the
    * selection specified by aSelectionType.
+   *
    * @param aSelectionType The selection type what you want to repaint.
    */
   nsresult RepaintSelection(mozilla::SelectionType aSelectionType);
 
-  /** GetFrameForNodeOffset given a node and its child offset, return the
-   * nsIFrame and the offset into that frame.
+  /**
+   * Given a node and its child offset, return the nsIFrame and the offset into
+   * that frame.
+   *
    * @param aNode input parameter for the node to look at
    * @param aOffset offset into above node.
    * @param aReturnOffset will contain offset into frame.
    */
   nsIFrame* GetFrameForNodeOffset(nsIContent* aNode, int32_t aOffset,
                                   CaretAssociateHint aHint,
                                   int32_t* aReturnOffset) const;
 
@@ -454,182 +496,204 @@ class nsFrameSelection final {
    */
   nsBidiLevel GetCaretBidiLevel() const;
 
   /**
    * UndefineCaretBidiLevel sets the caret bidi level to "undefined".
    */
   void UndefineCaretBidiLevel();
 
-  /** PhysicalMove will generally be called from the nsiselectioncontroller
+  /**
+   * PhysicalMove will generally be called from the nsiselectioncontroller
    * implementations. the effect being the selection will move one unit
    * 'aAmount' in the given aDirection.
    * @param aDirection  the direction to move the selection
    * @param aAmount     amount of movement (char/line; word/page; eol/doc)
    * @param aExtend     continue selection
    */
   /*unsafe*/
   nsresult PhysicalMove(int16_t aDirection, int16_t aAmount, bool aExtend);
 
-  /** CharacterMove will generally be called from the nsiselectioncontroller
+  /**
+   * CharacterMove will generally be called from the nsiselectioncontroller
    * implementations. the effect being the selection will move one character
    * left or right.
    * @param aForward move forward in document.
    * @param aExtend continue selection
    */
   /*unsafe*/
   nsresult CharacterMove(bool aForward, bool aExtend);
 
-  /** CharacterExtendForDelete extends the selection forward (logically) to
+  /**
+   * CharacterExtendForDelete extends the selection forward (logically) to
    * the next character cell, so that the selected cell can be deleted.
    */
   /*unsafe*/
   nsresult CharacterExtendForDelete();
 
-  /** CharacterExtendForBackspace extends the selection backward (logically) to
+  /**
+   * CharacterExtendForBackspace extends the selection backward (logically) to
    * the previous character cell, so that the selected cell can be deleted.
    */
   /*unsafe*/
   nsresult CharacterExtendForBackspace();
 
-  /** WordMove will generally be called from the nsiselectioncontroller
+  /**
+   * WordMove will generally be called from the nsiselectioncontroller
    * implementations. the effect being the selection will move one word left or
    * right.
    * @param aForward move forward in document.
    * @param aExtend continue selection
    */
   /*unsafe*/
   nsresult WordMove(bool aForward, bool aExtend);
 
-  /** WordExtendForDelete extends the selection backward or forward (logically)
+  /**
+   * WordExtendForDelete extends the selection backward or forward (logically)
    * to the next word boundary, so that the selected word can be deleted.
    * @param aForward select forward in document.
    */
   /*unsafe*/
   nsresult WordExtendForDelete(bool aForward);
 
-  /** LineMove will generally be called from the nsiselectioncontroller
+  /**
+   * LineMove will generally be called from the nsiselectioncontroller
    * implementations. the effect being the selection will move one line up or
    * down.
    * @param aForward move forward in document.
    * @param aExtend continue selection
    */
   /*unsafe*/
   nsresult LineMove(bool aForward, bool aExtend);
 
-  /** IntraLineMove will generally be called from the nsiselectioncontroller
+  /**
+   * IntraLineMove will generally be called from the nsiselectioncontroller
    * implementations. the effect being the selection will move to beginning or
    * end of line
    * @param aForward move forward in document.
    * @param aExtend continue selection
    */
   /*unsafe*/
   nsresult IntraLineMove(bool aForward, bool aExtend);
 
-  /** Select All will generally be called from the nsiselectioncontroller
+  /**
+   * Select All will generally be called from the nsiselectioncontroller
    * implementations. it will select the whole doc
    */
   MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult SelectAll();
 
   /** Sets/Gets The display selection enum.
    */
   void SetDisplaySelection(int16_t aState) { mDisplaySelection = aState; }
   int16_t GetDisplaySelection() const { return mDisplaySelection; }
 
-  /** This method can be used to store the data received during a MouseDown
-   *  event so that we can place the caret during the MouseUp event.
-   * @aMouseEvent the event received by the selection MouseDown
-   *  handling method. A nullptr value can be use to tell this method
-   *  that any data is storing is no longer valid.
+  /**
+   * This method can be used to store the data received during a MouseDown
+   * event so that we can place the caret during the MouseUp event.
+   *
+   * @param aMouseEvent the event received by the selection MouseDown
+   * handling method. A nullptr value can be use to tell this method
+   * that any data is storing is no longer valid.
    */
   void SetDelayedCaretData(mozilla::WidgetMouseEvent* aMouseEvent);
 
-  /** Get the delayed MouseDown event data necessary to place the
-   *  caret during MouseUp processing.
+  /**
+   * Get the delayed MouseDown event data necessary to place the
+   * caret during MouseUp processing.
+   *
    * @return a pointer to the event received
-   *  by the selection during MouseDown processing. It can be nullptr
-   *  if the data is no longer valid.
+   * by the selection during MouseDown processing. It can be nullptr
+   * if the data is no longer valid.
    */
   bool HasDelayedCaretData() { return mDelayedMouseEventValid; }
   bool IsShiftDownInDelayedCaretData() {
     NS_ASSERTION(mDelayedMouseEventValid, "No valid delayed caret data");
     return mDelayedMouseEventIsShift;
   }
   uint32_t GetClickCountInDelayedCaretData() {
     NS_ASSERTION(mDelayedMouseEventValid, "No valid delayed caret data");
     return mDelayedMouseEventClickCount;
   }
 
   bool MouseDownRecorded() {
     return !GetDragState() && HasDelayedCaretData() &&
            GetClickCountInDelayedCaretData() < 2;
   }
 
-  /** Get the content node that limits the selection
-   *  When searching up a nodes for parents, as in a text edit field
-   *    in an browser page, we must stop at this node else we reach into the
-   *    parent page, which is very bad!
+  /**
+   * Get the content node that limits the selection
+   *
+   * When searching up a nodes for parents, as in a text edit field
+   * in an browser page, we must stop at this node else we reach into the
+   * parent page, which is very bad!
    */
   nsIContent* GetLimiter() const { return mLimiter; }
 
   nsIContent* GetAncestorLimiter() const { return mAncestorLimiter; }
   MOZ_CAN_RUN_SCRIPT_BOUNDARY void SetAncestorLimiter(nsIContent* aLimiter);
 
-  /** This will tell the frame selection that a double click has been pressed
-   *  so it can track abort future drags if inside the same selection
-   *  @aDoubleDown has the double click down happened
+  /**
+   * This will tell the frame selection that a double click has been pressed
+   * so it can track abort future drags if inside the same selection
+   * @param aDoubleDown has the double click down happened
    */
   void SetMouseDoubleDown(bool aDoubleDown) {
     mMouseDoubleDownState = aDoubleDown;
   }
 
-  /** This will return whether the double down flag was set.
-   *  @return whether the double down flag was set
+  /**
+   * This will return whether the double down flag was set.
+   * @return whether the double down flag was set
    */
   bool GetMouseDoubleDown() const { return mMouseDoubleDownState; }
 
   /**
    * GetPrevNextBidiLevels will return the frames and associated Bidi levels of
    * the characters logically before and after a (collapsed) selection.
-   *  @param aNode is the node containing the selection
-   *  @param aContentOffset is the offset of the selection in the node
-   *  @param aJumpLines If true, look across line boundaries.
-   *                    If false, behave as if there were base-level frames at
-   * line edges.
    *
-   *  @return A struct holding the before/after frame and the before/after
+   * @param aNode is the node containing the selection
+   * @param aContentOffset is the offset of the selection in the node
+   * @param aJumpLines
+   *   If true, look across line boundaries.
+   *   If false, behave as if there were base-level frames at line edges.
+   *
+   * @return A struct holding the before/after frame and the before/after
    * level.
    *
-   *  At the beginning and end of each line there is assumed to be a frame with
-   *   Bidi level equal to the paragraph embedding level.
-   *  In these cases the before frame and after frame respectively will be
-   *   nullptr.
+   * At the beginning and end of each line there is assumed to be a frame with
+   * Bidi level equal to the paragraph embedding level.
+   *
+   * In these cases the before frame and after frame respectively will be
+   * nullptr.
    */
   nsPrevNextBidiLevels GetPrevNextBidiLevels(nsIContent* aNode,
                                              uint32_t aContentOffset,
                                              bool aJumpLines) const;
 
-  /** GetFrameFromLevel will scan in a given direction
-   *   until it finds a frame with a Bidi level less than or equal to a given
+  /**
+   * GetFrameFromLevel will scan in a given direction
+   * until it finds a frame with a Bidi level less than or equal to a given
    * level. It will return the last frame before this.
-   *  @param aPresContext is the context to use
-   *  @param aFrameIn is the frame to start from
-   *  @param aDirection is the direction to scan
-   *  @param aBidiLevel is the level to search for
-   *  @param aFrameOut will hold the frame returned
+   *
+   * @param aPresContext is the context to use
+   * @param aFrameIn is the frame to start from
+   * @param aDirection is the direction to scan
+   * @param aBidiLevel is the level to search for
+   * @param aFrameOut will hold the frame returned
    */
   nsresult GetFrameFromLevel(nsIFrame* aFrameIn, nsDirection aDirection,
                              nsBidiLevel aBidiLevel,
                              nsIFrame** aFrameOut) const;
 
   /**
    * MaintainSelection will track the current selection as being "sticky".
    * Dragging or extending selection will never allow for a subset
    * (or the whole) of the maintained selection to become unselected.
    * Primary use: double click selecting then dragging on second click
+   *
    * @param aAmount the initial amount of text selected (word, line or
    * paragraph). For "line", use eSelectBeginLine.
    */
   nsresult MaintainSelection(nsSelectionAmount aAmount = eSelectNoAmount);
 
   nsresult ConstrainFrameAndPointToAnchorSubtree(nsIFrame* aFrame,
                                                  const nsPoint& aPoint,
                                                  nsIFrame** aRetFrame,
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -40,18 +40,18 @@ struct nsBorderColor {
 
 enum nsFrameborder {
   eFrameborder_Yes = 0,
   eFrameborder_No,
   eFrameborder_Notset
 };
 
 struct nsFramesetDrag {
-  nsHTMLFramesetFrame*
-      mSource;      // frameset whose border was dragged to cause the resize
+  nsHTMLFramesetFrame* mSource;  // frameset whose border was dragged to cause
+                                 // the resize
   int32_t mIndex;   // index of left col or top row of effected area
   int32_t mChange;  // pos for left to right or top to bottom, neg otherwise
   bool mVertical;   // vertical if true, otherwise horizontal
 
   nsFramesetDrag();
   void Reset(bool aVertical, int32_t aIndex, int32_t aChange,
              nsHTMLFramesetFrame* aSource);
   void UnSet();
--- a/layout/generic/nsFrameState.cpp
+++ b/layout/generic/nsFrameState.cpp
@@ -36,40 +36,74 @@ nsCString GetFrameState(nsIFrame* aFrame
 
   nsFrameState state = aFrame->GetStateBits();
 
   if (state == nsFrameState(0)) {
     result.Assign('0');
     return result;
   }
 
-#define FRAME_STATE_GROUP(name_, class_)                                       \
+#define FRAME_STATE_GROUP_CLASS(name_, class_)                                 \
   {                                                                            \
     class_* frame = do_QueryFrame(aFrame);                                     \
     if (frame && (groups.IsEmpty() || strcmp(groups.LastElement(), #name_))) { \
       groups.AppendElement(#name_);                                            \
     }                                                                          \
   }
 #define FRAME_STATE_BIT(group_, value_, name_)                            \
   if ((state & NS_FRAME_STATE_BIT(value_)) && groups.Contains(#group_)) { \
     if (!result.IsEmpty()) {                                              \
       result.InsertLiteral(" | ", 0);                                     \
     }                                                                     \
     result.InsertLiteral(#name_, 0);                                      \
     state = state & ~NS_FRAME_STATE_BIT(value_);                          \
   }
 #include "nsFrameStateBits.h"
-#undef FRAME_STATE_GROUP
+#undef FRAME_STATE_GROUP_CLASS
 #undef FRAME_STATE_BIT
 
   if (state) {
     result.AppendPrintf(" | 0x%0" PRIx64, static_cast<uint64_t>(state));
   }
 
   return result;
 }
 
 void PrintFrameState(nsIFrame* aFrame) {
   printf("%s\n", GetFrameState(aFrame).get());
 }
+
+enum class FrameStateGroupId {
+#define FRAME_STATE_GROUP_NAME(name_) name_,
+#include "nsFrameStateBits.h"
+#undef FRAME_STATE_GROUP_NAME
+
+  LENGTH
+};
+
+void DebugVerifyFrameStateBits() {
+  // Build an array of all of the bits used by each group.  While
+  // building this we assert that a bit isn't used multiple times within
+  // the same group.
+  nsFrameState bitsUsedPerGroup[size_t(FrameStateGroupId::LENGTH)] = {
+      nsFrameState(0)};
+
+#define FRAME_STATE_BIT(group_, value_, name_)                           \
+  {                                                                      \
+    auto bit = NS_FRAME_STATE_BIT(value_);                               \
+    size_t group = size_t(FrameStateGroupId::group_);                    \
+    MOZ_ASSERT(!(bitsUsedPerGroup[group] & bit), #name_                  \
+               " must not use a bit already declared within its group"); \
+    bitsUsedPerGroup[group] |= bit;                                      \
+  }
+
+#include "nsFrameStateBits.h"
+#undef FRAME_STATE_BIT
+
+  // FIXME: Can we somehow check across the groups as well???  In other
+  // words, find the pairs of groups that could be used on the same
+  // frame (Generic paired with everything else, and a few other pairs),
+  // and check that we don't have bits in common between those pairs.
+}
+
 #endif
 
 }  // namespace mozilla
--- a/layout/generic/nsFrameState.h
+++ b/layout/generic/nsFrameState.h
@@ -62,12 +62,13 @@ inline nsFrameState& operator^=(nsFrameS
 // Bits 20-31 and 60-63 of the frame state are reserved for implementations.
 #define NS_FRAME_IMPL_RESERVED nsFrameState(0xF0000000FFF00000)
 #define NS_FRAME_RESERVED ~NS_FRAME_IMPL_RESERVED
 
 namespace mozilla {
 #ifdef DEBUG
 nsCString GetFrameState(nsIFrame* aFrame);
 void PrintFrameState(nsIFrame* aFrame);
+void DebugVerifyFrameStateBits();
 #endif
 }  // namespace mozilla
 
 #endif /* nsFrameState_h_ */
--- a/layout/generic/nsFrameStateBits.h
+++ b/layout/generic/nsFrameStateBits.h
@@ -7,52 +7,64 @@
 /* a list of all frame state bits, for preprocessing */
 
 /******
 
   This file contains definitions for frame state bits -- values used
   in nsIFrame::mState -- and groups of frame state bits and which
   classes they apply to.
 
-  There are two macros that can be defined before #including this
+  There are three macros that can be defined before #including this
   file:
 
-  FRAME_STATE_GROUP(name_, class_)
+  FRAME_STATE_GROUP_NAME(name_)
 
     This denotes the existence of a named group of frame state bits.
-    name_ is the name of the group and class_ is the name of a frame
-    class that uses the frame state bits that are a part of the group.
 
     The main group of frame state bits is named "Generic" and is
     defined to apply to nsIFrame, i.e. all frames.  All of the global
     frame state bits -- bits 0..19 and 32..59 -- are in this group.
 
+  FRAME_STATE_GROUP_CLASS(group_, class_)
+    class_ is the name of a frame class that uses the frame state bits
+    that are a part of the group.
+
   FRAME_STATE_BIT(group_, value_, name_)
 
     This denotes the existence of a frame state bit.  group_ indicates
     which group the bit belongs to, value_ is the bit number (0..63),
     and name_ is the name of the frame state bit constant.
 
   Note that if you add a new frame state group, you'll need to #include
   the header for its frame classes in nsFrameState.cpp and, if they don't
   already, add nsQueryFrame implementations (which can be DEBUG-only) to
   the frame classes.
 
  ******/
 
-#ifndef FRAME_STATE_GROUP
-#define FRAME_STATE_GROUP(name_, class_) /* nothing */
-#define DEFINED_FRAME_STATE_GROUP
+#ifndef FRAME_STATE_GROUP_NAME
+#define FRAME_STATE_GROUP_NAME(name_) /* nothing */
+#define DEFINED_FRAME_STATE_GROUP_NAME
+#endif
+
+#ifndef FRAME_STATE_GROUP_CLASS
+#define FRAME_STATE_GROUP_CLASS(name_, class_) /* nothing */
+#define DEFINED_FRAME_STATE_GROUP_CLASS
 #endif
 
 #ifndef FRAME_STATE_BIT
 #define FRAME_STATE_BIT(group_, value_, name_) /* nothing */
 #define DEFINED_FRAME_STATE_BIT
 #endif
 
+// Helper macro for the common case of a single class
+#define FRAME_STATE_GROUP(name_, class_) \
+  FRAME_STATE_GROUP_NAME(name_)          \
+  FRAME_STATE_GROUP_CLASS(name_, class_)
+
 // == Frame state bits that apply to all frames ===============================
 
 FRAME_STATE_GROUP(Generic, nsIFrame)
 
 // This bit is set when the frame is actively being reflowed. It is set in many
 // frames' Reflow() by calling MarkInReflow() and unset in DidReflow().
 FRAME_STATE_BIT(Generic, 0, NS_FRAME_IN_REFLOW)
 
@@ -369,18 +381,19 @@ FRAME_STATE_BIT(GridContainer, 26, NS_ST
 // The container contains one or more items subgridded in its block axis.
 FRAME_STATE_BIT(GridContainer, 27, NS_STATE_GRID_HAS_ROW_SUBGRID_ITEM)
 
 // We've merged some OverflowList children since last reflow.
 FRAME_STATE_BIT(GridContainer, 28, NS_STATE_GRID_HAS_CHILD_NIFS)
 
 // == Frame state bits that apply to SVG frames ===============================
 
-FRAME_STATE_GROUP(SVG, nsSVGDisplayableFrame)
-FRAME_STATE_GROUP(SVG, nsSVGContainerFrame)
+FRAME_STATE_GROUP_NAME(SVG)
+FRAME_STATE_GROUP_CLASS(SVG, nsSVGDisplayableFrame)
+FRAME_STATE_GROUP_CLASS(SVG, nsSVGContainerFrame)
 
 FRAME_STATE_BIT(SVG, 20, NS_STATE_IS_OUTER_SVG)
 
 // If this bit is set, we are a <clipPath> element or descendant.
 FRAME_STATE_BIT(SVG, 21, NS_STATE_SVG_CLIPPATH_CHILD)
 
 // For SVG text, the NS_FRAME_IS_DIRTY and NS_FRAME_HAS_DIRTY_CHILDREN bits
 // indicate that our anonymous block child needs to be reflowed, and that
@@ -573,18 +586,18 @@ FRAME_STATE_BIT(Block, 62, NS_BLOCK_FRAM
 // frame, or the block has first-letter style but has no first letter, this
 // bit is not set. This bit is set on the first continuation only.
 FRAME_STATE_BIT(Block, 63, NS_BLOCK_HAS_FIRST_LETTER_CHILD)
 
 // == Frame state bits that apply to bullet frames ============================
 
 FRAME_STATE_GROUP(Bullet, nsBulletFrame)
 
-FRAME_STATE_BIT(Block, 62, BULLET_FRAME_HAS_FONT_INFLATION)
-FRAME_STATE_BIT(Block, 63, BULLET_FRAME_IMAGE_LOADING)
+FRAME_STATE_BIT(Bullet, 62, BULLET_FRAME_HAS_FONT_INFLATION)
+FRAME_STATE_BIT(Bullet, 63, BULLET_FRAME_IMAGE_LOADING)
 
 // == Frame state bits that apply to image frames =============================
 
 FRAME_STATE_GROUP(Image, nsImageFrame)
 
 FRAME_STATE_BIT(Image, 20, IMAGE_SIZECONSTRAINED)
 
 // == Frame state bits that apply to inline frames ============================
@@ -655,18 +668,19 @@ FRAME_STATE_BIT(TableCell, 31, NS_TABLE_
 // Bits 28-31 on nsTableColFrames are used to store the column type.
 
 // == Frame state bits that apply to table column group frames ================
 
 // Bits 30-31 on nsTableColGroupFrames are used to store the column type.
 
 // == Frame state bits that apply to table rows and table row group frames ====
 
-FRAME_STATE_GROUP(TableRowAndRowGroup, nsTableRowFrame)
-FRAME_STATE_GROUP(TableRowAndRowGroup, nsTableRowGroupFrame)
+FRAME_STATE_GROUP_NAME(TableRowAndRowGroup)
+FRAME_STATE_GROUP_CLASS(TableRowAndRowGroup, nsTableRowFrame)
+FRAME_STATE_GROUP_CLASS(TableRowAndRowGroup, nsTableRowGroupFrame)
 
 // see nsTableRowGroupFrame::InitRepeatedFrame
 FRAME_STATE_BIT(TableRowAndRowGroup, 28, NS_REPEATED_ROW_OR_ROWGROUP)
 
 // == Frame state bits that apply to table row frames =========================
 
 FRAME_STATE_GROUP(TableRow, nsTableRowFrame)
 
@@ -685,17 +699,24 @@ FRAME_STATE_BIT(TableRowGroup, 30, NS_RO
 
 // thead or tfoot should be repeated on every printed page
 FRAME_STATE_BIT(TableRowGroup, 31, NS_ROWGROUP_REPEATABLE)
 
 FRAME_STATE_GROUP(Table, nsTableFrame)
 
 FRAME_STATE_BIT(Table, 28, NS_TABLE_PART_HAS_FIXED_BACKGROUND)
 
-#ifdef DEFINED_FRAME_STATE_GROUP
-#undef DEFINED_FRAME_STATE_GROUP
 #undef FRAME_STATE_GROUP
+
+#ifdef DEFINED_FRAME_STATE_GROUP_NAME
+#undef DEFINED_FRAME_STATE_GROUP_NAME
+#undef FRAME_STATE_GROUP_NAME
+#endif
+
+#ifdef DEFINED_FRAME_STATE_GROUP_CLASS
+#undef DEFINED_FRAME_STATE_GROUP_CLASS
+#undef FRAME_STATE_GROUP_CLASS
 #endif
 
 #ifdef DEFINED_FRAME_STATE_BIT
 #undef DEFINED_FRAME_STATE_BIT
 #undef FRAME_STATE_BIT
 #endif
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -221,20 +221,19 @@ struct MOZ_STACK_CLASS ScrollReflowInput
   // Whether we decided to show the horizontal scrollbar
   MOZ_INIT_OUTSIDE_CTOR
   bool mShowHScrollbar;
   // Whether we decided to show the vertical scrollbar
   MOZ_INIT_OUTSIDE_CTOR
   bool mShowVScrollbar;
 
   ScrollReflowInput(nsIScrollableFrame* aFrame, const ReflowInput& aReflowInput)
-      : mReflowInput(aReflowInput)
+      : mReflowInput(aReflowInput),
         // mBoxState is just used for scrollbars so we don't need to
         // worry about the reflow depth here
-        ,
         mBoxState(aReflowInput.mFrame->PresContext(),
                   aReflowInput.mRenderingContext) {
     ScrollStyles styles = aFrame->GetScrollStyles();
     mHScrollbar = ShouldShowScrollbar(styles.mHorizontal);
     mVScrollbar = ShouldShowScrollbar(styles.mVertical);
   }
 };
 
@@ -1862,20 +1861,21 @@ ComputeBezierAnimationSettingsForOrigin(
     maxMS = Preferences::GetInt(prefMax.get(), kDefaultMaxMS);
 
     static const int32_t kSmoothScrollMaxAllowedAnimationDurationMS = 10000;
     maxMS = clamped(maxMS, 0, kSmoothScrollMaxAllowedAnimationDurationMS);
     minMS = clamped(minMS, 0, maxMS);
   }
 
   // Keep the animation duration longer than the average event intervals
-  //   (to "connect" consecutive scroll animations before the scroll comes to a
-  //   stop).
-  static const double kDefaultDurationToIntervalRatio =
-      2;  // Duplicated at all.js
+  // (to "connect" consecutive scroll animations before the scroll comes to a
+  // stop).
+  //
+  // Default value is duplicated in all.js.
+  static const double kDefaultDurationToIntervalRatio = 2;
   intervalRatio =
       Preferences::GetInt("general.smoothScroll.durationToIntervalRatio",
                           kDefaultDurationToIntervalRatio * 100) /
       100.0;
 
   // Duration should be at least as long as the intervals -> ratio is at least 1
   intervalRatio = std::max(1.0, intervalRatio);
 
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -333,26 +333,25 @@ std::ostream& operator<<(std::ostream& a
  * When there is no scrollable overflow rect, the visual overflow rect
  * may be stored as four 1-byte deltas each strictly LESS THAN 0xff, for
  * the four edges of the rectangle, or the four bytes may be read as a
  * single 32-bit "overflow-rect type" value including at least one 0xff
  * byte as an indicator that the value does NOT represent four deltas.
  * If all four deltas are zero, this means that no overflow rect has
  * actually been set (this is the initial state of newly-created frames).
  */
-#define NS_FRAME_OVERFLOW_DELTA_MAX 0xfe  // max delta we can store
-
-#define NS_FRAME_OVERFLOW_NONE \
-  0x00000000  // there are no overflow rects;
-              // code relies on this being
-              // the all-zero value
-
-#define NS_FRAME_OVERFLOW_LARGE \
-  0x000000ff  // overflow is stored as a
-              // separate rect property
+
+// max delta we can store
+#define NS_FRAME_OVERFLOW_DELTA_MAX 0xfe
+
+// there are no overflow rects; code relies on this being the all-zero value
+#define NS_FRAME_OVERFLOW_NONE 0x00000000
+
+// overflow is stored as a separate rect property
+#define NS_FRAME_OVERFLOW_LARGE 0x000000ff
 
 /**
  * nsBidiLevel is the type of the level values in our Unicode Bidi
  * implementation.
  * It holds an embedding level and indicates the visual direction
  * by its bit 0 (even/odd value).<p>
  *
  * <li><code>aParaLevel</code> can be set to the
@@ -376,33 +375,34 @@ std::ostream& operator<<(std::ostream& a
  *
  * @see NSBIDI_DEFAULT_LTR
  * @see NSBIDI_DEFAULT_RTL
  * @see NSBIDI_LEVEL_OVERRIDE
  * @see NSBIDI_MAX_EXPLICIT_LEVEL
  */
 typedef uint8_t nsBidiLevel;
 
-/** Paragraph level setting.
- *  If there is no strong character, then set the paragraph level to 0
+/**
+ * Paragraph level setting.
+ * If there is no strong character, then set the paragraph level to 0
  * (left-to-right).
  */
 #define NSBIDI_DEFAULT_LTR 0xfe
 
-/** Paragraph level setting.
- *  If there is no strong character, then set the paragraph level to 1
+/**
+ * Paragraph level setting.
+ * If there is no strong character, then set the paragraph level to 1
  * (right-to-left).
  */
 #define NSBIDI_DEFAULT_RTL 0xff
 
 /**
  * Maximum explicit embedding level.
  * (The maximum resolved level can be up to
  * <code>NSBIDI_MAX_EXPLICIT_LEVEL+1</code>).
- *
  */
 #define NSBIDI_MAX_EXPLICIT_LEVEL 125
 
 /** Bit flag for level input.
  *  Overrides directional properties.
  */
 #define NSBIDI_LEVEL_OVERRIDE 0x80
 
@@ -612,17 +612,18 @@ class nsIFrame : public nsQueryFrame {
    * removal and destruction.
    */
   void Destroy() {
     AutoPostDestroyData data(PresContext());
     DestroyFrom(this, data.mData);
     // Note that |this| is deleted at this point.
   }
 
-  /** Flags for PeekOffsetCharacter, PeekOffsetNoAmount, PeekOffsetWord return
+  /**
+   * Flags for PeekOffsetCharacter, PeekOffsetNoAmount, PeekOffsetWord return
    * values.
    */
   enum FrameSearchResult {
     // Peek found a appropriate offset within frame.
     FOUND = 0x00,
     // try next frame for offset.
     CONTINUE = 0x1,
     // offset not found because the frame was empty of text.
@@ -1142,23 +1143,23 @@ class nsIFrame : public nsQueryFrame {
   }
 
 #define NS_DECLARE_FRAME_PROPERTY_DELETABLE(prop, type) \
   NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, DeleteValue)
 
 #define NS_DECLARE_FRAME_PROPERTY_RELEASABLE(prop, type) \
   NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, ReleaseValue)
 
-#define NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(prop, type)     \
-  static void AssertOnDestroyingProperty##prop(type*) {                  \
-    MOZ_ASSERT_UNREACHABLE("Frame property " #prop                       \
-                           " should never "                              \
-                           "be destroyed by the FrameProperties class"); \
-  }                                                                      \
-  NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type,                        \
+#define NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(prop, type) \
+  static void AssertOnDestroyingProperty##prop(type*) {              \
+    MOZ_ASSERT_UNREACHABLE(                                          \
+        "Frame property " #prop                                      \
+        " should never be destroyed by the FrameProperties class");  \
+  }                                                                  \
+  NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type,                    \
                                       AssertOnDestroyingProperty##prop)
 
 #define NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(prop, type) \
   NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(prop, mozilla::SmallValueHolder<type>)
 
   NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(IBSplitSibling, nsContainerFrame)
   NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(IBSplitPrevSibling, nsContainerFrame)
 
@@ -1828,21 +1829,21 @@ class nsIFrame : public nsQueryFrame {
   /**
    * Returns the number of ancestors between this and the root of our frame tree
    */
   uint32_t GetDepthInFrameTree() const;
 
   /**
    * Event handling of GUI events.
    *
-   * @param   aEvent event structure describing the type of event and rge widget
-   *            where the event originated
-   *          The |point| member of this is in the coordinate system of the
-   *          view returned by GetOffsetFromView.
-   * @param   aEventStatus a return value indicating whether the event was
+   * @param aEvent event structure describing the type of event and rge widget
+   * where the event originated. The |point| member of this is in the coordinate
+   * system of the view returned by GetOffsetFromView.
+   *
+   * @param aEventStatus a return value indicating whether the event was
    * handled and whether default processing should be done
    *
    * XXX From a frame's perspective it's unclear what the effect of the event
    * status is. Does it cause the event to continue propagating through the
    * frame hierarchy or is it just returned to the widgets?
    *
    * @see     WidgetGUIEvent
    * @see     nsEventStatus
@@ -2319,18 +2320,18 @@ class nsIFrame : public nsQueryFrame {
     eBClampMarginBoxMinSize = 1 << 3,  // clamp in our block axis
     /**
      * The frame is stretching (per CSS Box Alignment) and doesn't have an
      * Automatic Minimum Size in the indicated axis.
      * (may be used for both flex/grid items, but currently only used for Grid)
      * https://drafts.csswg.org/css-grid/#min-size-auto
      * https://drafts.csswg.org/css-align-3/#valdef-justify-self-stretch
      */
-    eIApplyAutoMinSize =
-        1 << 4,  // only has an effect when eShrinkWrap is false
+    eIApplyAutoMinSize = 1 << 4,  // only has an effect when eShrinkWrap is
+                                  // false
   };
 
   /**
    * Compute the size that a frame will occupy.  Called while
    * constructing the ReflowInput to be used to Reflow the frame,
    * in order to fill its mComputedWidth and mComputedHeight member
    * variables.
    *
@@ -3179,90 +3180,104 @@ class nsIFrame : public nsQueryFrame {
    */
   bool IsSelected() const {
     return (GetContent() && GetContent()->IsSelectionDescendant())
                ? IsFrameSelected()
                : false;
   }
 
   /**
-   *  called to discover where this frame, or a parent frame has user-select
+   * Called to discover where this frame, or a parent frame has user-select
    * style applied, which affects that way that it is selected.
    *
-   *  @param aSelectStyle  out param. Returns the type of selection style found
-   *                        (using values defined in nsStyleConsts.h).
+   * @param aSelectStyle out param. Returns the type of selection style found
+   * (using values defined in nsStyleConsts.h).
    *
-   *  @return Whether the frame can be selected (i.e. is not affected by
-   *          user-select: none)
+   * @return Whether the frame can be selected (i.e. is not affected by
+   * user-select: none)
    */
   bool IsSelectable(mozilla::StyleUserSelect* aSelectStyle) const;
 
   /**
-   *  Called to retrieve the SelectionController associated with the frame.
-   *  @param aSelCon will contain the selection controller associated with
-   *  the frame.
+   * Called to retrieve the SelectionController associated with the frame.
+   *
+   * @param aSelCon will contain the selection controller associated with
+   * the frame.
    */
   virtual nsresult GetSelectionController(nsPresContext* aPresContext,
                                           nsISelectionController** aSelCon) = 0;
 
   /**
-   *  Call to get nsFrameSelection for this frame.
+   * Call to get nsFrameSelection for this frame.
    */
   already_AddRefed<nsFrameSelection> GetFrameSelection();
 
   /**
    * GetConstFrameSelection returns an object which methods are safe to use for
    * example in nsIFrame code.
    */
   const nsFrameSelection* GetConstFrameSelection() const;
 
   /**
-   *  called to find the previous/next character, word, or line  returns the
-   * actual nsIFrame and the frame offset.  THIS DOES NOT CHANGE SELECTION STATE
-   *  uses frame's begin selection state to start. if no selection on this frame
-   * will return NS_ERROR_FAILURE
-   *  @param aPOS is defined in nsFrameSelection
+   * called to find the previous/next character, word, or line. Returns the
+   * actual nsIFrame and the frame offset. THIS DOES NOT CHANGE SELECTION STATE.
+   * Uses frame's begin selection state to start. If no selection on this frame
+   * will return NS_ERROR_FAILURE.
+   *
+   * @param aPOS is defined in nsFrameSelection
    */
   virtual nsresult PeekOffset(nsPeekOffsetStruct* aPos);
 
   /**
-   *  called to find the previous/next non-anonymous selectable leaf frame.
-   *  @param aDirection [in] the direction to move in (eDirPrevious or eDirNext)
-   *  @param aVisual [in] whether bidi caret behavior is visual (true) or
+   * Called to find the previous/next non-anonymous selectable leaf frame.
+   *
+   * @param aDirection [in] the direction to move in (eDirPrevious or eDirNext)
+   *
+   * @param aVisual [in] whether bidi caret behavior is visual (true) or
    * logical (false)
-   *  @param aJumpLines [in] whether to allow jumping across line boundaries
-   *  @param aScrollViewStop [in] whether to stop when reaching a scroll frame
+   *
+   * @param aJumpLines [in] whether to allow jumping across line boundaries
+   * @param aScrollViewStop [in] whether to stop when reaching a scroll frame
    * boundary
-   *  @param aOutFrame [out] the previous/next selectable leaf frame
-   *  @param aOutOffset [out] 0 indicates that we arrived at the beginning of
+   *
+   * @param aOutFrame [out] the previous/next selectable leaf frame
+   *
+   * @param aOutOffset [out] 0 indicates that we arrived at the beginning of
    * the output frame; -1 indicates that we arrived at its end.
-   *  @param aOutJumpedLine [out] whether this frame and the returned frame are
+   *
+   * @param aOutJumpedLine [out] whether this frame and the returned frame are
    * on different lines
-   *  @param aOutMovedOverNonSelectableText [out] whether we jumped over a
+   *
+   * @param aOutMovedOverNonSelectableText [out] whether we jumped over a
    * non-selectable frame during the search
    */
   nsresult GetFrameFromDirection(nsDirection aDirection, bool aVisual,
                                  bool aJumpLines, bool aScrollViewStop,
                                  bool aForceEditableRegion,
                                  nsIFrame** aOutFrame, int32_t* aOutOffset,
                                  bool* aOutJumpedLine,
                                  bool* aOutMovedOverNonSelectableText);
 
   /**
-   *  called to see if the children of the frame are visible from indexstart to
-   * index end. this does not change any state. returns true only if the indexes
-   * are valid and any of the children are visible.  for textframes this index
-   * is the character index. if aStart = aEnd result will be false
-   *  @param aStart start index of first child from 0-N (number of children)
-   *  @param aEnd   end index of last child from 0-N
-   *  @param aRecurse should this frame talk to siblings to get to the contents
+   * Called to see if the children of the frame are visible from indexstart to
+   * index end. This does not change any state. Returns true only if the indexes
+   * are valid and any of the children are visible. For textframes this index
+   * is the character index. If aStart = aEnd result will be false.
+   *
+   * @param aStart start index of first child from 0-N (number of children)
+   *
+   * @param aEnd end index of last child from 0-N
+   *
+   * @param aRecurse should this frame talk to siblings to get to the contents
    * other children?
-   *  @param aFinished did this frame have the aEndIndex? or is there more work
+   *
+   * @param aFinished did this frame have the aEndIndex? or is there more work
    * to do
-   *  @param _retval  return value true or false. false = range is not rendered.
+   *
+   * @param _retval return value true or false. false = range is not rendered.
    */
   virtual nsresult CheckVisibility(nsPresContext* aContext, int32_t aStartIndex,
                                    int32_t aEndIndex, bool aRecurse,
                                    bool* aFinished, bool* _retval) = 0;
 
   /**
    * Called to tell a frame that one of its child frames is dirty (i.e.,
    * has the NS_FRAME_IS_DIRTY *or* NS_FRAME_HAS_DIRTY_CHILDREN bit
@@ -4278,40 +4293,48 @@ class nsIFrame : public nsQueryFrame {
   bool mAllDescendantsAreInvisible : 1;
 
  protected:
   // There is a 1-bit gap left here.
 
   // Helpers
   /**
    * Can we stop inside this frame when we're skipping non-rendered whitespace?
-   * @param  aForward [in] Are we moving forward (or backward) in content order.
-   * @param  aOffset [in/out] At what offset into the frame to start looking.
-   *         on output - what offset was reached (whether or not we found a
-   * place to stop).
-   * @return STOP: An appropriate offset was found within this frame,
-   *         and is given by aOffset.
-   *         CONTINUE: Not found within this frame, need to try the next frame.
-   *         see enum FrameSearchResult for more details.
+   *
+   * @param aForward [in] Are we moving forward (or backward) in content order.
+   *
+   * @param aOffset [in/out] At what offset into the frame to start looking.
+   * at offset was reached (whether or not we found a place to stop).
+   *
+   * @return
+   *   * STOP: An appropriate offset was found within this frame,
+   *     and is given by aOffset.
+   *   * CONTINUE: Not found within this frame, need to try the next frame.
+   *     See enum FrameSearchResult for more details.
    */
   virtual FrameSearchResult PeekOffsetNoAmount(bool aForward,
                                                int32_t* aOffset) = 0;
 
   /**
    * Search the frame for the next character
-   * @param  aForward [in] Are we moving forward (or backward) in content order.
-   * @param  aOffset [in/out] At what offset into the frame to start looking.
-   *         on output - what offset was reached (whether or not we found a
-   * place to stop).
-   * @param  aOptions [in] Options, see the comment in
-   *         PeekOffsetCharacterOptions for the detail.
-   * @return STOP: An appropriate offset was found within this frame,
-   *         and is given by aOffset.
-   *         CONTINUE: Not found within this frame, need to try the next frame.
-   *         see enum FrameSearchResult for more details.
+   *
+   * @param aForward [in] Are we moving forward (or backward) in content order.
+   *
+   * @param aOffset [in/out] At what offset into the frame to start looking.
+   * on output - what offset was reached (whether or not we found a place to
+   * stop).
+   *
+   * @param aOptions [in] Options, see the comment in PeekOffsetCharacterOptions
+   * for the detail.
+   *
+   * @return
+   *   * STOP: An appropriate offset was found within this frame, and is given
+   *     by aOffset.
+   *   * CONTINUE: Not found within this frame, need to try the next frame. See
+   *     enum FrameSearchResult for more details.
    */
   virtual FrameSearchResult PeekOffsetCharacter(
       bool aForward, int32_t* aOffset,
       PeekOffsetCharacterOptions aOptions = PeekOffsetCharacterOptions()) = 0;
   static_assert(sizeof(PeekOffsetCharacterOptions) <= sizeof(intptr_t),
                 "aOptions should be changed to const reference");
 
   /**
--- a/layout/generic/nsLineBox.cpp
+++ b/layout/generic/nsLineBox.cpp
@@ -31,19 +31,18 @@ const uint32_t nsLineBox::kMinChildCount
 #endif
 
 using namespace mozilla;
 
 nsLineBox::nsLineBox(nsIFrame* aFrame, int32_t aCount, bool aIsBlock)
     : mFirstChild(aFrame),
       mWritingMode(),
       mContainerSize(-1, -1),
-      mBounds(WritingMode())  // mBounds will be initialized with the correct
-                              // writing mode when it is set
-      ,
+      mBounds(WritingMode()),  // mBounds will be initialized with the correct
+                               // writing mode when it is set
       mFrames(),
       mAscent(),
       mAllFlags(0),
       mData(nullptr) {
   // Assert that the union elements chosen for initialisation are at
   // least as large as all other elements in their respective unions, so
   // as to ensure that no parts are missed.
   static_assert(sizeof(mFrames) >= sizeof(mChildCount), "nsLineBox init #1");
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -1176,28 +1176,26 @@ void nsPluginFrame::PrintPlugin(gfxConte
    * rendered before.
    *
    * So, to avoid this, we use PushGroup, which creates a new windows
    * surface, the plugin renders to that, and then we use normal
    * cairo methods to composite that in such that it's recorded using the
    * meta surface.
    */
 
-  /* we'll already be translated into the right spot by gfxWindowsNativeDrawing
-   */
+  // we'll already be translated into the right spot by gfxWindowsNativeDrawing
   nsSize contentSize = GetContentRectRelativeToSelf().Size();
   window.x = 0;
   window.y = 0;
   window.width = presContext->AppUnitsToDevPixels(contentSize.width);
   window.height = presContext->AppUnitsToDevPixels(contentSize.height);
 
   aRenderingContext.Save();
 
-  /* Make sure plugins don't do any damage outside of where they're supposed to
-   */
+  // Make sure plugins don't do any damage outside of where they're supposed to
   aRenderingContext.NewPath();
   gfxRect r(window.x, window.y, window.width, window.height);
   aRenderingContext.Rectangle(r);
   aRenderingContext.Clip();
 
   gfxWindowsNativeDrawing nativeDraw(&aRenderingContext, r);
   do {
     HDC dc = nativeDraw.BeginNativeDrawing();
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -2928,52 +2928,50 @@ static bool IsJustifiableCharacter(const
     return false;
   }
 
   // text-justify: auto
   if (ch < 0x2150u) {
     return false;
   }
   if (aLangIsCJ) {
-    if ((0x2150u <= ch &&
-         ch <= 0x22ffu) ||  // Number Forms, Arrows, Mathematical Operators
-        (0x2460u <= ch && ch <= 0x24ffu) ||  // Enclosed Alphanumerics
-        (0x2580u <= ch &&
-         ch <= 0x27bfu) ||  // Block Elements, Geometric Shapes, Miscellaneous
-                            // Symbols, Dingbats
-        (0x27f0u <= ch &&
-         ch <= 0x2bffu) ||  // Supplemental Arrows-A, Braille Patterns,
-                            // Supplemental Arrows-B, Miscellaneous Mathematical
-                            // Symbols-B, Supplemental Mathematical Operators,
-                            // Miscellaneous Symbols and Arrows
-        (0x2e80u <= ch &&
-         ch <= 0x312fu) ||  // CJK Radicals Supplement, CJK Radicals Supplement,
-                            // Ideographic Description Characters, CJK Symbols
-                            // and Punctuation, Hiragana, Katakana, Bopomofo
-        (0x3190u <= ch &&
-         ch <= 0xabffu) ||  // Kanbun, Bopomofo Extended, Katakana Phonetic
-                            // Extensions, Enclosed CJK Letters and Months, CJK
-                            // Compatibility, CJK Unified Ideographs Extension
-                            // A, Yijing Hexagram Symbols, CJK Unified
-                            // Ideographs, Yi Syllables, Yi Radicals
-        (0xf900u <= ch && ch <= 0xfaffu) ||  // CJK Compatibility Ideographs
-        (0xff5eu <= ch &&
-         ch <= 0xff9fu)  // Halfwidth and Fullwidth Forms(a part)
-    ) {
+    if (  // Number Forms, Arrows, Mathematical Operators
+        (0x2150u <= ch && ch <= 0x22ffu) ||
+        // Enclosed Alphanumerics
+        (0x2460u <= ch && ch <= 0x24ffu) ||
+        // Block Elements, Geometric Shapes, Miscellaneous Symbols, Dingbats
+        (0x2580u <= ch && ch <= 0x27bfu) ||
+        // Supplemental Arrows-A, Braille Patterns, Supplemental Arrows-B,
+        // Miscellaneous Mathematical Symbols-B,
+        // Supplemental Mathematical Operators, Miscellaneous Symbols and Arrows
+        (0x27f0u <= ch && ch <= 0x2bffu) ||
+        // CJK Radicals Supplement, CJK Radicals Supplement, Ideographic
+        // Description Characters, CJK Symbols and Punctuation, Hiragana,
+        // Katakana, Bopomofo
+        (0x2e80u <= ch && ch <= 0x312fu) ||
+        // Kanbun, Bopomofo Extended, Katakana Phonetic Extensions,
+        // Enclosed CJK Letters and Months, CJK Compatibility,
+        // CJK Unified Ideographs Extension A, Yijing Hexagram Symbols,
+        // CJK Unified Ideographs, Yi Syllables, Yi Radicals
+        (0x3190u <= ch && ch <= 0xabffu) ||
+        // CJK Compatibility Ideographs
+        (0xf900u <= ch && ch <= 0xfaffu) ||
+        // Halfwidth and Fullwidth Forms (a part)
+        (0xff5eu <= ch && ch <= 0xff9fu)) {
       return true;
     }
     char16_t ch2;
     if (NS_IS_HIGH_SURROGATE(ch) && aFrag->GetLength() > uint32_t(aPos) + 1 &&
         NS_IS_LOW_SURROGATE(ch2 = aFrag->CharAt(aPos + 1))) {
       uint32_t u = SURROGATE_TO_UCS4(ch, ch2);
-      if (0x20000u <= u &&
-          u <= 0x2ffffu) {  // CJK Unified Ideographs Extension B,
-                            // CJK Unified Ideographs Extension C,
-                            // CJK Unified Ideographs Extension D,
-                            // CJK Compatibility Ideographs Supplement
+      // CJK Unified Ideographs Extension B,
+      // CJK Unified Ideographs Extension C,
+      // CJK Unified Ideographs Extension D,
+      // CJK Compatibility Ideographs Supplement
+      if (0x20000u <= u && u <= 0x2ffffu) {
         return true;
       }
     }
   }
   return false;
 }
 
 void nsTextFrame::ClearMetrics(ReflowOutput& aMetrics) {
@@ -3545,20 +3543,21 @@ void PropertyProvider::CalcTabWidths(Ran
 gfxFloat PropertyProvider::GetHyphenWidth() const {
   if (mHyphenWidth < 0) {
     mHyphenWidth = GetFontGroup()->GetHyphenWidth(this);
   }
   return mHyphenWidth + mLetterSpacing;
 }
 
 static inline bool IS_HYPHEN(char16_t u) {
-  return (u == char16_t('-') || u == 0x058A ||  // ARMENIAN HYPHEN
-          u == 0x2010 ||                        // HYPHEN
-          u == 0x2012 ||                        // FIGURE DASH
-          u == 0x2013);                         // EN DASH
+  return u == char16_t('-') ||  // HYPHEN-MINUS
+         u == 0x058A ||         // ARMENIAN HYPHEN
+         u == 0x2010 ||         // HYPHEN
+         u == 0x2012 ||         // FIGURE DASH
+         u == 0x2013;           // EN DASH
 }
 
 void PropertyProvider::GetHyphenationBreaks(Range aRange,
                                             HyphenType* aBreakBefore) const {
   MOZ_ASSERT(IsInBounds(mStart, mLength, aRange), "Range out of bounds");
   MOZ_ASSERT(mLength != INT32_MAX, "Can't call this with undefined length");
 
   if (!mTextStyle->WhiteSpaceCanWrap(mFrame) ||
--- a/layout/generic/nsTextRunTransformations.cpp
+++ b/layout/generic/nsTextRunTransformations.cpp
@@ -574,56 +574,48 @@ bool nsCaseTransformTextRunFactory::Tran
         }
         break;
 
       case NS_STYLE_TEXT_TRANSFORM_FULL_WIDTH:
         ch = mozilla::unicode::GetFullWidth(ch);
         break;
 
       case NS_STYLE_TEXT_TRANSFORM_FULL_SIZE_KANA: {
+        // clang-format off
         static const uint16_t kSmallKanas[] = {
             // ぁ   ぃ      ぅ      ぇ      ぉ      っ      ゃ      ゅ      ょ
-            0x3041, 0x3043, 0x3045, 0x3047, 0x3049, 0x3063, 0x3083, 0x3085,
-            0x3087,
+            0x3041, 0x3043, 0x3045, 0x3047, 0x3049, 0x3063, 0x3083, 0x3085, 0x3087,
             // ゎ   ゕ      ゖ
             0x308E, 0x3095, 0x3096,
             // ァ   ィ      ゥ      ェ      ォ      ッ      ャ      ュ      ョ
-            0x30A1, 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30C3, 0x30E3, 0x30E5,
-            0x30E7,
+            0x30A1, 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30C3, 0x30E3, 0x30E5, 0x30E7,
             // ヮ   ヵ      ヶ      ㇰ      ㇱ      ㇲ      ㇳ      ㇴ      ㇵ
-            0x30EE, 0x30F5, 0x30F6, 0x31F0, 0x31F1, 0x31F2, 0x31F3, 0x31F4,
-            0x31F5,
+            0x30EE, 0x30F5, 0x30F6, 0x31F0, 0x31F1, 0x31F2, 0x31F3, 0x31F4, 0x31F5,
             // ㇶ   ㇷ      ㇸ      ㇹ      ㇺ      ㇻ      ㇼ      ㇽ      ㇾ
-            0x31F6, 0x31F7, 0x31F8, 0x31F9, 0x31FA, 0x31FB, 0x31FC, 0x31FD,
-            0x31FE,
+            0x31F6, 0x31F7, 0x31F8, 0x31F9, 0x31FA, 0x31FB, 0x31FC, 0x31FD, 0x31FE,
             // ㇿ
             0x31FF,
             // ァ    ィ       ゥ       ェ       ォ       ャ       ュ       ョ       ッ
-            0xFF67, 0xFF68, 0xFF69, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E,
-            0xFF6F};
+            0xFF67, 0xFF68, 0xFF69, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E, 0xFF6F};
         static const uint16_t kFullSizeKanas[] = {
             // あ   い      う      え      お      つ      や      ゆ      よ
-            0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x3064, 0x3084, 0x3086,
-            0x3088,
+            0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x3064, 0x3084, 0x3086, 0x3088,
             // わ   か      け
             0x308F, 0x304B, 0x3051,
             // ア   イ      ウ      エ      オ      ツ      ヤ      ユ      ヨ
-            0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30C4, 0x30E4, 0x30E6,
-            0x30E8,
+            0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30C4, 0x30E4, 0x30E6, 0x30E8,
             // ワ   カ      ケ      ク      シ      ス      ト      ヌ      ハ
-            0x30EF, 0x30AB, 0x30B1, 0x30AF, 0x30B7, 0x30B9, 0x30C8, 0x30CC,
-            0x30CF,
+            0x30EF, 0x30AB, 0x30B1, 0x30AF, 0x30B7, 0x30B9, 0x30C8, 0x30CC, 0x30CF,
             // ヒ   フ      ヘ      ホ      ム      ラ      リ      ル      レ
-            0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30E0, 0x30E9, 0x30EA, 0x30EB,
-            0x30EC,
+            0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30E0, 0x30E9, 0x30EA, 0x30EB, 0x30EC,
             // ロ
             0x30ED,
             // ア    イ       ウ       エ       オ       ヤ       ユ       ヨ        ツ
-            0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF94, 0xFF95, 0xFF96,
-            0xFF82};
+            0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF94, 0xFF95, 0xFF96, 0xFF82};
+        // clang-format on
 
         size_t index;
         const uint16_t len = MOZ_ARRAY_LENGTH(kSmallKanas);
         if (mozilla::BinarySearch(kSmallKanas, 0, len, ch, &index)) {
           ch = kFullSizeKanas[index];
         }
         break;
       }
--- a/layout/mathml/nsIMathMLFrame.h
+++ b/layout/mathml/nsIMathMLFrame.h
@@ -122,29 +122,29 @@ class nsIMathMLFrame {
    * As a rule of thumb:
    *
    * 1. Use InheritAutomaticData() to set properties related to your ancestors:
    *    - set properties that are intrinsic to yourself
    *    - set properties that depend on the state that you expect your ancestors
    *      to have already reached in their own InheritAutomaticData().
    *    - set properties that your descendants assume that you would have set in
    *      your InheritAutomaticData() -- this way, they can safely query them
-   * and the process will feed upon itself.
+   *      and the process will feed upon itself.
    *
    * 2. Use TransmitAutomaticData() to set properties related to your
    * descendants:
    *    - set properties that depend on the state that you expect your
-   * descendants to have reached upon processing their own
-   * TransmitAutomaticData().
+   *      descendants to have reached upon processing their own
+   *      TransmitAutomaticData().
    *    - transmit properties that your descendants expect that you will
-   * transmit to them in your TransmitAutomaticData() -- this way, they remain
-   * up-to-date.
+   *      transmit to them in your TransmitAutomaticData() -- this way, they
+   *      remain up-to-date.
    *    - set properties that your ancestors expect that you would set in your
    *      TransmitAutomaticData() -- this way, they can safely query them and
-   * the process will feed upon itself.
+   *      the process will feed upon itself.
    */
 
   NS_IMETHOD
   InheritAutomaticData(nsIFrame* aParent) = 0;
 
   NS_IMETHOD
   TransmitAutomaticData() = 0;
 
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -998,22 +998,22 @@ void nsMathMLContainerFrame::UpdateIntri
 // built-in values for lspace & rspace in the Operator Dictionary.
 static int32_t
     kInterFrameSpacingTable[eMathMLFrameType_COUNT][eMathMLFrameType_COUNT] = {
         // in units of muspace.
         // upper half of the byte is set if the
         // spacing is not to be used for scriptlevel > 0
 
         /*           Ord  OpOrd OpInv OpUsr Inner Italic Upright */
-        /*Ord  */ {0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00},
-        /*OpOrd*/ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-        /*OpInv*/ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-        /*OpUsr*/ {0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01},
-        /*Inner*/ {0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01},
-        /*Italic*/ {0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01},
+        /*Ord    */ {0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00},
+        /*OpOrd  */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+        /*OpInv  */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+        /*OpUsr  */ {0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01},
+        /*Inner  */ {0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01},
+        /*Italic */ {0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01},
         /*Upright*/ {0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00}};
 
 #define GET_INTERSPACE(scriptlevel_, frametype1_, frametype2_, space_) \
   /* no space if there is a frame that we know nothing about */        \
   if (frametype1_ == eMathMLFrameType_UNKNOWN ||                       \
       frametype2_ == eMathMLFrameType_UNKNOWN)                         \
     space_ = 0;                                                        \
   else {                                                               \
--- a/layout/mathml/nsMathMLContainerFrame.h
+++ b/layout/mathml/nsMathMLContainerFrame.h
@@ -119,18 +119,17 @@ class nsMathMLContainerFrame : public ns
   //    implemented by this base class.
   //
   // 2. If the MathML frame class has cached automatic data that depends on
   //    the attribute:
   //    2a. If the automatic data to update resides only within the descendants,
   //        we just re-layout them using ReLayoutChildren(this);
   //        (e.g., this happens with <ms>).
   //    2b. If the automatic data to update affects us in some way, we ask our
-  //    parent
-  //        to re-layout its children using ReLayoutChildren(mParent);
+  //        parent to re-layout its children using ReLayoutChildren(mParent);
   //        Therefore, there is an overhead here in that our siblings are
   //        re-laid too (e.g., this happens with <munder>, <mover>,
   //        <munderover>).
   virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
                                     int32_t aModType) override;
 
   // helper function to apply mirroring to a horizontal coordinate, if needed.
   nscoord MirrorIfRTL(nscoord aParentWidth, nscoord aChildWidth,
--- a/layout/mathml/nsMathMLmpaddedFrame.cpp
+++ b/layout/mathml/nsMathMLmpaddedFrame.cpp
@@ -43,26 +43,27 @@ nsMathMLmpaddedFrame::InheritAutomaticDa
   nsMathMLContainerFrame::InheritAutomaticData(aParent);
 
   mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
 
   return NS_OK;
 }
 
 void nsMathMLmpaddedFrame::ProcessAttributes() {
+  // clang-format off
   /*
   parse the attributes
 
-  width  = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | h-unit |
-  namedspace) height = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit |
-  v-unit | namedspace) depth  = [+|-] unsigned-number (% [pseudo-unit] |
-  pseudo-unit | v-unit | namedspace) lspace = [+|-] unsigned-number (%
-  [pseudo-unit] | pseudo-unit | h-unit | namedspace) voffset= [+|-]
-  unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace)
+  width  = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | h-unit | namedspace)
+  height = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace)
+  depth  = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace)
+  lspace = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | h-unit | namedspace)
+  voffset= [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace)
   */
+  // clang-format on
 
   nsAutoString value;
 
   // width
   mWidthSign = NS_MATHML_SIGN_INVALID;
   mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value);
   if (!value.IsEmpty()) {
     if (!ParseAttribute(value, mWidthSign, mWidth, mWidthPseudoUnit)) {
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -631,18 +631,18 @@ static void ParseAlignAttribute(nsString
 #ifdef DEBUG_rbs_off
 // call ListMathMLTree(mParent) to get the big picture
 static void ListMathMLTree(nsIFrame* atLeast) {
   // climb up to <math> or <body> if <math> isn't there
   nsIFrame* f = atLeast;
   for (; f; f = f->GetParent()) {
     nsIContent* c = f->GetContent();
     if (!c || c->IsMathMLElement(nsGkAtoms::math) ||
-        c->NodeInfo()->NameAtom(
-            nsGkAtoms::body))  // XXXbaku which kind of body tag?
+        // XXXbaku which kind of body tag?
+        c->NodeInfo()->NameAtom(nsGkAtoms::body))
       break;
   }
   if (!f) f = atLeast;
   f->List(stdout, 0);
 }
 #endif
 
 // --------
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -382,22 +382,20 @@ DisplayItemData* DisplayItemData::Assert
 }
 
 /**
  * This is the userdata we associate with a layer manager.
  */
 class LayerManagerData : public LayerUserData {
  public:
   explicit LayerManagerData(LayerManager* aManager)
-      : mLayerManager(aManager)
+      : mLayerManager(aManager),
 #ifdef DEBUG_DISPLAY_ITEM_DATA
-        ,
-        mParent(nullptr)
+        mParent(nullptr),
 #endif
-        ,
         mInvalidateAllLayers(false) {
     MOZ_COUNT_CTOR(LayerManagerData);
   }
   ~LayerManagerData() override { MOZ_COUNT_DTOR(LayerManagerData); }
 
 #ifdef DEBUG_DISPLAY_ITEM_DATA
   void Dump(const char* aPrefix = "") {
     printf_stderr("%sLayerManagerData %p\n", aPrefix, this);
--- a/layout/printing/nsPrintData.h
+++ b/layout/printing/nsPrintData.h
@@ -56,18 +56,18 @@ class nsPrintData {
   ePrintDataType mType;  // the type of data this is (Printing or Print Preview)
   RefPtr<nsDeviceContext> mPrintDC;
 
   mozilla::UniquePtr<nsPrintObject> mPrintObject;
 
   nsCOMArray<nsIWebProgressListener> mPrintProgressListeners;
   nsCOMPtr<nsIPrintProgressParams> mPrintProgressParams;
 
-  nsCOMPtr<nsPIDOMWindowOuter>
-      mCurrentFocusWin;  // cache a pointer to the currently focused window
+  nsCOMPtr<nsPIDOMWindowOuter> mCurrentFocusWin;  // cache a pointer to the
+                                                  // currently focused window
 
   // Array of non-owning pointers to all the nsPrintObjects owned by this
   // nsPrintData. This includes this->mPrintObject, as well as all of its
   // mKids (and their mKids, etc.)
   nsTArray<nsPrintObject*> mPrintDocList;
 
   bool mIsIFrameSelected;
   bool mIsParentAFrameSet;
--- a/layout/style/CounterStyleManager.cpp
+++ b/layout/style/CounterStyleManager.cpp
@@ -198,91 +198,82 @@ enum CJKIdeographicLang { CHINESE, KOREA
 struct CJKIdeographicData {
   char16_t digit[10];
   char16_t unit[3];
   char16_t unit10K[2];
   uint8_t lang;
   bool informal;
 };
 static const CJKIdeographicData gDataJapaneseInformal = {
-    {// digit
-     0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
-     0x4e5d},
+    {0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
+     0x4e5d},                  // digit
     {0x5341, 0x767e, 0x5343},  // unit
     {0x4e07, 0x5104},          // unit10K
     JAPANESE,                  // lang
     true                       // informal
 };
 static const CJKIdeographicData gDataJapaneseFormal = {
-    {// digit
-     0x96f6, 0x58f1, 0x5f10, 0x53c2, 0x56db, 0x4f0d, 0x516d, 0x4e03, 0x516b,
-     0x4e5d},
+    {0x96f6, 0x58f1, 0x5f10, 0x53c2, 0x56db, 0x4f0d, 0x516d, 0x4e03, 0x516b,
+     0x4e5d},                  // digit
     {0x62fe, 0x767e, 0x9621},  // unit
     {0x842c, 0x5104},          // unit10K
     JAPANESE,                  // lang
     false                      // informal
 };
 static const CJKIdeographicData gDataKoreanHangulFormal = {
-    {// digit
-     0xc601, 0xc77c, 0xc774, 0xc0bc, 0xc0ac, 0xc624, 0xc721, 0xce60, 0xd314,
-     0xad6c},
+    {0xc601, 0xc77c, 0xc774, 0xc0bc, 0xc0ac, 0xc624, 0xc721, 0xce60, 0xd314,
+     0xad6c},                  // digit
     {0xc2ed, 0xbc31, 0xcc9c},  // unit
     {0xb9cc, 0xc5b5},          // unit10K
     KOREAN,                    // lang
     false                      // informal
 };
 static const CJKIdeographicData gDataKoreanHanjaInformal = {
-    {// digit
-     0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
-     0x4e5d},
+    {0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
+     0x4e5d},                  // digit
     {0x5341, 0x767e, 0x5343},  // unit
     {0x842c, 0x5104},          // unit10K
     KOREAN,                    // lang
     true                       // informal
 };
 static const CJKIdeographicData gDataKoreanHanjaFormal = {
-    {// digit
-     0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
-     0x4e5d},
+    {0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
+     0x4e5d},                  // digit
     {0x62fe, 0x767e, 0x4edf},  // unit
     {0x842c, 0x5104},          // unit10K
     KOREAN,                    // lang
     false                      // informal
 };
 static const CJKIdeographicData gDataSimpChineseInformal = {
-    {// digit
-     0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
-     0x4e5d},
+    {0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
+     0x4e5d},                  // digit
     {0x5341, 0x767e, 0x5343},  // unit
     {0x4e07, 0x4ebf},          // unit10K
     CHINESE,                   // lang
     true                       // informal
 };
 static const CJKIdeographicData gDataSimpChineseFormal = {
-    {// digit
-     0x96f6, 0x58f9, 0x8d30, 0x53c1, 0x8086, 0x4f0d, 0x9646, 0x67d2, 0x634c,
-     0x7396},
+    {0x96f6, 0x58f9, 0x8d30, 0x53c1, 0x8086, 0x4f0d, 0x9646, 0x67d2, 0x634c,
+     0x7396},                  // digit
     {0x62fe, 0x4f70, 0x4edf},  // unit
     {0x4e07, 0x4ebf},          // unit10K
     CHINESE,                   // lang
     false                      // informal
 };
 static const CJKIdeographicData gDataTradChineseInformal = {
-    {// digit
-     0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
-     0x4e5d},
+    {0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b,
+     0x4e5d},                  // digit
     {0x5341, 0x767e, 0x5343},  // unit
     {0x842c, 0x5104},          // unit10K
     CHINESE,                   // lang
     true                       // informal
 };
 static const CJKIdeographicData gDataTradChineseFormal = {
-    {// digit
-     0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x8086, 0x4f0d, 0x9678, 0x67d2, 0x634c,
-     0x7396},
+    {0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x8086, 0x4f0d, 0x9678, 0x67d2, 0x634c,
+     0x7396},                  // digit
     {0x62fe, 0x4f70, 0x4edf},  // unit
     {0x842c, 0x5104},          // unit10K
     CHINESE,                   // lang
     false                      // informal
 };
 
 static bool CJKIdeographicToText(CounterValue aOrdinal, nsAString& aResult,
                                  const CJKIdeographicData& data) {
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -635,19 +635,18 @@ nsresult FontFaceSet::StartLoad(gfxUserF
   rv = channel->AsyncOpen2(streamLoader);
   if (NS_FAILED(rv)) {
     fontLoader->DropChannel();  // explicitly need to break ref cycle
   }
 
   if (NS_SUCCEEDED(rv)) {
     mLoaders.PutEntry(fontLoader);
     fontLoader->StartedLoading(streamLoader);
-    aUserFontEntry->SetLoader(
-        fontLoader);  // let the font entry remember the
-                      // loader, in case we need to cancel it
+    // let the font entry remember the loader, in case we need to cancel it
+    aUserFontEntry->SetLoader(fontLoader);
   }
 
   return rv;
 }
 
 bool FontFaceSet::UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules) {
   MOZ_ASSERT(mUserFontSet);
 
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -48,24 +48,22 @@ StyleSheet::StyleSheet(const StyleSheet&
                        dom::DocumentOrShadowRoot* aDocumentOrShadowRoot,
                        nsINode* aOwningNodeToUse)
     : mParent(aParentToUse),
       mTitle(aCopy.mTitle),
       mDocumentOrShadowRoot(aDocumentOrShadowRoot),
       mOwningNode(aOwningNodeToUse),
       mOwnerRule(aOwnerRuleToUse),
       mParsingMode(aCopy.mParsingMode),
-      mState(aCopy.mState)
+      mState(aCopy.mState),
       // We only use this constructor during cloning.  It's the cloner's
       // responsibility to notify us if we end up being owned by a document.
-      ,
       mAssociationMode(NotOwnedByDocumentOrShadowRoot),
-      mInner(
-          aCopy.mInner)  // Shallow copy, but concrete subclasses will fix up.
-{
+      // Shallow copy, but concrete subclasses will fix up.
+      mInner(aCopy.mInner) {
   MOZ_ASSERT(mInner, "Should only copy StyleSheets with an mInner.");
   mInner->AddSheet(this);
 
   if (HasForcedUniqueInner()) {  // CSSOM's been there, force full copy now
     MOZ_ASSERT(IsComplete(),
                "Why have rules been accessed on an incomplete sheet?");
     // FIXME: handle failure?
     EnsureUniqueInner();
@@ -852,19 +850,20 @@ already_AddRefed<StyleSheet> StyleSheet:
   return child.forget();
 }
 
 // We disable parallel stylesheet parsing if any of the following three
 // conditions hold:
 //
 // (1) The pref is off.
 // (2) The browser is recording CSS errors (which parallel parsing can't
-// handle). (3) The stylesheet is a chrome stylesheet, since those can use
-// -moz-bool-pref,
-//     which needs to access the pref service, which is not threadsafe.
+//     handle).
+// (3) The stylesheet is a chrome stylesheet, since those can use
+//     -moz-bool-pref, which needs to access the pref service, which is not
+//     threadsafe.
 static bool AllowParallelParse(css::Loader* aLoader, nsIURI* aSheetURI) {
   // Check the pref.
   if (!StaticPrefs::layout_css_parsing_parallel()) {
     return false;
   }
 
   // If the browser is recording CSS errors, we need to use the sequential path
   // because the parallel path doesn't support that.
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -453,19 +453,19 @@ class StyleSheet final : public nsICSSLo
   void TraverseInner(nsCycleCollectionTraversalCallback&);
 
   // Return whether the given @import rule has pending child sheet.
   static bool RuleHasPendingChildSheet(css::Rule* aRule);
 
   StyleSheet* mParent;  // weak ref
 
   nsString mTitle;
-  dom::DocumentOrShadowRoot*
-      mDocumentOrShadowRoot;       // weak ref; parents maintain this for their
-                                   // children
+
+  // weak ref; parents maintain this for their children
+  dom::DocumentOrShadowRoot* mDocumentOrShadowRoot;
   nsINode* mOwningNode;            // weak ref
   dom::CSSImportRule* mOwnerRule;  // weak ref
 
   RefPtr<dom::MediaList> mMedia;
 
   RefPtr<StyleSheet> mNext;
 
   // mParsingMode controls access to nonstandard style constructs that
--- a/layout/style/URLExtraData.h
+++ b/layout/style/URLExtraData.h
@@ -23,20 +23,19 @@ namespace mozilla {
 struct URLExtraData {
   URLExtraData(already_AddRefed<nsIURI> aBaseURI,
                already_AddRefed<nsIURI> aReferrer,
                already_AddRefed<nsIPrincipal> aPrincipal,
                net::ReferrerPolicy aReferrerPolicy)
       : mBaseURI(std::move(aBaseURI)),
         mReferrer(std::move(aReferrer)),
         mReferrerPolicy(aReferrerPolicy),
-        mPrincipal(std::move(aPrincipal))
+        mPrincipal(std::move(aPrincipal)),
         // When we hold the URI data of a style sheet, mReferrer is always
         // equal to the sheet URI.
-        ,
         mIsChrome(mReferrer ? dom::IsChromeURI(mReferrer) : false) {
     MOZ_ASSERT(mBaseURI);
     MOZ_ASSERT(mPrincipal);
   }
 
   URLExtraData(nsIURI* aBaseURI, nsIURI* aReferrer, nsIPrincipal* aPrincipal,
                net::ReferrerPolicy aReferrerPolicy)
       : URLExtraData(do_AddRef(aBaseURI), do_AddRef(aReferrer),
--- a/layout/style/nsCSSAnonBoxes.h
+++ b/layout/style/nsCSSAnonBoxes.h
@@ -66,26 +66,29 @@ class nsCSSAnonBoxes {
   }
 #endif  // DEBUG
 
   // This function is rather slow; you probably don't want to use it outside
   // asserts unless you have to.
   static bool IsWrapperAnonBox(nsAtom* aPseudo) {
     // We commonly get null passed here, and want to quickly return false for
     // it.
-    return aPseudo && (
+    if (!aPseudo) {
+      return false;
+    }
+    return
 #define CSS_ANON_BOX(_name, _value) /* nothing */
 #define CSS_WRAPPER_ANON_BOX(_name, _value) \
   nsGkAtoms::AnonBox_##_name == aPseudo ||
 #define CSS_NON_INHERITING_ANON_BOX(_name, _value) /* nothing */
 #include "nsCSSAnonBoxList.h"
 #undef CSS_NON_INHERITING_ANON_BOX
 #undef CSS_WRAPPER_ANON_BOX
 #undef CSS_ANON_BOX
-                          false);
+        false;
   }
 
   // Get the NonInheriting type for a given pseudo tag.  The pseudo tag must
   // test true for IsNonInheritingAnonBox.
   static NonInheriting NonInheritingTypeForPseudoTag(nsAtom* aPseudo);
 
 #ifdef DEBUG
   static void AssertAtoms();
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -288,37 +288,34 @@ class nsCSSProps {
   // "layout.css.background-clip.text" changes:
   static const KTableEntry kShapeRadiusKTable[];
   static const KTableEntry kFilterFunctionKTable[];
   static const KTableEntry kBoxShadowTypeKTable[];
   static const KTableEntry kCursorKTable[];
   // Not const because we modify its entries when various
   // "layout.css.*.enabled" prefs changes:
   static KTableEntry kDisplayKTable[];
-  // -- tables for parsing the {align,justify}-{content,items,self} properties
-  // --
+  // clang-format off
+  // -- tables for parsing the {align,justify}-{content,items,self} properties --
   static const KTableEntry kAlignAllKeywords[];
   static const KTableEntry kAlignOverflowPosition[];  // <overflow-position>
   static const KTableEntry kAlignSelfPosition[];      // <self-position>
   static const KTableEntry kAlignLegacy[];            // 'legacy'
   static const KTableEntry kAlignLegacyPosition[];    // 'left/right/center'
-  static const KTableEntry
-      kAlignAutoNormalStretchBaseline[];  // 'auto/normal/stretch/baseline'
-  static const KTableEntry
-      kAlignNormalStretchBaseline[];                // 'normal/stretch/baseline'
+  static const KTableEntry kAlignAutoNormalStretchBaseline[];  // 'auto/normal/stretch/baseline'
+  static const KTableEntry kAlignNormalStretchBaseline[];  // 'normal/stretch/baseline'
   static const KTableEntry kAlignNormalBaseline[];  // 'normal/baseline'
-  static const KTableEntry
-      kAlignContentDistribution[];                   // <content-distribution>
+  static const KTableEntry kAlignContentDistribution[];  // <content-distribution>
   static const KTableEntry kAlignContentPosition[];  // <content-position>
-  // -- tables for auto-completion of the {align,justify}-{content,items,self}
-  // properties --
+  // -- tables for auto-completion of the {align,justify}-{content,items,self} properties --
   static const KTableEntry kAutoCompletionAlignJustifySelf[];
   static const KTableEntry kAutoCompletionAlignItems[];
   static const KTableEntry kAutoCompletionAlignJustifyContent[];
   // ------------------------------------------------------------------
+  // clang-format on
   static const KTableEntry kFontSmoothingKTable[];
   static const KTableEntry kGridAutoFlowKTable[];
   static const KTableEntry kGridTrackBreadthKTable[];
   static const KTableEntry kLineHeightKTable[];
   static const KTableEntry kContainKTable[];
   static const KTableEntry kOverflowSubKTable[];
   static const KTableEntry kOverflowClipBoxKTable[];
   static const KTableEntry kOverscrollBehaviorKTable[];
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -245,92 +245,87 @@ struct GridTemplateAreasValue final {
 enum nsCSSUnit {
   eCSSUnit_Null = 0,     // (n/a) null unit, value is not specified
   eCSSUnit_Auto = 1,     // (n/a) value is algorithmic
   eCSSUnit_Inherit = 2,  // (n/a) value is inherited
   eCSSUnit_Initial = 3,  // (n/a) value is default UA value
   eCSSUnit_Unset = 4,    // (n/a) value equivalent to 'initial' if on a reset
                          // property, 'inherit' otherwise
   eCSSUnit_None = 5,     // (n/a) value is none
-  eCSSUnit_Normal =
-      6,  // (n/a) value is normal (algorithmic, different than auto)
+  eCSSUnit_Normal = 6,   // (n/a) value is normal (algorithmic, different than
+                         // auto)
   eCSSUnit_System_Font = 7,    // (n/a) value is -moz-use-system-font
   eCSSUnit_All = 8,            // (n/a) value is all
   eCSSUnit_Dummy = 9,          // (n/a) a fake but specified value, used
                                //       only in temporary values
   eCSSUnit_DummyInherit = 10,  // (n/a) a fake but specified value, used
                                //       only in temporary values
 
   eCSSUnit_String = 11,   // (char16_t*) a string value
   eCSSUnit_Ident = 12,    // (char16_t*) a string value
   eCSSUnit_Attr = 14,     // (char16_t*) a attr(string) value
   eCSSUnit_Element = 15,  // (char16_t*) an element id
 
-  eCSSUnit_Array = 20,  // (nsCSSValue::Array*) a list of values
-  eCSSUnit_Counter =
-      21,  // (nsCSSValue::Array*) a counter(string,[string]) value
-  eCSSUnit_Counters =
-      22,  // (nsCSSValue::Array*) a counters(string,string[,string]) value
-  eCSSUnit_Cubic_Bezier = 23,  // (nsCSSValue::Array*) a list of float values
-  eCSSUnit_Steps = 24,  // (nsCSSValue::Array*) a list of (integer, enumerated)
-  eCSSUnit_Symbols =
-      25,  // (nsCSSValue::Array*) a symbols(enumerated, symbols) value
-  eCSSUnit_Function = 26,  // (nsCSSValue::Array*) a function with
-                           //  parameters.  First elem of array is name,
-                           //  an nsCSSKeyword as eCSSUnit_Enumerated,
-                           //  the rest of the values are arguments.
+  // nsCSSValue::Array* values
+  eCSSUnit_Array = 20,     // (Array*) a list of values
+  eCSSUnit_Counter = 21,   // (Array*) a counter(string,[string]) value
+  eCSSUnit_Counters = 22,  // (Array*) a counters(string,string[,string]) value
+  eCSSUnit_Cubic_Bezier = 23,  // (Array*) a list of float values
+  eCSSUnit_Steps = 24,         // (Array*) a list of (integer, enumerated)
+  eCSSUnit_Symbols = 25,       // (Array*) a symbols(enumerated, symbols) value
+  eCSSUnit_Function = 26,  // (Array*) a function with parameters. First elem of
+                           // array is name, an nsCSSKeyword as
+                           // eCSSUnit_Enumerated, the rest of the values are
+                           // arguments.
 
   // The top level of a calc() expression is eCSSUnit_Calc.  All
   // remaining eCSSUnit_Calc_* units only occur inside these toplevel
   // calc values.
 
-  // eCSSUnit_Calc has an array with exactly 1 element.  eCSSUnit_Calc
-  // exists so we can distinguish calc(2em) from 2em as specified values
-  // (but we drop this distinction for nsStyleCoord when we store
+  // eCSSUnit_Calc exists so we can distinguish calc(2em) from 2em as specified
+  // values (but we drop this distinction for nsStyleCoord when we store
   // computed values).
-  eCSSUnit_Calc = 30,  // (nsCSSValue::Array*) calc() value
-  // Plus, Minus, Times_* and Divided have arrays with exactly 2
-  // elements.  a + b + c + d is grouped as ((a + b) + c) + d
-  eCSSUnit_Calc_Plus = 31,  // (nsCSSValue::Array*) + node within calc()
+  eCSSUnit_Calc = 30,       // (Array*) calc() value -- exactly 1 elt.
+  eCSSUnit_Calc_Plus = 31,  // (Array*) + node within calc(); exactly 2 elts.
+                            // a + b + c + d is grouped as ((a + b) + c) + d
 
   eCSSUnit_Pair = 50,        // (nsCSSValuePair*) pair of values
   eCSSUnit_List = 53,        // (nsCSSValueList*) list of values
   eCSSUnit_SharedList = 55,  // (nsCSSValueSharedList*) same as list
                              //   but reference counted and shared
   eCSSUnit_PairList = 56,    // (nsCSSValuePairList*) list of value pairs
 
   // Atom units
   eCSSUnit_AtomIdent = 60,  // (nsAtom*) for its string as an identifier
 
   eCSSUnit_Integer = 70,     // (int) simple value
   eCSSUnit_Enumerated = 71,  // (int) value has enumerated meaning
 
-  eCSSUnit_Percent =
-      100,  // (float) 1.0 == 100%) value is percentage of something
-  eCSSUnit_Number = 101,  // (float) value is numeric (usually multiplier,
-                          // different behavior than percent)
+  eCSSUnit_Percent = 100,  // (float) (1.0 == 100%) value is percentage of
+                           // something
+  eCSSUnit_Number = 101,   // (float) value is numeric (usually multiplier,
+                           // different behavior than percent)
 
   // Length units - relative
   // Viewport relative measure
-  eCSSUnit_ViewportWidth =
-      700,  // (float) 1% of the width of the initial containing block
-  eCSSUnit_ViewportHeight =
-      701,  // (float) 1% of the height of the initial containing block
-  eCSSUnit_ViewportMin =
-      702,  // (float) smaller of ViewportWidth and ViewportHeight
-  eCSSUnit_ViewportMax =
-      703,  // (float) larger of ViewportWidth and ViewportHeight
+  eCSSUnit_ViewportWidth = 700,   // (float) 1% of the width of the initial
+                                  // containing block (ICB)
+  eCSSUnit_ViewportHeight = 701,  // (float) 1% of the height of the ICB
+  eCSSUnit_ViewportMin = 702,     // (float) smaller of ViewportWidth and
+                                  // ViewportHeight
+  eCSSUnit_ViewportMax = 703,     // (float) larger of ViewportWidth and
+                                  // ViewportHeight
 
   // Font relative measure
-  eCSSUnit_EM = 800,  // (float) == current font size
-  eCSSUnit_XHeight =
-      801,  // (float) distance from top of lower case x to baseline
-  eCSSUnit_Char =
-      802,  // (float) number of characters, used for width with monospace font
-  eCSSUnit_RootEM = 803,  // (float) == root element font size
+  eCSSUnit_EM = 800,       // (float) == current font size
+  eCSSUnit_XHeight = 801,  // (float) distance from top of lower case x to
+                           // baseline
+  eCSSUnit_Char = 802,     // (float) number of characters, used for width with
+                           // monospace font
+  eCSSUnit_RootEM = 803,   // (float) == root element font size
 
   // Screen relative measure
   eCSSUnit_Point = 900,       // (float) 4/3 of a CSS pixel
   eCSSUnit_Inch = 901,        // (float) 96 CSS pixels
   eCSSUnit_Millimeter = 902,  // (float) 96/25.4 CSS pixels
   eCSSUnit_Centimeter = 903,  // (float) 96/2.54 CSS pixels
   eCSSUnit_Pica = 904,        // (float) 12 points == 16 CSS pixls
   eCSSUnit_Quarter = 905,     // (float) 96/101.6 CSS pixels
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -748,18 +748,17 @@ enum class StyleWhiteSpace : uint8_t {
 #define NS_STYLE_RUBY_ALIGN_START 0
 #define NS_STYLE_RUBY_ALIGN_CENTER 1
 #define NS_STYLE_RUBY_ALIGN_SPACE_BETWEEN 2
 #define NS_STYLE_RUBY_ALIGN_SPACE_AROUND 3
 
 // ruby-position, see nsStyleText
 #define NS_STYLE_RUBY_POSITION_OVER 0
 #define NS_STYLE_RUBY_POSITION_UNDER 1
-#define NS_STYLE_RUBY_POSITION_INTER_CHARACTER \
-  2 /* placeholder, not yet parsed */
+#define NS_STYLE_RUBY_POSITION_INTER_CHARACTER 2  // placeholder, not yet parsed
 
 // See nsStyleText
 #define NS_STYLE_TEXT_SIZE_ADJUST_NONE 0
 #define NS_STYLE_TEXT_SIZE_ADJUST_AUTO 1
 
 // See nsStyleText
 #define NS_STYLE_TEXT_ORIENTATION_MIXED 0
 #define NS_STYLE_TEXT_ORIENTATION_UPRIGHT 1
--- a/layout/style/nsStyleCoord.h
+++ b/layout/style/nsStyleCoord.h
@@ -178,18 +178,18 @@ class nsStyleCoord {
            (IsCalcUnit(aUnit) && !AsCalcValue(aValue)->mHasPercent);
   }
 
   bool ConvertsToLength() const { return ConvertsToLength(mUnit, mValue); }
 
   static nscoord ToLength(nsStyleUnit aUnit, nsStyleUnion aValue) {
     MOZ_ASSERT(ConvertsToLength(aUnit, aValue));
     if (IsCalcUnit(aUnit)) {
-      return AsCalcValue(aValue)
-          ->ToLength();  // Note: This asserts !mHasPercent
+      // Note: ToLength asserts !mHasPercent
+      return AsCalcValue(aValue)->ToLength();
     }
     MOZ_ASSERT(aUnit == eStyleUnit_Coord);
     return aValue.mInt;
   }
 
   nscoord ToLength() const { return ToLength(GetUnit(), mValue); }
 
   // Callers must verify IsCalcUnit before calling this function.
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -116,18 +116,17 @@ nsStyleFont::nsStyleFont(const nsPresCon
       mSize(ZoomText(aContext, mFont.size)),
       mFontSizeFactor(1.0),
       mFontSizeOffset(0),
       mFontSizeKeyword(NS_STYLE_FONT_SIZE_MEDIUM),
       mGenericID(kGenericFont_NONE),
       mScriptLevel(0),
       mMathVariant(NS_MATHML_MATHVARIANT_NONE),
       mMathDisplay(NS_MATHML_DISPLAYSTYLE_INLINE),
-      mMinFontSizeRatio(100)  // 100%
-      ,
+      mMinFontSizeRatio(100),  // 100%
       mExplicitLanguage(false),
       mAllowZoom(true),
       mScriptUnconstrainedSize(mSize),
       mScriptMinSize(nsPresContext::CSSTwipsToAppUnits(
           NS_POINTS_TO_TWIPS(NS_MATHML_DEFAULT_SCRIPT_MIN_SIZE_PT))),
       mScriptSizeMultiplier(NS_MATHML_DEFAULT_SCRIPT_SIZE_MULTIPLIER),
       mLanguage(GetLanguage(aContext)) {
   MOZ_COUNT_CTOR(nsStyleFont);
@@ -648,18 +647,17 @@ nsChangeHint nsStyleColumn::CalcDifferen
 
   return nsChangeHint(0);
 }
 
 // --------------------
 // nsStyleSVG
 //
 nsStyleSVG::nsStyleSVG(const nsPresContext* aContext)
-    : mFill(eStyleSVGPaintType_Color)  // Will be initialized to NS_RGB(0, 0, 0)
-      ,
+    : mFill(eStyleSVGPaintType_Color),  // Will be initialized to NS_RGB(0,0,0)
       mStroke(eStyleSVGPaintType_None),
       mStrokeDashoffset(0, nsStyleCoord::CoordConstructor),
       mStrokeWidth(nsPresContext::CSSPixelsToAppUnits(1),
                    nsStyleCoord::CoordConstructor),
       mFillOpacity(1.0f),
       mStrokeMiterlimit(4.0f),
       mStrokeOpacity(1.0f),
       mClipRule(StyleFillRule::Nonzero),
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -601,40 +601,37 @@ struct nsStyleImageLayers {
     typedef mozilla::StyleGeometryBox StyleGeometryBox;
     typedef mozilla::StyleImageLayerAttachment StyleImageLayerAttachment;
 
     nsStyleImage mImage;
     mozilla::Position mPosition;
     Size mSize;
     StyleGeometryBox mClip;
     MOZ_INIT_OUTSIDE_CTOR StyleGeometryBox mOrigin;
+
+    // This property is used for background layer only.
+    // For a mask layer, it should always be the initial value, which is
+    // StyleImageLayerAttachment::Scroll.
     StyleImageLayerAttachment mAttachment;
-    // background-only property
-    // This property is used for background layer
-    // only. For a mask layer, it should always
-    // be the initial value, which is
-    // StyleImageLayerAttachment::Scroll.
+
+    // This property is used for background layer only.
+    // For a mask layer, it should always be the initial value, which is
+    // NS_STYLE_BLEND_NORMAL.
     uint8_t mBlendMode;  // NS_STYLE_BLEND_*
-                         // background-only property
-                         // This property is used for background layer
-                         // only. For a mask layer, it should always
-                         // be the initial value, which is
-                         // NS_STYLE_BLEND_NORMAL.
+
+    // This property is used for mask layer only.
+    // For a background layer, it should always be the initial value, which is
+    // NS_STYLE_COMPOSITE_MODE_ADD.
     uint8_t mComposite;  // NS_STYLE_MASK_COMPOSITE_*
-                         // mask-only property
-                         // This property is used for mask layer only.
-                         // For a background layer, it should always
-                         // be the initial value, which is
-                         // NS_STYLE_COMPOSITE_MODE_ADD.
-    uint8_t mMaskMode;   // NS_STYLE_MASK_MODE_*
-                         // mask-only property
-                         // This property is used for mask layer only.
-                         // For a background layer, it should always
-                         // be the initial value, which is
-                         // NS_STYLE_MASK_MODE_MATCH_SOURCE.
+
+    // mask-only property. This property is used for mask layer only. For a
+    // background layer, it should always be the initial value, which is
+    // NS_STYLE_MASK_MODE_MATCH_SOURCE.
+    uint8_t mMaskMode;  // NS_STYLE_MASK_MODE_*
+
     Repeat mRepeat;
 
     // This constructor does not initialize mRepeat or mOrigin and Initialize()
     // must be called to do that.
     Layer();
     ~Layer();
 
     // Initialize mRepeat and mOrigin by specified layer type
@@ -657,19 +654,27 @@ struct nsStyleImageLayers {
     // An equality operator that compares the images using URL-equality
     // rather than pointer-equality.
     bool operator==(const Layer& aOther) const;
     bool operator!=(const Layer& aOther) const { return !(*this == aOther); }
   };
 
   // The (positive) number of computed values of each property, since
   // the lengths of the lists are independent.
-  uint32_t mAttachmentCount, mClipCount, mOriginCount, mRepeatCount,
-      mPositionXCount, mPositionYCount, mImageCount, mSizeCount, mMaskModeCount,
-      mBlendModeCount, mCompositeCount;
+  uint32_t mAttachmentCount;
+  uint32_t mClipCount;
+  uint32_t mOriginCount;
+  uint32_t mRepeatCount;
+  uint32_t mPositionXCount;
+  uint32_t mPositionYCount;
+  uint32_t mImageCount;
+  uint32_t mSizeCount;
+  uint32_t mMaskModeCount;
+  uint32_t mBlendModeCount;
+  uint32_t mCompositeCount;
 
   // Layers are stored in an array, matching the top-to-bottom order in
   // which they are specified in CSS.  The number of layers to be used
   // should come from the background-image property.  We create
   // additional |Layer| objects for *any* property, not just
   // background-image.  This means that the bottommost layer that
   // callers in layout care about (which is also the one whose
   // background-clip applies to the background-color) may not be last
@@ -1940,25 +1945,27 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   RefPtr<nsCSSValueSharedList> mIndividualTransform;
   mozilla::UniquePtr<mozilla::StyleMotion> mMotion;
 
   nsStyleCoord mTransformOrigin[3];    // percent, coord, calc, 3rd param is
                                        // coord, calc only
   nsStyleCoord mChildPerspective;      // none, coord
   nsStyleCoord mPerspectiveOrigin[2];  // percent, coord, calc
 
-  nsStyleCoord
-      mVerticalAlign;  // coord, percent, calc, enum (NS_STYLE_VERTICAL_ALIGN_*)
+  nsStyleCoord mVerticalAlign;  // coord, percent, calc, enum
+                                // (NS_STYLE_VERTICAL_ALIGN_*)
 
   nsStyleAutoArray<mozilla::StyleTransition> mTransitions;
 
   // The number of elements in mTransitions that are not from repeating
   // a list due to another property being longer.
-  uint32_t mTransitionTimingFunctionCount, mTransitionDurationCount,
-      mTransitionDelayCount, mTransitionPropertyCount;
+  uint32_t mTransitionTimingFunctionCount;
+  uint32_t mTransitionDurationCount;
+  uint32_t mTransitionDelayCount;
+  uint32_t mTransitionPropertyCount;
 
   nsCSSPropertyID GetTransitionProperty(uint32_t aIndex) const {
     return mTransitions[aIndex % mTransitionPropertyCount].GetProperty();
   }
   float GetTransitionDelay(uint32_t aIndex) const {
     return mTransitions[aIndex % mTransitionDelayCount].GetDelay();
   }
   float GetTransitionDuration(uint32_t aIndex) const {
@@ -1975,20 +1982,24 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
                0.0f) +
            mTransitions[aIndex % mTransitionDelayCount].GetDelay();
   }
 
   nsStyleAutoArray<mozilla::StyleAnimation> mAnimations;
 
   // The number of elements in mAnimations that are not from repeating
   // a list due to another property being longer.
-  uint32_t mAnimationTimingFunctionCount, mAnimationDurationCount,
-      mAnimationDelayCount, mAnimationNameCount, mAnimationDirectionCount,
-      mAnimationFillModeCount, mAnimationPlayStateCount,
-      mAnimationIterationCountCount;
+  uint32_t mAnimationTimingFunctionCount;
+  uint32_t mAnimationDurationCount;
+  uint32_t mAnimationDelayCount;
+  uint32_t mAnimationNameCount;
+  uint32_t mAnimationDirectionCount;
+  uint32_t mAnimationFillModeCount;
+  uint32_t mAnimationPlayStateCount;
+  uint32_t mAnimationIterationCountCount;
 
   nsAtom* GetAnimationName(uint32_t aIndex) const {
     return mAnimations[aIndex % mAnimationNameCount].GetName();
   }
   float GetAnimationDelay(uint32_t aIndex) const {
     return mAnimations[aIndex % mAnimationDelayCount].GetDelay();
   }
   float GetAnimationDuration(uint32_t aIndex) const {
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -479,18 +479,21 @@ struct TextRenderedRun {
    * GetTransformFromRunUserSpaceToUserSpace is that when calling in to
    * nsTextFrame::PaintText, it will already take into account any left clip
    * edge (that is, it doesn't just apply a visual clip to the rendered text, it
    * shifts the glyphs over so that they are painted with their left edge at the
    * x coordinate passed in to it). Thus we need to account for this in our
    * transform.
    *
    *
-   * Assume that we have <text x="100" y="100" rotate="0 0 1 0 0
-   * 1">abcdef</text>. This would result in four text rendered runs:
+   * Assume that we have:
+   *
+   *   <text x="100" y="100" rotate="0 0 1 0 0 * 1">abcdef</text>.
+   *
+   * This would result in four text rendered runs:
    *
    *   - one for "ab"
    *   - one for "c"
    *   - one for "de"
    *   - one for "f"
    *
    * Assume now that we are painting the third TextRenderedRun.  It will have
    * a left clip edge that is the sum of the advances of "abc", and it will
--- a/layout/svg/nsSVGDisplayableFrame.h
+++ b/layout/svg/nsSVGDisplayableFrame.h
@@ -99,25 +99,26 @@ class nsSVGDisplayableFrame : public nsQ
   // to update and then invalidate their cached bounds. This method is not
   // called until after the nsSVGOuterSVGFrame has had its initial reflow
   // (i.e. once the SVG viewport dimensions are known). It should also only
   // be called by nsSVGOuterSVGFrame during its reflow.
   virtual void ReflowSVG() = 0;
 
   // Flags to pass to NotifySVGChange:
   //
-  // DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when
-  //                           updating the descendant frames of a clipPath,
-  //                           mask, pattern or marker frame (or other similar
-  //                           NS_FRAME_IS_NONDISPLAY frame) immediately
-  //                           prior to painting that frame's descendants.
-  // TRANSFORM_CHANGED     - the current transform matrix for this frame has
-  // changed COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate
-  // context has
-  //                           changed (percentage lengths must be reevaluated)
+  // DO_NOT_NOTIFY_RENDERING_OBSERVERS:
+  //   this should only be used when updating the descendant frames of a
+  //   clipPath, mask, pattern or marker frame (or other similar
+  //   NS_FRAME_IS_NONDISPLAY frame) immediately prior to painting that frame's
+  //   descendants.
+  // TRANSFORM_CHANGED:
+  //   the current transform matrix for this frame has changed
+  // COORD_CONTEXT_CHANGED:
+  //   the dimensions of this frame's coordinate context has changed (percentage
+  //   lengths must be reevaluated)
   enum SVGChangedFlags {
     TRANSFORM_CHANGED = 0x01,
     COORD_CONTEXT_CHANGED = 0x02,
     FULL_ZOOM_CHANGED = 0x04
   };
   /**
    * This is called on a frame when there has been a change to one of its
    * ancestors that might affect the frame too. SVGChangedFlags are passed
--- a/layout/svg/nsSVGOuterSVGFrame.h
+++ b/layout/svg/nsSVGOuterSVGFrame.h
@@ -171,17 +171,17 @@ class nsSVGOuterSVGFrame final : public 
    */
   bool IsRootOfImage();
 
   // This is temporary until display list based invalidation is implemented for
   // SVG.
   // A hash-set containing our nsSVGForeignObjectFrame descendants. Note we use
   // a hash-set to avoid the O(N^2) behavior we'd get tearing down an SVG frame
   // subtree if we were to use a list (see bug 381285 comment 20).
-  nsAutoPtr<nsTHashtable<nsPtrHashKey<nsSVGForeignObjectFrame> > >
+  nsAutoPtr<nsTHashtable<nsPtrHashKey<nsSVGForeignObjectFrame>>>
       mForeignObjectHash;
 
   nsRegion mInvalidRegion;
 
   float mFullZoom;
 
   bool mViewportInitialized;
   bool mIsRootContent;
--- a/layout/tables/celldata.h
+++ b/layout/tables/celldata.h
@@ -105,23 +105,23 @@ class CellData {
    *            is only a spanned entry
    */
   nsTableCellFrame* GetCellFrame() const;
 
  private:
   friend class nsCellMap;
   friend class BCCellData;
 
-  /** constructor.
+  /**
+   * Implemented in nsCellMap.cpp
+   *
    * @param aOrigCell  the table cell frame which will be stored in mOrigCell.
    */
-  explicit CellData(
-      nsTableCellFrame* aOrigCell);  // implemented in nsCellMap.cpp
+  explicit CellData(nsTableCellFrame* aOrigCell);
 
-  /** destructor */
   ~CellData();  // implemented in nsCellMap.cpp
 
  protected:
   // this union relies on the assumption that an object (not primitive type)
   // does not start on an odd bit boundary. If mSpan is 0 then mOrigCell is in
   // effect and the data does not represent a span. If mSpan is 1, then mBits is
   // in effect and the data represents a span. mBits must match the size of
   // mOrigCell on both 32- and 64-bit platforms.
--- a/layout/tables/nsTableColFrame.h
+++ b/layout/tables/nsTableColFrame.h
@@ -15,24 +15,26 @@
 
 class nsTableColFrame final : public nsSplittableFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsTableColFrame)
 
   enum {
     eWIDTH_SOURCE_NONE = 0,  // no cell has contributed to the width style
     eWIDTH_SOURCE_CELL = 1,  // a cell specified a width
-    eWIDTH_SOURCE_CELL_WITH_SPAN =
-        2  // a cell implicitly specified a width via colspan
+    eWIDTH_SOURCE_CELL_WITH_SPAN = 2  // a cell implicitly specified a width via
+                                      // colspan
   };
 
   nsTableColType GetColType() const;
   void SetColType(nsTableColType aType);
 
-  /** instantiate a new instance of nsTableRowFrame.
+  /**
+   * instantiate a new instance of nsTableRowFrame.
+   *
    * @param aPresShell the pres shell for this frame
    *
    * @return           the frame that was created
    */
   friend nsTableColFrame* NS_NewTableColFrame(nsIPresShell* aPresShell,
                                               ComputedStyle* aContext);
 
   // nsIFrame overrides
--- a/layout/tables/nsTableColGroupFrame.h
+++ b/layout/tables/nsTableColGroupFrame.h
@@ -16,17 +16,19 @@ class nsTableColFrame;
 /**
  * nsTableColGroupFrame
  * data structure to maintain information about a single table cell's frame
  */
 class nsTableColGroupFrame final : public nsContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsTableColGroupFrame)
 
-  /** instantiate a new instance of nsTableRowFrame.
+  /**
+   * instantiate a new instance of nsTableRowFrame.
+   *
    * @param aPresShell the pres shell for this frame
    *
    * @return           the frame that was created
    */
   friend nsTableColGroupFrame* NS_NewTableColGroupFrame(
       nsIPresShell* aPresShell, ComputedStyle* aStyle);
 
   // nsIFrame overrides
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1824,72 +1824,76 @@ void nsTableFrame::RequestSpecialBSizeRe
 
 /******************************************************************************************
  * Before reflow, intrinsic inline-size calculation is done using GetMinISize
  * and GetPrefISize.  This used to be known as pass 1 reflow.
  *
  * After the intrinsic isize calculation, the table determines the
  * column widths using BalanceColumnISizes() and
  * then reflows each child again with a constrained avail isize. This reflow is
- *referred to as the pass 2 reflow.
+ * referred to as the pass 2 reflow.
  *
  * A special bsize reflow (pass 3 reflow) can occur during an initial or resize
- *reflow if (a) a row group, row, cell, or a frame inside a cell has a percent
- *bsize but no computed bsize or (b) in paginated mode, a table has a bsize. (a)
- *supports percent nested tables contained inside cells whose bsizes aren't
- *known until after the pass 2 reflow. (b) is necessary because the table cannot
- *split until after the pass 2 reflow. The mechanics of the special bsize reflow
- *(variety a) are as follows:
+ * reflow if (a) a row group, row, cell, or a frame inside a cell has a percent
+ * bsize but no computed bsize or (b) in paginated mode, a table has a bsize.
+ * (a) supports percent nested tables contained inside cells whose bsizes aren't
+ * known until after the pass 2 reflow. (b) is necessary because the table
+ * cannot split until after the pass 2 reflow. The mechanics of the special
+ * bsize reflow (variety a) are as follows:
  *
  * 1) Each table related frame (table, row group, row, cell) implements
- *NeedsSpecialReflow() to indicate that it should get the reflow. It does this
- *when it has a percent bsize but no computed bsize by calling
- *CheckRequestSpecialBSizeReflow(). This method calls
+ *    NeedsSpecialReflow() to indicate that it should get the reflow. It does
+ *    this when it has a percent bsize but no computed bsize by calling
+ *    CheckRequestSpecialBSizeReflow(). This method calls
  *    RequestSpecialBSizeReflow() which calls SetNeedSpecialReflow() on its
- *ancestors until it reaches the containing table and calls
- *SetNeedToInitiateSpecialReflow() on it. For percent bsize frames inside cells,
- *during DidReflow(), the cell's NotifyPercentBSize() is called (the cell is the
- *reflow state's mPercentBSizeObserver in this case). NotifyPercentBSize() calls
- *RequestSpecialBSizeReflow().
+ *    ancestors until it reaches the containing table and calls
+ *    SetNeedToInitiateSpecialReflow() on it. For percent bsize frames inside
+ *    cells, during DidReflow(), the cell's NotifyPercentBSize() is called
+ *    (the cell is the reflow state's mPercentBSizeObserver in this case).
+ *    NotifyPercentBSize() calls RequestSpecialBSizeReflow().
  *
  * XXX (jfkthame) This comment appears to be out of date; it refers to
- *methods/flags that are no longer present in the code. 2) After the pass 2
- *reflow, if the table's NeedToInitiateSpecialReflow(true) was called, it will
- *do the special bsize reflow, setting the reflow state's
- *mFlags.mSpecialBSizeReflow to true and mSpecialHeightInitiator to itself. It
- *won't do this if IsPrematureSpecialHeightReflow() returns true because in that
- *case another special bsize reflow will be coming along with the containing
- *table as the mSpecialHeightInitiator. It is only relevant to do the reflow
- *when the mSpecialHeightInitiator is the containing table, because if it is a
- *remote ancestor, then appropriate bsizes will not be known.
+ * methods/flags that are no longer present in the code.
+ *
+ * 2) After the pass 2 reflow, if the table's NeedToInitiateSpecialReflow(true)
+ *    was called, it will do the special bsize reflow, setting the reflow
+ *    state's mFlags.mSpecialBSizeReflow to true and mSpecialHeightInitiator to
+ *    itself. It won't do this if IsPrematureSpecialHeightReflow() returns true
+ *    because in that case another special bsize reflow will be coming along
+ *    with the containing table as the mSpecialHeightInitiator. It is only
+ *    relevant to do the reflow when the mSpecialHeightInitiator is the
+ *    containing table, because if it is a remote ancestor, then appropriate
+ *    bsizes will not be known.
  *
  * 3) Since the bsizes of the table, row groups, rows, and cells was determined
- *during the pass 2 reflow, they return their last desired sizes during the
- *special bsize reflow. The reflow only permits percent bsize frames inside the
- *cells to resize based on the cells bsize and that bsize was determined during
- *the pass 2 reflow.
+ *    during the pass 2 reflow, they return their last desired sizes during the
+ *    special bsize reflow. The reflow only permits percent bsize frames inside
+ *    the cells to resize based on the cells bsize and that bsize was
+ *    determined during the pass 2 reflow.
  *
  * So, in the case of deeply nested tables, all of the tables that were told to
- *initiate a special reflow will do so, but if a table is already in a special
- *reflow, it won't inititate the reflow until the current initiator is its
- *containing table. Since these reflows are only received by frames that need
- *them and they don't cause any rebalancing of tables, the extra overhead is
- *minimal.
+ * initiate a special reflow will do so, but if a table is already in a special
+ * reflow, it won't inititate the reflow until the current initiator is its
+ * containing table. Since these reflows are only received by frames that need
+ * them and they don't cause any rebalancing of tables, the extra overhead is
+ * minimal.
  *
  * The type of special reflow that occurs during printing (variety b) follows
- *the same mechanism except that all frames will receive the reflow even if they
- *don't really need them.
+ * the same mechanism except that all frames will receive the reflow even if
+ * they don't really need them.
  *
  * Open issues with the special bsize reflow:
  *
  * 1) At some point there should be 2 kinds of special bsize reflows because (a)
- *and (b) above are really quite different. This would avoid unnecessary reflows
- *during printing. 2) When a cell contains frames whose percent bsizes > 100%,
- *there is data loss (see bug 115245). However, this can also occur if a cell
- *has a fixed bsize and there is no special bsize reflow.
+ *    and (b) above are really quite different. This would avoid unnecessary
+ *    reflows during printing.
+ *
+ * 2) When a cell contains frames whose percent bsizes > 100%, there is data
+ *    loss (see bug 115245). However, this can also occur if a cell has a fixed
+ *    bsize and there is no special bsize reflow.
  *
  * XXXldb Special bsize reflow should really be its own method, not
  * part of nsIFrame::Reflow.  It should then call nsIFrame::Reflow on
  * the contents of the cells to do the necessary block-axis resizing.
  *
  ******************************************************************************************/
 
 /* Layout the entire inner table. */
@@ -4055,18 +4059,18 @@ bool nsTableFrame::ColumnHasCellSpacingB
  * Collapsing Borders
  *
  *  The CSS spec says to resolve border conflicts in this order:
  *  1) any border with the style HIDDEN wins
  *  2) the widest border with a style that is not NONE wins
  *  3) the border styles are ranked in this order, highest to lowest precedence:
  *     double, solid, dashed, dotted, ridge, outset, groove, inset
  *  4) borders that are of equal width and style (differ only in color) have
- *this precedence: cell, row, rowgroup, col, colgroup, table 5) if all border
- *styles are NONE, then that's the computed border style.
+ *     this precedence: cell, row, rowgroup, col, colgroup, table
+ *  5) if all border styles are NONE, then that's the computed border style.
  *******************************************************************************/
 
 #ifdef DEBUG
 #define VerifyNonNegativeDamageRect(r)                       \
   NS_ASSERTION((r).StartCol() >= 0, "negative col index");   \
   NS_ASSERTION((r).StartRow() >= 0, "negative row index");   \
   NS_ASSERTION((r).ColCount() >= 0, "negative cols damage"); \
   NS_ASSERTION((r).RowCount() >= 0, "negative rows damage");
@@ -5544,48 +5548,57 @@ BCCellBorder BCMapCellInfo::GetBStartInt
 
 /* XXX This comment is still written in physical (horizontal-tb) terms.
 
    Here is the order for storing border edges in the cell map as a cell is
    processed. There are n=colspan top and bottom border edges per cell and
    n=rowspan left and right border edges per cell.
 
    1) On the top edge of the table, store the top edge. Never store the top edge
-   otherwise, since a bottom edge from a cell above will take care of it. 2) On
-   the left edge of the table, store the left edge. Never store the left edge
-   othewise, since a right edge from a cell to the left will take care of it. 3)
-   Store the right edge (or edges if a row span) 4) Store the bottom edge (or
-   edges if a col span)
+      otherwise, since a bottom edge from a cell above will take care of it.
+
+   2) On the left edge of the table, store the left edge. Never store the left
+      edge othewise, since a right edge from a cell to the left will take care
+      of it.
+
+   3) Store the right edge (or edges if a row span)
+
+   4) Store the bottom edge (or edges if a col span)
 
    Since corners are computed with only an array of BCCornerInfo indexed by the
    number-of-cols, corner calculations are somewhat complicated. Using an array
    with number-of-rows * number-of-col entries would simplify this, but at an
    extra in memory cost of nearly 12 bytes per cell map entry. Collapsing
    borders already have about an extra 8 byte per cell map entry overhead (this
    could be reduced to 4 bytes if we are willing to not store border widths in
    nsTableCellFrame), Here are the rules in priority order for storing cornes in
    the cell map as a cell is processed. top-left means the left endpoint of the
    border edge on the top of the cell. There are n=colspan top and bottom border
    edges per cell and n=rowspan left and right border edges per cell.
 
    1) On the top edge of the table, store the top-left corner, unless on the
-   left edge of the table. Never store the top-right corner, since it will get
-   stored as a right-top corner. 2) On the left edge of the table, store the
-   left-top corner. Never store the left-bottom corner, since it will get stored
-   as a bottom-left corner. 3) Store the right-top corner if (a) it is the top
-   right corner of the table or (b) it is not on the top edge of the table.
-   Never store the right-bottom corner since it will get stored as a
-      bottom-right corner.
+      left edge of the table. Never store the top-right corner, since it will
+      get stored as a right-top corner.
+
+   2) On the left edge of the table, store the left-top corner. Never store the
+      left-bottom corner, since it will get stored as a bottom-left corner.
+
+   3) Store the right-top corner if (a) it is the top right corner of the table
+      or (b) it is not on the top edge of the table. Never store the
+      right-bottom corner since it will get stored as a bottom-right corner.
+
    4) Store the bottom-right corner, if it is the bottom right corner of the
-   table. Never store it otherwise, since it will get stored as either a
-   right-top corner by a cell below or a bottom-left corner from a cell to the
-   right. 5) Store the bottom-left corner, if (a) on the bottom edge of the
-   table or (b) if the left edge hits the top side of a colspan in its interior.
-   Never store the corner otherwise, since it will get stored as a right-top
-   corner by a cell from below.
+      table. Never store it otherwise, since it will get stored as either a
+      right-top corner by a cell below or a bottom-left corner from a cell to
+      the right.
+
+   5) Store the bottom-left corner, if (a) on the bottom edge of the table or
+      (b) if the left edge hits the top side of a colspan in its interior.
+      Never store the corner otherwise, since it will get stored as a right-top
+      corner by a cell from below.
 
    XXX the BC-RTL hack - The correct fix would be a rewrite as described in bug
    203686. In order to draw borders in rtl conditions somehow correct, the
    existing structure which relies heavily on the assumption that the next cell
    sibling will be on the right side, has been modified. We flip the border
    during painting and during style lookup. Look for tableIsLTR for places where
    the flipping is done.
  */
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -93,18 +93,17 @@ class nsAutoPushCurrentTableItem {
  private:
   nsDisplayListBuilder* mBuilder;
   nsDisplayTableItem* mOldCurrentItem;
 #ifdef DEBUG
   nsDisplayTableItem* mPushedItem;
 #endif
 };
 
-/* ============================================================================
- */
+/* ========================================================================== */
 
 enum nsTableColType {
   eColContent = 0,            // there is real col content associated
   eColAnonymousCol = 1,       // the result of a span on a col
   eColAnonymousColGroup = 2,  // the result of a span on a col group
   eColAnonymousCell = 3       // the result of a cell alone
 };
 
@@ -126,17 +125,19 @@ class nsTableFrame : public nsContainerF
   NS_DECL_FRAMEARENA_HELPERS(nsTableFrame)
 
   typedef nsTArray<nsIFrame*> FrameTArray;
   NS_DECLARE_FRAME_PROPERTY_DELETABLE(PositionedTablePartArray, FrameTArray)
 
   /** nsTableWrapperFrame has intimate knowledge of the inner table frame */
   friend class nsTableWrapperFrame;
 
-  /** instantiate a new instance of nsTableRowFrame.
+  /**
+   * instantiate a new instance of nsTableRowFrame.
+   *
    * @param aPresShell the pres shell for this frame
    *
    * @return           the frame that was created
    */
   friend nsTableFrame* NS_NewTableFrame(nsIPresShell* aPresShell,
                                         ComputedStyle* aStyle);
 
   /** sets defaults for table-specific style.
@@ -317,26 +318,33 @@ class nsTableFrame : public nsContainerF
   /**
    * A copy of nsFrame::ShrinkWidthToFit that calls a different
    * GetPrefISize, since tables have two different ones.
    */
   nscoord TableShrinkISizeToFit(gfxContext* aRenderingContext,
                                 nscoord aWidthInCB);
 
   // XXXldb REWRITE THIS COMMENT!
-  /** inner tables are reflowed in two steps.
+  // clang-format off
+  /**
+   * Inner tables are reflowed in two steps.
    * <pre>
-   * if mFirstPassValid is false, this is our first time through since content
-   * was last changed set pass to 1 do pass 1 get min/max info for all cells in
-   * an infinite space do column balancing set mFirstPassValid to true do pass 2
+   * if mFirstPassValid is false, this is our first time through since content was last changed
+   *   set pass to 1
+   *   do pass 1
+   *     get min/max info for all cells in an infinite space
+   *   do column balancing
+   *   set mFirstPassValid to true
+   *   do pass 2
    *     use column widths to Reflow cells
    * </pre>
    *
    * @see nsIFrame::Reflow
    */
+  // clang-format on
   virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
                       const ReflowInput& aReflowInput,
                       nsReflowStatus& aStatus) override;
 
   void ReflowTable(ReflowOutput& aDesiredSize, const ReflowInput& aReflowInput,
                    nscoord aAvailBSize, nsIFrame*& aLastChildReflowed,
                    nsReflowStatus& aStatus);
 
@@ -834,36 +842,36 @@ class nsTableFrame : public nsContainerF
   AutoTArray<nsTableColFrame*, 8> mColFrames;
 
   struct TableBits {
     uint32_t mHaveReflowedColGroups : 1;  // have the col groups gotten their
                                           // initial reflow
     uint32_t mHasPctCol : 1;        // does any cell or col have a pct width
     uint32_t mCellSpansPctCol : 1;  // does any cell span a col with a pct width
                                     // (or containing a cell with a pct width)
-    uint32_t
-        mIsBorderCollapse : 1;  // border collapsing model vs. separate model
+    uint32_t mIsBorderCollapse : 1;  // border collapsing model vs. separate
+                                     // model
     uint32_t mRowInserted : 1;
     uint32_t mNeedToCalcBCBorders : 1;
     uint32_t mGeometryDirty : 1;
     uint32_t mIStartContBCBorder : 8;
     uint32_t mNeedToCollapse : 1;  // rows, cols that have visibility:collapse
                                    // need to be collapsed
     uint32_t mResizedColumns : 1;  // have we resized columns since last reflow?
     uint32_t mNeedToCalcHasBCBorders : 1;
     uint32_t mHasBCBorders : 1;
   } mBits;
 
   std::map<int32_t, int32_t> mDeletedRowIndexRanges;  // maintains ranges of row
                                                       // indices of deleted rows
-  nsTableCellMap*
-      mCellMap;  // maintains the relationships between rows, cols, and cells
-  nsITableLayoutStrategy*
-      mTableLayoutStrategy;  // the layout strategy for this frame
-  nsFrameList mColGroups;    // the list of colgroup frames
+  nsTableCellMap* mCellMap;  // maintains the relationships between rows, cols,
+                             // and cells
+  nsITableLayoutStrategy* mTableLayoutStrategy;  // the layout strategy for this
+                                                 // frame
+  nsFrameList mColGroups;                        // the list of colgroup frames
 };
 
 inline bool nsTableFrame::IsRowGroup(mozilla::StyleDisplay aDisplayType) const {
   return mozilla::StyleDisplay::TableHeaderGroup == aDisplayType ||
          mozilla::StyleDisplay::TableFooterGroup == aDisplayType ||
          mozilla::StyleDisplay::TableRowGroup == aDisplayType;
 }
 
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -75,18 +75,22 @@ class nsTableRowFrame : public nsContain
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override;
 
   // Implemented in nsTableCellFrame.h, because it needs to know about the
   // nsTableCellFrame class, but we can't include nsTableCellFrame.h here.
   inline nsTableCellFrame* GetFirstCell() const;
 
   /** calls Reflow for all of its child cells.
+   *
    * Cells with rowspan=1 are all set to the same height and stacked
-   * horizontally. <P> Cells are not split unless absolutely necessary. <P>
+   * horizontally.
+   *
+   * Cells are not split unless absolutely necessary.
+   *
    * Cells are resized in nsTableFrame::BalanceColumnWidths and
    * nsTableFrame::ShrinkWrapChildren
    *
    * @param aDesiredSize width set to width of the sum of the cells, height set
    * to height of cells with rowspan=1.
    *
    * @see nsIFrame::Reflow
    * @see nsTableFrame::BalanceColumnWidths
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -70,19 +70,22 @@ class nsTableRowGroupFrame final : publi
 
   virtual nsMargin GetUsedMargin() const override;
   virtual nsMargin GetUsedBorder() const override;
   virtual nsMargin GetUsedPadding() const override;
 
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override;
 
-  /** calls Reflow for all of its child rows.
+  /**
+   * Calls Reflow for all of its child rows.
+   *
    * Rows are all set to the same isize and stacked in the block direction.
-   * <P> rows are not split unless absolutely necessary.
+   *
+   * Rows are not split unless absolutely necessary.
    *
    * @param aDesiredSize isize set to isize of rows, bsize set to
    *                     sum of bsize of rows that fit in AvailableBSize.
    *
    * @see nsIFrame::Reflow
    */
   virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
                       const ReflowInput& aReflowInput,
@@ -218,21 +221,20 @@ class nsTableRowGroupFrame final : publi
    *                       frame and the index is at least aStartLine.
    *                       -1 if the frame cannot be found.
    */
   virtual int32_t FindLineContaining(nsIFrame* aFrame,
                                      int32_t aStartLine = 0) override;
 
   /** Find the orginating cell frame on a row that is the nearest to the
    * inline-dir coordinate of aPos.
-   * @param aLineNumber          - the index of the row relative to the row
-   * group
-   * @param aPos                 - coordinate in twips relative to the
-   *                               origin of the row group
-   * @param aFrameFound          - pointer to the cellframe
+   * @param aLineNumber        - the index of the row relative to the row group
+   * @param aPos               - coordinate in twips relative to the
+   *                             origin of the row group
+   * @param aFrameFound        - pointer to the cellframe
    * @param aPosIsBeforeFirstFrame - the point is before the first originating
    *                               cellframe
    * @param aPosIsAfterLastFrame   - the point is after the last originating
    *                               cellframe
    */
   NS_IMETHOD FindFrameAt(int32_t aLineNumber, nsPoint aPos,
                          nsIFrame** aFrameFound, bool* aPosIsBeforeFirstFrame,
                          bool* aPosIsAfterLastFrame) override;
--- a/layout/xul/BoxObject.h
+++ b/layout/xul/BoxObject.h
@@ -77,18 +77,17 @@ class BoxObject : public nsPIBoxObject, 
   Element* GetFirstChild();
   Element* GetLastChild();
   Element* GetNextSibling();
   Element* GetPreviousSibling();
 
  protected:
   virtual ~BoxObject();
 
-  nsAutoPtr<nsInterfaceHashtable<nsStringHashKey, nsISupports> >
-      mPropertyTable;  //[OWNER]
+  nsAutoPtr<nsInterfaceHashtable<nsStringHashKey, nsISupports>> mPropertyTable;
 
   Element* mContent;  // [WEAK]
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -9,22 +9,27 @@
 // Netscape Communications
 //
 // See documentation in associated header file
 //
 
 // How boxes layout
 // ----------------
 // Boxes layout a bit differently than html. html does a bottom up layout. Where
-// boxes do a top down. 1) First thing a box does it goes out and askes each
-// child for its min, max, and preferred sizes. 2) It then adds them up to
-// determine its size. 3) If the box was asked to layout it self intrinically it
-// will layout its children at their preferred size
-//    otherwise it will layout the child at the size it was told to. It will
-//    squeeze or stretch its children if Necessary.
+// boxes do a top down.
+//
+// 1) First thing a box does it goes out and askes each child for its min, max,
+//    and preferred sizes.
+//
+// 2) It then adds them up to determine its size.
+//
+// 3) If the box was asked to layout it self intrinically it will layout its
+//    children at their preferred size otherwise it will layout the child at
+//    the size it was told to. It will squeeze or stretch its children if
+//    Necessary.
 //
 // However there is a catch. Some html components like block frames can not
 // determine their preferred size. this is their size if they were laid out
 // intrinsically. So the box will flow the child to determine this can cache the
 // value.
 
 // Boxes and Incremental Reflow
 // ----------------------------
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -164,20 +164,20 @@ void nsImageBoxFrame::DestroyFrom(nsIFra
                                           &mRequestRegistered);
 
     mImageRequest->UnlockImage();
 
     // Release image loader first so that it's refcnt can go to zero
     mImageRequest->CancelAndForgetObserver(NS_ERROR_FAILURE);
   }
 
-  if (mListener)
-    reinterpret_cast<nsImageBoxListener*>(mListener.get())
-        ->ClearFrame();  // set the frame to null so we don't send messages to a
-                         // dead object.
+  if (mListener) {
+    // set the frame to null so we don't send messages to a dead object.
+    reinterpret_cast<nsImageBoxListener*>(mListener.get())->ClearFrame();
+  }
 
   nsLeafBoxFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
 }
 
 void nsImageBoxFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
                            nsIFrame* aPrevInFlow) {
   if (!mListener) {
     RefPtr<nsImageBoxListener> listener = new nsImageBoxListener(this);
--- a/layout/xul/nsMenuBarFrame.h
+++ b/layout/xul/nsMenuBarFrame.h
@@ -46,18 +46,19 @@ class nsMenuBarFrame final : public nsBo
 
   NS_IMETHOD SetActive(bool aActiveFlag) override;
 
   virtual bool IsMenuBar() override { return true; }
   virtual bool IsContextMenu() override { return false; }
   virtual bool IsActive() override { return mIsActive; }
   virtual bool IsMenu() override { return false; }
   virtual bool IsOpen() override {
+    // menubars are considered always open
     return true;
-  }  // menubars are considered always open
+  }
 
   bool IsMenuOpen() { return mCurrentMenu && mCurrentMenu->IsOpen(); }
 
   void InstallKeyboardNavigator();
   void RemoveKeyboardNavigator();
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override;
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -874,18 +874,17 @@ void nsMenuFrame::UpdateMenuSpecialState
   while (sib) {
     nsMenuFrame* menu = do_QueryFrame(sib);
     if (sib != this) {
       if (menu && menu->GetMenuType() == eMenuType_Radio && menu->IsChecked() &&
           menu->GetRadioGroupName() == mGroupName) {
         /* uncheck the old item */
         sib->GetContent()->AsElement()->UnsetAttr(kNameSpaceID_None,
                                                   nsGkAtoms::checked, true);
-        /* XXX in DEBUG, check to make sure that there aren't two checked items
-         */
+        // XXX in DEBUG, check to make sure that there aren't two checked items
         return;
       }
     }
     sib = nsXULPopupManager::GetNextMenuItem(GetParent(), menu, true, true);
     if (sib == firstMenuItem) {
       break;
     }
   }
--- a/layout/xul/nsMenuPopupFrame.h
+++ b/layout/xul/nsMenuPopupFrame.h
@@ -183,18 +183,19 @@ class nsMenuPopupFrame final : public ns
                             bool aFromKey) override;
 
   // as popups are opened asynchronously, the popup pending state is used to
   // prevent multiple requests from attempting to open the same popup twice
   nsPopupState PopupState() { return mPopupState; }
   void SetPopupState(nsPopupState aPopupState) { mPopupState = aPopupState; }
 
   NS_IMETHOD SetActive(bool aActiveFlag) override {
+    // We don't care.
     return NS_OK;
-  }  // We don't care.
+  }
   virtual bool IsActive() override { return false; }
   virtual bool IsMenuBar() override { return false; }
 
   /*
    * When this popup is open, should clicks outside of it be consumed?
    * Return true if the popup should rollup on an outside click,
    * but consume that click so it can't be used for anything else.
    * Return false to allow clicks outside the popup to activate content
--- a/layout/xul/nsScrollbarFrame.cpp
+++ b/layout/xul/nsScrollbarFrame.cpp
@@ -278,29 +278,28 @@ int32_t nsScrollbarFrame::MoveToNewPosit
     }
   }
   content->UnsetAttr(kNameSpaceID_None, nsGkAtoms::smooth, false);
   return curpos;
 }
 
 nsresult nsScrollbarFrame::CreateAnonymousContent(
     nsTArray<ContentInfo>& aElements) {
-  // <xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement"
-  // xbl:inherits="curpos,maxpos,disabled"/> <xul:scrollbarbutton
-  // sbattr="scrollbar-down-top" type="increment"
-  // xbl:inherits="curpos,maxpos,disabled"/> <xul:slider flex="1"
-  // xbl:inherits="disabled,curpos,maxpos,pageincrement,increment,orient">
-  //   <xul:thumb sbattr="scrollbar-thumb"
-  //   xbl:inherits="orient,collapsed=disabled"
+  // clang-format off
+
+  // <xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement" xbl:inherits="curpos,maxpos,disabled"/>
+  // <xul:scrollbarbutton sbattr="scrollbar-down-top" type="increment" xbl:inherits="curpos,maxpos,disabled"/>
+  // <xul:slider flex="1" xbl:inherits="disabled,curpos,maxpos,pageincrement,increment,orient">
+  //   <xul:thumb sbattr="scrollbar-thumb" xbl:inherits="orient,collapsed=disabled"
   //              align="center" pack="center"/>
   // </xul:slider>
-  // <xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement"
-  // xbl:inherits="curpos,maxpos,disabled"/> <xul:scrollbarbutton
-  // sbattr="scrollbar-down-bottom" type="increment"
-  // xbl:inherits="curpos,maxpos,disabled"/>
+  // <xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" xbl:inherits="curpos,maxpos,disabled"/>
+  // <xul:scrollbarbutton sbattr="scrollbar-down-bottom" type="increment" xbl:inherits="curpos,maxpos,disabled"/>
+
+  // clang-format on
 
   nsNodeInfoManager* nodeInfoManager = mContent->NodeInfo()->NodeInfoManager();
 
   Element* el(GetContent()->AsElement());
 
   // If there are children already in the node, don't create any anonymous
   // content (this only apply to crashtests/369038-1.xhtml)
   if (el->HasChildren()) {
--- a/layout/xul/nsXULPopupManager.h
+++ b/layout/xul/nsXULPopupManager.h
@@ -472,18 +472,18 @@ class nsXULPopupManager final : public n
 
   /*
    * Hide a popup aPopup. If the popup is in a <menu>, then also inform the
    * menu that the popup is being hidden.
    *
    * aHideChain - true if the entire chain of menus should be closed. If false,
    *              only this popup is closed.
    * aDeselectMenu - true if the parent <menu> of the popup should be
-   * deselected. This will be false when the menu is closed by pressing the
-   *                 Escape key.
+   *                 deselected. This will be false when the menu is closed by
+   *                 pressing the Escape key.
    * aAsynchronous - true if the first popuphiding event should be sent
    *                 asynchrously. This should be true if HidePopup is called
    *                 from a frame.
    * aIsCancel - true if this popup is hiding due to being cancelled.
    * aLastPopup - optional popup to close last when hiding a chain of menus.
    *              If null, then all popups will be closed.
    */
   void HidePopup(nsIContent* aPopup, bool aHideChain, bool aDeselectMenu,
--- a/layout/xul/tree/nsTreeBodyFrame.h
+++ b/layout/xul/tree/nsTreeBodyFrame.h
@@ -468,17 +468,17 @@ class nsTreeBodyFrame final : public nsL
    * that is used to expose the information structures described by method
    * arguments via a property bag.
    *
    * @param aStartRow  the start index of invalidated rows, -1 means that
    *                   columns have been invalidated only
    * @param aEndRow    the end index of invalidated rows, -1 means that columns
    *                   have been invalidated only
    * @param aStartCol  the start invalidated column, nullptr means that only
-   * rows have been invalidated
+   *                   rows have been invalidated
    * @param aEndCol    the end invalidated column, nullptr means that rows have
    *                   been invalidated only
    */
   void FireInvalidateEvent(int32_t aStartRow, int32_t aEndRow,
                            nsTreeColumn* aStartCol, nsTreeColumn* aEndCol);
 #endif
 
  protected:  // Data Members
--- a/media/libcubeb/moz.yaml
+++ b/media/libcubeb/moz.yaml
@@ -14,10 +14,10 @@ bugzilla:
 origin:
   name: "cubeb"
   description: "Cross platform audio library"
 
   url: "https://github.com/kinetiknz/cubeb"
   license: "ISC"
 
   # update.sh will update this value
-  release: "9a7a55153e7f9b9e0036ab023909c7bc4a41688b (2018-10-30 09:05:26 +1300)"
+  release: "e5c3a1d8a68c412177f768908b1d54550cf9d510-dirty (2018-11-29 18:20:54 +0100)"
 
--- a/media/libcubeb/src/cubeb_mixer.cpp
+++ b/media/libcubeb/src/cubeb_mixer.cpp
@@ -231,23 +231,18 @@ int MixerContext::auto_matrix()
   if (unaccounted & CHANNEL_BACK_CENTER) {
     if (out_ch_layout & CHANNEL_BACK_LEFT) {
       matrix[BACK_LEFT][BACK_CENTER] += M_SQRT1_2;
       matrix[BACK_RIGHT][BACK_CENTER] += M_SQRT1_2;
     } else if (out_ch_layout & CHANNEL_SIDE_LEFT) {
       matrix[SIDE_LEFT][BACK_CENTER] += M_SQRT1_2;
       matrix[SIDE_RIGHT][BACK_CENTER] += M_SQRT1_2;
     } else if (out_ch_layout & CHANNEL_FRONT_LEFT) {
-      if (unaccounted & (CHANNEL_BACK_LEFT | CHANNEL_SIDE_LEFT)) {
-        matrix[FRONT_LEFT][BACK_CENTER] -= _surround_mix_level * M_SQRT1_2;
-        matrix[FRONT_RIGHT][BACK_CENTER] += _surround_mix_level * M_SQRT1_2;
-      } else {
-        matrix[FRONT_LEFT][BACK_CENTER] -= _surround_mix_level;
-        matrix[FRONT_RIGHT][BACK_CENTER] += _surround_mix_level;
-      }
+      matrix[FRONT_LEFT][BACK_CENTER] += _surround_mix_level * M_SQRT1_2;
+      matrix[FRONT_RIGHT][BACK_CENTER] += _surround_mix_level * M_SQRT1_2;
     } else if (out_ch_layout & CHANNEL_FRONT_CENTER) {
       matrix[FRONT_CENTER][BACK_CENTER] +=
         _surround_mix_level * M_SQRT1_2;
     }
   }
   if (unaccounted & CHANNEL_BACK_LEFT) {
     if (out_ch_layout & CHANNEL_BACK_CENTER) {
       matrix[BACK_CENTER][BACK_LEFT] += M_SQRT1_2;
@@ -256,20 +251,18 @@ int MixerContext::auto_matrix()
       if (in_ch_layout & CHANNEL_SIDE_LEFT) {
         matrix[SIDE_LEFT][BACK_LEFT] += M_SQRT1_2;
         matrix[SIDE_RIGHT][BACK_RIGHT] += M_SQRT1_2;
       } else {
         matrix[SIDE_LEFT][BACK_LEFT] += 1.0;
         matrix[SIDE_RIGHT][BACK_RIGHT] += 1.0;
       }
     } else if (out_ch_layout & CHANNEL_FRONT_LEFT) {
-      matrix[FRONT_LEFT][BACK_LEFT] -= _surround_mix_level * M_SQRT1_2;
-      matrix[FRONT_LEFT][BACK_RIGHT] -= _surround_mix_level * M_SQRT1_2;
-      matrix[FRONT_RIGHT][BACK_LEFT] += _surround_mix_level * M_SQRT1_2;
-      matrix[FRONT_RIGHT][BACK_RIGHT] += _surround_mix_level * M_SQRT1_2;
+      matrix[FRONT_LEFT][BACK_LEFT] += _surround_mix_level;
+      matrix[FRONT_RIGHT][BACK_RIGHT] += _surround_mix_level;
     } else if (out_ch_layout & CHANNEL_FRONT_CENTER) {
       matrix[FRONT_CENTER][BACK_LEFT] += _surround_mix_level * M_SQRT1_2;
       matrix[FRONT_CENTER][BACK_RIGHT] += _surround_mix_level * M_SQRT1_2;
     }
   }
 
   if (unaccounted & CHANNEL_SIDE_LEFT) {
     if (out_ch_layout & CHANNEL_BACK_LEFT) {
@@ -281,20 +274,18 @@ int MixerContext::auto_matrix()
       } else {
         matrix[BACK_LEFT][SIDE_LEFT] += 1.0;
         matrix[BACK_RIGHT][SIDE_RIGHT] += 1.0;
       }
     } else if (out_ch_layout & CHANNEL_BACK_CENTER) {
       matrix[BACK_CENTER][SIDE_LEFT] += M_SQRT1_2;
       matrix[BACK_CENTER][SIDE_RIGHT] += M_SQRT1_2;
     } else if (out_ch_layout & CHANNEL_FRONT_LEFT) {
-      matrix[FRONT_LEFT][SIDE_LEFT] -= _surround_mix_level * M_SQRT1_2;
-      matrix[FRONT_LEFT][SIDE_RIGHT] -= _surround_mix_level * M_SQRT1_2;
-      matrix[FRONT_RIGHT][SIDE_LEFT] += _surround_mix_level * M_SQRT1_2;
-      matrix[FRONT_RIGHT][SIDE_RIGHT] += _surround_mix_level * M_SQRT1_2;
+      matrix[FRONT_LEFT][SIDE_LEFT] += _surround_mix_level;
+      matrix[FRONT_RIGHT][SIDE_RIGHT] += _surround_mix_level;
     } else if (out_ch_layout & CHANNEL_FRONT_CENTER) {
       matrix[FRONT_CENTER][SIDE_LEFT] += _surround_mix_level * M_SQRT1_2;
       matrix[FRONT_CENTER][SIDE_RIGHT] += _surround_mix_level * M_SQRT1_2;
     }
   }
 
   if (unaccounted & CHANNEL_FRONT_LEFT_OF_CENTER) {
     if (out_ch_layout & CHANNEL_FRONT_LEFT) {
--- a/media/mp4parse-rust/mp4parse.h
+++ b/media/mp4parse-rust/mp4parse.h
@@ -78,16 +78,17 @@ typedef struct {
   Mp4parseByteData kid;
 } Mp4parseSinfInfo;
 
 typedef struct {
   uint16_t channels;
   uint16_t bit_depth;
   uint32_t sample_rate;
   uint16_t profile;
+  uint16_t extended_profile;
   Mp4parseByteData codec_specific_config;
   Mp4parseByteData extra_data;
   Mp4parseSinfInfo protected_data;
 } Mp4parseTrackAudioInfo;
 
 typedef struct {
   Mp4parseTrackType track_type;
   Mp4parseCodec codec;
--- a/media/mp4parse-rust/mp4parse/src/lib.rs
+++ b/media/mp4parse-rust/mp4parse/src/lib.rs
@@ -288,16 +288,17 @@ pub enum SampleEntry {
     Unknown,
 }
 
 #[allow(non_camel_case_types)]
 #[derive(Debug, Clone, Default)]
 pub struct ES_Descriptor {
     pub audio_codec: CodecType,
     pub audio_object_type: Option<u16>,
+    pub extended_audio_object_type: Option<u16>,
     pub audio_sample_rate: Option<u32>,
     pub audio_channel_count: Option<u16>,
     pub codec_esds: Vec<u8>,
     pub decoder_specific_data: Vec<u8>, // Data in DECODER_SPECIFIC_TAG
 }
 
 #[allow(non_camel_case_types)]
 #[derive(Debug, Clone)]
@@ -1501,100 +1502,169 @@ fn find_descriptor(data: &[u8], esds: &m
         }
 
         remains = &remains[end as usize .. remains.len()];
     }
 
     Ok(())
 }
 
+fn get_audio_object_type(bit_reader: &mut BitReader) -> Result<u16> {
+    let mut audio_object_type: u16 = ReadInto::read(bit_reader, 5)?;
+
+    // Extend audio object type, for example, HE-AAC.
+    if audio_object_type == 31 {
+        let audio_object_type_ext: u16 = ReadInto::read(bit_reader, 6)?;
+        audio_object_type = 32 + audio_object_type_ext;
+    }
+    Ok(audio_object_type)
+}
+
 fn read_ds_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> {
     let frequency_table =
         vec![(0x0, 96000), (0x1, 88200), (0x2, 64000), (0x3, 48000),
              (0x4, 44100), (0x5, 32000), (0x6, 24000), (0x7, 22050),
              (0x8, 16000), (0x9, 12000), (0xa, 11025), (0xb, 8000),
              (0xc, 7350)];
 
     let bit_reader = &mut BitReader::new(data);
 
-    let mut audio_object_type: u16 = ReadInto::read(bit_reader, 5)?;
-
-    // Extend audio object type, for example, HE-AAC.
-    if audio_object_type == 31 {
-        let audio_object_type_ext: u16 = ReadInto::read(bit_reader, 6)?;
-        audio_object_type = 32 + audio_object_type_ext;
-    }
+    let mut audio_object_type = get_audio_object_type(bit_reader)?;
 
     let sample_index: u32 = ReadInto::read(bit_reader, 4)?;
 
     // Sample frequency could be from table, or retrieved from stream directly
     // if index is 0x0f.
     let sample_frequency = match sample_index {
         0x0F => {
             Some(ReadInto::read(bit_reader, 24)?)
         },
         _ => {
             frequency_table.iter().find(|item| item.0 == sample_index).map(|x| x.1)
         },
     };
 
-    let mut channel_counts: u16 = ReadInto::read(bit_reader, 4)?;
+    let channel_configuration: u16 = ReadInto::read(bit_reader, 4)?;
+
+    let extended_audio_object_type = match audio_object_type {
+        5 | 29 => Some(5),
+        _ => None,
+    };
 
-    // parsing GASpecificConfig
-    bit_reader.skip(1)?;        // frameLengthFlag
-    let depend_on_core_order: u8 = ReadInto::read(bit_reader, 1)?;
-    if depend_on_core_order > 0 {
-        bit_reader.skip(14)?;   // codeCoderDelay
-    }
-    bit_reader.skip(1)?;        // extensionFlag
+    if audio_object_type == 5 || audio_object_type == 29 {
+        // We have an explicit signaling for BSAC extension, should the decoder
+        // decode the BSAC extension (all Gecko's AAC decoders do), then this is
+        // what the stream will actually look like once decoded.
+        let _extended_sample_index = ReadInto::read(bit_reader, 4)?;
+        let _extended_sample_frequency: Option<u32> = match _extended_sample_index {
+            0x0F => Some(ReadInto::read(bit_reader, 24)?),
+            _ => frequency_table.iter().find(|item| item.0 == sample_index).map(|x| x.1)
+        };
+        audio_object_type = get_audio_object_type(bit_reader)?;
+        let _extended_channel_configuration = match audio_object_type {
+            22 => ReadInto::read(bit_reader, 4)?,
+            _ => channel_configuration
+        };
+    };
 
-    // When channel_counts is 0, we need to parse the program_config_element
-    // to calculate the channel counts.
-    if channel_counts == 0 {
-        debug!("Parsing program_config_element for channel counts");
+    match audio_object_type {
+        1 ... 4 | 6 | 7 | 17 | 19 ... 23 => {
+            if sample_frequency.is_none() {
+                return Err(Error::Unsupported("unknown frequency"));
+            }
+
+            // parsing GASpecificConfig
 
-        bit_reader.skip(4)?;    // element_instance_tag
-        bit_reader.skip(2)?;    // object_type
-        bit_reader.skip(4)?;    // sampling_frequency_index
-        let num_front_channel: u8 = ReadInto::read(bit_reader, 4)?;
-        let num_side_channel: u8 = ReadInto::read(bit_reader, 4)?;
-        let num_back_channel:u8 = ReadInto::read(bit_reader, 4)?;
-        let num_lfe_channel: u8 = ReadInto::read(bit_reader, 2)?;
-        bit_reader.skip(3)?;    // num_assoc_data
-        bit_reader.skip(4)?;    // num_valid_cc
+            // If the sampling rate is not one of the rates listed in the right
+            // column in Table 4.82, the sampling frequency dependent tables
+            // (code tables, scale factor band tables etc.) must be deduced in
+            // order for the bitstream payload to be parsed. Since a given
+            // sampling frequency is associated with only one sampling frequency
+            // table, and since maximum flexibility is desired in the range of
+            // possible sampling frequencies, the following table shall be used
+            // to associate an implied sampling frequency with the desired
+            // sampling frequency dependent tables.
+            let sample_frequency_value = match sample_frequency.unwrap() {
+                0 ... 9390 => 8000,
+                9391 ... 11501 => 11025,
+                11502 ... 13855 => 12000,
+                13856 ... 18782 => 16000,
+                18783 ... 23003 => 22050,
+                23004 ... 27712 => 24000,
+                27713 ... 37565 => 32000,
+                37566 ... 46008 => 44100,
+                46009 ... 55425 => 48000,
+                55426 ... 75131 => 64000,
+                75132 ... 92016 => 88200,
+                _ => 96000
+            };
 
-        let mono_mixdown_present: bool = ReadInto::read(bit_reader, 1)?;
-        if mono_mixdown_present {
-            bit_reader.skip(4)?;    // mono_mixdown_element_number
-        }
+            bit_reader.skip(1)?;        // frameLengthFlag
+            let depend_on_core_order: u8 = ReadInto::read(bit_reader, 1)?;
+            if depend_on_core_order > 0 {
+                bit_reader.skip(14)?;   // codeCoderDelay
+            }
+            bit_reader.skip(1)?;        // extensionFlag
+
+            let channel_counts = match channel_configuration {
+                0 => {
+                    debug!("Parsing program_config_element for channel counts");
 
-        let stereo_mixdown_present: bool = ReadInto::read(bit_reader, 1)?;
-        if stereo_mixdown_present {
-            bit_reader.skip(4)?;    // stereo_mixdown_element_number
-        }
+                    bit_reader.skip(4)?;    // element_instance_tag
+                    bit_reader.skip(2)?;    // object_type
+                    bit_reader.skip(4)?;    // sampling_frequency_index
+                    let num_front_channel: u8 = ReadInto::read(bit_reader, 4)?;
+                    let num_side_channel: u8 = ReadInto::read(bit_reader, 4)?;
+                    let num_back_channel:u8 = ReadInto::read(bit_reader, 4)?;
+                    let num_lfe_channel: u8 = ReadInto::read(bit_reader, 2)?;
+                    bit_reader.skip(3)?;    // num_assoc_data
+                    bit_reader.skip(4)?;    // num_valid_cc
+
+                    let mono_mixdown_present: bool = ReadInto::read(bit_reader, 1)?;
+                    if mono_mixdown_present {
+                        bit_reader.skip(4)?;    // mono_mixdown_element_number
+                    }
+
+                    let stereo_mixdown_present: bool = ReadInto::read(bit_reader, 1)?;
+                    if stereo_mixdown_present {
+                        bit_reader.skip(4)?;    // stereo_mixdown_element_number
+                    }
 
-        let matrix_mixdown_idx_present: bool = ReadInto::read(bit_reader, 1)?;
-        if matrix_mixdown_idx_present {
-            bit_reader.skip(2)?;    // matrix_mixdown_idx
-            bit_reader.skip(1)?;    // pseudo_surround_enable
-        }
+                    let matrix_mixdown_idx_present: bool = ReadInto::read(bit_reader, 1)?;
+                    if matrix_mixdown_idx_present {
+                        bit_reader.skip(2)?;    // matrix_mixdown_idx
+                        bit_reader.skip(1)?;    // pseudo_surround_enable
+                    }
+                    let mut _channel_counts = 0;
+                    _channel_counts += read_surround_channel_count(bit_reader, num_front_channel)?;
+                    _channel_counts += read_surround_channel_count(bit_reader, num_side_channel)?;
+                    _channel_counts += read_surround_channel_count(bit_reader, num_back_channel)?;
+                    _channel_counts += read_surround_channel_count(bit_reader, num_lfe_channel)?;
+                    _channel_counts
+                },
+                1 ... 7 => channel_configuration,
+                // Amendment 4 of the AAC standard in 2013 below
+                11 => 7, // 6.1 Amendment 4 of the AAC standard in 2013
+                12 | 14 => 8, // 7.1 (a/d) of ITU BS.2159
+                _ => {
+                    return Err(Error::Unsupported("invalid channel configuration"));
+                }
+            };
 
-        channel_counts += read_surround_channel_count(bit_reader, num_front_channel)?;
-        channel_counts += read_surround_channel_count(bit_reader, num_side_channel)?;
-        channel_counts += read_surround_channel_count(bit_reader, num_back_channel)?;
-        channel_counts += read_surround_channel_count(bit_reader, num_lfe_channel)?;
-    }
+            esds.audio_object_type = Some(audio_object_type);
+            esds.extended_audio_object_type = extended_audio_object_type;
+            esds.audio_sample_rate = Some(sample_frequency_value);
+            esds.audio_channel_count = Some(channel_counts);
+            assert!(esds.decoder_specific_data.is_empty());
+            esds.decoder_specific_data.extend_from_slice(data);
 
-    esds.audio_object_type = Some(audio_object_type);
-    esds.audio_sample_rate = sample_frequency;
-    esds.audio_channel_count = Some(channel_counts);
-    assert!(esds.decoder_specific_data.is_empty());
-    esds.decoder_specific_data.extend_from_slice(data);
-
-    Ok(())
+            Ok(())
+        },
+        _ => Err(Error::Unsupported("unknown aac audio object type"))
+    }
 }
 
 fn read_surround_channel_count(bit_reader: &mut BitReader, channels: u8) -> Result<u16> {
     let mut count = 0;
     for _ in 0..channels {
         let is_cpe: bool = ReadInto::read(bit_reader, 1)?;
         count += if is_cpe { 2 } else { 1 };
         bit_reader.skip(4)?;
--- a/media/mp4parse-rust/mp4parse_capi/src/lib.rs
+++ b/media/mp4parse-rust/mp4parse_capi/src/lib.rs
@@ -176,16 +176,17 @@ pub struct Mp4parseSinfInfo {
 
 #[repr(C)]
 #[derive(Default, Debug)]
 pub struct Mp4parseTrackAudioInfo {
     pub channels: u16,
     pub bit_depth: u16,
     pub sample_rate: u32,
     pub profile: u16,
+    pub extended_profile: u16,
     pub codec_specific_config: Mp4parseByteData,
     pub extra_data: Mp4parseByteData,
     pub protected_data: Mp4parseSinfInfo,
 }
 
 #[repr(C)]
 #[derive(Default, Debug)]
 pub struct Mp4parseTrackVideoInfo {
@@ -533,16 +534,20 @@ pub unsafe extern fn mp4parse_get_track_
                 (*info).sample_rate = rate;
             }
             if let Some(channels) = v.audio_channel_count {
                 (*info).channels = channels;
             }
             if let Some(profile) = v.audio_object_type {
                 (*info).profile = profile;
             }
+            (*info).extended_profile = match v.extended_audio_object_type {
+                Some(extended_profile) => extended_profile,
+                _ =>  (*info).profile
+            };
         }
         AudioCodecSpecific::FLACSpecificBox(ref flac) => {
             // Return the STREAMINFO metadata block in the codec_specific.
             let streaminfo = &flac.blocks[0];
             if streaminfo.block_type != 0 || streaminfo.data.len() != 34 {
                 return Mp4parseStatus::Invalid;
             }
             (*info).codec_specific_config.length = streaminfo.data.len() as u32;
--- a/media/webrtc/trunk/webrtc/modules/video_capture/test/video_capture_unittest.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/test/video_capture_unittest.cc
@@ -393,18 +393,17 @@ TEST_F(VideoCaptureExternalTest, TestExt
       webrtc::VideoType::kI420, test_frame_->width(), test_frame_->height());
   std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
   webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
   EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
       length, capture_callback_.capability(), 0));
   EXPECT_TRUE(capture_callback_.CompareLastFrame(*test_frame_));
 }
 
-// Disabled, see Bug 1368816
-TEST_F(VideoCaptureExternalTest, DISABLED_Rotation) {
+TEST_F(VideoCaptureExternalTest, Rotation) {
   EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_0));
   size_t length = webrtc::CalcBufferSize(
       webrtc::VideoType::kI420, test_frame_->width(), test_frame_->height());
   std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
   webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
   EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
     length, capture_callback_.capability(), 0));
   EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_90));
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -3223,20 +3223,16 @@ void arena_t::DallocSmall(arena_chunk_t*
   size_t size;
 
   run = (arena_run_t*)(aMapElm->bits & ~gPageSizeMask);
   MOZ_DIAGNOSTIC_ASSERT(run->mMagic == ARENA_RUN_MAGIC);
   bin = run->mBin;
   size = bin->mSizeClass;
   MOZ_DIAGNOSTIC_ASSERT(uintptr_t(aPtr) >=
                         uintptr_t(run) + bin->mRunFirstRegionOffset);
-  MOZ_DIAGNOSTIC_ASSERT(
-      (uintptr_t(aPtr) - (uintptr_t(run) + bin->mRunFirstRegionOffset)) %
-          size ==
-      0);
 
   memset(aPtr, kAllocPoison, size);
 
   arena_run_reg_dalloc(run, bin, aPtr, size);
   run->mNumFree++;
 
   if (run->mNumFree == bin->mRunNumRegions) {
     // Deallocate run.
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt
@@ -186,30 +186,32 @@ class AccessibilityTest : BaseSessionTes
         sessionRule.waitUntilCalled(object : EventDelegate {
             @AssertCalled(count = 1)
             override fun onAccessibilityFocused(event: AccessibilityEvent) {
                 nodeId = getSourceId(event)
                 val node = createNodeInfo(nodeId)
                 assertThat("Label accessibility focused", node.className.toString(),
                         equalTo("android.view.View"))
                 assertThat("Text node should not be focusable", node.isFocusable, equalTo(false))
+                assertThat("Text node should not be clickable", node.isClickable, equalTo(false))
             }
         })
 
         provider.performAction(nodeId,
             AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT, null)
 
         sessionRule.waitUntilCalled(object : EventDelegate {
             @AssertCalled(count = 1)
             override fun onAccessibilityFocused(event: AccessibilityEvent) {
                 nodeId = getSourceId(event)
                 val node = createNodeInfo(nodeId)
                 assertThat("Editbox accessibility focused", node.className.toString(),
                         equalTo("android.widget.EditText"))
                 assertThat("Entry node should be focusable", node.isFocusable, equalTo(true))
+                assertThat("Entry node should be clickable", node.isClickable, equalTo(true))
             }
         })
     }
 
     @Test fun testTextEntryNode() {
         sessionRule.session.loadString("<input aria-label='Name' value='Tobias'>", "text/html")
         waitForInitialFocus()
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
@@ -150,17 +150,17 @@ public class SessionAccessibility {
                             mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityCursorToFocused", null);
                         } else {
                             final int className = nodeInfo != null ? nodeInfo.getInt("className") : CLASSNAME_VIEW;
                             sendEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED, virtualViewId, className, null);
                         }
                     }
                 return true;
             case AccessibilityNodeInfo.ACTION_CLICK:
-                mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityActivate", null);
+                nativeProvider.click(virtualViewId);
                 GeckoBundle nodeInfo = nativeProvider.getNodeInfo(virtualViewId);
                 final int flags = nodeInfo != null ? nodeInfo.getInt("flags") : 0;
                 if ((flags & (FLAG_SELECTABLE | FLAG_CHECKABLE)) == 0) {
                     final int className = nodeInfo != null ? nodeInfo.getInt("className") : CLASSNAME_VIEW;
                     sendEvent(AccessibilityEvent.TYPE_VIEW_CLICKED, virtualViewId, className, null);
                 }
                 return true;
             case AccessibilityNodeInfo.ACTION_LONG_CLICK:
@@ -168,17 +168,17 @@ public class SessionAccessibility {
                 return true;
             case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD:
                 mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityScrollForward", null);
                 return true;
             case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD:
                 mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityScrollBackward", null);
                 return true;
             case AccessibilityNodeInfo.ACTION_SELECT:
-                mSession.getEventDispatcher().dispatch("GeckoView:AccessibilitySelect", null);
+                nativeProvider.click(virtualViewId);
                 return true;
             case AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT:
             case AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT:
                 if (arguments != null) {
                     data = new GeckoBundle(1);
                     data.putString("rule", arguments.getString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING));
                 } else {
                     data = null;
@@ -743,16 +743,19 @@ public class SessionAccessibility {
         }
 
         @WrapForJNI(dispatchTo = "current")
         public native GeckoBundle getNodeInfo(int id);
 
         @WrapForJNI(dispatchTo = "gecko")
         public native void setText(int id, String text);
 
+        @WrapForJNI(dispatchTo = "gecko")
+        public native void click(int id);
+
         @WrapForJNI(calledFrom = "gecko", stubName = "SendEvent")
         private void sendEventNative(final int eventType, final int sourceId, final int className, final GeckoBundle eventData) {
             ThreadUtils.postToUiThread(new Runnable() {
                 @Override
                 public void run() {
                     sendEvent(eventType, sourceId, className, eventData);
                 }
             });
--- a/mobile/android/locales/filter.py
+++ b/mobile/android/locales/filter.py
@@ -35,16 +35,19 @@ def test(mod, path, entity=None):
         ):
             return "error"
         if re.match(r"crashreporter/[^/]*.ftl", path):
             # error on crashreporter/*.ftl
             return "error"
         if re.match(r"toolkit/about/[^/]*About.ftl", path):
             # error on toolkit/about/*About.ftl
             return "error"
+        if re.match(r"toolkit/about/[^/]*Plugins.ftl", path):
+            # error on toolkit/about/*Plugins.ftl
+            return "error"
         return "ignore"
 
     if mod == "dom":
         # keep this file list in sync with jar.mn
         if path in (
             "chrome/global.dtd",
             "chrome/accessibility/AccessFu.properties",
             "chrome/dom/dom.properties",
--- a/mobile/android/locales/l10n.toml
+++ b/mobile/android/locales/l10n.toml
@@ -149,16 +149,20 @@ exclude-multi-locale = [
     reference = "dom/locales/en-US/chrome/accessibility/AccessFu.properties"
     l10n = "{l}dom/chrome/accessibility/AccessFu.properties"
 
 [[paths]]
     reference = "dom/locales/en-US/chrome/dom/dom.properties"
     l10n = "{l}dom/chrome/dom/dom.properties"
 
 [[paths]]
+    reference = "toolkit/locales/en-US/toolkit/about/*Plugins.ftl"
+    l10n = "{l}toolkit/toolkit/about/*Plugins.ftl"
+
+[[paths]]
     reference = "dom/locales/en-US/chrome/plugins.properties"
     l10n = "{l}dom/chrome/plugins.properties"
 
 [[paths]]
     reference = "toolkit/locales/en-US/toolkit/about/*About.ftl"
     l10n = "{l}toolkit/toolkit/about/*About.ftl"
 
 [[paths]]
--- a/mobile/locales/filter.py
+++ b/mobile/locales/filter.py
@@ -36,16 +36,19 @@ def test(mod, path, entity=None):
             return "error"
         if re.match(r"crashreporter/[^/]*.ftl", path):
             # error on crashreporter/*.ftl
             return "error"
 
         if re.match(r"toolkit/about/[^/]*About.ftl", path):
             # error on toolkit/about/*About.ftl
             return "error"
+        if re.match(r"toolkit/about/[^/]*Plugins.ftl", path):
+            # error on toolkit/about/*Plugins.ftl
+            return "error"
         return "ignore"
 
     if mod == "dom":
         # keep this file list in sync with jar.mn
         if path in (
             "chrome/global.dtd",
             "chrome/accessibility/AccessFu.properties",
             "chrome/dom/dom.properties",
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -170,30 +170,30 @@ HttpChannelChild::HttpChannelChild()
       mCacheFetchCount(0),
       mCacheExpirationTime(nsICacheEntry::NO_EXPIRATION_TIME),
       mDeletingChannelSent(false),
       mIPCOpen(false),
       mUnknownDecoderInvolved(false),
       mDivertingToParent(false),
       mFlushedForDiversion(false),
       mIsFromCache(false),
+      mCacheNeedToReportBytesReadInitialized(false),
+      mNeedToReportBytesRead(true),
       mCacheEntryAvailable(false),
       mAltDataCacheEntryAvailable(false),
       mSendResumeAt(false),
       mKeptAlive(false),
       mSuspendSent(false),
       mSynthesizedResponse(false),
       mShouldInterceptSubsequentRedirect(false),
       mRedirectingForSubsequentSynthesizedResponse(false),
       mPostRedirectChannelShouldIntercept(false),
       mPostRedirectChannelShouldUpgrade(false),
       mShouldParentIntercept(false),
-      mSuspendParentAfterSynthesizeResponse(false),
-      mCacheNeedToReportBytesReadInitialized(false),
-      mNeedToReportBytesRead(true) {
+      mSuspendParentAfterSynthesizeResponse(false) {
   LOG(("Creating HttpChannelChild @%p\n", this));
 
   mChannelCreationTime = PR_Now();
   mChannelCreationTimestamp = TimeStamp::Now();
   mLastStatusReported =
       mChannelCreationTimestamp;  // in case we enable the profiler after Init()
   mAsyncOpenTime = TimeStamp::Now();
   mEventQ = new ChannelEventQueue(static_cast<nsIHttpChannel*>(this));
@@ -1905,16 +1905,17 @@ void HttpChannelChild::ProcessDivertMess
 
 // Returns true if has actually completed the redirect and cleaned up the
 // channel, or false the interception logic kicked in and we need to asyncly
 // call FinishInterceptedRedirect and CleanupRedirectingChannel.
 // The argument is an optional OverrideRunnable that we pass to the redirected
 // channel.
 bool HttpChannelChild::Redirect3Complete(OverrideRunnable* aRunnable) {
   LOG(("HttpChannelChild::Redirect3Complete [this=%p]\n", this));
+  MOZ_ASSERT(NS_IsMainThread());
   nsresult rv = NS_OK;
 
   nsCOMPtr<nsIHttpChannelChild> chan = do_QueryInterface(mRedirectChannelChild);
   RefPtr<HttpChannelChild> httpChannelChild =
       static_cast<HttpChannelChild*>(chan.get());
   // Chrome channel has been AsyncOpen'd.  Reflect this in child.
   if (mRedirectChannelChild) {
     if (httpChannelChild) {
@@ -1973,16 +1974,17 @@ void HttpChannelChild::CleanupRedirectin
 //-----------------------------------------------------------------------------
 // HttpChannelChild::nsIChildChannel
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelChild::ConnectParent(uint32_t registrarId) {
   LOG(("HttpChannelChild::ConnectParent [this=%p, id=%" PRIu32 "]\n", this,
        registrarId));
+  MOZ_ASSERT(NS_IsMainThread());
   mozilla::dom::TabChild* tabChild = nullptr;
   nsCOMPtr<nsITabChild> iTabChild;
   GetCallback(iTabChild);
   if (iTabChild) {
     tabChild = static_cast<mozilla::dom::TabChild*>(iTabChild.get());
   }
   if (MissingRequiredTabChild(tabChild, "http")) {
     return NS_ERROR_ILLEGAL_VALUE;
@@ -2047,16 +2049,17 @@ HttpChannelChild::ConnectParent(uint32_t
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpChannelChild::CompleteRedirectSetup(nsIStreamListener* listener,
                                         nsISupports* aContext) {
   LOG(("HttpChannelChild::FinishRedirectSetup [this=%p]\n", this));
+  MOZ_ASSERT(NS_IsMainThread());
 
   NS_ENSURE_TRUE(!mIsPending, NS_ERROR_IN_PROGRESS);
   NS_ENSURE_TRUE(!mWasOpened, NS_ERROR_ALREADY_OPENED);
 
   if (mShouldParentIntercept) {
     // This is a redirected channel, and the corresponding parent channel has
     // started AsyncOpen but was intercepted and suspended. We must tear it down
     // and start fresh - we will intercept the child channel this time, before
@@ -2106,16 +2109,17 @@ HttpChannelChild::CompleteRedirectSetup(
 
 //-----------------------------------------------------------------------------
 // HttpChannelChild::nsIAsyncVerifyRedirectCallback
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelChild::OnRedirectVerifyCallback(nsresult result) {
   LOG(("HttpChannelChild::OnRedirectVerifyCallback [this=%p]\n", this));
+  MOZ_ASSERT(NS_IsMainThread());
   OptionalURIParams redirectURI;
   nsresult rv;
 
   uint32_t referrerPolicy = REFERRER_POLICY_UNSET;
   OptionalURIParams referrerURI;
   SerializeURI(nullptr, referrerURI);
 
   nsCOMPtr<nsIHttpChannel> newHttpChannel =
@@ -2281,16 +2285,17 @@ HttpChannelChild::Cancel(nsresult status
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpChannelChild::Suspend() {
   LOG(("HttpChannelChild::Suspend [this=%p, mSuspendCount=%" PRIu32 ", "
        "mDivertingToParent=%d]\n",
        this, mSuspendCount + 1, static_cast<bool>(mDivertingToParent)));
+  MOZ_ASSERT(NS_IsMainThread());
   NS_ENSURE_TRUE(RemoteChannelExists() || mInterceptListener,
                  NS_ERROR_NOT_AVAILABLE);
 
   // SendSuspend only once, when suspend goes from 0 to 1.
   // Don't SendSuspend at all if we're diverting callbacks to the parent;
   // suspend will be called at the correct time in the parent itself.
   if (!mSuspendCount++ && !mDivertingToParent) {
     if (RemoteChannelExists()) {
@@ -2306,16 +2311,17 @@ HttpChannelChild::Suspend() {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpChannelChild::Resume() {
   LOG(("HttpChannelChild::Resume [this=%p, mSuspendCount=%" PRIu32 ", "
        "mDivertingToParent=%d]\n",
        this, mSuspendCount - 1, static_cast<bool>(mDivertingToParent)));
+  MOZ_ASSERT(NS_IsMainThread());
   NS_ENSURE_TRUE(RemoteChannelExists() || mInterceptListener,
                  NS_ERROR_NOT_AVAILABLE);
   NS_ENSURE_TRUE(mSuspendCount > 0, NS_ERROR_UNEXPECTED);
 
   nsresult rv = NS_OK;
 
   // SendResume only once, when suspend count drops to 0.
   // Don't SendResume at all if we're diverting callbacks to the parent (unless
@@ -2863,45 +2869,48 @@ HttpChannelChild::SetupFallbackChannel(c
 
 //-----------------------------------------------------------------------------
 // HttpChannelChild::nsICacheInfoChannel
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelChild::GetCacheTokenFetchCount(int32_t* _retval) {
   NS_ENSURE_ARG_POINTER(_retval);
+  MOZ_ASSERT(NS_IsMainThread());
 
   if (mSynthesizedCacheInfo) {
     return mSynthesizedCacheInfo->GetCacheTokenFetchCount(_retval);
   }
 
   if (!mCacheEntryAvailable && !mAltDataCacheEntryAvailable) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   *_retval = mCacheFetchCount;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpChannelChild::GetCacheTokenExpirationTime(uint32_t* _retval) {
   NS_ENSURE_ARG_POINTER(_retval);
+  MOZ_ASSERT(NS_IsMainThread());
 
   if (mSynthesizedCacheInfo) {
     return mSynthesizedCacheInfo->GetCacheTokenExpirationTime(_retval);
   }
 
   if (!mCacheEntryAvailable) return NS_ERROR_NOT_AVAILABLE;
 
   *_retval = mCacheExpirationTime;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpChannelChild::GetCacheTokenCachedCharset(nsACString& _retval) {
+  MOZ_ASSERT(NS_IsMainThread());
   if (mSynthesizedCacheInfo) {
     return mSynthesizedCacheInfo->GetCacheTokenCachedCharset(_retval);
   }
 
   if (!mCacheEntryAvailable) return NS_ERROR_NOT_AVAILABLE;
 
   _retval = mCachedCharset;
   return NS_OK;
@@ -2947,16 +2956,17 @@ HttpChannelChild::GetCacheEntryId(uint64
   }
 
   *aCacheEntryId = mCacheEntryId;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpChannelChild::GetCacheKey(uint32_t* cacheKey) {
+  MOZ_ASSERT(NS_IsMainThread());
   if (mSynthesizedCacheInfo) {
     return mSynthesizedCacheInfo->GetCacheKey(cacheKey);
   }
 
   *cacheKey = mCacheKey;
   return NS_OK;
 }
 NS_IMETHODIMP
@@ -3293,16 +3303,17 @@ HttpChannelChild::RemoveCorsPreflightCac
 // HttpChannelChild::nsIDivertableChannel
 //-----------------------------------------------------------------------------
 NS_IMETHODIMP
 HttpChannelChild::DivertToParent(ChannelDiverterChild** aChild) {
   LOG(("HttpChannelChild::DivertToParent [this=%p]\n", this));
   MOZ_RELEASE_ASSERT(aChild);
   MOZ_RELEASE_ASSERT(gNeckoChild);
   MOZ_RELEASE_ASSERT(!mDivertingToParent);
+  MOZ_ASSERT(NS_IsMainThread());
 
   nsresult rv = NS_OK;
 
   // If the channel was intercepted, then we likely do not have an IPC actor
   // yet.  We need one, though, in order to have a parent side to divert to.
   // Therefore, create the actor just in time for us to suspend and divert it.
   if (mSynthesizedResponse && !RemoteChannelExists()) {
     mSuspendParentAfterSynthesizeResponse = true;
@@ -3553,16 +3564,17 @@ void HttpChannelChild::CancelOnMainThrea
 }
 
 void HttpChannelChild::OverrideWithSynthesizedResponse(
     nsAutoPtr<nsHttpResponseHead>& aResponseHead,
     nsIInputStream* aSynthesizedInput,
     nsIInterceptedBodyCallback* aSynthesizedCallback,
     InterceptStreamListener* aStreamListener,
     nsICacheInfoChannel* aCacheInfoChannel) {
+  MOZ_ASSERT(NS_IsMainThread());
   nsresult rv = NS_OK;
   auto autoCleanup = MakeScopeExit([&] {
     // Auto-cancel on failure.  Do this first to get mStatus set, if necessary.
     if (NS_FAILED(rv)) {
       Cancel(rv);
     }
 
     // If we early exit before taking ownership of the body, then automatically
@@ -3654,26 +3666,28 @@ void HttpChannelChild::OverrideWithSynth
   }
 
   MOZ_DIAGNOSTIC_ASSERT(!mCanceled);
 }
 
 NS_IMETHODIMP
 HttpChannelChild::ForceIntercepted(bool aPostRedirectChannelShouldIntercept,
                                    bool aPostRedirectChannelShouldUpgrade) {
+  MOZ_ASSERT(NS_IsMainThread());
   mShouldParentIntercept = true;
   mPostRedirectChannelShouldIntercept = aPostRedirectChannelShouldIntercept;
   mPostRedirectChannelShouldUpgrade = aPostRedirectChannelShouldUpgrade;
   return NS_OK;
 }
 
 void HttpChannelChild::ForceIntercepted(
     nsIInputStream* aSynthesizedInput,
     nsIInterceptedBodyCallback* aSynthesizedCallback,
     nsICacheInfoChannel* aCacheInfo) {
+  MOZ_ASSERT(NS_IsMainThread());
   mSynthesizedInput = aSynthesizedInput;
   mSynthesizedCallback = aSynthesizedCallback;
   mSynthesizedCacheInfo = aCacheInfo;
   mSynthesizedResponse = true;
   mRedirectingForSubsequentSynthesizedResponse = true;
 }
 
 mozilla::ipc::IPCResult HttpChannelChild::RecvIssueDeprecationWarning(
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -382,17 +382,22 @@ class HttpChannelChild final : public PH
   Atomic<bool, ReleaseAcquire> mUnknownDecoderInvolved;
 
   // Once set, OnData and possibly OnStop will be diverted to the parent.
   Atomic<bool, ReleaseAcquire> mDivertingToParent;
   // Once set, no OnStart/OnData/OnStop callbacks should be received from the
   // parent channel, nor dequeued from the ChannelEventQueue.
   Atomic<bool, ReleaseAcquire> mFlushedForDiversion;
 
-  uint8_t mIsFromCache : 1;
+  Atomic<bool, SequentiallyConsistent> mIsFromCache;
+  // Set if we get the result and cache |mNeedToReportBytesRead|
+  Atomic<bool, SequentiallyConsistent> mCacheNeedToReportBytesReadInitialized;
+  // True if we need to tell the parent the size of unreported received data
+  Atomic<bool, SequentiallyConsistent> mNeedToReportBytesRead;
+
   uint8_t mCacheEntryAvailable : 1;
   uint8_t mAltDataCacheEntryAvailable : 1;
 
   // If ResumeAt is called before AsyncOpen, we need to send extra data upstream
   uint8_t mSendResumeAt : 1;
 
   uint8_t mKeptAlive : 1;  // IPC kept open, but only for security info
 
@@ -423,22 +428,16 @@ class HttpChannelChild final : public PH
   // Set if the corresponding parent channel should force an interception to
   // occur before the network transaction is initiated.
   uint8_t mShouldParentIntercept : 1;
 
   // Set if the corresponding parent channel should suspend after a response
   // is synthesized.
   uint8_t mSuspendParentAfterSynthesizeResponse : 1;
 
-  // Set if we get the result and cache |mNeedToReportBytesRead|
-  uint8_t mCacheNeedToReportBytesReadInitialized : 1;
-
-  // True if we need to tell the parent the size of unreported received data
-  uint8_t mNeedToReportBytesRead : 1;
-
   void FinishInterceptedRedirect();
   void CleanupRedirectingChannel(nsresult rv);
 
   // true after successful AsyncOpen until OnStopRequest completes.
   bool RemoteChannelExists() { return mIPCOpen && !mKeptAlive; }
 
   void AssociateApplicationCache(const nsCString& groupID,
                                  const nsCString& clientID);
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1511454_aboutPlugins.py
@@ -0,0 +1,153 @@
+# coding=utf8
+
+# Any copyright is dedicated to the Public Domain.
+# http://creativecommons.org/publicdomain/zero/1.0/
+
+from __future__ import absolute_import
+import fluent.syntax.ast as FTL
+from fluent.migrate.helpers import transforms_from
+from fluent.migrate import COPY
+from fluent.migrate import CONCAT
+
+def migrate(ctx):
+    """Bug 1511454 - Migrate about:plugins to use Fluent for localization, part {index}."""
+
+    ctx.add_transforms(
+        "toolkit/toolkit/about/aboutPlugins.ftl",
+        "toolkit/toolkit/about/aboutPlugins.ftl",
+        transforms_from(
+"""
+title-label = { COPY("dom/chrome/plugins.properties", "title_label") }
+installed-plugins-label = { COPY("dom/chrome/plugins.properties", "installedplugins_label") }
+no-plugins-are-installed-label = { COPY("dom/chrome/plugins.properties", "nopluginsareinstalled_label") }
+
+mime-type-label = { COPY("dom/chrome/plugins.properties", "mimetype_label") }
+description-label = { COPY("dom/chrome/plugins.properties", "description_label") }
+suffixes-label = { COPY("dom/chrome/plugins.properties", "suffixes_label") }
+""")
+)
+
+    ctx.add_transforms(
+        "toolkit/toolkit/about/aboutPlugins.ftl",
+        "toolkit/toolkit/about/aboutPlugins.ftl",
+        [
+            FTL.Message(
+                id=FTL.Identifier("deprecation-description"),
+                value=CONCAT(
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "deprecation_description"
+                    ),
+                    FTL.TextElement(' <a data-l10n-name="deprecation-link">'),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "deprecation_learn_more"
+                    ),
+                    FTL.TextElement('</a>')
+                )
+            ),
+
+            FTL.Message(
+                id=FTL.Identifier("file-dd"),
+                value=CONCAT(
+                    FTL.TextElement('<span data-l10n-name="file">'),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "file_label"
+                    ),
+                    FTL.TextElement('</span> { $pluginLibraries }'),
+                )
+            ),
+
+            FTL.Message(
+                id=FTL.Identifier("path-dd"),
+                value=CONCAT(
+                    FTL.TextElement('<span data-l10n-name="path">'),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "path_label"
+                    ),
+                    FTL.TextElement('</span> { $pluginFullPath }'),
+                )
+            ),
+
+            FTL.Message(
+                id=FTL.Identifier("version-dd"),
+                value=CONCAT(
+                    FTL.TextElement('<span data-l10n-name="version">'),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "version_label"
+                    ),
+                    FTL.TextElement('</span> { $version }'),
+                )
+            ),
+
+            FTL.Message(
+                id=FTL.Identifier("state-dd-enabled"),
+                value=CONCAT(
+                    FTL.TextElement('<span data-l10n-name="state">'),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "state_label"
+                    ),
+                    FTL.TextElement('</span> '),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "state_enabled"
+                    ),
+                )
+            ),
+
+            FTL.Message(
+                id=FTL.Identifier("state-dd-enabled-block-list-state"),
+                value=CONCAT(
+                    FTL.TextElement('<span data-l10n-name="state">'),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "state_label"
+                    ),
+                    FTL.TextElement('</span> '),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "state_enabled"
+                    ),
+                    FTL.TextElement(' ({ $blockListState })'),
+                )
+            ),
+
+            FTL.Message(
+                id=FTL.Identifier("state-dd-Disabled"),
+                value=CONCAT(
+                    FTL.TextElement('<span data-l10n-name="state">'),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "state_label"
+                    ),
+                    FTL.TextElement('</span> '),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "state_disabled"
+                    ),
+                )
+            ),
+
+            FTL.Message(
+                id=FTL.Identifier("state-dd-Disabled-block-list-state"),
+                value=CONCAT(
+                    FTL.TextElement('<span data-l10n-name="state">'),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "state_label"
+                    ),
+                    FTL.TextElement('</span> '),
+                    COPY(
+                        "dom/chrome/plugins.properties",
+                        "state_disabled"
+                    ),
+                    FTL.TextElement(' ({ $blockListState })'),
+                )
+            ),
+
+        ]
+    )
--- a/taskcluster/docker/funsize-update-generator/Dockerfile
+++ b/taskcluster/docker/funsize-update-generator/Dockerfile
@@ -3,31 +3,28 @@ MAINTAINER Simon Fraser <sfraser@mozilla
 
 # Required software
 ENV DEBIAN_FRONTEND noninteractive
 # Chain apt-get commands with apt-get clean in a single docker RUN
 # to make sure that files are removed within a single docker layer
 RUN apt-get update -q && \
     apt-get install -yyq --no-install-recommends \
     python3.6 python3-setuptools python3-cryptography libgetopt-simple-perl \
-    bzip2 clamav clamav-freshclam python3-requests python3-sh curl \
+    bzip2 python3-requests python3-sh curl \
     python3-dev gcc liblzma-dev xz-utils jq libdpkg-perl locales && \
     apt-get clean
 RUN useradd -d /home/worker -s /bin/bash -m worker
 COPY Pipfile Pipfile.lock /
 
 RUN locale-gen en_CA.UTF-8
 ENV LANG en_CA.UTF-8
 ENV LANGUAGE en_CA.UTF-8
 ENV LANG_ALL en_CA.UTF-8
 ENV LC_ALL en_CA.UTF-8
 
-# Freshclam may be flaky, retry if it fails
-RUN for i in 1 2 3 4 5; do freshclam --verbose && break || sleep 15; done
-
 # python-pip installs a lot of dependencies increasing the size of an image
 # drastically. Install it like this saves us almost 200M.
 RUN bash -c "curl -L https://bootstrap.pypa.io/get-pip.py | python3"
 RUN ["pip", "install", "pipenv<2018.10.9", "pip==18.0"]
 
 # scripts
 RUN mkdir /home/worker/bin
 COPY scripts/* /home/worker/bin/
--- a/taskcluster/docker/funsize-update-generator/scripts/funsize.py
+++ b/taskcluster/docker/funsize-update-generator/scripts/funsize.py
@@ -315,22 +315,16 @@ async def manage_partial(partial_def, wo
                                  section="App", option="Version")
             major = int(version.split(".")[0])
             # The updater for versions less than 56.0 requires BZ2
             # compressed MAR files
             if major < 56:
                 use_old_format = True
                 log.info("Forcing BZ2 compression for %s", f)
 
-        log.info("AV-scanning %s ...", unpack_dir)
-        metric_tags = [
-            "platform:{}".format(partial_def['platform']),
-        ]
-        with ddstats.timer('mar.clamscan.time', tags=metric_tags):
-            await run_command("clamscan -r {}".format(unpack_dir), label='clamscan')
         log.info("Done.")
 
     to_path = os.path.join(work_env.workdir, "to")
     from_path = os.path.join(work_env.workdir, "from")
 
     mar_data = {
         "ACCEPTED_MAR_CHANNEL_IDS": get_option(
             to_path, filename="update-settings.ini", section="Settings",
@@ -450,18 +444,16 @@ def main():
                         type=argparse.FileType('r'))
     parser.add_argument("--allow-staging-prefixes",
                         action="store_true",
                         default=strtobool(
                             os.environ.get('FUNSIZE_ALLOW_STAGING_PREFIXES', "false")),
                         help="Allow files from staging buckets.")
     parser.add_argument("--filename-template",
                         default=DEFAULT_FILENAME_TEMPLATE)
-    parser.add_argument("--no-freshclam", action="store_true", default=False,
-                        help="Do not refresh ClamAV DB")
     parser.add_argument("-q", "--quiet", dest="log_level",
                         action="store_const", const=logging.WARNING,
                         default=logging.DEBUG)
     args = parser.parse_args()
 
     logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s")
     log.setLevel(args.log_level)
 
@@ -486,27 +478,16 @@ def main():
         log.info("Starting metric collection")
         initialize(**dd_options)
         ddstats.start(flush_interval=1)
         # For use in shell scripts.
         write_dogrc(dd_api_key)
     else:
         log.info("No metric collection")
 
-    if args.no_freshclam:
-        log.info("Skipping freshclam")
-    else:
-        log.info("Refreshing clamav db...")
-        try:
-            redo.retry(lambda: sh.freshclam("--stdout", "--verbose",
-                                            _timeout=300, _err_to_out=True))
-            log.info("Done.")
-        except sh.ErrorReturnCode:
-            log.warning("Freshclam failed, skipping DB update")
-
     loop = asyncio.get_event_loop()
     manifest = loop.run_until_complete(async_main(args, signing_certs))
     loop.close()
 
     manifest_file = os.path.join(args.artifacts_dir, "manifest.json")
     with open(manifest_file, "w") as fp:
         json.dump(manifest, fp, indent=2, sort_keys=True)
 
--- a/taskcluster/scripts/run-task
+++ b/taskcluster/scripts/run-task
@@ -261,17 +261,17 @@ def configure_cache_posix(cache, user, g
 
     requires_path = os.path.join(cache, '.cacherequires')
     audit_path = os.path.join(cache, '.cachelog')
 
     # The cache is empty. Configure it.
     if not os.listdir(cache):
         print_line(b'cache', b'cache %s is empty; writing requirements: '
                              b'%s\n' % (
-                    cache.encode('utf-8'), b' '.join(sorted(our_requirements))))
+                                 cache.encode('utf-8'), b' '.join(sorted(our_requirements))))
 
         # We write a requirements file so future invocations know what the
         # requirements are.
         with open(requires_path, 'wb') as fh:
             fh.write(b'\n'.join(sorted(our_requirements)))
 
         # And make it read-only as a precaution against deletion.
         os.chmod(requires_path, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
@@ -422,17 +422,17 @@ def vcs_checkout(source_repo, dest, stor
     # on the system, which is managed some other way (such as puppet)
     if fetch_hgfingerprint:
         try:
             print_line(b'vcs', b'fetching hg.mozilla.org fingerprint from %s\n' %
                        FINGERPRINT_URL.encode('utf-8'))
             res = urllib.request.urlopen(FINGERPRINT_URL, timeout=10)
             secret = res.read()
             try:
-                secret = json.loads(secret, encoding='utf-8')
+                secret = json.loads(secret.decode('utf-8'))
             except ValueError:
                 print_line(b'vcs', b'invalid JSON in hg fingerprint secret')
                 sys.exit(1)
         except (urllib.error.URLError, socket.timeout):
             print_line(b'vcs', b'Unable to retrieve current hg.mozilla.org fingerprint'
                                b'using the secret service, using fallback instead.')
             # XXX This fingerprint will not be accurate if running on an old
             #     revision after the server fingerprint has changed.
@@ -694,45 +694,48 @@ def main(args):
         # with it.
         if base_repo == 'https://hg.mozilla.org/mozilla-central':
             base_repo = 'https://hg.mozilla.org/mozilla-unified'
 
         os.environ['GECKO_HEAD_REV'] = vcs_checkout(
             os.environ['GECKO_HEAD_REPOSITORY'],
             args.vcs_checkout,
             os.environ['HG_STORE_PATH'],
+            fetch_hgfingerprint=args.fetch_hgfingerprint,
             base_repo=base_repo,
             revision=os.environ.get('GECKO_HEAD_REV'),
             branch=os.environ.get('GECKO_HEAD_REF'),
             sparse_profile=args.sparse_profile)
 
     elif not os.environ.get('GECKO_HEAD_REV') and \
             os.environ.get('GECKO_HEAD_REF'):
         print('task should be defined in terms of non-symbolic revision')
         return 1
 
     if args.tools_checkout:
         vcs_checkout('https://hg.mozilla.org/build/tools',
                      args.tools_checkout,
                      os.environ['HG_STORE_PATH'],
+                     fetch_hgfingerprint=args.fetch_hgfingerprint,
                      # Always check out the latest commit on default branch.
                      # This is non-deterministic!
                      branch='default')
 
     # Checkout the repository, setting the COMM_HEAD_REV to the current
     # revision hash. Revision hashes have priority over symbolic revisions. We
     # disallow running tasks with symbolic revisions unless they have been
     # resolved by a checkout.
     if args.comm_checkout:
         base_repo = os.environ.get('COMM_BASE_REPOSITORY')
 
         os.environ['COMM_HEAD_REV'] = vcs_checkout(
             os.environ['COMM_HEAD_REPOSITORY'],
             args.comm_checkout,
             os.environ['HG_STORE_PATH'],
+            fetch_hgfingerprint=args.fetch_hgfingerprint,
             base_repo=base_repo,
             revision=os.environ.get('COMM_HEAD_REV'),
             branch=os.environ.get('COMM_HEAD_REF'))
 
     elif not os.environ.get('COMM_HEAD_REV') and \
             os.environ.get('COMM_HEAD_REF'):
         print('task should be defined in terms of non-symbolic revision')
         return 1
--- a/toolkit/components/telemetry/tests/marionette/tests/client/test_main_tab_scalars.py
+++ b/toolkit/components/telemetry/tests/marionette/tests/client/test_main_tab_scalars.py
@@ -23,15 +23,16 @@ class TestMainTabScalars(TelemetryTestCa
 
             self.browser.tabbar.close_tab(tab3, force=True)
             self.browser.tabbar.close_tab(tab2, force=True)
 
             self.browser.tabbar.switch_to(tab1)
 
         ping = self.wait_for_ping(self.restart_browser, MAIN_SHUTDOWN_PING)
 
-        assert ping["type"] == "main"
-        assert ping["clientId"] == self.client_id
+        self.assertEqual(ping["type"], "main")
+        self.assertEqual(ping["clientId"], self.client_id)
 
         scalars = ping["payload"]["processes"]["parent"]["scalars"]
-        assert scalars["browser.engagement.max_concurrent_tab_count"] == 3
-        assert scalars["browser.engagement.tab_open_event_count"] == 2
-        assert scalars["browser.engagement.max_concurrent_window_count"] == 1
+
+        self.assertEqual(scalars["browser.engagement.max_concurrent_tab_count"], 3)
+        self.assertEqual(scalars["browser.engagement.tab_open_event_count"], 2)
+        self.assertEqual(scalars["browser.engagement.max_concurrent_window_count"], 1)
--- a/toolkit/content/plugins.html
+++ b/toolkit/content/plugins.html
@@ -1,32 +1,24 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <html>
 <head>
+<title data-l10n-id="title-label"></title>
 <script type="application/javascript">
   "use strict";
-
   ChromeUtils.import("resource://gre/modules/Services.jsm");
-
-  // XXX Bug 1418959 - For some reason, using Services.strings here causes
-  // about:plugins to leak when running browser_aboutURLs.js.
-  // eslint-disable-next-line mozilla/use-services
-  var strBundleService = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService);
-  var pluginsbundle = strBundleService.createBundle("chrome://global/locale/plugins.properties");
-
-  // eslint-disable-next-line no-unsanitized/method
-  document.writeln("<title>" + pluginsbundle.GetStringFromName("title_label") + "<\/title>");
 </script>
 <link rel="stylesheet" type="text/css" href="chrome://global/content/plugins.css">
 <link rel="stylesheet" type="text/css" href="chrome://global/skin/plugins.css">
+<link rel="localization" href="toolkit/about/aboutPlugins.ftl"/>
 </head>
 <body>
 <div id="outside">
 <script type="application/javascript">
   /* eslint-env mozilla/frame-script */
 
   "use strict";
 
@@ -64,33 +56,34 @@
 
   RPMAddMessageListener("PluginList", function({ data: aPlugins }) {
     var fragment = document.createDocumentFragment();
 
     // "Installed plugins"
     var id, label;
     if (aPlugins.length > 0) {
       id = "plugs";
-      label = "installedplugins_label";
+      label = "installed-plugins-label";
     } else {
       id = "noplugs";
-      label = "nopluginsareinstalled_label";
+      label = "no-plugins-are-installed-label";
     }
     var enabledplugins = document.createElement("h1");
     enabledplugins.setAttribute("id", id);
-    enabledplugins.appendChild(document.createTextNode(pluginsbundle.GetStringFromName(label)));
+    document.l10n.setAttributes(enabledplugins, label);
     fragment.appendChild(enabledplugins);
 
     var deprecation = document.createElement("p");
+    var deprecationLink = document.createElement("a");
+    let deprecationLink_href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "npapi";
+    deprecationLink.setAttribute("data-l10n-name", "deprecation-link");
+    deprecationLink.setAttribute("href", deprecationLink_href);
+    deprecation.appendChild(deprecationLink);
     deprecation.setAttribute("class", "notice");
-    deprecation.textContent = pluginsbundle.GetStringFromName("deprecation_description") + " \u00A0 ";
-    var deprecationLink = document.createElement("a");
-    deprecationLink.textContent = pluginsbundle.GetStringFromName("deprecation_learn_more");
-    deprecationLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "npapi";
-    deprecation.appendChild(deprecationLink);
+    document.l10n.setAttributes(deprecation, "deprecation-description");
     fragment.appendChild(deprecation);
 
     var stateNames = {};
     ["STATE_SOFTBLOCKED",
      "STATE_BLOCKED",
      "STATE_OUTDATED",
      "STATE_VULNERABLE_UPDATE_AVAILABLE",
      "STATE_VULNERABLE_NO_UPDATE"].forEach(function(label) {
@@ -107,51 +100,57 @@
         fragment.appendChild(plugname);
 
         var dl = document.createElement("dl");
         fragment.appendChild(dl);
 
         // "File: Flash Player.plugin"
         var fileDd = document.createElement("dd");
         var file = document.createElement("span");
+        file.setAttribute("data-l10n-name", "file");
         file.setAttribute("class", "label");
-        file.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("file_label") + " "));
         fileDd.appendChild(file);
-        fileDd.appendChild(document.createTextNode(plugin.pluginLibraries));
+        document.l10n.setAttributes(fileDd, "file-dd", { pluginLibraries: plugin.pluginLibraries[0] });
         dl.appendChild(fileDd);
 
         // "Path: /usr/lib/mozilla/plugins/libtotem-cone-plugin.so"
         var pathDd = document.createElement("dd");
         var path = document.createElement("span");
+        path.setAttribute("data-l10n-name", "path");
         path.setAttribute("class", "label");
-        path.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("path_label") + " "));
         pathDd.appendChild(path);
-        pathDd.appendChild(document.createTextNode(plugin.pluginFullpath));
+        document.l10n.setAttributes(pathDd, "path-dd", { pluginFullPath: plugin.pluginFullpath[0] });
         dl.appendChild(pathDd);
 
         // "Version: "
         var versionDd = document.createElement("dd");
         var version = document.createElement("span");
+        version.setAttribute("data-l10n-name", "version");
         version.setAttribute("class", "label");
-        version.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("version_label") + " "));
         versionDd.appendChild(version);
-        versionDd.appendChild(document.createTextNode(plugin.version));
+        document.l10n.setAttributes(versionDd, "version-dd", { version: plugin.version });
         dl.appendChild(versionDd);
 
         // "State: "
         var stateDd = document.createElement("dd");
         var state = document.createElement("span");
+        state.setAttribute("data-l10n-name", "state");
         state.setAttribute("label", "state");
-        state.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("state_label") + " "));
         stateDd.appendChild(state);
-        var status = plugin.isActive ? pluginsbundle.GetStringFromName("state_enabled") : pluginsbundle.GetStringFromName("state_disabled");
-        if (plugin.blocklistState in stateNames) {
-          status += " (" + stateNames[plugin.blocklistState] + ")";
+        if (plugin.isActive) {
+          if (plugin.blocklistState in stateNames) {
+            document.l10n.setAttributes(stateDd, "state-dd-enabled-block-list-state", { blockListState: stateNames[plugin.blocklistState] });
+          } else {
+            document.l10n.setAttributes(stateDd, "state-dd-enabled");
+          }
+        } else if (plugin.blocklistState in stateNames) {
+            document.l10n.setAttributes(stateDd, "state-dd-disabled-block-list-state", { blockListState: stateNames[plugin.blocklistState] });
+        } else {
+          document.l10n.setAttributes(stateDd, "state-dd-disabled");
         }
-        stateDd.appendChild(document.createTextNode(status));
         dl.appendChild(stateDd);
 
         // Plugin Description
         var descDd = document.createElement("dd");
         descDd.appendChild(document.createTextNode(plugin.description));
         dl.appendChild(descDd);
 
         // MIME Type table
@@ -163,29 +162,29 @@
         var thead = document.createElement("thead");
         mimetypeTable.appendChild(thead);
         var tr = document.createElement("tr");
         thead.appendChild(tr);
 
         // "MIME Type" column header
         var typeTh = document.createElement("th");
         typeTh.setAttribute("class", "type");
-        typeTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("mimetype_label")));
+        document.l10n.setAttributes(typeTh, "mime-type-label");
         tr.appendChild(typeTh);
 
         // "Description" column header
         var descTh = document.createElement("th");
         descTh.setAttribute("class", "desc");
-        descTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("description_label")));
+        document.l10n.setAttributes(descTh, "description-label");
         tr.appendChild(descTh);
 
         // "Suffixes" column header
         var suffixesTh = document.createElement("th");
         suffixesTh.setAttribute("class", "suff");
-        suffixesTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("suffixes_label")));
+        document.l10n.setAttributes(suffixesTh, "suffixes-label");
         tr.appendChild(suffixesTh);
 
         var tbody = document.createElement("tbody");
         mimetypeTable.appendChild(tbody);
 
         var mimeTypes = plugin.pluginMimeTypes;
         for (var j = 0; j < mimeTypes.length; j++) {
           var mimetype = mimeTypes[j];
new file mode 100644
--- /dev/null
+++ b/toolkit/locales/en-US/toolkit/about/aboutPlugins.ftl
@@ -0,0 +1,33 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+title-label = About Plugins
+
+installed-plugins-label = Installed plugins
+no-plugins-are-installed-label = No installed plugins found
+
+deprecation-description = Missing something? Some plugins are no longer supported. <a data-l10n-name="deprecation-link">Learn More.</a>
+
+## The information of plugins
+##
+## Variables:
+##   $pluginLibraries: the plugin library
+##   $pluginFullPath: path of the plugin
+##   $version: version of the plugin
+file-dd = <span data-l10n-name="file">File:</span> { $pluginLibraries }
+path-dd = <span data-l10n-name="path">Path:</span> { $pluginFullPath }
+version-dd = <span data-l10n-name="version">Version:</span> { $version }
+
+## These strings describe the state of plugins
+##
+## Variables:
+##   $blockListState: show some special state of the plugin, such as blocked, outdated
+state-dd-enabled = <span data-l10n-name="state">State:</span> Enabled
+state-dd-enabled-block-list-state = <span data-l10n-name="state">State:</span> Enabled ({ $blockListState })
+state-dd-Disabled = <span data-l10n-name="state">State:</span> Disabled
+state-dd-Disabled-block-list-state = <span data-l10n-name="state">State:</span> Disabled ({ $blockListState })
+
+mime-type-label = MIME Type
+description-label = Description
+suffixes-label = Suffixes