Bug 1288572: Don't hide -moz-box / -moz-inline-box yet. r?mats draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 02 Jun 2018 20:53:33 +0200
changeset 803336 8285980a0b706adb655423133aeb1b72f8845f17
parent 803335 9cd8445b6b4ef3a41f99464b891a6021fb73120b
child 803337 08b8f4c18f0c19bf0269572251a6302d6985b04d
child 803338 b3d11b8af7d02340c377ee4861e23599bd56c342
push id112074
push userbmo:emilio@crisal.io
push dateSun, 03 Jun 2018 11:02:15 +0000
reviewersmats
bugs1288572
milestone62.0a1
Bug 1288572: Don't hide -moz-box / -moz-inline-box yet. r?mats I'd really prefer to not land this patch, but... MozReview-Commit-ID: HzmvhTd32gz
dom/base/nsDeprecatedOperationList.h
layout/base/nsCSSFrameConstructor.cpp
layout/style/test/test_non_content_accessible_values.html
servo/components/style/values/specified/box.rs
--- a/dom/base/nsDeprecatedOperationList.h
+++ b/dom/base/nsDeprecatedOperationList.h
@@ -42,8 +42,9 @@ DEPRECATED_OPERATION(WindowContentUntrus
 DEPRECATED_OPERATION(RegisterProtocolHandlerInsecure)
 DEPRECATED_OPERATION(MixedDisplayObjectSubrequest)
 DEPRECATED_OPERATION(MotionEvent)
 DEPRECATED_OPERATION(OrientationEvent)
 DEPRECATED_OPERATION(ProximityEvent)
 DEPRECATED_OPERATION(AmbientLightEvent)
 DEPRECATED_OPERATION(IDBOpenDBOptions_StorageType)
 DEPRECATED_OPERATION(DOMAttrModifiedEvent)
+DEPRECATED_OPERATION(MozBoxOrInlineBoxDisplay)
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -4464,30 +4464,36 @@ nsCSSFrameConstructor::FindXULDisplayDat
                   FCDATA_SKIP_ABSPOS_PUSH, NS_NewMenuPopupFrame))
 #endif /* MOZ_XUL */
   };
 
   if (aDisplay->mDisplay < StyleDisplay::MozBox) {
     return nullptr;
   }
 
-  // If we're emulating -moz-box with flexbox, then treat it as non-XUL and
-  // return null (except for scrollcorners which have to be XUL becuase their
-  // parent reflows them with BoxReflow() which means they have to get
-  // actual-XUL frames).
-  if (StaticPrefs::layout_css_emulate_moz_box_with_flex() &&
-      aElement && !aElement->IsXULElement(nsGkAtoms::scrollcorner) &&
-      (aDisplay->mDisplay == StyleDisplay::MozBox ||
-       aDisplay->mDisplay == StyleDisplay::MozInlineBox)) {
-    return nullptr;
-  }
-
   MOZ_ASSERT(aDisplay->mDisplay <= StyleDisplay::MozPopup,
              "Someone added a new display value?");
 
+  if (aDisplay->mDisplay == StyleDisplay::MozBox ||
+      aDisplay->mDisplay == StyleDisplay::MozInlineBox) {
+    if (!aElement->IsInNativeAnonymousSubtree() &&
+        aElement->OwnerDoc()->IsContentDocument()) {
+      aElement->OwnerDoc()->WarnOnceAbout(nsIDocument::eMozBoxOrInlineBoxDisplay);
+    }
+
+    // If we're emulating -moz-box with flexbox, then treat it as non-XUL and
+    // return null (except for scrollcorners which have to be XUL becuase their
+    // parent reflows them with BoxReflow() which means they have to get
+    // actual-XUL frames).
+    if (StaticPrefs::layout_css_emulate_moz_box_with_flex() &&
+        !aElement->IsXULElement(nsGkAtoms::scrollcorner)) {
+      return nullptr;
+    }
+  }
+
   const FrameConstructionDataByDisplay& data =
     sXULDisplayData[size_t(aDisplay->mDisplay) - size_t(StyleDisplay::MozBox)];
   MOZ_ASSERT(aDisplay->mDisplay == data.mDisplay,
              "Did someone mess with the order?");
 
   return &data.mData;
 }
 
--- a/layout/style/test/test_non_content_accessible_values.html
+++ b/layout/style/test/test_non_content_accessible_values.html
@@ -1,18 +1,19 @@
 <!doctype html>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <style id="sheet"></style>
 <div></div>
 <script>
 const NON_CONTENT_ACCESSIBLE_VALUES = {
   "display": [
-    "-moz-box",
-    "-moz-inline-box",
+    // FIXME(emilio, bug TBD): Remove from content these two too.
+    // "-moz-box",
+    // "-moz-inline-box",
     "-moz-grid",
     "-moz-inline-grid",
     "-moz-grid-group",
     "-moz-grid-line",
     "-moz-stack",
     "-moz-inline-stack",
     "-moz-deck",
     "-moz-popup",
--- a/servo/components/style/values/specified/box.rs
+++ b/servo/components/style/values/specified/box.rs
@@ -74,20 +74,18 @@ pub enum Display {
     Contents,
     #[cfg(feature = "gecko")]
     FlowRoot,
     #[cfg(feature = "gecko")]
     WebkitBox,
     #[cfg(feature = "gecko")]
     WebkitInlineBox,
     #[cfg(feature = "gecko")]
-    #[css(parse_condition = "moz_display_values_enabled_on_content")]
     MozBox,
     #[cfg(feature = "gecko")]
-    #[css(parse_condition = "moz_display_values_enabled_on_content")]
     MozInlineBox,
     #[cfg(feature = "gecko")]
     #[css(parse_condition = "moz_display_values_enabled_on_content")]
     MozGrid,
     #[cfg(feature = "gecko")]
     #[css(parse_condition = "moz_display_values_enabled_on_content")]
     MozInlineGrid,
     #[cfg(feature = "gecko")]