mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 870022 - Part 5.1 - Add HTMLPictureElement & atom. r=jst, sr=jst
This commit is contained in:
parent
74d7dac84a
commit
46c4e670a5
@ -2220,6 +2220,7 @@ GK_ATOM(menuitemradio, "menuitemradio")
|
||||
GK_ATOM(mixed, "mixed")
|
||||
GK_ATOM(multiline, "multiline")
|
||||
GK_ATOM(password, "password")
|
||||
GK_ATOM(picture, "picture")
|
||||
GK_ATOM(posinset, "posinset")
|
||||
GK_ATOM(presentation, "presentation")
|
||||
GK_ATOM(progressbar, "progressbar")
|
||||
|
57
content/html/content/src/HTMLPictureElement.cpp
Normal file
57
content/html/content/src/HTMLPictureElement.cpp
Normal file
@ -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
|
43
content/html/content/src/HTMLPictureElement.h
Normal file
43
content/html/content/src/HTMLPictureElement.h
Normal file
@ -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',
|
||||
'HTMLOutputElement.h',
|
||||
'HTMLParagraphElement.h',
|
||||
'HTMLPictureElement.h',
|
||||
'HTMLPreElement.h',
|
||||
'HTMLProgressElement.h',
|
||||
'HTMLScriptElement.h',
|
||||
@ -118,6 +119,7 @@ UNIFIED_SOURCES += [
|
||||
'HTMLOptionsCollection.cpp',
|
||||
'HTMLOutputElement.cpp',
|
||||
'HTMLParagraphElement.cpp',
|
||||
'HTMLPictureElement.cpp',
|
||||
'HTMLPreElement.cpp',
|
||||
'HTMLProgressElement.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(Output)
|
||||
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(Progress)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
|
||||
|
@ -45,6 +45,7 @@ XPIDL_SOURCES += [
|
||||
'nsIDOMHTMLOptionElement.idl',
|
||||
'nsIDOMHTMLOptionsCollection.idl',
|
||||
'nsIDOMHTMLParagraphElement.idl',
|
||||
'nsIDOMHTMLPictureElement.idl',
|
||||
'nsIDOMHTMLPreElement.idl',
|
||||
'nsIDOMHTMLQuoteElement.idl',
|
||||
'nsIDOMHTMLScriptElement.idl',
|
||||
|
12
dom/interfaces/html/nsIDOMHTMLPictureElement.idl
Normal file
12
dom/interfaces/html/nsIDOMHTMLPictureElement.idl
Normal file
@ -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",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"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!
|
||||
"HTMLProgressElement",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
9
dom/webidl/HTMLPictureElement.webidl
Normal file
9
dom/webidl/HTMLPictureElement.webidl
Normal file
@ -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',
|
||||
'HTMLParagraphElement.webidl',
|
||||
'HTMLParamElement.webidl',
|
||||
'HTMLPictureElement.webidl',
|
||||
'HTMLPreElement.webidl',
|
||||
'HTMLProgressElement.webidl',
|
||||
'HTMLPropertiesCollection.webidl',
|
||||
|
Loading…
Reference in New Issue
Block a user