зеркало из https://github.com/mozilla/gecko-dev.git
Bug 870022 - Part 5.1 - Add HTMLPictureElement & atom. r=jst, sr=jst
This commit is contained in:
Родитель
737a2d14d8
Коммит
669338ae76
|
@ -2220,6 +2220,7 @@ GK_ATOM(menuitemradio, "menuitemradio")
|
||||||
GK_ATOM(mixed, "mixed")
|
GK_ATOM(mixed, "mixed")
|
||||||
GK_ATOM(multiline, "multiline")
|
GK_ATOM(multiline, "multiline")
|
||||||
GK_ATOM(password, "password")
|
GK_ATOM(password, "password")
|
||||||
|
GK_ATOM(picture, "picture")
|
||||||
GK_ATOM(posinset, "posinset")
|
GK_ATOM(posinset, "posinset")
|
||||||
GK_ATOM(presentation, "presentation")
|
GK_ATOM(presentation, "presentation")
|
||||||
GK_ATOM(progressbar, "progressbar")
|
GK_ATOM(progressbar, "progressbar")
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||||
|
/* 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/HTMLPictureElement.h"
|
||||||
|
#include "mozilla/dom/HTMLPictureElementBinding.h"
|
||||||
|
#include "mozilla/dom/HTMLImageElement.h"
|
||||||
|
|
||||||
|
#include "mozilla/Preferences.h"
|
||||||
|
static const char *kPrefPictureEnabled = "dom.image.picture.enabled";
|
||||||
|
|
||||||
|
// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Picture) to add pref check.
|
||||||
|
nsGenericHTMLElement*
|
||||||
|
NS_NewHTMLPictureElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||||
|
mozilla::dom::FromParser aFromParser)
|
||||||
|
{
|
||||||
|
if (!mozilla::dom::HTMLPictureElement::IsPictureEnabled()) {
|
||||||
|
return new mozilla::dom::HTMLUnknownElement(aNodeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new mozilla::dom::HTMLPictureElement(aNodeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
HTMLPictureElement::HTMLPictureElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||||
|
: nsGenericHTMLElement(aNodeInfo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HTMLPictureElement::~HTMLPictureElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMPL_ISUPPORTS_INHERITED(HTMLPictureElement, nsGenericHTMLElement,
|
||||||
|
nsIDOMHTMLPictureElement)
|
||||||
|
|
||||||
|
NS_IMPL_ELEMENT_CLONE(HTMLPictureElement)
|
||||||
|
|
||||||
|
bool
|
||||||
|
HTMLPictureElement::IsPictureEnabled()
|
||||||
|
{
|
||||||
|
return HTMLImageElement::IsSrcsetEnabled() &&
|
||||||
|
Preferences::GetBool(kPrefPictureEnabled, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSObject*
|
||||||
|
HTMLPictureElement::WrapNode(JSContext* aCx)
|
||||||
|
{
|
||||||
|
return HTMLPictureElementBinding::Wrap(aCx, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
|
@ -0,0 +1,43 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
#ifndef mozilla_dom_HTMLPictureElement_h
|
||||||
|
#define mozilla_dom_HTMLPictureElement_h
|
||||||
|
|
||||||
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "nsIDOMHTMLPictureElement.h"
|
||||||
|
#include "nsGenericHTMLElement.h"
|
||||||
|
|
||||||
|
#include "mozilla/dom/HTMLUnknownElement.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
class HTMLPictureElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||||
|
public nsIDOMHTMLPictureElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HTMLPictureElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||||
|
virtual ~HTMLPictureElement();
|
||||||
|
|
||||||
|
// nsISupports
|
||||||
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
|
// nsIDOMHTMLPictureElement
|
||||||
|
NS_DECL_NSIDOMHTMLPICTUREELEMENT
|
||||||
|
|
||||||
|
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
static bool IsPictureEnabled();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif // mozilla_dom_HTMLPictureElement_h
|
|
@ -47,6 +47,7 @@ EXPORTS.mozilla.dom += [
|
||||||
'HTMLOptionsCollection.h',
|
'HTMLOptionsCollection.h',
|
||||||
'HTMLOutputElement.h',
|
'HTMLOutputElement.h',
|
||||||
'HTMLParagraphElement.h',
|
'HTMLParagraphElement.h',
|
||||||
|
'HTMLPictureElement.h',
|
||||||
'HTMLPreElement.h',
|
'HTMLPreElement.h',
|
||||||
'HTMLProgressElement.h',
|
'HTMLProgressElement.h',
|
||||||
'HTMLScriptElement.h',
|
'HTMLScriptElement.h',
|
||||||
|
@ -118,6 +119,7 @@ UNIFIED_SOURCES += [
|
||||||
'HTMLOptionsCollection.cpp',
|
'HTMLOptionsCollection.cpp',
|
||||||
'HTMLOutputElement.cpp',
|
'HTMLOutputElement.cpp',
|
||||||
'HTMLParagraphElement.cpp',
|
'HTMLParagraphElement.cpp',
|
||||||
|
'HTMLPictureElement.cpp',
|
||||||
'HTMLPreElement.cpp',
|
'HTMLPreElement.cpp',
|
||||||
'HTMLProgressElement.cpp',
|
'HTMLProgressElement.cpp',
|
||||||
'HTMLPropertiesCollection.cpp',
|
'HTMLPropertiesCollection.cpp',
|
||||||
|
|
|
@ -1764,6 +1764,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(OptGroup)
|
||||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Option)
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Option)
|
||||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Output)
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Output)
|
||||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Paragraph)
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Paragraph)
|
||||||
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Picture)
|
||||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
|
||||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Progress)
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Progress)
|
||||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
|
||||||
|
|
|
@ -45,6 +45,7 @@ XPIDL_SOURCES += [
|
||||||
'nsIDOMHTMLOptionElement.idl',
|
'nsIDOMHTMLOptionElement.idl',
|
||||||
'nsIDOMHTMLOptionsCollection.idl',
|
'nsIDOMHTMLOptionsCollection.idl',
|
||||||
'nsIDOMHTMLParagraphElement.idl',
|
'nsIDOMHTMLParagraphElement.idl',
|
||||||
|
'nsIDOMHTMLPictureElement.idl',
|
||||||
'nsIDOMHTMLPreElement.idl',
|
'nsIDOMHTMLPreElement.idl',
|
||||||
'nsIDOMHTMLQuoteElement.idl',
|
'nsIDOMHTMLQuoteElement.idl',
|
||||||
'nsIDOMHTMLScriptElement.idl',
|
'nsIDOMHTMLScriptElement.idl',
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||||
|
/* 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 "nsIDOMHTMLElement.idl"
|
||||||
|
|
||||||
|
[scriptable, uuid(e0e5ac7f-b969-494c-a61e-9d740e38abba)]
|
||||||
|
interface nsIDOMHTMLPictureElement : nsISupports
|
||||||
|
{
|
||||||
|
};
|
|
@ -501,6 +501,8 @@ var interfaceNamesInGlobalScope =
|
||||||
"HTMLParamElement",
|
"HTMLParamElement",
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
"HTMLPreElement",
|
"HTMLPreElement",
|
||||||
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
{name: "HTMLPictureElement", pref: "dom.image.picture.enabled"},
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
"HTMLProgressElement",
|
"HTMLProgressElement",
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
/* -*- Mode: IDL; 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[Pref="dom.image.picture.enabled"]
|
||||||
|
interface HTMLPictureElement : HTMLElement {
|
||||||
|
};
|
|
@ -178,6 +178,7 @@ WEBIDL_FILES = [
|
||||||
'HTMLOutputElement.webidl',
|
'HTMLOutputElement.webidl',
|
||||||
'HTMLParagraphElement.webidl',
|
'HTMLParagraphElement.webidl',
|
||||||
'HTMLParamElement.webidl',
|
'HTMLParamElement.webidl',
|
||||||
|
'HTMLPictureElement.webidl',
|
||||||
'HTMLPreElement.webidl',
|
'HTMLPreElement.webidl',
|
||||||
'HTMLProgressElement.webidl',
|
'HTMLProgressElement.webidl',
|
||||||
'HTMLPropertiesCollection.webidl',
|
'HTMLPropertiesCollection.webidl',
|
||||||
|
|
Загрузка…
Ссылка в новой задаче