Bug 1271549 - Remove details and summary preference.
Bug 1259889 Part 2 [1] cannot be reverted cleanly, so I manually undo those
changes in this patch. That is, remove the ability for html.css to
invalidate dynamically since it was added specifically for details element.
Although reftest-stylo.list explicit mentions "DO NOT EDIT!", but I still
remove details pref from the file, since it doesn't harm to edit it anyway.
[1] https://hg.mozilla.org/mozilla-central/rev/30aaf3805b56
MozReview-Commit-ID: FsyTGQTxujh
--- a/dom/html/HTMLDetailsElement.cpp
+++ b/dom/html/HTMLDetailsElement.cpp
@@ -1,49 +1,22 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#include "mozilla/dom/HTMLDetailsElement.h"
#include "mozilla/dom/HTMLDetailsElementBinding.h"
-#include "mozilla/dom/HTMLUnknownElement.h"
-#include "mozilla/Preferences.h"
-// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Details) to add pref check.
-nsGenericHTMLElement*
-NS_NewHTMLDetailsElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
- mozilla::dom::FromParser aFromParser)
-{
- if (!mozilla::dom::HTMLDetailsElement::IsDetailsEnabled()) {
- return new mozilla::dom::HTMLUnknownElement(aNodeInfo);
- }
-
- return new mozilla::dom::HTMLDetailsElement(aNodeInfo);
-}
+NS_IMPL_NS_NEW_HTML_ELEMENT(Details)
namespace mozilla {
namespace dom {
-/* static */ bool
-HTMLDetailsElement::IsDetailsEnabled()
-{
- static bool isDetailsEnabled = false;
- static bool added = false;
-
- if (!added) {
- Preferences::AddBoolVarCache(&isDetailsEnabled,
- "dom.details_element.enabled");
- added = true;
- }
-
- return isDetailsEnabled;
-}
-
HTMLDetailsElement::~HTMLDetailsElement()
{
}
NS_IMPL_ELEMENT_CLONE(HTMLDetailsElement)
nsIContent*
HTMLDetailsElement::GetFirstSummary() const
--- a/dom/html/HTMLDetailsElement.h
+++ b/dom/html/HTMLDetailsElement.h
@@ -18,18 +18,16 @@ namespace dom {
// controls. Please see the spec for more information.
// https://html.spec.whatwg.org/multipage/forms.html#the-details-element
//
class HTMLDetailsElement final : public nsGenericHTMLElement
{
public:
using NodeInfo = mozilla::dom::NodeInfo;
- static bool IsDetailsEnabled();
-
explicit HTMLDetailsElement(already_AddRefed<NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
}
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLDetailsElement, details)
nsIContent* GetFirstSummary() const;
--- a/dom/html/HTMLSummaryElement.cpp
+++ b/dom/html/HTMLSummaryElement.cpp
@@ -9,27 +9,17 @@
#include "mozilla/dom/HTMLElementBinding.h"
#include "mozilla/dom/HTMLUnknownElement.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/TextEvents.h"
#include "nsFocusManager.h"
-// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Summary) to add pref check.
-nsGenericHTMLElement*
-NS_NewHTMLSummaryElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
- mozilla::dom::FromParser aFromParser)
-{
- if (!mozilla::dom::HTMLDetailsElement::IsDetailsEnabled()) {
- return new mozilla::dom::HTMLUnknownElement(aNodeInfo);
- }
-
- return new mozilla::dom::HTMLSummaryElement(aNodeInfo);
-}
+NS_IMPL_NS_NEW_HTML_ELEMENT(Summary)
namespace mozilla {
namespace dom {
HTMLSummaryElement::~HTMLSummaryElement()
{
}
--- a/dom/webidl/EventHandler.webidl
+++ b/dom/webidl/EventHandler.webidl
@@ -88,17 +88,16 @@ interface GlobalEventHandlers {
attribute EventHandler onsuspend;
attribute EventHandler ontimeupdate;
attribute EventHandler onvolumechange;
attribute EventHandler onwaiting;
[Pref="dom.select_events.enabled"]
attribute EventHandler onselectstart;
- [Pref="dom.details_element.enabled"]
attribute EventHandler ontoggle;
// Pointer events handlers
[Pref="dom.w3c_pointer_events.enabled"]
attribute EventHandler onpointercancel;
[Pref="dom.w3c_pointer_events.enabled"]
attribute EventHandler onpointerdown;
[Pref="dom.w3c_pointer_events.enabled"]
--- a/dom/webidl/HTMLDetailsElement.webidl
+++ b/dom/webidl/HTMLDetailsElement.webidl
@@ -6,13 +6,12 @@
* The origin of this IDL file is
* https://html.spec.whatwg.org/multipage/forms.html#the-details-element
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
-[Pref="dom.details_element.enabled"]
interface HTMLDetailsElement : HTMLElement {
[SetterThrows]
attribute boolean open;
};
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -3547,20 +3547,16 @@ nsCSSFrameConstructor::FindHTMLData(Elem
// <legend> is only special inside fieldset, we only check the frame tree
// parent because the content tree parent may not be a <fieldset> due to
// display:contents, Shadow DOM, or XBL. For floated or absolutely
// positioned legends we want to construct by display type and
// not do special legend stuff.
return nullptr;
}
- if (aTag == nsGkAtoms::details && !HTMLDetailsElement::IsDetailsEnabled()) {
- return nullptr;
- }
-
static const FrameConstructionDataByTag sHTMLData[] = {
SIMPLE_TAG_CHAIN(img, nsCSSFrameConstructor::FindImgData),
SIMPLE_TAG_CHAIN(mozgeneratedcontentimage,
nsCSSFrameConstructor::FindImgData),
{ &nsGkAtoms::br,
FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT | FCDATA_IS_LINE_BREAK,
NS_NewBRFrame) },
SIMPLE_TAG_CREATE(wbr, NS_NewWBRFrame),
@@ -5762,17 +5758,17 @@ nsCSSFrameConstructor::AddFrameConstruct
}
// When constructing a child of a non-open <details>, create only the frame
// for the main <summary> element, and skip other elements. This only applies
// to things that are not roots of native anonymous subtrees (except for
// ::before and ::after); we always want to create "internal" anonymous
// content.
auto* details = HTMLDetailsElement::FromContentOrNull(parent);
- if (details && details->IsDetailsEnabled() && !details->Open() &&
+ if (details && !details->Open() &&
(!aContent->IsRootOfNativeAnonymousSubtree() ||
aContent->IsGeneratedContentContainerForBefore() ||
aContent->IsGeneratedContentContainerForAfter())) {
auto* summary = HTMLSummaryElement::FromContentOrNull(aContent);
if (!summary || !summary->IsMainSummary()) {
SetAsUndisplayedContent(aState, aItems, aContent, styleContext,
isGeneratedContent);
return;
@@ -5930,17 +5926,17 @@ nsCSSFrameConstructor::AddFrameConstruct
CSSPseudoElementType::after, aItems);
if (canHavePageBreak && display->mBreakAfter) {
AddPageBreakItem(aContent, aStyleContext, aItems);
}
return;
}
FrameConstructionItem* item = nullptr;
- if (details && details->IsDetailsEnabled() && details->Open()) {
+ if (details && details->Open()) {
auto* summary = HTMLSummaryElement::FromContentOrNull(aContent);
if (summary && summary->IsMainSummary()) {
// If details is open, the main summary needs to be rendered as if it is
// the first child, so add the item to the front of the item list.
item = aItems.PrependItem(data, aContent, aTag, aNameSpaceID,
pendingBinding, styleContext.forget(),
aSuppressWhiteSpaceOptimizations, aAnonChildren);
}
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -601,29 +601,29 @@ load 1222783.xhtml
load 1223568-1.html
load 1223568-2.html
load 1224230-1.html
pref(layout.css.grid.enabled,true) load 1225118.html
pref(layout.css.grid.enabled,true) load 1225376.html
pref(layout.css.grid.enabled,true) load 1225592.html
load 1229437-1.html
load 1229437-2.html
-pref(dom.details_element.enabled,true) load details-containing-only-text.html
-pref(dom.details_element.enabled,true) load details-display-none-summary-1.html
-pref(dom.details_element.enabled,true) load details-display-none-summary-2.html
-pref(dom.details_element.enabled,true) load details-display-none-summary-3.html
-pref(dom.details_element.enabled,true) load details-open-overflow-auto.html
-pref(dom.details_element.enabled,true) load details-open-overflow-hidden.html
-pref(dom.details_element.enabled,true) load details-three-columns.html
+load details-containing-only-text.html
+load details-display-none-summary-1.html
+load details-display-none-summary-2.html
+load details-display-none-summary-3.html
+load details-open-overflow-auto.html
+load details-open-overflow-hidden.html
+load details-three-columns.html
load first-letter-638937-1.html
load first-letter-638937-2.html
load flex-nested-abspos-1.html
pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) asserts(0-100) load font-inflation-762332.html # bug 762332
load outline-on-frameset.xhtml
-pref(dom.details_element.enabled,true) load summary-position-out-of-flow.html
+load summary-position-out-of-flow.html
load text-overflow-bug666751-1.html
load text-overflow-bug666751-2.html
load text-overflow-bug670564.xhtml
load text-overflow-bug671796.xhtml
load text-overflow-bug713610.html
load text-overflow-form-elements.html
load text-overflow-iframe.html
asserts-if(Android,2-4) asserts-if(!Android,4) load 1225005.html # bug 682647 and bug 448083
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -1874,22 +1874,20 @@ nsContainerFrame::RenumberFrameAndDescen
// drill down through any wrappers to the real frame
nsIFrame* kid = GetContentInsertionFrame();
if (!kid) {
return false;
}
// Do not renumber list for summary elements.
- if (HTMLDetailsElement::IsDetailsEnabled()) {
- HTMLSummaryElement* summary =
- HTMLSummaryElement::FromContent(kid->GetContent());
- if (summary && summary->IsMainSummary()) {
- return false;
- }
+ HTMLSummaryElement* summary =
+ HTMLSummaryElement::FromContent(kid->GetContent());
+ if (summary && summary->IsMainSummary()) {
+ return false;
}
bool kidRenumberedABullet = false;
// If the frame is a list-item and the frame implements our
// block frame API then get its bullet and set the list item
// ordinal.
if (mozilla::StyleDisplay::ListItem == display->mDisplay) {
deleted file mode 100644
--- a/layout/reftests/details-summary/disabled-no-summary-ref.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<!-- Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<html>
- <body>
- <div>
- <p>This is the details.</p>
- </div>
- </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/details-summary/disabled-single-summary-ref.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<!-- Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<html>
- <body>
- <div>
- <div>Summary</div>
- <p>This is the details.</p>
- </div>
- </body>
-</html>
--- a/layout/reftests/details-summary/reftest-stylo.list
+++ b/layout/reftests/details-summary/reftest-stylo.list
@@ -1,16 +1,9 @@
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
-default-preferences pref(dom.details_element.enabled,true)
-
-# Disable <details> and <summary>
-pref(dom.details_element.enabled,false) == single-summary.html single-summary.html
-pref(dom.details_element.enabled,false) == open-single-summary.html open-single-summary.html
-pref(dom.details_element.enabled,false) == no-summary.html no-summary.html
-
# Basic <summary> handling
== multiple-summary.html multiple-summary.html
== open-multiple-summary.html open-multiple-summary.html
== summary-not-first-child.html summary-not-first-child.html
== open-summary-not-first-child.html open-summary-not-first-child.html
== open-summary-block-style.html open-summary-block-style.html
== no-summary.html no-summary.html
== open-no-summary.html open-no-summary.html
--- a/layout/reftests/details-summary/reftest.list
+++ b/layout/reftests/details-summary/reftest.list
@@ -1,15 +1,8 @@
-default-preferences pref(dom.details_element.enabled,true)
-
-# Disable <details> and <summary>
-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 <summary> handling
== multiple-summary.html single-summary.html
== open-multiple-summary.html open-multiple-summary-ref.html
== summary-not-first-child.html single-summary.html
== open-summary-not-first-child.html open-single-summary.html
== open-summary-block-style.html open-summary-block-style-ref.html
== open-summary-inline-style.html open-summary-inline-style-ref.html
== open-summary-table-cell-style.html open-summary-table-cell-style-ref.html
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -128,21 +128,16 @@ nsLayoutStylesheetCache::UASheet()
}
return mUASheet;
}
StyleSheet*
nsLayoutStylesheetCache::HTMLSheet()
{
- if (!mHTMLSheet) {
- LoadSheetURL("resource://gre-resources/html.css",
- &mHTMLSheet, eAgentSheetFeatures);
- }
-
return mHTMLSheet;
}
StyleSheet*
nsLayoutStylesheetCache::MinimalXULSheet()
{
return mMinimalXULSheet;
}
@@ -320,16 +315,18 @@ nsLayoutStylesheetCache::nsLayoutStylesh
}
InitFromProfile();
// And make sure that we load our UA sheets. No need to do this
// per-profile, since they're profile-invariant.
LoadSheetURL("resource://gre-resources/counterstyles.css",
&mCounterStylesSheet, eAgentSheetFeatures);
+ LoadSheetURL("resource://gre-resources/html.css",
+ &mHTMLSheet, eAgentSheetFeatures);
LoadSheetURL("chrome://global/content/minimal-xul.css",
&mMinimalXULSheet, eAgentSheetFeatures);
LoadSheetURL("resource://gre-resources/quirk.css",
&mQuirkSheet, eAgentSheetFeatures);
LoadSheetURL("resource://gre/res/svg.css",
&mSVGSheet, eAgentSheetFeatures);
LoadSheetURL("chrome://global/content/xul.css",
&mXULSheet, eAgentSheetFeatures);
@@ -374,18 +371,16 @@ nsLayoutStylesheetCache::For(StyleBacken
// For each pref that controls a CSS feature that a UA style sheet depends
// on (such as a pref that enables a property that a UA style sheet uses),
// register DependentPrefChanged as a callback to ensure that the relevant
// style sheets will be re-parsed.
// Preferences::RegisterCallback(&DependentPrefChanged,
// "layout.css.example-pref.enabled");
Preferences::RegisterCallback(&DependentPrefChanged,
"layout.css.grid.enabled");
- Preferences::RegisterCallback(&DependentPrefChanged,
- "dom.details_element.enabled");
}
return cache;
}
void
nsLayoutStylesheetCache::InitFromProfile()
{
@@ -815,17 +810,16 @@ nsLayoutStylesheetCache::DependentPrefCh
// then setting our cached sheet pointer to null. This will only work for
// sheets that are loaded lazily.
#define INVALIDATE(sheet_) \
InvalidateSheet(gStyleCache_Gecko ? &gStyleCache_Gecko->sheet_ : nullptr, \
gStyleCache_Servo ? &gStyleCache_Servo->sheet_ : nullptr);
INVALIDATE(mUASheet); // for layout.css.grid.enabled
- INVALIDATE(mHTMLSheet); // for dom.details_element.enabled
#undef INVALIDATE
}
/* static */ void
nsLayoutStylesheetCache::InvalidatePreferenceSheets()
{
if (gStyleCache_Gecko) {
--- a/layout/style/res/html.css
+++ b/layout/style/res/html.css
@@ -770,33 +770,30 @@ video > .caption-box {
/* datetime elements */
input[type="time"] > xul|datetimebox {
display: flex;
-moz-binding: url("chrome://global/content/bindings/datetimebox.xml#time-input");
}
/* details & summary */
-/* Need to revert Bug 1259889 Part 2 when removing details preference. */
-@supports -moz-bool-pref("dom.details_element.enabled") {
- details > summary:first-of-type,
- details > summary:-moz-native-anonymous {
- display: list-item;
- list-style: disclosure-closed inside;
- }
+details > summary:first-of-type,
+details > summary:-moz-native-anonymous {
+ display: list-item;
+ list-style: disclosure-closed inside;
+}
- details[open] > summary:first-of-type,
- details[open] > summary:-moz-native-anonymous {
- list-style-type: disclosure-open;
- }
+details[open] > summary:first-of-type,
+details[open] > summary:-moz-native-anonymous {
+ list-style-type: disclosure-open;
+}
- details > summary:first-of-type > *|* {
- /* Cancel "list-style-position: inside" inherited from summary. */
- list-style-position: initial;
- }
+details > summary:first-of-type > *|* {
+ /* Cancel "list-style-position: inside" inherited from summary. */
+ list-style-position: initial;
}
/* emulation of non-standard HTML <marquee> tag */
marquee {
inline-size: -moz-available;
display: inline-block;
vertical-align: text-bottom;
text-align: start;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5422,19 +5422,16 @@ pref("narrate.filter-voices", true);
// Whether to allow, on a Linux system that doesn't support the necessary sandboxing
// features, loading Gecko Media Plugins unsandboxed. However, EME CDMs will not be
// loaded without sandboxing even if this pref is changed.
pref("media.gmp.insecure.allow", false);
#endif
pref("dom.audiochannel.mutedByDefault", false);
-// Enable <details> and <summary> tags.
-pref("dom.details_element.enabled", true);
-
// Secure Element API
#ifdef MOZ_SECUREELEMENT
pref("dom.secureelement.enabled", false);
#endif
// Allow control characters appear in composition string.
// When this is false, control characters except
// CHARACTER TABULATION (horizontal tab) are removed from
--- a/testing/web-platform/meta/html/dom/interfaces.html.ini
+++ b/testing/web-platform/meta/html/dom/interfaces.html.ini
@@ -1,11 +1,11 @@
[interfaces.html]
type: testharness
- prefs: [dom.forms.inputmode:true, dom.details_element.enabled:true]
+ prefs: [dom.forms.inputmode:true]
[Document interface: attribute domain]
expected: FAIL
[Document interface: attribute cookie]
expected: FAIL
[Document interface: attribute body]
expected: FAIL
--- a/testing/web-platform/meta/html/dom/reflection-misc.html.ini
+++ b/testing/web-platform/meta/html/dom/reflection-misc.html.ini
@@ -1,11 +1,10 @@
[reflection-misc.html]
type: testharness
- prefs: [dom.details_element.enabled:true]
[html.tabIndex: setAttribute() to object "3" followed by getAttribute()]
expected: FAIL
[html.tabIndex: setAttribute() to object "3" followed by IDL get]
expected: FAIL
[script.tabIndex: setAttribute() to object "3" followed by getAttribute()]
expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/details.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[details.html]
- type: testharness
- prefs: [dom.details_element.enabled:true]
deleted file mode 100644
--- a/testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/toggleEvent.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[toggleEvent.html]
- type: testharness
- prefs: [dom.details_element.enabled:true]
--- a/testing/web-platform/meta/html/semantics/interfaces.html.ini
+++ b/testing/web-platform/meta/html/semantics/interfaces.html.ini
@@ -1,11 +1,10 @@
[interfaces.html]
type: testharness
- prefs: [dom.details_element.enabled:true]
[Interfaces for image]
expected: FAIL
[Interfaces for keygen]
expected: FAIL
[Interfaces for marquee]
expected: FAIL
--- a/testing/web-platform/meta/svg/interfaces.html.ini
+++ b/testing/web-platform/meta/svg/interfaces.html.ini
@@ -1,11 +1,10 @@
[interfaces.html]
type: testharness
- prefs: [dom.details_element.enabled:true]
[SVGGeometryElement interface: existence and properties of interface object]
expected: FAIL
[SVGGeometryElement interface object length]
expected: FAIL
[SVGGeometryElement interface object name]
expected: FAIL