diff --git a/dom/html/HTMLDetailsElement.cpp b/dom/html/HTMLDetailsElement.cpp index 940b96f3303..6085d7b8a2f 100644 --- a/dom/html/HTMLDetailsElement.cpp +++ b/dom/html/HTMLDetailsElement.cpp @@ -24,7 +24,7 @@ NS_NewHTMLDetailsElement(already_AddRefed&& aNodeInfo, namespace mozilla { namespace dom { -bool +/* static */ bool HTMLDetailsElement::IsDetailsEnabled() { static bool isDetailsEnabled = false; diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 9e0847800d2..17778401ead 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -5641,7 +5641,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState // When constructing a child of a non-open
, create only the frame // for the main element, and skip other elements. auto* details = HTMLDetailsElement::FromContentOrNull(parent); - if (details && !details->Open()) { + if (details && details->IsDetailsEnabled() && !details->Open()) { auto* summary = HTMLSummaryElement::FromContentOrNull(aContent); if (!summary || !summary->IsMainSummary()) { SetAsUndisplayedContent(aState, aItems, aContent, styleContext, diff --git a/layout/reftests/details-summary/disabled-no-summary-ref.html b/layout/reftests/details-summary/disabled-no-summary-ref.html new file mode 100644 index 00000000000..6ecdbcdc0ae --- /dev/null +++ b/layout/reftests/details-summary/disabled-no-summary-ref.html @@ -0,0 +1,11 @@ + + + + + +
+

This is the details.

+
+ + diff --git a/layout/reftests/details-summary/disabled-single-summary-ref.html b/layout/reftests/details-summary/disabled-single-summary-ref.html new file mode 100644 index 00000000000..f643af6dcd1 --- /dev/null +++ b/layout/reftests/details-summary/disabled-single-summary-ref.html @@ -0,0 +1,12 @@ + + + + + +
+
Summary
+

This is the details.

+
+ + diff --git a/layout/reftests/details-summary/reftest.list b/layout/reftests/details-summary/reftest.list index eb985035404..54cf691025e 100644 --- a/layout/reftests/details-summary/reftest.list +++ b/layout/reftests/details-summary/reftest.list @@ -1,3 +1,8 @@ +# Disable
and +pref(dom.details_element.enabled,false) == single-summary.html disabled-single-summary-ref.html +pref(dom.details_element.enabled,false) == open-single-summary.html disabled-single-summary-ref.html +pref(dom.details_element.enabled,false) == no-summary.html disabled-no-summary-ref.html + # Basic handling pref(dom.details_element.enabled,true) == multiple-summary.html single-summary.html pref(dom.details_element.enabled,true) == open-multiple-summary.html open-multiple-summary-ref.html