Bug 591737 - Add pref for details and summary elements. r=bz
This commit is contained in:
@@ -6,12 +6,39 @@
|
||||
#include "mozilla/dom/HTMLDetailsElement.h"
|
||||
|
||||
#include "mozilla/dom/HTMLDetailsElementBinding.h"
|
||||
#include "mozilla/dom/HTMLUnknownElement.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Details)
|
||||
// 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);
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user