mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Fix for bug 824007 (Convert HTMLBodyElement, HTMLDataListElement, HTMLFontElement, HTMLFrameSetElement and HTMLLabelElement to new DOM bindings) - move some HTML element classes to mozilla::dom. r=bz.
--HG-- rename : content/html/content/src/nsHTMLBodyElement.cpp => content/html/content/src/HTMLBodyElement.cpp rename : content/html/content/src/nsHTMLDataListElement.cpp => content/html/content/src/HTMLDataListElement.cpp rename : content/html/content/src/nsHTMLDivElement.cpp => content/html/content/src/HTMLDivElement.cpp rename : content/html/content/src/nsHTMLDivElement.h => content/html/content/src/HTMLDivElement.h rename : content/html/content/src/nsHTMLElement.cpp => content/html/content/src/HTMLElement.cpp rename : content/html/content/src/nsHTMLFontElement.cpp => content/html/content/src/HTMLFontElement.cpp rename : content/html/content/src/nsHTMLFrameSetElement.cpp => content/html/content/src/HTMLFrameSetElement.cpp rename : content/html/content/src/nsHTMLFrameSetElement.h => content/html/content/src/HTMLFrameSetElement.h rename : content/html/content/src/nsHTMLLabelElement.cpp => content/html/content/src/HTMLLabelElement.cpp rename : content/html/content/src/nsHTMLLabelElement.h => content/html/content/src/HTMLLabelElement.h rename : content/html/content/src/nsHTMLUnknownElement.cpp => content/html/content/src/HTMLUnknownElement.cpp rename : content/html/content/src/nsHTMLUnknownElement.h => content/html/content/src/HTMLUnknownElement.h extra : rebase_source : 99a2b1764bfd34db1375939b967f816dc2a42a91
This commit is contained in:
parent
22cf1a5568
commit
d837e37c50
@ -277,11 +277,11 @@ public:
|
||||
// worthwhile:
|
||||
// - nsGenericHTMLElement: mForm, mFieldSet
|
||||
// - nsGenericHTMLFrameElement: mFrameLoader (bug 672539), mTitleChangedListener
|
||||
// - nsHTMLBodyElement: mContentStyleRule
|
||||
// - nsHTMLDataListElement: mOptions
|
||||
// - HTMLBodyElement: mContentStyleRule
|
||||
// - HTMLDataListElement: mOptions
|
||||
// - nsHTMLFieldSetElement: mElements, mDependentElements, mFirstLegend
|
||||
// - nsHTMLFormElement: many!
|
||||
// - nsHTMLFrameSetElement: mRowSpecs, mColSpecs
|
||||
// - HTMLFrameSetElement: mRowSpecs, mColSpecs
|
||||
// - nsHTMLInputElement: mInputData, mFiles, mFileList, mStaticDocfileList
|
||||
// - nsHTMLMapElement: mAreas
|
||||
// - nsHTMLMediaElement: many!
|
||||
|
@ -92,7 +92,7 @@
|
||||
#include "nsICommandParams.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsHTMLLabelElement.h"
|
||||
#include "mozilla/dom/HTMLLabelElement.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
@ -4613,7 +4613,8 @@ nsEventStateManager::GetEventTargetContent(nsEvent* aEvent)
|
||||
static Element*
|
||||
GetLabelTarget(nsIContent* aPossibleLabel)
|
||||
{
|
||||
nsHTMLLabelElement* label = nsHTMLLabelElement::FromContent(aPossibleLabel);
|
||||
mozilla::dom::HTMLLabelElement* label =
|
||||
mozilla::dom::HTMLLabelElement::FromContent(aPossibleLabel);
|
||||
if (!label)
|
||||
return nullptr;
|
||||
|
||||
|
@ -5,10 +5,7 @@
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "HTMLBodyElement.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
@ -22,92 +19,17 @@
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#include "jspubtd.h"
|
||||
#include "mozilla/dom/EventHandlerBinding.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Body)
|
||||
DOMCI_NODE_DATA(HTMLBodyElement, mozilla::dom::HTMLBodyElement)
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
class nsHTMLBodyElement;
|
||||
|
||||
class BodyRule: public nsIStyleRule {
|
||||
public:
|
||||
BodyRule(nsHTMLBodyElement* aPart);
|
||||
virtual ~BodyRule();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStyleRule interface
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
nsHTMLBodyElement* mPart; // not ref-counted, cleared by content
|
||||
};
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsHTMLBodyElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLBodyElement
|
||||
{
|
||||
public:
|
||||
using Element::GetText;
|
||||
using Element::SetText;
|
||||
|
||||
nsHTMLBodyElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLBodyElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLBodyElement
|
||||
NS_DECL_NSIDOMHTMLBODYELEMENT
|
||||
|
||||
// Event listener stuff; we need to declare only the ones we need to
|
||||
// forward to window that don't come from nsIDOMHTMLBodyElement.
|
||||
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by the shim */
|
||||
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHOD GetOn##name_(JSContext *cx, jsval *vp); \
|
||||
NS_IMETHOD SetOn##name_(JSContext *cx, const jsval &v);
|
||||
#include "nsEventNameList.h"
|
||||
#undef FORWARDED_EVENT
|
||||
#undef EVENT
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true);
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual already_AddRefed<nsIEditor> GetAssociatedEditor();
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
private:
|
||||
nsresult GetColorHelper(nsIAtom* aAtom, nsAString& aColor);
|
||||
|
||||
protected:
|
||||
BodyRule* mContentStyleRule;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
BodyRule::BodyRule(nsHTMLBodyElement* aPart)
|
||||
BodyRule::BodyRule(HTMLBodyElement* aPart)
|
||||
{
|
||||
mPart = aPart;
|
||||
}
|
||||
@ -264,17 +186,7 @@ BodyRule::List(FILE* out, int32_t aIndent) const
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Body)
|
||||
|
||||
|
||||
nsHTMLBodyElement::nsHTMLBodyElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo),
|
||||
mContentStyleRule(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLBodyElement::~nsHTMLBodyElement()
|
||||
HTMLBodyElement::~HTMLBodyElement()
|
||||
{
|
||||
if (mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nullptr;
|
||||
@ -283,33 +195,31 @@ nsHTMLBodyElement::~nsHTMLBodyElement()
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLBodyElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLBodyElement, Element)
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLBodyElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLBodyElement, Element)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLBodyElement, nsHTMLBodyElement)
|
||||
|
||||
// QueryInterface implementation for nsHTMLBodyElement
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLBodyElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLBodyElement, nsIDOMHTMLBodyElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLBodyElement,
|
||||
// QueryInterface implementation for HTMLBodyElement
|
||||
NS_INTERFACE_TABLE_HEAD(HTMLBodyElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLBodyElement, nsIDOMHTMLBodyElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLBodyElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLBodyElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLBodyElement)
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLBodyElement)
|
||||
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Background, background)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, VLink, vlink)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, ALink, alink)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Link, link)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Text, text)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, BgColor, bgcolor)
|
||||
NS_IMPL_STRING_ATTR(HTMLBodyElement, Background, background)
|
||||
NS_IMPL_STRING_ATTR(HTMLBodyElement, VLink, vlink)
|
||||
NS_IMPL_STRING_ATTR(HTMLBodyElement, ALink, alink)
|
||||
NS_IMPL_STRING_ATTR(HTMLBodyElement, Link, link)
|
||||
NS_IMPL_STRING_ATTR(HTMLBodyElement, Text, text)
|
||||
NS_IMPL_STRING_ATTR(HTMLBodyElement, BgColor, bgcolor)
|
||||
|
||||
bool
|
||||
nsHTMLBodyElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
HTMLBodyElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::bgcolor ||
|
||||
@ -337,7 +247,7 @@ nsHTMLBodyElement::ParseAttribute(int32_t aNamespaceID,
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLBodyElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
HTMLBodyElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
if (mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nullptr;
|
||||
@ -398,13 +308,13 @@ void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aD
|
||||
}
|
||||
|
||||
nsMapRuleToAttributesFunc
|
||||
nsHTMLBodyElement::GetAttributeMappingFunction() const
|
||||
HTMLBodyElement::GetAttributeMappingFunction() const
|
||||
{
|
||||
return &MapAttributesIntoRule;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
HTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
nsGenericHTMLElement::WalkContentStyleRules(aRuleWalker);
|
||||
|
||||
@ -421,7 +331,7 @@ nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsHTMLBodyElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
HTMLBodyElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
{ &nsGkAtoms::link },
|
||||
@ -447,7 +357,7 @@ nsHTMLBodyElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
}
|
||||
|
||||
already_AddRefed<nsIEditor>
|
||||
nsHTMLBodyElement::GetAssociatedEditor()
|
||||
HTMLBodyElement::GetAssociatedEditor()
|
||||
{
|
||||
nsIEditor* editor = nullptr;
|
||||
if (NS_SUCCEEDED(GetEditorInternal(&editor)) && editor) {
|
||||
@ -479,55 +389,59 @@ nsHTMLBodyElement::GetAssociatedEditor()
|
||||
// nsGenericHTMLElement::GetOnError returns
|
||||
// already_AddRefed<EventHandlerNonNull> while other getters return
|
||||
// EventHandlerNonNull*, so allow passing in the type to use here.
|
||||
#define FORWARDED_EVENT_HELPER(name_, getter_type_) \
|
||||
NS_IMETHODIMP nsHTMLBodyElement::GetOn##name_(JSContext *cx, \
|
||||
jsval *vp) { \
|
||||
getter_type_ h = nsGenericHTMLElement::GetOn##name_(); \
|
||||
vp->setObjectOrNull(h ? h->Callable() : nullptr); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP nsHTMLBodyElement::SetOn##name_(JSContext *cx, \
|
||||
const jsval &v) { \
|
||||
JSObject *obj = GetWrapper(); \
|
||||
if (!obj) { \
|
||||
/* Just silently do nothing */ \
|
||||
return NS_OK; \
|
||||
} \
|
||||
nsRefPtr<EventHandlerNonNull> handler; \
|
||||
JSObject *callable; \
|
||||
if (v.isObject() && \
|
||||
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
|
||||
bool ok; \
|
||||
handler = new EventHandlerNonNull(cx, obj, callable, &ok); \
|
||||
if (!ok) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
} \
|
||||
ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetOn##name_(handler, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
#define FORWARDED_EVENT_HELPER(name_, getter_type_) \
|
||||
NS_IMETHODIMP \
|
||||
HTMLBodyElement::GetOn##name_(JSContext *cx, jsval *vp) \
|
||||
{ \
|
||||
getter_type_ h = nsGenericHTMLElement::GetOn##name_(); \
|
||||
vp->setObjectOrNull(h ? h->Callable() : nullptr); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
HTMLBodyElement::SetOn##name_(JSContext *cx, const jsval &v) \
|
||||
{ \
|
||||
JSObject *obj = GetWrapper(); \
|
||||
if (!obj) { \
|
||||
/* Just silently do nothing */ \
|
||||
return NS_OK; \
|
||||
} \
|
||||
nsRefPtr<EventHandlerNonNull> handler; \
|
||||
JSObject *callable; \
|
||||
if (v.isObject() && \
|
||||
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
|
||||
bool ok; \
|
||||
handler = new EventHandlerNonNull(cx, obj, callable, &ok); \
|
||||
if (!ok) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
} \
|
||||
ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetOn##name_(handler, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
}
|
||||
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
|
||||
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
|
||||
FORWARDED_EVENT_HELPER(name_, EventHandlerNonNull*)
|
||||
#define ERROR_EVENT(name_, id_, type_, struct_) \
|
||||
#define ERROR_EVENT(name_, id_, type_, struct_) \
|
||||
FORWARDED_EVENT_HELPER(name_, nsCOMPtr<EventHandlerNonNull>)
|
||||
#define WINDOW_EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHODIMP nsHTMLBodyElement::GetOn##name_(JSContext *cx, \
|
||||
jsval *vp) { \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win && win->IsInnerWindow()) { \
|
||||
return win->GetOn##name_(cx, vp); \
|
||||
} \
|
||||
*vp = JSVAL_NULL; \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP nsHTMLBodyElement::SetOn##name_(JSContext *cx, \
|
||||
const jsval &v) { \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win && win->IsInnerWindow()) { \
|
||||
return win->SetOn##name_(cx, v); \
|
||||
} \
|
||||
return NS_OK; \
|
||||
#define WINDOW_EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHODIMP \
|
||||
HTMLBodyElement::GetOn##name_(JSContext *cx, jsval *vp) \
|
||||
{ \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win && win->IsInnerWindow()) { \
|
||||
return win->GetOn##name_(cx, vp); \
|
||||
} \
|
||||
*vp = JSVAL_NULL; \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
HTMLBodyElement::SetOn##name_(JSContext *cx, const jsval &v) \
|
||||
{ \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win && win->IsInnerWindow()) { \
|
||||
return win->SetOn##name_(cx, v); \
|
||||
} \
|
||||
return NS_OK; \
|
||||
}
|
||||
#include "nsEventNameList.h"
|
||||
#undef WINDOW_EVENT
|
||||
@ -535,3 +449,6 @@ nsHTMLBodyElement::GetAssociatedEditor()
|
||||
#undef FORWARDED_EVENT
|
||||
#undef FORWARDED_EVENT_HELPER
|
||||
#undef EVENT
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
97
content/html/content/src/HTMLBodyElement.h
Normal file
97
content/html/content/src/HTMLBodyElement.h
Normal file
@ -0,0 +1,97 @@
|
||||
/* -*- 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/. */
|
||||
#ifndef HTMLBodyElement_h___
|
||||
#define HTMLBodyElement_h___
|
||||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "nsIStyleRule.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class BeforeUnloadEventHandlerNonNull;
|
||||
class HTMLBodyElement;
|
||||
|
||||
class BodyRule: public nsIStyleRule
|
||||
{
|
||||
public:
|
||||
BodyRule(HTMLBodyElement* aPart);
|
||||
virtual ~BodyRule();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStyleRule interface
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
HTMLBodyElement* mPart; // not ref-counted, cleared by content
|
||||
};
|
||||
|
||||
class HTMLBodyElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLBodyElement
|
||||
{
|
||||
public:
|
||||
using Element::GetText;
|
||||
using Element::SetText;
|
||||
|
||||
HTMLBodyElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo),
|
||||
mContentStyleRule(nullptr)
|
||||
{
|
||||
}
|
||||
virtual ~HTMLBodyElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLBodyElement
|
||||
NS_DECL_NSIDOMHTMLBODYELEMENT
|
||||
|
||||
// Event listener stuff; we need to declare only the ones we need to
|
||||
// forward to window that don't come from nsIDOMHTMLBodyElement.
|
||||
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by the shim */
|
||||
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHOD GetOn##name_(JSContext *cx, jsval *vp); \
|
||||
NS_IMETHOD SetOn##name_(JSContext *cx, const jsval &v);
|
||||
#include "nsEventNameList.h"
|
||||
#undef FORWARDED_EVENT
|
||||
#undef EVENT
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true);
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual already_AddRefed<nsIEditor> GetAssociatedEditor();
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
private:
|
||||
nsresult GetColorHelper(nsIAtom* aAtom, nsAString& aColor);
|
||||
|
||||
protected:
|
||||
BodyRule* mContentStyleRule;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* HTMLBodyElement_h___ */
|
64
content/html/content/src/HTMLDataListElement.cpp
Normal file
64
content/html/content/src/HTMLDataListElement.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/* -*- 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 "HTMLDataListElement.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(DataList)
|
||||
DOMCI_NODE_DATA(HTMLDataListElement, mozilla::dom::HTMLDataListElement)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
HTMLDataListElement::~HTMLDataListElement()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLDataListElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOptions)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLDataListElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLDataListElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOptions)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLDataListElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLDataListElement, Element)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLDataListElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLDataListElement,
|
||||
nsIDOMHTMLDataListElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLDataListElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLDataListElement)
|
||||
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLDataListElement)
|
||||
|
||||
bool
|
||||
HTMLDataListElement::MatchOptions(nsIContent* aContent, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData)
|
||||
{
|
||||
return aContent->NodeInfo()->Equals(nsGkAtoms::option, kNameSpaceID_XHTML) &&
|
||||
!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLDataListElement::GetOptions(nsIDOMHTMLCollection** aOptions)
|
||||
{
|
||||
if (!mOptions) {
|
||||
mOptions = new nsContentList(this, MatchOptions, nullptr, nullptr, true);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aOptions = mOptions);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
60
content/html/content/src/HTMLDataListElement.h
Normal file
60
content/html/content/src/HTMLDataListElement.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* -*- 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/. */
|
||||
#ifndef HTMLDataListElement_h___
|
||||
#define HTMLDataListElement_h___
|
||||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLDataListElement.h"
|
||||
#include "nsContentList.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLDataListElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLDataListElement
|
||||
{
|
||||
public:
|
||||
HTMLDataListElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
virtual ~HTMLDataListElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLDataListElement
|
||||
NS_DECL_NSIDOMHTMLDATALISTELEMENT
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
// This function is used to generate the nsContentList (option elements).
|
||||
static bool MatchOptions(nsIContent* aContent, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLDataListElement,
|
||||
nsGenericHTMLElement)
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
protected:
|
||||
|
||||
// <option>'s list inside the datalist element.
|
||||
nsRefPtr<nsContentList> mOptions;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* HTMLDataListElement_h___ */
|
@ -5,54 +5,45 @@
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "nsHTMLDivElement.h"
|
||||
#include "HTMLDivElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "mozilla/dom/HTMLDivElementBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Div)
|
||||
DOMCI_NODE_DATA(HTMLDivElement, mozilla::dom::HTMLDivElement)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsHTMLDivElement::nsHTMLDivElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsHTMLDivElement::~nsHTMLDivElement()
|
||||
HTMLDivElement::~HTMLDivElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLDivElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLDivElement, Element)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLDivElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLDivElement, Element)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLDivElement, nsHTMLDivElement)
|
||||
|
||||
// QueryInterface implementation for nsHTMLDivElement
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLDivElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLDivElement, nsIDOMHTMLDivElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLDivElement,
|
||||
// QueryInterface implementation for HTMLDivElement
|
||||
NS_INTERFACE_TABLE_HEAD(HTMLDivElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLDivElement, nsIDOMHTMLDivElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLDivElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLDivElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLDivElement)
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLDivElement)
|
||||
|
||||
JSObject*
|
||||
nsHTMLDivElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
HTMLDivElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
{
|
||||
return dom::HTMLDivElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLDivElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
HTMLDivElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
|
||||
@ -96,7 +87,7 @@ MapMarqueeAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData*
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsHTMLDivElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
HTMLDivElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::div)) {
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
@ -118,7 +109,7 @@ nsHTMLDivElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
}
|
||||
|
||||
nsMapRuleToAttributesFunc
|
||||
nsHTMLDivElement::GetAttributeMappingFunction() const
|
||||
HTMLDivElement::GetAttributeMappingFunction() const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::div)) {
|
||||
return &MapAttributesIntoRule;
|
||||
@ -129,3 +120,5 @@ nsHTMLDivElement::GetAttributeMappingFunction() const
|
||||
return nsGenericHTMLElement::GetAttributeMappingFunction();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -2,18 +2,25 @@
|
||||
/* 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 nsHTMLDivElement_h___
|
||||
#define nsHTMLDivElement_h___
|
||||
#ifndef HTMLDivElement_h___
|
||||
#define HTMLDivElement_h___
|
||||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLDivElement.h"
|
||||
|
||||
class nsHTMLDivElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLDivElement
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLDivElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLDivElement
|
||||
{
|
||||
public:
|
||||
nsHTMLDivElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLDivElement();
|
||||
HTMLDivElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
virtual ~HTMLDivElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
@ -52,9 +59,9 @@ public:
|
||||
}
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
@ -67,4 +74,7 @@ protected:
|
||||
bool *aTriedToWrap) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif /* nsHTMLDivElement_h___ */
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* HTMLDivElement_h___ */
|
@ -4,20 +4,18 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/dom/HTMLElementBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class nsHTMLElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLElement
|
||||
class HTMLElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLElement
|
||||
{
|
||||
public:
|
||||
nsHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLElement();
|
||||
HTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~HTMLElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
@ -34,7 +32,8 @@ public:
|
||||
virtual void GetInnerHTML(nsAString& aInnerHTML,
|
||||
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
||||
|
||||
nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
|
||||
virtual nsresult Clone(nsINodeInfo* aNodeInfo,
|
||||
nsINode** aResult) const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
@ -45,40 +44,29 @@ protected:
|
||||
bool *aTriedToWrap) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
// Here, we expand 'NS_IMPL_NS_NEW_HTML_ELEMENT()' by hand.
|
||||
// (Calling the macro directly (with no args) produces compiler warnings.)
|
||||
nsGenericHTMLElement*
|
||||
NS_NewHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
FromParser aFromParser)
|
||||
{
|
||||
return new nsHTMLElement(aNodeInfo);
|
||||
}
|
||||
|
||||
nsHTMLElement::nsHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
HTMLElement::HTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsHTMLElement::~nsHTMLElement()
|
||||
HTMLElement::~HTMLElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLElement, Element)
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLElement, Element)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLElement, nsHTMLElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE0(nsHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLElement,
|
||||
NS_INTERFACE_TABLE_HEAD(HTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE0(HTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLElement)
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLElement)
|
||||
|
||||
void
|
||||
nsHTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
|
||||
HTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
|
||||
{
|
||||
/**
|
||||
* nsGenericHTMLElement::GetInnerHTML escapes < and > characters (at least).
|
||||
@ -97,7 +85,21 @@ nsHTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
|
||||
}
|
||||
|
||||
JSObject*
|
||||
nsHTMLElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
HTMLElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
{
|
||||
return dom::HTMLElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
// Here, we expand 'NS_IMPL_NS_NEW_HTML_ELEMENT()' by hand.
|
||||
// (Calling the macro directly (with no args) produces compiler warnings.)
|
||||
nsGenericHTMLElement*
|
||||
NS_NewHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser)
|
||||
{
|
||||
return new mozilla::dom::HTMLElement(aNodeInfo);
|
||||
}
|
||||
|
||||
DOMCI_NODE_DATA(HTMLElement, mozilla::dom::HTMLElement)
|
@ -5,94 +5,45 @@
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMHTMLFontElement.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "HTMLFontElement.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsRuleData.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
class nsHTMLFontElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLFontElement
|
||||
{
|
||||
public:
|
||||
nsHTMLFontElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLFontElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLFontElement
|
||||
NS_DECL_NSIDOMHTMLFONTELEMENT
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
};
|
||||
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Font)
|
||||
DOMCI_NODE_DATA(HTMLFontElement, mozilla::dom::HTMLFontElement)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsHTMLFontElement::nsHTMLFontElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
HTMLFontElement::~HTMLFontElement()
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLFontElement::~nsHTMLFontElement()
|
||||
{
|
||||
}
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLFontElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLFontElement, Element)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLFontElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLFontElement, Element)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLFontElement, nsHTMLFontElement)
|
||||
|
||||
// QueryInterface implementation for nsHTMLFontElement
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLFontElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLFontElement, nsIDOMHTMLFontElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLFontElement,
|
||||
// QueryInterface implementation for HTMLFontElement
|
||||
NS_INTERFACE_TABLE_HEAD(HTMLFontElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLFontElement, nsIDOMHTMLFontElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLFontElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLFontElement)
|
||||
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLFontElement)
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLFontElement)
|
||||
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLFontElement, Color, color)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLFontElement, Face, face)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLFontElement, Size, size)
|
||||
NS_IMPL_STRING_ATTR(HTMLFontElement, Color, color)
|
||||
NS_IMPL_STRING_ATTR(HTMLFontElement, Face, face)
|
||||
NS_IMPL_STRING_ATTR(HTMLFontElement, Size, size)
|
||||
|
||||
|
||||
bool
|
||||
nsHTMLFontElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
HTMLFontElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::size) {
|
||||
@ -169,7 +120,7 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsHTMLFontElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
HTMLFontElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
{ &nsGkAtoms::face },
|
||||
@ -188,7 +139,10 @@ nsHTMLFontElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
|
||||
|
||||
nsMapRuleToAttributesFunc
|
||||
nsHTMLFontElement::GetAttributeMappingFunction() const
|
||||
HTMLFontElement::GetAttributeMappingFunction() const
|
||||
{
|
||||
return &MapAttributesIntoRule;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
53
content/html/content/src/HTMLFontElement.h
Normal file
53
content/html/content/src/HTMLFontElement.h
Normal file
@ -0,0 +1,53 @@
|
||||
/* -*- 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/. */
|
||||
#ifndef HTMLFontElement_h___
|
||||
#define HTMLFontElement_h___
|
||||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLFontElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLFontElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLFontElement
|
||||
{
|
||||
public:
|
||||
HTMLFontElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
virtual ~HTMLFontElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLFontElement
|
||||
NS_DECL_NSIDOMHTMLFONTELEMENT
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* HTMLFontElement_h___ */
|
@ -3,53 +3,44 @@
|
||||
* 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 "nsHTMLFrameSetElement.h"
|
||||
#include "jsapi.h"
|
||||
#include "HTMLFrameSetElement.h"
|
||||
#include "mozilla/dom/EventHandlerBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(FrameSet)
|
||||
DOMCI_NODE_DATA(HTMLFrameSetElement, mozilla::dom::HTMLFrameSetElement)
|
||||
|
||||
nsHTMLFrameSetElement::nsHTMLFrameSetElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo), mNumRows(0), mNumCols(0),
|
||||
mCurrentRowColHint(NS_STYLE_HINT_REFLOW)
|
||||
{
|
||||
}
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsHTMLFrameSetElement::~nsHTMLFrameSetElement()
|
||||
HTMLFrameSetElement::~HTMLFrameSetElement()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLFrameSetElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLFrameSetElement, Element)
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLFrameSetElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLFrameSetElement, Element)
|
||||
|
||||
|
||||
DOMCI_NODE_DATA(HTMLFrameSetElement, nsHTMLFrameSetElement)
|
||||
|
||||
// QueryInterface implementation for nsHTMLFrameSetElement
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLFrameSetElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLFrameSetElement,
|
||||
// QueryInterface implementation for HTMLFrameSetElement
|
||||
NS_INTERFACE_TABLE_HEAD(HTMLFrameSetElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLFrameSetElement,
|
||||
nsIDOMHTMLFrameSetElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLFrameSetElement,
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLFrameSetElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLFrameSetElement)
|
||||
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLFrameSetElement)
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLFrameSetElement)
|
||||
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLFrameSetElement, Cols, cols)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLFrameSetElement, Rows, rows)
|
||||
NS_IMPL_STRING_ATTR(HTMLFrameSetElement, Cols, cols)
|
||||
NS_IMPL_STRING_ATTR(HTMLFrameSetElement, Rows, rows)
|
||||
|
||||
nsresult
|
||||
nsHTMLFrameSetElement::SetAttr(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
nsIAtom* aPrefix,
|
||||
const nsAString& aValue,
|
||||
bool aNotify)
|
||||
HTMLFrameSetElement::SetAttr(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
nsIAtom* aPrefix,
|
||||
const nsAString& aValue,
|
||||
bool aNotify)
|
||||
{
|
||||
nsresult rv;
|
||||
/* The main goal here is to see whether the _number_ of rows or
|
||||
@ -85,8 +76,8 @@ nsHTMLFrameSetElement::SetAttr(int32_t aNameSpaceID,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLFrameSetElement::GetRowSpec(int32_t *aNumValues,
|
||||
const nsFramesetSpec** aSpecs)
|
||||
HTMLFrameSetElement::GetRowSpec(int32_t *aNumValues,
|
||||
const nsFramesetSpec** aSpecs)
|
||||
{
|
||||
NS_PRECONDITION(aNumValues, "Must have a pointer to an integer here!");
|
||||
NS_PRECONDITION(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
|
||||
@ -119,8 +110,8 @@ nsHTMLFrameSetElement::GetRowSpec(int32_t *aNumValues,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLFrameSetElement::GetColSpec(int32_t *aNumValues,
|
||||
const nsFramesetSpec** aSpecs)
|
||||
HTMLFrameSetElement::GetColSpec(int32_t *aNumValues,
|
||||
const nsFramesetSpec** aSpecs)
|
||||
{
|
||||
NS_PRECONDITION(aNumValues, "Must have a pointer to an integer here!");
|
||||
NS_PRECONDITION(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
|
||||
@ -154,10 +145,10 @@ nsHTMLFrameSetElement::GetColSpec(int32_t *aNumValues,
|
||||
|
||||
|
||||
bool
|
||||
nsHTMLFrameSetElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
HTMLFrameSetElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::bordercolor) {
|
||||
@ -176,8 +167,8 @@ nsHTMLFrameSetElement::ParseAttribute(int32_t aNamespaceID,
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
nsHTMLFrameSetElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
int32_t aModType) const
|
||||
HTMLFrameSetElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
int32_t aModType) const
|
||||
{
|
||||
nsChangeHint retval =
|
||||
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
|
||||
@ -192,9 +183,9 @@ nsHTMLFrameSetElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
* Translate a "rows" or "cols" spec into an array of nsFramesetSpecs
|
||||
*/
|
||||
nsresult
|
||||
nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
|
||||
int32_t& aNumSpecs,
|
||||
nsFramesetSpec** aSpecs)
|
||||
HTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
|
||||
int32_t& aNumSpecs,
|
||||
nsFramesetSpec** aSpecs)
|
||||
{
|
||||
if (aValue.IsEmpty()) {
|
||||
aNumSpecs = 0;
|
||||
@ -324,56 +315,60 @@ nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
|
||||
// nsGenericHTMLElement::GetOnError returns
|
||||
// already_AddRefed<EventHandlerNonNull> while other getters return
|
||||
// EventHandlerNonNull*, so allow passing in the type to use here.
|
||||
#define FORWARDED_EVENT_HELPER(name_, getter_type_) \
|
||||
NS_IMETHODIMP nsHTMLFrameSetElement::GetOn##name_(JSContext *cx, \
|
||||
jsval *vp) { \
|
||||
getter_type_ h = nsGenericHTMLElement::GetOn##name_(); \
|
||||
vp->setObjectOrNull(h ? h->Callable() : nullptr); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP nsHTMLFrameSetElement::SetOn##name_(JSContext *cx, \
|
||||
const jsval &v) { \
|
||||
JSObject *obj = GetWrapper(); \
|
||||
if (!obj) { \
|
||||
/* Just silently do nothing */ \
|
||||
return NS_OK; \
|
||||
} \
|
||||
nsRefPtr<EventHandlerNonNull> handler; \
|
||||
JSObject *callable; \
|
||||
if (v.isObject() && \
|
||||
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
|
||||
bool ok; \
|
||||
handler = new EventHandlerNonNull(cx, obj, callable, &ok); \
|
||||
if (!ok) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
} \
|
||||
ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetOn##name_(handler, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
#define FORWARDED_EVENT_HELPER(name_, getter_type_) \
|
||||
NS_IMETHODIMP \
|
||||
HTMLFrameSetElement::GetOn##name_(JSContext *cx, jsval *vp) \
|
||||
{ \
|
||||
getter_type_ h = nsGenericHTMLElement::GetOn##name_(); \
|
||||
vp->setObjectOrNull(h ? h->Callable() : nullptr); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
HTMLFrameSetElement::SetOn##name_(JSContext *cx, const jsval &v) \
|
||||
{ \
|
||||
JSObject *obj = GetWrapper(); \
|
||||
if (!obj) { \
|
||||
/* Just silently do nothing */ \
|
||||
return NS_OK; \
|
||||
} \
|
||||
nsRefPtr<EventHandlerNonNull> handler; \
|
||||
JSObject *callable; \
|
||||
if (v.isObject() && \
|
||||
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
|
||||
bool ok; \
|
||||
handler = new EventHandlerNonNull(cx, obj, callable, &ok); \
|
||||
if (!ok) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
} \
|
||||
ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetOn##name_(handler, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
}
|
||||
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
|
||||
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
|
||||
FORWARDED_EVENT_HELPER(name_, EventHandlerNonNull*)
|
||||
#define ERROR_EVENT(name_, id_, type_, struct_) \
|
||||
#define ERROR_EVENT(name_, id_, type_, struct_) \
|
||||
FORWARDED_EVENT_HELPER(name_, nsCOMPtr<EventHandlerNonNull>)
|
||||
#define WINDOW_EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHODIMP nsHTMLFrameSetElement::GetOn##name_(JSContext *cx, \
|
||||
jsval *vp) { \
|
||||
/* XXXbz note to self: add tests for this! */ \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win && win->IsInnerWindow()) { \
|
||||
return win->GetOn##name_(cx, vp); \
|
||||
} \
|
||||
*vp = JSVAL_NULL; \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP nsHTMLFrameSetElement::SetOn##name_(JSContext *cx, \
|
||||
const jsval &v) { \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win && win->IsInnerWindow()) { \
|
||||
return win->SetOn##name_(cx, v); \
|
||||
} \
|
||||
return NS_OK; \
|
||||
#define WINDOW_EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHODIMP \
|
||||
HTMLFrameSetElement::GetOn##name_(JSContext *cx, jsval *vp) \
|
||||
{ \
|
||||
/* XXXbz note to self: add tests for this! */ \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win && win->IsInnerWindow()) { \
|
||||
return win->GetOn##name_(cx, vp); \
|
||||
} \
|
||||
*vp = JSVAL_NULL; \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
HTMLFrameSetElement::SetOn##name_(JSContext *cx, const jsval &v) \
|
||||
{ \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win && win->IsInnerWindow()) { \
|
||||
return win->SetOn##name_(cx, v); \
|
||||
} \
|
||||
return NS_OK; \
|
||||
}
|
||||
#include "nsEventNameList.h"
|
||||
#undef WINDOW_EVENT
|
||||
@ -381,3 +376,6 @@ nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
|
||||
#undef FORWARDED_EVENT
|
||||
#undef FORWARDED_EVENT_HELPER
|
||||
#undef EVENT
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -3,15 +3,11 @@
|
||||
* 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 nsHTMLFrameSetElement_h
|
||||
#define nsHTMLFrameSetElement_h
|
||||
#ifndef HTMLFrameSetElement_h
|
||||
#define HTMLFrameSetElement_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDOMHTMLFrameSetElement.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
||||
/**
|
||||
* The nsFramesetUnit enum is used to denote the type of each entry
|
||||
@ -40,14 +36,23 @@ struct nsFramesetSpec {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsHTMLFrameSetElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLFrameSetElement
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLFrameSetElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLFrameSetElement
|
||||
{
|
||||
public:
|
||||
nsHTMLFrameSetElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLFrameSetElement();
|
||||
HTMLFrameSetElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo),
|
||||
mNumRows(0),
|
||||
mNumCols(0),
|
||||
mCurrentRowColHint(NS_STYLE_HINT_REFLOW)
|
||||
{
|
||||
}
|
||||
virtual ~HTMLFrameSetElement();
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(nsHTMLFrameSetElement, frameset)
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLFrameSetElement, frameset)
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
@ -68,8 +73,8 @@ public:
|
||||
// forward to window that don't come from nsIDOMHTMLFrameSetElement.
|
||||
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by the superclass */
|
||||
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHOD GetOn##name_(JSContext *cx, jsval *vp); \
|
||||
NS_IMETHOD SetOn##name_(JSContext *cx, const jsval &v);
|
||||
NS_IMETHOD GetOn##name_(JSContext *cx, jsval *vp); \
|
||||
NS_IMETHOD SetOn##name_(JSContext *cx, const jsval &v);
|
||||
#include "nsEventNameList.h"
|
||||
#undef FORWARDED_EVENT
|
||||
#undef EVENT
|
||||
@ -142,4 +147,7 @@ private:
|
||||
nsAutoArrayPtr<nsFramesetSpec> mColSpecs; // parsed, non-computed dimensions
|
||||
};
|
||||
|
||||
#endif // nsHTMLFrameSetElement_h
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // HTMLFrameSetElement_h
|
@ -6,72 +6,49 @@
|
||||
/**
|
||||
* Implementation of HTML <label> elements.
|
||||
*/
|
||||
#include "nsHTMLLabelElement.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIForm.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "HTMLLabelElement.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
// construction, destruction
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Label)
|
||||
DOMCI_NODE_DATA(HTMLLabelElement, mozilla::dom::HTMLLabelElement)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsHTMLLabelElement::nsHTMLLabelElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLFormElement(aNodeInfo)
|
||||
, mHandlingEvent(false)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLLabelElement::~nsHTMLLabelElement()
|
||||
HTMLLabelElement::~HTMLLabelElement()
|
||||
{
|
||||
}
|
||||
|
||||
// nsISupports
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLLabelElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLLabelElement, Element)
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLLabelElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLLabelElement, Element)
|
||||
|
||||
|
||||
DOMCI_NODE_DATA(HTMLLabelElement, nsHTMLLabelElement)
|
||||
|
||||
// QueryInterface implementation for nsHTMLLabelElement
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLLabelElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLLabelElement,
|
||||
// QueryInterface implementation for HTMLLabelElement
|
||||
NS_INTERFACE_TABLE_HEAD(HTMLLabelElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLLabelElement,
|
||||
nsIDOMHTMLLabelElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLLabelElement,
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLLabelElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLLabelElement)
|
||||
|
||||
|
||||
// nsIDOMHTMLLabelElement
|
||||
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLLabelElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLLabelElement)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLabelElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
HTMLLabelElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
{
|
||||
return nsGenericHTMLFormElement::GetForm(aForm);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLabelElement::GetControl(nsIDOMHTMLElement** aElement)
|
||||
HTMLLabelElement::GetControl(nsIDOMHTMLElement** aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLElement> element = do_QueryInterface(GetLabeledElement());
|
||||
element.forget(aElement);
|
||||
@ -79,10 +56,10 @@ nsHTMLLabelElement::GetControl(nsIDOMHTMLElement** aElement)
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLLabelElement, HtmlFor, _for)
|
||||
NS_IMPL_STRING_ATTR(HTMLLabelElement, HtmlFor, _for)
|
||||
|
||||
void
|
||||
nsHTMLLabelElement::Focus(ErrorResult& aError)
|
||||
HTMLLabelElement::Focus(ErrorResult& aError)
|
||||
{
|
||||
// retarget the focus method at the for content
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
@ -93,22 +70,6 @@ nsHTMLLabelElement::Focus(ErrorResult& aError)
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLLabelElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
{
|
||||
return nsGenericHTMLFormElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLLabelElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
||||
static bool
|
||||
EventTargetIn(nsEvent *aEvent, nsIContent *aChild, nsIContent *aStop)
|
||||
{
|
||||
@ -139,7 +100,7 @@ DestroyMouseDownPoint(void * /*aObject*/,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (mHandlingEvent ||
|
||||
(!NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent) &&
|
||||
@ -238,35 +199,20 @@ nsHTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLLabelElement::Reset()
|
||||
HTMLLabelElement::Reset()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLabelElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
|
||||
HTMLLabelElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLLabelElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix,
|
||||
const nsAString& aValue, bool aNotify)
|
||||
{
|
||||
return nsGenericHTMLFormElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue,
|
||||
aNotify);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLLabelElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify)
|
||||
{
|
||||
return nsGenericHTMLFormElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLLabelElement::PerformAccesskey(bool aKeyCausesActivation,
|
||||
bool aIsTrustedEvent)
|
||||
HTMLLabelElement::PerformAccesskey(bool aKeyCausesActivation,
|
||||
bool aIsTrustedEvent)
|
||||
{
|
||||
if (!aKeyCausesActivation) {
|
||||
nsRefPtr<Element> element = GetLabeledElement();
|
||||
@ -291,7 +237,7 @@ nsHTMLLabelElement::PerformAccesskey(bool aKeyCausesActivation,
|
||||
}
|
||||
|
||||
Element*
|
||||
nsHTMLLabelElement::GetLabeledElement()
|
||||
HTMLLabelElement::GetLabeledElement()
|
||||
{
|
||||
nsAutoString elementId;
|
||||
|
||||
@ -317,7 +263,7 @@ nsHTMLLabelElement::GetLabeledElement()
|
||||
}
|
||||
|
||||
Element*
|
||||
nsHTMLLabelElement::GetFirstLabelableDescendant()
|
||||
HTMLLabelElement::GetFirstLabelableDescendant()
|
||||
{
|
||||
for (nsIContent* cur = nsINode::GetFirstChild(); cur;
|
||||
cur = cur->GetNextNode(this)) {
|
||||
@ -330,3 +276,5 @@ nsHTMLLabelElement::GetFirstLabelableDescendant()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -6,20 +6,27 @@
|
||||
/**
|
||||
* Declaration of HTML <label> elements.
|
||||
*/
|
||||
#ifndef nsHTMLLabelElement_h
|
||||
#define nsHTMLLabelElement_h
|
||||
#ifndef HTMLLabelElement_h
|
||||
#define HTMLLabelElement_h
|
||||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
|
||||
class nsHTMLLabelElement : public nsGenericHTMLFormElement,
|
||||
public nsIDOMHTMLLabelElement
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLLabelElement : public nsGenericHTMLFormElement,
|
||||
public nsIDOMHTMLLabelElement
|
||||
{
|
||||
public:
|
||||
nsHTMLLabelElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLLabelElement();
|
||||
HTMLLabelElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLFormElement(aNodeInfo),
|
||||
mHandlingEvent(false)
|
||||
{
|
||||
}
|
||||
virtual ~HTMLLabelElement();
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(nsHTMLLabelElement, label)
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLLabelElement, label)
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
@ -46,24 +53,7 @@ public:
|
||||
virtual bool IsDisabled() const { return false; }
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers);
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true);
|
||||
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
|
||||
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString& aValue, bool aNotify)
|
||||
{
|
||||
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
||||
}
|
||||
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
nsIAtom* aPrefix, const nsAString& aValue,
|
||||
bool aNotify);
|
||||
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify);
|
||||
virtual void PerformAccesskey(bool aKeyCausesActivation,
|
||||
bool aIsTrustedEvent);
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
@ -80,4 +70,7 @@ protected:
|
||||
bool mHandlingEvent;
|
||||
};
|
||||
|
||||
#endif /* nsHTMLLabelElement_h */
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* HTMLLabelElement_h */
|
@ -3,32 +3,34 @@
|
||||
* 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 "nsHTMLUnknownElement.h"
|
||||
#include "HTMLUnknownElement.h"
|
||||
#include "mozilla/dom/HTMLElementBinding.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Unknown)
|
||||
DOMCI_NODE_DATA(HTMLUnknownElement, mozilla::dom::HTMLUnknownElement)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLUnknownElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLUnknownElement, Element)
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLUnknownElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLUnknownElement, Element)
|
||||
|
||||
JSObject*
|
||||
nsHTMLUnknownElement::WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
HTMLUnknownElement::WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap)
|
||||
{
|
||||
return HTMLUnknownElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Unknown)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLUnknownElement, nsHTMLUnknownElement)
|
||||
|
||||
// QueryInterface implementation for nsHTMLUnknownElement
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLUnknownElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLUnknownElement,
|
||||
// QueryInterface implementation for HTMLUnknownElement
|
||||
NS_INTERFACE_TABLE_HEAD(HTMLUnknownElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLUnknownElement,
|
||||
nsIDOMHTMLUnknownElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLUnknownElement,
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLUnknownElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLUnknownElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLUnknownElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLUnknownElement)
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -2,17 +2,20 @@
|
||||
/* 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 nsHTMLUnknownElement_h___
|
||||
#define nsHTMLUnknownElement_h___
|
||||
#ifndef HTMLUnknownElement_h___
|
||||
#define HTMLUnknownElement_h___
|
||||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLUnknownElement.h"
|
||||
|
||||
class nsHTMLUnknownElement MOZ_FINAL : public nsGenericHTMLElement
|
||||
, public nsIDOMHTMLUnknownElement
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLUnknownElement MOZ_FINAL : public nsGenericHTMLElement
|
||||
, public nsIDOMHTMLUnknownElement
|
||||
{
|
||||
public:
|
||||
nsHTMLUnknownElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
HTMLUnknownElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
@ -44,4 +47,7 @@ protected:
|
||||
bool *aTriedToWrap) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif /* nsHTMLUnknownElement_h___ */
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* HTMLUnknownElement_h___ */
|
@ -25,6 +25,17 @@ EXPORTS = \
|
||||
nsTimeRanges.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/dom
|
||||
|
||||
EXPORTS_mozilla/dom = \
|
||||
HTMLBodyElement.h \
|
||||
HTMLDataListElement.h \
|
||||
HTMLDivElement.h \
|
||||
HTMLFontElement.h \
|
||||
HTMLFrameSetElement.h \
|
||||
HTMLLabelElement.h \
|
||||
HTMLUnknownElement.h
|
||||
|
||||
CPPSRCS = \
|
||||
HTMLPropertiesCollection.cpp \
|
||||
nsClientRect.cpp \
|
||||
@ -33,27 +44,27 @@ CPPSRCS = \
|
||||
nsGenericHTMLFrameElement.cpp \
|
||||
nsFormSubmission.cpp \
|
||||
nsTextEditorState.cpp \
|
||||
nsHTMLElement.cpp \
|
||||
HTMLElement.cpp \
|
||||
nsHTMLAnchorElement.cpp \
|
||||
nsHTMLAreaElement.cpp \
|
||||
nsHTMLBRElement.cpp \
|
||||
nsHTMLBodyElement.cpp \
|
||||
HTMLBodyElement.cpp \
|
||||
nsHTMLButtonElement.cpp \
|
||||
nsHTMLCanvasElement.cpp \
|
||||
nsHTMLDataListElement.cpp \
|
||||
nsHTMLDivElement.cpp \
|
||||
HTMLDataListElement.cpp \
|
||||
HTMLDivElement.cpp \
|
||||
nsHTMLFieldSetElement.cpp \
|
||||
nsHTMLFontElement.cpp \
|
||||
HTMLFontElement.cpp \
|
||||
nsHTMLFormElement.cpp \
|
||||
nsHTMLFrameElement.cpp \
|
||||
nsHTMLFrameSetElement.cpp \
|
||||
HTMLFrameSetElement.cpp \
|
||||
nsHTMLHRElement.cpp \
|
||||
nsHTMLHeadingElement.cpp \
|
||||
nsHTMLIFrameElement.cpp \
|
||||
nsHTMLImageElement.cpp \
|
||||
nsHTMLInputElement.cpp \
|
||||
nsHTMLLIElement.cpp \
|
||||
nsHTMLLabelElement.cpp \
|
||||
HTMLLabelElement.cpp \
|
||||
nsHTMLLegendElement.cpp \
|
||||
nsHTMLLinkElement.cpp \
|
||||
nsHTMLMapElement.cpp \
|
||||
@ -84,7 +95,7 @@ CPPSRCS = \
|
||||
nsHTMLTableSectionElement.cpp \
|
||||
nsHTMLTextAreaElement.cpp \
|
||||
nsHTMLTitleElement.cpp \
|
||||
nsHTMLUnknownElement.cpp \
|
||||
HTMLUnknownElement.cpp \
|
||||
nsDOMValidityState.cpp \
|
||||
nsIConstraintValidation.cpp \
|
||||
nsRadioVisitor.cpp \
|
||||
|
@ -1811,8 +1811,8 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
||||
// FIXME (https://bugzilla.mozilla.org/show_bug.cgi?id=431767)
|
||||
// nsDocument::GetInnerWindow can return an outer window in some cases,
|
||||
// we don't want to stick an event listener on an outer window, so
|
||||
// bail if it does. See similar code in nsHTMLBodyElement and
|
||||
// nsHTMLFramesetElement
|
||||
// bail if it does. See similar code in HTMLBodyElement and
|
||||
// HTMLFramesetElement
|
||||
*aDefer = false;
|
||||
if ((win = document->GetInnerWindow()) && win->IsInnerWindow()) {
|
||||
nsCOMPtr<nsIDOMEventTarget> piTarget(do_QueryInterface(win));
|
||||
|
@ -1,112 +0,0 @@
|
||||
/* -*- 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 "nsIDOMHTMLDataListElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsContentList.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
class nsHTMLDataListElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLDataListElement
|
||||
{
|
||||
public:
|
||||
nsHTMLDataListElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLDataListElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLDataListElement
|
||||
NS_DECL_NSIDOMHTMLDATALISTELEMENT
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
// This function is used to generate the nsContentList (option elements).
|
||||
static bool MatchOptions(nsIContent* aContent, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLDataListElement,
|
||||
nsGenericHTMLElement)
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
protected:
|
||||
|
||||
// <option>'s list inside the datalist element.
|
||||
nsRefPtr<nsContentList> mOptions;
|
||||
};
|
||||
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(DataList)
|
||||
|
||||
|
||||
nsHTMLDataListElement::nsHTMLDataListElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLDataListElement::~nsHTMLDataListElement()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLDataListElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOptions)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLDataListElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLDataListElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOptions)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLDataListElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLDataListElement, Element)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLDataListElement, nsHTMLDataListElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLDataListElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLDataListElement, nsIDOMHTMLDataListElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLDataListElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLDataListElement)
|
||||
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLDataListElement)
|
||||
|
||||
bool
|
||||
nsHTMLDataListElement::MatchOptions(nsIContent* aContent, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData)
|
||||
{
|
||||
return aContent->NodeInfo()->Equals(nsGkAtoms::option, kNameSpaceID_XHTML) &&
|
||||
!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDataListElement::GetOptions(nsIDOMHTMLCollection** aOptions)
|
||||
{
|
||||
if (!mOptions) {
|
||||
mOptions = new nsContentList(this, MatchOptions, nullptr, nullptr, true);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aOptions = mOptions);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -284,10 +284,6 @@ DOMInterfaces = {
|
||||
'resultNotAddRefed': [ 'item' ]
|
||||
},
|
||||
|
||||
'HTMLDivElement': {
|
||||
'nativeType': 'nsHTMLDivElement'
|
||||
},
|
||||
|
||||
'HTMLElement': {
|
||||
'nativeType': 'nsGenericHTMLElement',
|
||||
'hasXPConnectImpls': True,
|
||||
@ -312,10 +308,6 @@ DOMInterfaces = {
|
||||
'resultNotAddRefed': [ 'item', 'namedItem', 'names' ]
|
||||
},
|
||||
|
||||
'HTMLUnknownElement': {
|
||||
'nativeType': 'nsHTMLUnknownElement'
|
||||
},
|
||||
|
||||
'IID': [
|
||||
{
|
||||
'nativeType': 'nsIJSID',
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLCanvasElement.h"
|
||||
#include "nsHTMLDivElement.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "nsHTMLImageElement.h"
|
||||
#include "nsHTMLOptionElement.h"
|
||||
@ -165,7 +164,6 @@ xpc_qsUnwrapArg<_clazz>(JSContext *cx, jsval v, _clazz **ppArg, \
|
||||
}
|
||||
|
||||
DEFINE_UNWRAP_CAST_HTML(canvas, nsHTMLCanvasElement)
|
||||
DEFINE_UNWRAP_CAST_HTML(div, nsHTMLDivElement)
|
||||
DEFINE_UNWRAP_CAST_HTML(form, nsHTMLFormElement)
|
||||
DEFINE_UNWRAP_CAST_HTML(img, nsHTMLImageElement)
|
||||
DEFINE_UNWRAP_CAST_HTML(optgroup, nsHTMLOptGroupElement)
|
||||
|
@ -42,11 +42,12 @@
|
||||
#include "nsNodeUtils.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsHTMLFrameSetElement.h"
|
||||
#include "mozilla/dom/HTMLFrameSetElement.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
// masks for mEdgeVisibility
|
||||
#define LEFT_VIS 0x0001
|
||||
@ -276,7 +277,7 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
|
||||
nscolor borderColor = GetBorderColor();
|
||||
|
||||
// Get the rows= cols= data
|
||||
nsHTMLFrameSetElement* ourContent = nsHTMLFrameSetElement::FromContent(mContent);
|
||||
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
|
||||
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
|
||||
const nsFramesetSpec* rowSpecs = nullptr;
|
||||
const nsFramesetSpec* colSpecs = nullptr;
|
||||
@ -929,7 +930,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
|
||||
height -= (mNumRows - 1) * borderWidth;
|
||||
if (height < 0) height = 0;
|
||||
|
||||
nsHTMLFrameSetElement* ourContent = nsHTMLFrameSetElement::FromContent(mContent);
|
||||
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
|
||||
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
|
||||
const nsFramesetSpec* rowSpecs = nullptr;
|
||||
const nsFramesetSpec* colSpecs = nullptr;
|
||||
@ -1389,7 +1390,7 @@ nsHTMLFramesetFrame::MouseDrag(nsPresContext* aPresContext,
|
||||
if (change != 0) {
|
||||
// Recompute the specs from the new sizes.
|
||||
nscoord width = mRect.width - (mNumCols - 1) * GetBorderWidth(aPresContext, true);
|
||||
nsHTMLFrameSetElement* ourContent = nsHTMLFrameSetElement::FromContent(mContent);
|
||||
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
|
||||
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
|
||||
const nsFramesetSpec* colSpecs = nullptr;
|
||||
ourContent->GetColSpec(&mNumCols, &colSpecs);
|
||||
@ -1412,7 +1413,7 @@ nsHTMLFramesetFrame::MouseDrag(nsPresContext* aPresContext,
|
||||
if (change != 0) {
|
||||
// Recompute the specs from the new sizes.
|
||||
nscoord height = mRect.height - (mNumRows - 1) * GetBorderWidth(aPresContext, true);
|
||||
nsHTMLFrameSetElement* ourContent = nsHTMLFrameSetElement::FromContent(mContent);
|
||||
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
|
||||
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
|
||||
const nsFramesetSpec* rowSpecs = nullptr;
|
||||
ourContent->GetRowSpec(&mNumRows, &rowSpecs);
|
||||
|
@ -29,7 +29,7 @@ class nsHTMLFramesetFrame;
|
||||
|
||||
#define NO_COLOR 0xFFFFFFFA
|
||||
|
||||
// defined at nsHTMLFrameSetElement.h
|
||||
// defined at HTMLFrameSetElement.h
|
||||
struct nsFramesetSpec;
|
||||
|
||||
struct nsBorderColor
|
||||
|
Loading…
Reference in New Issue
Block a user