Bug 1271549 - Remove details and summary preference. r=bz

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

--HG--
extra : rebase_source : 25e5a05a8a5a47642772da69f427631fa07e232d
This commit is contained in:
Ting-Yu Lin 2016-11-16 14:02:58 +08:00
Родитель ee34799ca7
Коммит 55e3c801ba
21 изменённых файлов: 31 добавлений и 136 удалений

Просмотреть файл

@ -6,39 +6,12 @@
#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()
{
}

Просмотреть файл

@ -23,8 +23,6 @@ class HTMLDetailsElement final : public nsGenericHTMLElement
public:
using NodeInfo = mozilla::dom::NodeInfo;
static bool IsDetailsEnabled();
explicit HTMLDetailsElement(already_AddRefed<NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{

Просмотреть файл

@ -14,17 +14,7 @@
#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 {

Просмотреть файл

@ -93,7 +93,6 @@ interface GlobalEventHandlers {
[Pref="dom.select_events.enabled"]
attribute EventHandler onselectstart;
[Pref="dom.details_element.enabled"]
attribute EventHandler ontoggle;
// Pointer events handlers

Просмотреть файл

@ -11,7 +11,6 @@
* and create derivative works of this document.
*/
[Pref="dom.details_element.enabled"]
interface HTMLDetailsElement : HTMLElement {
[SetterThrows]
attribute boolean open;

Просмотреть файл

@ -3552,10 +3552,6 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement,
return nullptr;
}
if (aTag == nsGkAtoms::details && !HTMLDetailsElement::IsDetailsEnabled()) {
return nullptr;
}
static const FrameConstructionDataByTag sHTMLData[] = {
SIMPLE_TAG_CHAIN(img, nsCSSFrameConstructor::FindImgData),
SIMPLE_TAG_CHAIN(mozgeneratedcontentimage,
@ -5767,7 +5763,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
// ::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())) {
@ -5935,7 +5931,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
}
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

Просмотреть файл

@ -606,19 +606,19 @@ 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

Просмотреть файл

@ -1879,12 +1879,10 @@ nsContainerFrame::RenumberFrameAndDescendants(int32_t* aOrdinal,
}
// 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;

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -1,11 +1,4 @@
# 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

Просмотреть файл

@ -1,10 +1,3 @@
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

Просмотреть файл

@ -133,11 +133,6 @@ nsLayoutStylesheetCache::UASheet()
StyleSheet*
nsLayoutStylesheetCache::HTMLSheet()
{
if (!mHTMLSheet) {
LoadSheetURL("resource://gre-resources/html.css",
&mHTMLSheet, eAgentSheetFeatures);
}
return mHTMLSheet;
}
@ -325,6 +320,8 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache(StyleBackendType aType)
// 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",
@ -379,8 +376,6 @@ nsLayoutStylesheetCache::For(StyleBackendType aType)
// "layout.css.example-pref.enabled");
Preferences::RegisterCallback(&DependentPrefChanged,
"layout.css.grid.enabled");
Preferences::RegisterCallback(&DependentPrefChanged,
"dom.details_element.enabled");
}
return cache;
@ -820,7 +815,6 @@ nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData)
gStyleCache_Servo ? &gStyleCache_Servo->sheet_ : nullptr);
INVALIDATE(mUASheet); // for layout.css.grid.enabled
INVALIDATE(mHTMLSheet); // for dom.details_element.enabled
#undef INVALIDATE
}

Просмотреть файл

@ -775,23 +775,20 @@ input[type="time"] > xul|datetimebox {
}
/* 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 */

Просмотреть файл

@ -5415,9 +5415,6 @@ pref("media.gmp.insecure.allow", false);
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);

Просмотреть файл

@ -1,6 +1,6 @@
[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

Просмотреть файл

@ -1,6 +1,5 @@
[reflection-misc.html]
type: testharness
prefs: [dom.details_element.enabled:true]
[html.tabIndex: setAttribute() to object "3" followed by getAttribute()]
expected: FAIL

Просмотреть файл

@ -1,3 +0,0 @@
[details.html]
type: testharness
prefs: [dom.details_element.enabled:true]

Просмотреть файл

@ -1,3 +0,0 @@
[toggleEvent.html]
type: testharness
prefs: [dom.details_element.enabled:true]

Просмотреть файл

@ -1,6 +1,5 @@
[interfaces.html]
type: testharness
prefs: [dom.details_element.enabled:true]
[Interfaces for image]
expected: FAIL

Просмотреть файл

@ -1,6 +1,5 @@
[interfaces.html]
type: testharness
prefs: [dom.details_element.enabled:true]
[SVGGeometryElement interface: existence and properties of interface object]
expected: FAIL