зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 807075 (New DOM binding APIs for HTMLElement). r=bz.
--HG-- extra : rebase_source : 9afce481cd0a5c8a1014c8c9b0aad7d6665aaa82
This commit is contained in:
Родитель
e8544ee9d1
Коммит
f19ca9b71f
|
@ -475,7 +475,7 @@ HTMLTextFieldAccessible::DoAction(uint8_t aIndex)
|
|||
if (aIndex == 0) {
|
||||
nsHTMLInputElement* element = nsHTMLInputElement::FromContent(mContent);
|
||||
if (element)
|
||||
return element->DOMFocus();
|
||||
return element->Focus();
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -488,15 +488,14 @@ nsGenericElement::GetStyledFrame()
|
|||
return frame ? nsLayoutUtils::GetStyleFrame(frame) : nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
||||
nsGenericElement*
|
||||
nsGenericElement::GetOffsetRect(nsRect& aRect)
|
||||
{
|
||||
*aOffsetParent = nullptr;
|
||||
aRect = nsRect();
|
||||
|
||||
nsIFrame* frame = GetStyledFrame();
|
||||
if (!frame) {
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsPoint origin = frame->GetPosition();
|
||||
|
@ -511,6 +510,8 @@ nsGenericElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
|||
nsRect rcFrame = nsLayoutUtils::GetAllInFlowRectsUnion(frame, parent);
|
||||
aRect.width = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.width);
|
||||
aRect.height = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.height);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIntSize
|
||||
|
|
|
@ -668,12 +668,12 @@ protected:
|
|||
|
||||
/**
|
||||
* Retrieve the rectangle for the offsetX properties, which
|
||||
* are coordinates relative to the returned aOffsetParent.
|
||||
* are coordinates relative to the returned element.
|
||||
*
|
||||
* @param aRect offset rectangle
|
||||
* @param aOffsetParent offset parent
|
||||
*/
|
||||
virtual void GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent);
|
||||
virtual nsGenericElement* GetOffsetRect(nsRect& aRect);
|
||||
|
||||
/**
|
||||
* Retrieve the size of the padding rect of this element.
|
||||
|
|
|
@ -106,7 +106,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
*/
|
||||
nsEventStates ObjectState() const;
|
||||
|
||||
ObjectType Type() { return mType; }
|
||||
ObjectType Type() const { return mType; }
|
||||
|
||||
void SetIsNetworkCreated(bool aNetworkCreated)
|
||||
{
|
||||
|
|
|
@ -191,7 +191,7 @@ nsStyledElementNotElementCSSInlineStyle::GetInlineStyleRule()
|
|||
// ---------------------------------------------------------------
|
||||
// Others and helpers
|
||||
|
||||
nsIDOMCSSStyleDeclaration*
|
||||
nsICSSDeclaration*
|
||||
nsStyledElementNotElementCSSInlineStyle::GetStyle(nsresult* retval)
|
||||
{
|
||||
nsGenericElement::nsDOMSlots *slots = DOMSlots();
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
const nsAttrValue* aValue, bool aNotify);
|
||||
|
||||
nsIDOMCSSStyleDeclaration* GetStyle(nsresult* retval);
|
||||
nsICSSDeclaration* GetStyle(nsresult* retval);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsIConsoleService.h"
|
||||
#include "nsIDOMCanvasRenderingContext2D.h"
|
||||
#include "nsICanvasRenderingContextInternal.h"
|
||||
#include "nsIHTMLCollection.h"
|
||||
#include "nsHTMLCanvasElement.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsHTMLMediaElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLMediaElement
|
||||
using nsHTMLMediaElement::GetPaused;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLCanvasElement
|
||||
NS_DECL_NSIDOMHTMLCANVASELEMENT
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsHTMLMediaElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLMediaElement
|
||||
using nsHTMLMediaElement::GetPaused;
|
||||
|
|
|
@ -109,6 +109,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
|
||||
INCLUDES += \
|
||||
-I$(srcdir)/../../document/src \
|
||||
-I$(srcdir)/../../../base/src \
|
||||
-I$(srcdir)/../../../events/src \
|
||||
-I$(srcdir)/../../../xbl/src \
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
#include "nsTextFragment.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsHTMLDocument.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -232,11 +233,9 @@ class nsGenericHTMLElementTearoff : public nsIDOMElementCSSInlineStyle
|
|||
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
|
||||
{
|
||||
nsresult rv;
|
||||
*aStyle = mElement->GetStyle(&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ADDREF(*aStyle);
|
||||
return NS_OK;
|
||||
mozilla::ErrorResult rv;
|
||||
NS_IF_ADDREF(*aStyle = mElement->GetStyle(rv));
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsGenericHTMLElementTearoff,
|
||||
|
@ -257,8 +256,6 @@ NS_INTERFACE_TABLE_HEAD(nsGenericHTMLElementTearoff)
|
|||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsGenericHTMLElementTearoff)
|
||||
NS_INTERFACE_MAP_END_AGGREGATED(mElement)
|
||||
|
||||
NS_IMPL_BOOL_ATTR(nsGenericHTMLElement, Hidden, hidden)
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::DOMQueryInterface(nsIDOMHTMLElement *aElement,
|
||||
REFNSIID aIID, void **aInstancePtr)
|
||||
|
@ -349,74 +346,13 @@ nsGenericHTMLElement::ClearDataset()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation for nsIDOMHTMLElement
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetId(nsAString& aId)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, aId);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::SetId(const nsAString& aId)
|
||||
{
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::id, aId, true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetTitle(nsAString& aTitle)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::title, aTitle);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::SetTitle(const nsAString& aTitle)
|
||||
{
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::title, aTitle, true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetLang(nsAString& aLang)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::lang, aLang);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::SetLang(const nsAString& aLang)
|
||||
{
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::lang, aLang, true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const nsAttrValue::EnumTable kDirTable[] = {
|
||||
{ "ltr", NS_STYLE_DIRECTION_LTR },
|
||||
{ "rtl", NS_STYLE_DIRECTION_RTL },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsGenericHTMLElement, Dir, dir, NULL)
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetClassName(nsAString& aClassName)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::SetClassName(const nsAString& aClassName)
|
||||
{
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName, true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsGenericHTMLElement, AccessKey, accesskey)
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsGenericHTMLElement::GetAccessKeyLabel(nsAString& aLabel)
|
||||
{
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
|
@ -429,8 +365,6 @@ nsGenericHTMLElement::GetAccessKeyLabel(nsAString& aLabel)
|
|||
aLabel.Append(suffix);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static bool IS_TABLE_CELL(nsIAtom* frameType) {
|
||||
|
@ -446,15 +380,14 @@ IsOffsetParent(nsIFrame* aFrame)
|
|||
frameType == nsGkAtoms::tableFrame);
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
||||
nsGenericElement*
|
||||
nsGenericHTMLElement::GetOffsetRect(nsRect& aRect)
|
||||
{
|
||||
*aOffsetParent = nullptr;
|
||||
aRect = nsRect();
|
||||
|
||||
nsIFrame* frame = GetStyledFrame();
|
||||
if (!frame) {
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIFrame* parent = frame->GetParent();
|
||||
|
@ -466,6 +399,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
|||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
nsIContent* offsetParent = nullptr;
|
||||
Element* docElement = GetCurrentDoc()->GetRootElement();
|
||||
nsIContent* content = frame->GetContent();
|
||||
|
||||
|
@ -482,8 +416,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
|||
|
||||
// Stop at the first ancestor that is positioned.
|
||||
if (parent->IsPositioned()) {
|
||||
*aOffsetParent = content;
|
||||
NS_IF_ADDREF(*aOffsetParent);
|
||||
offsetParent = content;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -503,14 +436,13 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
|||
// Break if the ancestor frame type makes it suitable as offset parent
|
||||
// and this element is *not* positioned or if we found the body element.
|
||||
if (isOffsetParent || content->IsHTML(nsGkAtoms::body)) {
|
||||
*aOffsetParent = content;
|
||||
NS_ADDREF(*aOffsetParent);
|
||||
offsetParent = content;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isAbsolutelyPositioned && !*aOffsetParent) {
|
||||
if (isAbsolutelyPositioned && !offsetParent) {
|
||||
// If this element is absolutely positioned, but we don't have
|
||||
// an offset parent it means this element is an absolutely
|
||||
// positioned child that's not nested inside another positioned
|
||||
|
@ -522,11 +454,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
|||
nsCOMPtr<nsIDOMHTMLDocument> html_doc(do_QueryInterface(GetCurrentDoc()));
|
||||
|
||||
if (html_doc) {
|
||||
nsCOMPtr<nsIDOMHTMLElement> html_element;
|
||||
html_doc->GetBody(getter_AddRefs(html_element));
|
||||
if (html_element) {
|
||||
CallQueryInterface(html_element, aOffsetParent);
|
||||
}
|
||||
offsetParent = static_cast<nsHTMLDocument*>(html_doc.get())->GetBody();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -552,70 +480,10 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
|||
nsRect rcFrame = nsLayoutUtils::GetAllInFlowRectsUnion(frame, frame);
|
||||
aRect.width = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.width);
|
||||
aRect.height = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.height);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetOffsetTop(int32_t* aOffsetTop)
|
||||
{
|
||||
nsRect rcFrame;
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
GetOffsetRect(rcFrame, getter_AddRefs(parent));
|
||||
|
||||
*aOffsetTop = rcFrame.y;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetOffsetLeft(int32_t* aOffsetLeft)
|
||||
{
|
||||
nsRect rcFrame;
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
GetOffsetRect(rcFrame, getter_AddRefs(parent));
|
||||
|
||||
*aOffsetLeft = rcFrame.x;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetOffsetWidth(int32_t* aOffsetWidth)
|
||||
{
|
||||
nsRect rcFrame;
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
GetOffsetRect(rcFrame, getter_AddRefs(parent));
|
||||
|
||||
*aOffsetWidth = rcFrame.width;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetOffsetHeight(int32_t* aOffsetHeight)
|
||||
{
|
||||
nsRect rcFrame;
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
GetOffsetRect(rcFrame, getter_AddRefs(parent));
|
||||
|
||||
*aOffsetHeight = rcFrame.height;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent)
|
||||
{
|
||||
nsRect rcFrame;
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
GetOffsetRect(rcFrame, getter_AddRefs(parent));
|
||||
|
||||
if (parent) {
|
||||
CallQueryInterface(parent, aOffsetParent);
|
||||
} else {
|
||||
*aOffsetParent = nullptr;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return offsetParent ?
|
||||
static_cast<nsGenericElement*>(offsetParent->AsElement()) :
|
||||
nullptr;
|
||||
}
|
||||
|
||||
// Try to keep the size of StringBuilder close to a jemalloc bucket size.
|
||||
|
@ -1290,9 +1158,10 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
|
|||
aError = GetMarkup(false, aInnerHTML);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::GetOuterHTML(nsAString& aOuterHTML) {
|
||||
return GetMarkup(true, aOuterHTML);
|
||||
void
|
||||
nsGenericHTMLElement::GetOuterHTML(nsAString& aOuterHTML, ErrorResult& aError)
|
||||
{
|
||||
aError = GetMarkup(true, aOuterHTML);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1371,16 +1240,18 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
|
||||
void
|
||||
nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
nsCOMPtr<nsINode> parent = GetParentNode();
|
||||
if (!parent) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent->NodeType() == nsIDOMNode::DOCUMENT_NODE) {
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (OwnerDoc()->IsHTML()) {
|
||||
|
@ -1396,9 +1267,11 @@ nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
|
|||
namespaceID = kNameSpaceID_XHTML;
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocumentFragment> df;
|
||||
nsresult rv = NS_NewDocumentFragment(getter_AddRefs(df),
|
||||
OwnerDoc()->NodeInfoManager());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aError = NS_NewDocumentFragment(getter_AddRefs(df),
|
||||
OwnerDoc()->NodeInfoManager());
|
||||
if (aError.Failed()) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIContent> fragment = do_QueryInterface(df);
|
||||
nsContentUtils::ParseFragmentHTML(aOuterHTML,
|
||||
fragment,
|
||||
|
@ -1408,9 +1281,8 @@ nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
|
|||
eCompatibility_NavQuirks,
|
||||
true);
|
||||
nsAutoMutationBatch mb(parent, true, false);
|
||||
ErrorResult error;
|
||||
parent->ReplaceChild(*fragment, *this, error);
|
||||
return error.ErrorCode();
|
||||
parent->ReplaceChild(*fragment, *this, aError);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> context;
|
||||
|
@ -1428,16 +1300,16 @@ nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocumentFragment> df;
|
||||
nsresult rv = nsContentUtils::CreateContextualFragment(context,
|
||||
aOuterHTML,
|
||||
true,
|
||||
getter_AddRefs(df));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aError = nsContentUtils::CreateContextualFragment(context,
|
||||
aOuterHTML,
|
||||
true,
|
||||
getter_AddRefs(df));
|
||||
if (aError.Failed()) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsINode> fragment = do_QueryInterface(df);
|
||||
nsAutoMutationBatch mb(parent, true, false);
|
||||
ErrorResult error;
|
||||
parent->ReplaceChild(*fragment, *this, error);
|
||||
return error.ErrorCode();
|
||||
parent->ReplaceChild(*fragment, *this, aError);
|
||||
}
|
||||
|
||||
enum nsAdjacentPosition {
|
||||
|
@ -1450,6 +1322,16 @@ enum nsAdjacentPosition {
|
|||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition,
|
||||
const nsAString& aText)
|
||||
{
|
||||
ErrorResult rv;
|
||||
InsertAdjacentHTML(aPosition, aText, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition,
|
||||
const nsAString& aText,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
nsAdjacentPosition position;
|
||||
if (aPosition.LowerCaseEqualsLiteral("beforebegin")) {
|
||||
|
@ -1461,14 +1343,16 @@ nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition,
|
|||
} else if (aPosition.LowerCaseEqualsLiteral("afterend")) {
|
||||
position = eAfterEnd;
|
||||
} else {
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
aError.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> destination;
|
||||
if (position == eBeforeBegin || position == eAfterEnd) {
|
||||
destination = GetParent();
|
||||
if (!destination) {
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
destination = this;
|
||||
|
@ -1483,7 +1367,6 @@ nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition,
|
|||
// Batch possible DOMSubtreeModified events.
|
||||
mozAutoSubtreeModified subtree(doc, nullptr);
|
||||
|
||||
nsresult rv;
|
||||
// Parse directly into destination if possible
|
||||
if (doc->IsHTML() && !OwnerDoc()->MayHaveDOMMutationObservers() &&
|
||||
(position == eBeforeEnd ||
|
||||
|
@ -1498,69 +1381,56 @@ nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition,
|
|||
// Spec bug: http://www.w3.org/Bugs/Public/show_bug.cgi?id=12434
|
||||
contextLocal = nsGkAtoms::body;
|
||||
}
|
||||
rv = nsContentUtils::ParseFragmentHTML(aText,
|
||||
destination,
|
||||
contextLocal,
|
||||
contextNs,
|
||||
doc->GetCompatibilityMode() ==
|
||||
eCompatibility_NavQuirks,
|
||||
true);
|
||||
aError = nsContentUtils::ParseFragmentHTML(aText,
|
||||
destination,
|
||||
contextLocal,
|
||||
contextNs,
|
||||
doc->GetCompatibilityMode() ==
|
||||
eCompatibility_NavQuirks,
|
||||
true);
|
||||
// HTML5 parser has notified, but not fired mutation events.
|
||||
FireMutationEventsForDirectParsing(doc, destination, oldChildCount);
|
||||
return rv;
|
||||
return;
|
||||
}
|
||||
|
||||
// couldn't parse directly
|
||||
nsCOMPtr<nsIDOMDocumentFragment> df;
|
||||
rv = nsContentUtils::CreateContextualFragment(destination,
|
||||
aText,
|
||||
true,
|
||||
getter_AddRefs(df));
|
||||
aError = nsContentUtils::CreateContextualFragment(destination,
|
||||
aText,
|
||||
true,
|
||||
getter_AddRefs(df));
|
||||
if (aError.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> fragment = do_QueryInterface(df);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Suppress assertion about node removal mutation events that can't have
|
||||
// listeners anyway, because no one has had the chance to register mutation
|
||||
// listeners on the fragment that comes from the parser.
|
||||
nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker;
|
||||
|
||||
ErrorResult error;
|
||||
nsAutoMutationBatch mb(destination, true, false);
|
||||
switch (position) {
|
||||
case eBeforeBegin:
|
||||
destination->InsertBefore(*fragment, this, error);
|
||||
destination->InsertBefore(*fragment, this, aError);
|
||||
break;
|
||||
case eAfterBegin:
|
||||
static_cast<nsINode*>(this)->InsertBefore(*fragment, GetFirstChild(), error);
|
||||
static_cast<nsINode*>(this)->InsertBefore(*fragment, GetFirstChild(),
|
||||
aError);
|
||||
break;
|
||||
case eBeforeEnd:
|
||||
static_cast<nsINode*>(this)->AppendChild(*fragment, error);
|
||||
static_cast<nsINode*>(this)->AppendChild(*fragment, aError);
|
||||
break;
|
||||
case eAfterEnd:
|
||||
destination->InsertBefore(*fragment, GetNextSibling(), error);
|
||||
destination->InsertBefore(*fragment, GetNextSibling(), aError);
|
||||
break;
|
||||
}
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::ScrollIntoView(bool aTop, uint8_t optional_argc)
|
||||
bool
|
||||
nsGenericHTMLElement::Spellcheck()
|
||||
{
|
||||
if (!optional_argc) {
|
||||
aTop = true;
|
||||
}
|
||||
|
||||
nsGenericElement::ScrollIntoView(aTop);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::GetSpellcheck(bool* aSpellcheck)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSpellcheck);
|
||||
*aSpellcheck = false; // Default answer is to not spellcheck
|
||||
|
||||
// Has the state has been explicitly set?
|
||||
nsIContent* node;
|
||||
for (node = this; node; node = node->GetParent()) {
|
||||
|
@ -1570,45 +1440,39 @@ nsGenericHTMLElement::GetSpellcheck(bool* aSpellcheck)
|
|||
switch (node->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck,
|
||||
strings, eCaseMatters)) {
|
||||
case 0: // spellcheck = "true"
|
||||
*aSpellcheck = true;
|
||||
// Fall through
|
||||
return true;
|
||||
case 1: // spellcheck = "false"
|
||||
return NS_OK;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Is this a chrome element?
|
||||
if (nsContentUtils::IsChromeDoc(OwnerDoc())) {
|
||||
return NS_OK; // Not spellchecked by default
|
||||
return false; // Not spellchecked by default
|
||||
}
|
||||
|
||||
if (IsCurrentBodyElement()) {
|
||||
nsCOMPtr<nsIHTMLDocument> doc = do_QueryInterface(GetCurrentDoc());
|
||||
if (doc) {
|
||||
*aSpellcheck = doc->IsEditingOn();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return doc && doc->IsEditingOn();
|
||||
}
|
||||
|
||||
// Is this element editable?
|
||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(this);
|
||||
if (!formControl) {
|
||||
return NS_OK; // Not spellchecked by default
|
||||
return false; // Not spellchecked by default
|
||||
}
|
||||
|
||||
// Is this a multiline plaintext input?
|
||||
int32_t controlType = formControl->GetType();
|
||||
if (controlType == NS_FORM_TEXTAREA) {
|
||||
*aSpellcheck = true; // Spellchecked by default
|
||||
return NS_OK;
|
||||
return true; // Spellchecked by default
|
||||
}
|
||||
|
||||
// Is this anything other than an input text?
|
||||
// Other inputs are not spellchecked.
|
||||
if (controlType != NS_FORM_INPUT_TEXT) {
|
||||
return NS_OK; // Not spellchecked by default
|
||||
return false; // Not spellchecked by default
|
||||
}
|
||||
|
||||
// Does the user want input text spellchecked by default?
|
||||
|
@ -1616,21 +1480,7 @@ nsGenericHTMLElement::GetSpellcheck(bool* aSpellcheck)
|
|||
// The web page should not know if the user has disabled spellchecking.
|
||||
// We'll catch this in the editor itself.
|
||||
int32_t spellcheckLevel = Preferences::GetInt("layout.spellcheckDefault", 1);
|
||||
if (spellcheckLevel == 2) { // "Spellcheck multi- and single-line"
|
||||
*aSpellcheck = true; // Spellchecked by default
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::SetSpellcheck(bool aSpellcheck)
|
||||
{
|
||||
if (aSpellcheck) {
|
||||
return SetAttrHelper(nsGkAtoms::spellcheck, NS_LITERAL_STRING("true"));
|
||||
}
|
||||
|
||||
return SetAttrHelper(nsGkAtoms::spellcheck, NS_LITERAL_STRING("false"));
|
||||
return spellcheckLevel == 2; // "Spellcheck multi- and single-line"
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -2879,26 +2729,26 @@ nsGenericHTMLElement::SetDoubleAttr(nsIAtom* aAttr, double aValue)
|
|||
return SetAttr(kNameSpaceID_None, aAttr, value, true);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetURIAttr(nsIAtom* aAttr, nsIAtom* aBaseAttr, nsAString& aResult)
|
||||
void
|
||||
nsGenericHTMLElement::GetURIAttr(nsIAtom* aAttr, nsIAtom* aBaseAttr,
|
||||
nsAString& aResult) const
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
bool hadAttr = GetURIAttr(aAttr, aBaseAttr, getter_AddRefs(uri));
|
||||
if (!hadAttr) {
|
||||
aResult.Truncate();
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!uri) {
|
||||
// Just return the attr value
|
||||
GetAttr(kNameSpaceID_None, aAttr, aResult);
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
CopyUTF8toUTF16(spec, aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -2982,10 +2832,10 @@ nsGenericHTMLElement::GetURIListAttr(nsIAtom* aAttr, nsAString& aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
nsGenericHTMLElement::GetEnumAttr(nsIAtom* aAttr,
|
||||
const char* aDefault,
|
||||
nsAString& aResult)
|
||||
nsAString& aResult) const
|
||||
{
|
||||
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(aAttr);
|
||||
|
||||
|
@ -2996,92 +2846,26 @@ nsGenericHTMLElement::GetEnumAttr(nsIAtom* aAttr,
|
|||
} else if (aDefault) {
|
||||
AppendASCIItoUTF16(nsDependentCString(aDefault), aResult);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetContentEditable(nsAString& aContentEditable)
|
||||
nsHTMLMenuElement*
|
||||
nsGenericHTMLElement::GetContextMenu() const
|
||||
{
|
||||
ContentEditableTristate value = GetContentEditableValue();
|
||||
|
||||
if (value == eTrue) {
|
||||
aContentEditable.AssignLiteral("true");
|
||||
}
|
||||
else if (value == eFalse) {
|
||||
aContentEditable.AssignLiteral("false");
|
||||
}
|
||||
else {
|
||||
aContentEditable.AssignLiteral("inherit");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::SetContentEditable(const nsAString& aContentEditable)
|
||||
{
|
||||
if (nsContentUtils::EqualsLiteralIgnoreASCIICase(aContentEditable, "inherit")) {
|
||||
UnsetAttr(kNameSpaceID_None, nsGkAtoms::contenteditable, true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (nsContentUtils::EqualsLiteralIgnoreASCIICase(aContentEditable, "true")) {
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::contenteditable, NS_LITERAL_STRING("true"), true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (nsContentUtils::EqualsLiteralIgnoreASCIICase(aContentEditable, "false")) {
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::contenteditable, NS_LITERAL_STRING("false"), true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetIsContentEditable(bool* aContentEditable)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentEditable);
|
||||
|
||||
for (nsIContent* node = this; node; node = node->GetParent()) {
|
||||
nsGenericHTMLElement* element = FromContent(node);
|
||||
if (element) {
|
||||
ContentEditableTristate value = element->GetContentEditableValue();
|
||||
if (value != eInherit) {
|
||||
*aContentEditable = value == eTrue;
|
||||
return NS_OK;
|
||||
}
|
||||
nsAutoString value;
|
||||
GetHTMLAttr(nsGkAtoms::contextmenu, value);
|
||||
if (!value.IsEmpty()) {
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
return nsHTMLMenuElement::FromContentOrNull(doc->GetElementById(value));
|
||||
}
|
||||
}
|
||||
|
||||
*aContentEditable = false;
|
||||
return NS_OK;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu)
|
||||
void
|
||||
nsGenericHTMLElement::GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) const
|
||||
{
|
||||
*aContextMenu = nullptr;
|
||||
|
||||
nsAutoString value;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::contextmenu, value);
|
||||
|
||||
if (value.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
nsRefPtr<nsHTMLMenuElement> element =
|
||||
nsHTMLMenuElement::FromContentOrNull(doc->GetElementById(value));
|
||||
element.forget(aContextMenu);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
NS_IF_ADDREF(*aContextMenu = GetContextMenu());
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -3754,21 +3538,23 @@ nsGenericHTMLFormElement::IsLabelable() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::Blur()
|
||||
void
|
||||
nsGenericHTMLElement::Blur(mozilla::ErrorResult& aError)
|
||||
{
|
||||
if (!ShouldBlur(this)) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIDOMWindow* win = doc->GetWindow();
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
return (win && fm) ? fm->ClearFocus(win) : NS_OK;
|
||||
if (win && fm) {
|
||||
aError = fm->ClearFocus(win);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3830,8 +3616,7 @@ nsGenericHTMLElement::IsHTMLFocusable(bool aWithMouse,
|
|||
return true;
|
||||
}
|
||||
|
||||
int32_t tabIndex = 0; // Default value for non HTML elements with -moz-user-focus
|
||||
GetTabIndex(&tabIndex);
|
||||
int32_t tabIndex = TabIndex();
|
||||
|
||||
bool override, disabled = false;
|
||||
if (IsEditableRoot()) {
|
||||
|
@ -4106,23 +3891,18 @@ nsGenericHTMLElement::ChangeEditableState(int32_t aChange)
|
|||
MakeContentDescendantsEditable(this, document);
|
||||
}
|
||||
|
||||
NS_IMPL_BOOL_ATTR(nsGenericHTMLElement, ItemScope, itemscope)
|
||||
NS_IMPL_URI_ATTR(nsGenericHTMLElement, ItemId, itemid)
|
||||
|
||||
JS::Value
|
||||
nsGenericHTMLElement::GetItemValue(JSContext* aCx, JSObject* aScope,
|
||||
ErrorResult& error)
|
||||
ErrorResult& aError)
|
||||
{
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::itemprop)) {
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
bool itemScope;
|
||||
GetItemScope(&itemScope);
|
||||
if (itemScope) {
|
||||
if (ItemScope()) {
|
||||
JS::Value v;
|
||||
if (!mozilla::dom::WrapObject(aCx, aScope, this, &v)) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
return v;
|
||||
|
@ -4132,7 +3912,7 @@ nsGenericHTMLElement::GetItemValue(JSContext* aCx, JSObject* aScope,
|
|||
GetItemValueText(string);
|
||||
JS::Value v;
|
||||
if (!xpc::NonVoidStringToJsval(aCx, string, &v)) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
return v;
|
||||
|
@ -4149,9 +3929,7 @@ nsGenericHTMLElement::GetItemValue(nsIVariant** aValue)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool itemScope;
|
||||
GetItemScope(&itemScope);
|
||||
if (itemScope) {
|
||||
if (ItemScope()) {
|
||||
out->SetAsISupports(static_cast<nsISupports*>(this));
|
||||
} else {
|
||||
nsAutoString string;
|
||||
|
@ -4163,6 +3941,24 @@ nsGenericHTMLElement::GetItemValue(nsIVariant** aValue)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::SetItemValue(JSContext* aCx, JS::Value aValue,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::itemprop) ||
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::itemscope)) {
|
||||
aError.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
FakeDependentString string;
|
||||
if (!ConvertJSValueToString(aCx, aValue, &aValue, eStringify, eStringify, string)) {
|
||||
aError.Throw(NS_ERROR_UNEXPECTED);
|
||||
return;
|
||||
}
|
||||
SetItemValueText(string);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::SetItemValue(nsIVariant* aValue)
|
||||
{
|
||||
|
@ -4215,58 +4011,19 @@ nsGenericHTMLElement::GetTokenList(nsIAtom* aAtom)
|
|||
return list;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::GetItemRef(nsIVariant** aResult)
|
||||
void
|
||||
nsGenericHTMLElement::GetTokenList(nsIAtom* aAtom, nsIVariant** aResult)
|
||||
{
|
||||
nsIDOMDOMSettableTokenList* itemRef = GetTokenList(nsGkAtoms::itemref);
|
||||
nsCOMPtr<nsIWritableVariant> out = new nsVariant();
|
||||
out->SetAsInterface(NS_GET_IID(nsIDOMDOMSettableTokenList), itemRef);
|
||||
out.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::SetItemRef(nsIVariant* aValue)
|
||||
{
|
||||
nsDOMSettableTokenList* itemRef = GetTokenList(nsGkAtoms::itemref);
|
||||
nsAutoString string;
|
||||
aValue->GetAsAString(string);
|
||||
return itemRef->SetValue(string);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::GetItemProp(nsIVariant** aResult)
|
||||
{
|
||||
nsIDOMDOMSettableTokenList* itemProp = GetTokenList(nsGkAtoms::itemprop);
|
||||
nsCOMPtr<nsIWritableVariant> out = new nsVariant();
|
||||
out->SetAsInterface(NS_GET_IID(nsIDOMDOMSettableTokenList), itemProp);
|
||||
out.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::SetItemProp(nsIVariant* aValue)
|
||||
{
|
||||
nsDOMSettableTokenList* itemProp = GetTokenList(nsGkAtoms::itemprop);
|
||||
nsAutoString string;
|
||||
aValue->GetAsAString(string);
|
||||
return itemProp->SetValue(string);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::GetItemType(nsIVariant** aResult)
|
||||
{
|
||||
nsIDOMDOMSettableTokenList* itemType = GetTokenList(nsGkAtoms::itemtype);
|
||||
nsIDOMDOMSettableTokenList* itemType = GetTokenList(aAtom);
|
||||
nsCOMPtr<nsIWritableVariant> out = new nsVariant();
|
||||
out->SetAsInterface(NS_GET_IID(nsIDOMDOMSettableTokenList), itemType);
|
||||
out.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::SetItemType(nsIVariant* aValue)
|
||||
nsresult
|
||||
nsGenericHTMLElement::SetTokenList(nsIAtom* aAtom, nsIVariant* aValue)
|
||||
{
|
||||
nsDOMSettableTokenList* itemType = GetTokenList(nsGkAtoms::itemtype);
|
||||
nsDOMSettableTokenList* itemType = GetTokenList(aAtom);
|
||||
nsAutoString string;
|
||||
aValue->GetAsAString(string);
|
||||
return itemType->SetValue(string);
|
||||
|
@ -4281,8 +4038,8 @@ HTMLPropertiesCollectionDestructor(void *aObject, nsIAtom *aProperty,
|
|||
NS_IF_RELEASE(properties);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::GetProperties(nsIDOMHTMLPropertiesCollection** aReturn)
|
||||
HTMLPropertiesCollection*
|
||||
nsGenericHTMLElement::Properties()
|
||||
{
|
||||
HTMLPropertiesCollection* properties =
|
||||
static_cast<HTMLPropertiesCollection*>(GetProperty(nsGkAtoms::microdataProperties));
|
||||
|
@ -4291,8 +4048,13 @@ nsGenericHTMLElement::GetProperties(nsIDOMHTMLPropertiesCollection** aReturn)
|
|||
NS_ADDREF(properties);
|
||||
SetProperty(nsGkAtoms::microdataProperties, properties, HTMLPropertiesCollectionDestructor);
|
||||
}
|
||||
NS_ADDREF(*aReturn = properties);
|
||||
return NS_OK;
|
||||
return properties;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::GetProperties(nsIDOMHTMLPropertiesCollection** aProperties)
|
||||
{
|
||||
NS_ADDREF(*aProperties = Properties());
|
||||
}
|
||||
|
||||
nsSize
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDOMHTMLMenuElement.h"
|
||||
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMEventListener;
|
||||
|
@ -21,6 +23,7 @@ class nsIFrame;
|
|||
class nsIStyleRule;
|
||||
class nsChildContentList;
|
||||
class nsDOMCSSDeclaration;
|
||||
class nsHTMLMenuElement;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
class nsIURI;
|
||||
class nsIFormControlFrame;
|
||||
|
@ -35,6 +38,12 @@ class nsIDOMHTMLMenuElement;
|
|||
class nsIDOMHTMLCollection;
|
||||
class nsDOMSettableTokenList;
|
||||
class nsIDOMHTMLPropertiesCollection;
|
||||
class nsIDOMDOMStringMap;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class HTMLPropertiesCollection;
|
||||
}
|
||||
}
|
||||
|
||||
typedef nsMappedAttributeElement nsGenericHTMLElementBase;
|
||||
|
||||
|
@ -69,7 +78,76 @@ public:
|
|||
// From nsGenericElement
|
||||
nsresult CopyInnerTo(nsGenericElement* aDest);
|
||||
|
||||
// WebIDL HTMLElement
|
||||
void GetTitle(nsAString& aTitle) const
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::title, aTitle);
|
||||
}
|
||||
void SetTitle(const nsAString& aTitle)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::title, aTitle);
|
||||
}
|
||||
void GetLang(nsAString& aLang) const
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::lang, aLang);
|
||||
}
|
||||
void SetLang(const nsAString& aLang)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::lang, aLang);
|
||||
}
|
||||
void GetDir(nsAString& aDir) const
|
||||
{
|
||||
GetHTMLEnumAttr(nsGkAtoms::dir, aDir);
|
||||
}
|
||||
void SetDir(const nsAString& aDir, mozilla::ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::dir, aDir, aError);
|
||||
}
|
||||
already_AddRefed<nsDOMStringMap> Dataset();
|
||||
bool ItemScope() const
|
||||
{
|
||||
return GetBoolAttr(nsGkAtoms::itemscope);
|
||||
}
|
||||
void SetItemScope(bool aItemScope, mozilla::ErrorResult& aError)
|
||||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::itemscope, aItemScope, aError);
|
||||
}
|
||||
nsDOMSettableTokenList* ItemType()
|
||||
{
|
||||
return GetTokenList(nsGkAtoms::itemtype);
|
||||
}
|
||||
void GetItemId(nsAString& aItemId) const
|
||||
{
|
||||
GetHTMLURIAttr(nsGkAtoms::itemid, aItemId);
|
||||
}
|
||||
void SetItemId(const nsAString& aItemID, mozilla::ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::itemid, aItemID, aError);
|
||||
}
|
||||
nsDOMSettableTokenList* ItemRef()
|
||||
{
|
||||
return GetTokenList(nsGkAtoms::itemref);
|
||||
}
|
||||
nsDOMSettableTokenList* ItemProp()
|
||||
{
|
||||
return GetTokenList(nsGkAtoms::itemprop);
|
||||
}
|
||||
mozilla::dom::HTMLPropertiesCollection* Properties();
|
||||
JS::Value GetItemValue(JSContext* aCx, JSObject* aScope,
|
||||
mozilla::ErrorResult& aError);
|
||||
JS::Value GetItemValue(JSContext* aCx, mozilla::ErrorResult& aError)
|
||||
{
|
||||
return GetItemValue(aCx, GetWrapperPreserveColor(), aError);
|
||||
}
|
||||
void SetItemValue(JSContext* aCx, JS::Value aValue,
|
||||
mozilla::ErrorResult& aError);
|
||||
bool Hidden() const
|
||||
{
|
||||
return GetBoolAttr(nsGkAtoms::hidden);
|
||||
}
|
||||
void SetHidden(bool aHidden, mozilla::ErrorResult& aError)
|
||||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::hidden, aHidden, aError);
|
||||
}
|
||||
virtual void Click();
|
||||
virtual int32_t TabIndexDefault()
|
||||
{
|
||||
|
@ -81,9 +159,19 @@ public:
|
|||
}
|
||||
void SetTabIndex(int32_t aTabIndex, mozilla::ErrorResult& aError)
|
||||
{
|
||||
aError = SetIntAttr(nsGkAtoms::tabindex, aTabIndex);
|
||||
SetHTMLIntAttr(nsGkAtoms::tabindex, aTabIndex, aError);
|
||||
}
|
||||
virtual void Focus(mozilla::ErrorResult& aError);
|
||||
void Blur(mozilla::ErrorResult& aError);
|
||||
void GetAccessKey(nsAString& aAccessKey) const
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::accesskey, aAccessKey);
|
||||
}
|
||||
void SetAccessKey(const nsAString& aAccessKey, mozilla::ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::accesskey, aAccessKey, aError);
|
||||
}
|
||||
void GetAccessKeyLabel(nsAString& aAccessKeyLabel);
|
||||
virtual bool Draggable() const
|
||||
{
|
||||
return AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
||||
|
@ -91,127 +179,139 @@ public:
|
|||
}
|
||||
void SetDraggable(bool aDraggable, mozilla::ErrorResult& aError)
|
||||
{
|
||||
aError = SetAttrHelper(nsGkAtoms::draggable,
|
||||
aDraggable ? NS_LITERAL_STRING("true")
|
||||
: NS_LITERAL_STRING("false"));
|
||||
SetHTMLAttr(nsGkAtoms::draggable,
|
||||
aDraggable ? NS_LITERAL_STRING("true")
|
||||
: NS_LITERAL_STRING("false"),
|
||||
aError);
|
||||
}
|
||||
void GetContentEditable(nsAString& aContentEditable) const
|
||||
{
|
||||
ContentEditableTristate value = GetContentEditableValue();
|
||||
if (value == eTrue) {
|
||||
aContentEditable.AssignLiteral("true");
|
||||
} else if (value == eFalse) {
|
||||
aContentEditable.AssignLiteral("false");
|
||||
} else {
|
||||
aContentEditable.AssignLiteral("inherit");
|
||||
}
|
||||
}
|
||||
void SetContentEditable(const nsAString& aContentEditable,
|
||||
mozilla::ErrorResult& aError)
|
||||
{
|
||||
if (nsContentUtils::EqualsLiteralIgnoreASCIICase(aContentEditable, "inherit")) {
|
||||
UnsetHTMLAttr(nsGkAtoms::contenteditable, aError);
|
||||
} else if (nsContentUtils::EqualsLiteralIgnoreASCIICase(aContentEditable, "true")) {
|
||||
SetHTMLAttr(nsGkAtoms::contenteditable, NS_LITERAL_STRING("true"), aError);
|
||||
} else if (nsContentUtils::EqualsLiteralIgnoreASCIICase(aContentEditable, "false")) {
|
||||
SetHTMLAttr(nsGkAtoms::contenteditable, NS_LITERAL_STRING("false"), aError);
|
||||
} else {
|
||||
aError.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
}
|
||||
}
|
||||
bool IsContentEditable()
|
||||
{
|
||||
for (nsIContent* node = this; node; node = node->GetParent()) {
|
||||
nsGenericHTMLElement* element = FromContent(node);
|
||||
if (element) {
|
||||
ContentEditableTristate value = element->GetContentEditableValue();
|
||||
if (value != eInherit) {
|
||||
return value == eTrue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
nsHTMLMenuElement* GetContextMenu() const;
|
||||
bool Spellcheck();
|
||||
void SetSpellcheck(bool aSpellcheck, mozilla::ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::spellcheck,
|
||||
aSpellcheck ? NS_LITERAL_STRING("true")
|
||||
: NS_LITERAL_STRING("false"),
|
||||
aError);
|
||||
}
|
||||
nsICSSDeclaration* GetStyle(mozilla::ErrorResult& aError)
|
||||
{
|
||||
nsresult rv;
|
||||
nsICSSDeclaration* style = nsMappedAttributeElement::GetStyle(&rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
aError.Throw(rv);
|
||||
}
|
||||
return style;
|
||||
}
|
||||
void GetClassName(nsAString& aClassName)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName);
|
||||
}
|
||||
void SetClassName(const nsAString& aClassName)
|
||||
{
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName, true);
|
||||
}
|
||||
|
||||
virtual void GetInnerHTML(nsAString& aInnerHTML,
|
||||
mozilla::ErrorResult& aError);
|
||||
virtual void SetInnerHTML(const nsAString& aInnerHTML,
|
||||
mozilla::ErrorResult& aError);
|
||||
void GetOuterHTML(nsAString& aOuterHTML, mozilla::ErrorResult& aError);
|
||||
void SetOuterHTML(const nsAString& aOuterHTML, mozilla::ErrorResult& aError);
|
||||
void InsertAdjacentHTML(const nsAString& aPosition, const nsAString& aText,
|
||||
mozilla::ErrorResult& aError);
|
||||
nsGenericElement* GetOffsetParent()
|
||||
{
|
||||
nsRect rcFrame;
|
||||
return GetOffsetRect(rcFrame);
|
||||
}
|
||||
int32_t OffsetTop()
|
||||
{
|
||||
nsRect rcFrame;
|
||||
GetOffsetRect(rcFrame);
|
||||
|
||||
return rcFrame.y;
|
||||
}
|
||||
int32_t OffsetLeft()
|
||||
{
|
||||
nsRect rcFrame;
|
||||
GetOffsetRect(rcFrame);
|
||||
|
||||
return rcFrame.x;
|
||||
}
|
||||
int32_t OffsetWidth()
|
||||
{
|
||||
nsRect rcFrame;
|
||||
GetOffsetRect(rcFrame);
|
||||
|
||||
return rcFrame.width;
|
||||
}
|
||||
int32_t OffsetHeight()
|
||||
{
|
||||
nsRect rcFrame;
|
||||
GetOffsetRect(rcFrame);
|
||||
|
||||
return rcFrame.height;
|
||||
}
|
||||
|
||||
// nsIDOMHTMLElement methods. Note that these are non-virtual
|
||||
// methods, implementations are expected to forward calls to these
|
||||
// methods.
|
||||
nsresult GetId(nsAString& aId);
|
||||
nsresult SetId(const nsAString& aId);
|
||||
nsresult GetTitle(nsAString& aTitle);
|
||||
nsresult SetTitle(const nsAString& aTitle);
|
||||
nsresult GetLang(nsAString& aLang);
|
||||
nsresult SetLang(const nsAString& aLang);
|
||||
NS_IMETHOD GetDir(nsAString& aDir);
|
||||
NS_IMETHOD SetDir(const nsAString& aDir);
|
||||
nsresult GetClassName(nsAString& aClassName);
|
||||
nsresult SetClassName(const nsAString& aClassName);
|
||||
|
||||
nsresult DOMClick()
|
||||
{
|
||||
Click();
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult GetTabIndex(int32_t* aTabIndex)
|
||||
{
|
||||
*aTabIndex = TabIndex();
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult SetTabIndex(int32_t aTabIndex)
|
||||
{
|
||||
mozilla::ErrorResult rv;
|
||||
SetTabIndex(aTabIndex, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
nsresult DOMFocus() {
|
||||
mozilla::ErrorResult rv;
|
||||
Focus(rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
nsresult GetDraggable(bool* aDraggable)
|
||||
{
|
||||
*aDraggable = Draggable();
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult SetDraggable(bool aDraggable)
|
||||
{
|
||||
mozilla::ErrorResult rv;
|
||||
SetDraggable(aDraggable, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
nsresult GetDOMInnerHTML(nsAString& aInnerHTML)
|
||||
{
|
||||
mozilla::ErrorResult rv;
|
||||
GetInnerHTML(aInnerHTML, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
nsresult SetDOMInnerHTML(const nsAString& aInnerHTML)
|
||||
{
|
||||
mozilla::ErrorResult rv;
|
||||
SetInnerHTML(aInnerHTML, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
nsresult GetOffsetTop(int32_t* aOffsetTop);
|
||||
nsresult GetOffsetLeft(int32_t* aOffsetLeft);
|
||||
nsresult GetOffsetWidth(int32_t* aOffsetWidth);
|
||||
nsresult GetOffsetHeight(int32_t* aOffsetHeight);
|
||||
nsresult GetOffsetParent(nsIDOMElement** aOffsetParent);
|
||||
NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML);
|
||||
NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML);
|
||||
NS_IMETHOD InsertAdjacentHTML(const nsAString& aPosition,
|
||||
const nsAString& aText);
|
||||
nsresult ScrollIntoView(bool aTop, uint8_t optional_argc);
|
||||
// Declare Blur(), GetHidden(), SetHidden(), GetSpellcheck(), and
|
||||
// SetSpellcheck() such that classes that inherit interfaces with those
|
||||
// methods properly override them.
|
||||
NS_IMETHOD Blur();
|
||||
NS_IMETHOD GetHidden(bool* aHidden);
|
||||
NS_IMETHOD SetHidden(bool aHidden);
|
||||
NS_IMETHOD GetSpellcheck(bool* aSpellcheck);
|
||||
NS_IMETHOD SetSpellcheck(bool aSpellcheck);
|
||||
NS_IMETHOD GetItemScope(bool* aItemScope);
|
||||
NS_IMETHOD SetItemScope(bool aItemScope);
|
||||
NS_IMETHOD GetItemValue(nsIVariant** aValue);
|
||||
JS::Value GetItemValue(JSContext* aCx, JSObject* aScope,
|
||||
mozilla::ErrorResult& error);
|
||||
NS_IMETHOD SetItemValue(nsIVariant* aValue);
|
||||
protected:
|
||||
void GetProperties(nsIDOMHTMLPropertiesCollection** aProperties);
|
||||
void GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) const;
|
||||
|
||||
// These methods are used to implement element-specific behavior of Get/SetItemValue
|
||||
// when an element has @itemprop but no @itemscope.
|
||||
virtual void GetItemValueText(nsAString& text);
|
||||
virtual void SetItemValueText(const nsAString& text);
|
||||
nsDOMSettableTokenList* GetTokenList(nsIAtom* aAtom);
|
||||
void GetTokenList(nsIAtom* aAtom, nsIVariant** aResult);
|
||||
nsresult SetTokenList(nsIAtom* aAtom, nsIVariant* aValue);
|
||||
public:
|
||||
NS_IMETHOD GetItemType(nsIVariant** aType);
|
||||
NS_IMETHOD SetItemType(nsIVariant* aType);
|
||||
NS_IMETHOD GetItemId(nsAString& aId);
|
||||
NS_IMETHOD SetItemId(const nsAString& aId);
|
||||
NS_IMETHOD GetItemRef(nsIVariant** aRef);
|
||||
NS_IMETHOD SetItemRef(nsIVariant* aValue);
|
||||
NS_IMETHOD GetItemProp(nsIVariant** aProp);
|
||||
NS_IMETHOD SetItemProp(nsIVariant* aValue);
|
||||
NS_IMETHOD GetProperties(nsIDOMHTMLPropertiesCollection** aReturn);
|
||||
NS_IMETHOD GetAccessKey(nsAString &aAccessKey);
|
||||
NS_IMETHOD SetAccessKey(const nsAString& aAccessKey);
|
||||
NS_IMETHOD GetAccessKeyLabel(nsAString& aLabel);
|
||||
nsresult GetContentEditable(nsAString& aContentEditable);
|
||||
nsresult GetIsContentEditable(bool* aContentEditable);
|
||||
nsresult SetContentEditable(const nsAString &aContentEditable);
|
||||
nsresult GetDataset(nsISupports** aDataset);
|
||||
already_AddRefed<nsDOMStringMap> Dataset();
|
||||
// Callback for destructor of of dataset to ensure to null out weak pointer.
|
||||
nsresult ClearDataset();
|
||||
nsresult GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu);
|
||||
|
||||
/**
|
||||
* Get width and height, using given image request if attributes are unset.
|
||||
|
@ -591,7 +691,7 @@ public:
|
|||
* @param aBaseAttr name of base attribute.
|
||||
* @param aResult result value [out]
|
||||
*/
|
||||
NS_HIDDEN_(nsresult) GetURIAttr(nsIAtom* aAttr, nsIAtom* aBaseAttr, nsAString& aResult);
|
||||
NS_HIDDEN_(void) GetURIAttr(nsIAtom* aAttr, nsIAtom* aBaseAttr, nsAString& aResult) const;
|
||||
|
||||
/**
|
||||
* Gets the absolute URI values of an attribute, by resolving any relative
|
||||
|
@ -685,6 +785,47 @@ protected:
|
|||
|
||||
virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const;
|
||||
|
||||
void GetHTMLAttr(nsIAtom* aName, nsAString& aResult) const
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, aName, aResult);
|
||||
}
|
||||
void GetHTMLEnumAttr(nsIAtom* aName, nsAString& aResult) const
|
||||
{
|
||||
GetEnumAttr(aName, nullptr, aResult);
|
||||
}
|
||||
void GetHTMLURIAttr(nsIAtom* aName, nsAString& aResult) const
|
||||
{
|
||||
GetURIAttr(aName, nullptr, aResult);
|
||||
}
|
||||
|
||||
void SetHTMLAttr(nsIAtom* aName, const nsAString& aValue)
|
||||
{
|
||||
SetAttr(kNameSpaceID_None, aName, aValue, true);
|
||||
}
|
||||
void SetHTMLAttr(nsIAtom* aName, const nsAString& aValue, mozilla::ErrorResult& aError)
|
||||
{
|
||||
aError = SetAttr(kNameSpaceID_None, aName, aValue, true);
|
||||
}
|
||||
void UnsetHTMLAttr(nsIAtom* aName, mozilla::ErrorResult& aError)
|
||||
{
|
||||
aError = UnsetAttr(kNameSpaceID_None, aName, true);
|
||||
}
|
||||
void SetHTMLBoolAttr(nsIAtom* aName, bool aValue, mozilla::ErrorResult& aError)
|
||||
{
|
||||
if (aValue) {
|
||||
SetHTMLAttr(aName, EmptyString(), aError);
|
||||
} else {
|
||||
UnsetHTMLAttr(aName, aError);
|
||||
}
|
||||
}
|
||||
void SetHTMLIntAttr(nsIAtom* aName, int32_t aValue, mozilla::ErrorResult& aError)
|
||||
{
|
||||
nsAutoString value;
|
||||
value.AppendInt(aValue);
|
||||
|
||||
SetHTMLAttr(aName, value, aError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for NS_IMPL_STRING_ATTR macro.
|
||||
* Sets the value of an attribute, returns specified default value if the
|
||||
|
@ -795,9 +936,9 @@ protected:
|
|||
* @param aDefault the default value if the attribute is missing or invalid.
|
||||
* @param aResult string corresponding to the value [out].
|
||||
*/
|
||||
NS_HIDDEN_(nsresult) GetEnumAttr(nsIAtom* aAttr,
|
||||
const char* aDefault,
|
||||
nsAString& aResult);
|
||||
NS_HIDDEN_(void) GetEnumAttr(nsIAtom* aAttr,
|
||||
const char* aDefault,
|
||||
nsAString& aResult) const;
|
||||
|
||||
/**
|
||||
* Locates the nsIEditor associated with this node. In general this is
|
||||
|
@ -811,12 +952,11 @@ protected:
|
|||
|
||||
/**
|
||||
* Get the frame's offset information for offsetTop/Left/Width/Height.
|
||||
* Returns the parent the offset is relative to.
|
||||
* @note This method flushes pending notifications (Flush_Layout).
|
||||
* @param aRect the offset information [OUT]
|
||||
* @param aOffsetParent the parent the offset is relative to (offsetParent)
|
||||
* [OUT]
|
||||
*/
|
||||
virtual void GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent);
|
||||
virtual nsGenericElement* GetOffsetRect(nsRect& aRect);
|
||||
|
||||
/**
|
||||
* Returns true if this is the current document's body element
|
||||
|
@ -1170,7 +1310,8 @@ protected:
|
|||
NS_IMETHODIMP \
|
||||
_class::Get##_method(nsAString& aValue) \
|
||||
{ \
|
||||
return GetURIAttr(nsGkAtoms::_atom, nullptr, aValue); \
|
||||
GetURIAttr(nsGkAtoms::_atom, nullptr, aValue); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::Set##_method(const nsAString& aValue) \
|
||||
|
@ -1182,7 +1323,8 @@ protected:
|
|||
NS_IMETHODIMP \
|
||||
_class::Get##_method(nsAString& aValue) \
|
||||
{ \
|
||||
return GetURIAttr(nsGkAtoms::_atom, nsGkAtoms::_base_atom, aValue); \
|
||||
GetURIAttr(nsGkAtoms::_atom, nsGkAtoms::_base_atom, aValue); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::Set##_method(const nsAString& aValue) \
|
||||
|
@ -1200,10 +1342,10 @@ protected:
|
|||
_class::Get##_method(nsAString& aValue) \
|
||||
{ \
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue); \
|
||||
if (aValue.IsEmpty()) { \
|
||||
return NS_OK; \
|
||||
if (!aValue.IsEmpty()) { \
|
||||
GetURIAttr(nsGkAtoms::_atom, nullptr, aValue); \
|
||||
} \
|
||||
return GetURIAttr(nsGkAtoms::_atom, nullptr, aValue); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::Set##_method(const nsAString& aValue) \
|
||||
|
@ -1246,7 +1388,8 @@ protected:
|
|||
NS_IMETHODIMP \
|
||||
_class::Get##_method(nsAString& aValue) \
|
||||
{ \
|
||||
return GetEnumAttr(nsGkAtoms::_atom, _default, aValue); \
|
||||
GetEnumAttr(nsGkAtoms::_atom, _default, aValue); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::Set##_method(const nsAString& aValue) \
|
||||
|
@ -1409,6 +1552,241 @@ protected:
|
|||
NS_INTERFACE_TABLE_ENTRY(_class, _i10) \
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_END
|
||||
|
||||
#define NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC \
|
||||
NS_IMETHOD GetId(nsAString& aId) MOZ_FINAL { \
|
||||
nsGenericElement::GetId(aId); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetId(const nsAString& aId) MOZ_FINAL { \
|
||||
nsGenericElement::SetId(aId); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetTitle(aTitle); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetTitle(const nsAString& aTitle) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::SetTitle(aTitle); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetLang(nsAString& aLang) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetLang(aLang); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetLang(const nsAString& aLang) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::SetLang(aLang); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetDir(nsAString& aDir) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetDir(aDir); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetDir(const nsAString& aDir) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetDir(aDir, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD GetClassName(nsAString& aClassName) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetClassName(aClassName); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetClassName(const nsAString& aClassName) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::SetClassName(aClassName); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetDataset(nsISupports** aDataset) MOZ_FINAL { \
|
||||
return nsGenericHTMLElement::GetDataset(aDataset); \
|
||||
} \
|
||||
NS_IMETHOD GetHidden(bool* aHidden) MOZ_FINAL { \
|
||||
*aHidden = nsGenericHTMLElement::Hidden(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetHidden(bool aHidden) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetHidden(aHidden, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD DOMBlur() MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::Blur(rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD GetItemScope(bool* aItemScope) MOZ_FINAL { \
|
||||
*aItemScope = nsGenericHTMLElement::ItemScope(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetItemScope(bool aItemScope) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetItemScope(aItemScope, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD GetItemType(nsIVariant** aType) MOZ_FINAL { \
|
||||
GetTokenList(nsGkAtoms::itemtype, aType); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetItemType(nsIVariant* aType) MOZ_FINAL { \
|
||||
return nsGenericHTMLElement::SetTokenList(nsGkAtoms::itemtype, aType); \
|
||||
} \
|
||||
NS_IMETHOD GetItemId(nsAString& aId) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetItemId(aId); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetItemId(const nsAString& aId) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetItemId(aId, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD GetProperties(nsIDOMHTMLPropertiesCollection** aReturn) \
|
||||
MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetProperties(aReturn); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetItemValue(nsIVariant** aValue) MOZ_FINAL { \
|
||||
return nsGenericHTMLElement::GetItemValue(aValue); \
|
||||
} \
|
||||
NS_IMETHOD SetItemValue(nsIVariant* aValue) MOZ_FINAL { \
|
||||
return nsGenericHTMLElement::SetItemValue(aValue); \
|
||||
} \
|
||||
NS_IMETHOD GetItemRef(nsIVariant** aRef) MOZ_FINAL { \
|
||||
GetTokenList(nsGkAtoms::itemref, aRef); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetItemRef(nsIVariant* aRef) MOZ_FINAL { \
|
||||
return nsGenericHTMLElement::SetTokenList(nsGkAtoms::itemref, aRef); \
|
||||
} \
|
||||
NS_IMETHOD GetItemProp(nsIVariant** aProp) MOZ_FINAL { \
|
||||
GetTokenList(nsGkAtoms::itemprop, aProp); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetItemProp(nsIVariant* aProp) MOZ_FINAL { \
|
||||
return nsGenericHTMLElement::SetTokenList(nsGkAtoms::itemprop, aProp); \
|
||||
} \
|
||||
NS_IMETHOD GetAccessKey(nsAString& aAccessKey) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetAccessKey(aAccessKey); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetAccessKey(aAccessKey, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetAccessKeyLabel(aAccessKeyLabel); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetDraggable(bool aDraggable) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetDraggable(aDraggable, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD GetContentEditable(nsAString& aContentEditable) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetContentEditable(aContentEditable); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetContentEditable(const nsAString& aContentEditable) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetContentEditable(aContentEditable, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable) MOZ_FINAL { \
|
||||
*aIsContentEditable = nsGenericHTMLElement::IsContentEditable(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) MOZ_FINAL { \
|
||||
nsGenericHTMLElement::GetContextMenu(aContextMenu); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetSpellcheck(bool* aSpellcheck) MOZ_FINAL { \
|
||||
*aSpellcheck = nsGenericHTMLElement::Spellcheck(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetSpellcheck(bool aSpellcheck) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetSpellcheck(aSpellcheck, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::GetOuterHTML(aOuterHTML, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetOuterHTML(aOuterHTML, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD InsertAdjacentHTML(const nsAString& position, \
|
||||
const nsAString& text) MOZ_FINAL { \
|
||||
return nsGenericHTMLElement::InsertAdjacentHTML(position, text); \
|
||||
} \
|
||||
NS_IMETHOD ScrollIntoView(bool top, uint8_t _argc) MOZ_FINAL { \
|
||||
if (!_argc) { \
|
||||
top = true; \
|
||||
} \
|
||||
nsGenericElement::ScrollIntoView(top); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) MOZ_FINAL { \
|
||||
nsGenericElement* offsetParent = nsGenericHTMLElement::GetOffsetParent(); \
|
||||
if (!offsetParent) { \
|
||||
*aOffsetParent = nullptr; \
|
||||
return NS_OK; \
|
||||
} \
|
||||
return CallQueryInterface(offsetParent, aOffsetParent); \
|
||||
} \
|
||||
NS_IMETHOD GetOffsetTop(int32_t* aOffsetTop) MOZ_FINAL { \
|
||||
*aOffsetTop = nsGenericHTMLElement::OffsetTop(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetOffsetLeft(int32_t* aOffsetLeft) MOZ_FINAL { \
|
||||
*aOffsetLeft = nsGenericHTMLElement::OffsetLeft(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetOffsetWidth(int32_t* aOffsetWidth) MOZ_FINAL { \
|
||||
*aOffsetWidth = nsGenericHTMLElement::OffsetWidth(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetOffsetHeight(int32_t* aOffsetHeight) MOZ_FINAL { \
|
||||
*aOffsetHeight = nsGenericHTMLElement::OffsetHeight(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD DOMClick() MOZ_FINAL { \
|
||||
Click(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetTabIndex(int32_t* aTabIndex) MOZ_FINAL { \
|
||||
*aTabIndex = TabIndex(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
using nsGenericHTMLElement::SetTabIndex; \
|
||||
NS_IMETHOD SetTabIndex(int32_t aTabIndex) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
nsGenericHTMLElement::SetTabIndex(aTabIndex, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
using nsGenericHTMLElement::Focus; \
|
||||
NS_IMETHOD Focus() MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
Focus(rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
NS_IMETHOD GetDraggable(bool* aDraggable) MOZ_FINAL { \
|
||||
*aDraggable = Draggable(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
using nsGenericHTMLElement::GetInnerHTML; \
|
||||
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
GetInnerHTML(aInnerHTML, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
} \
|
||||
using nsGenericHTMLElement::SetInnerHTML; \
|
||||
NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) MOZ_FINAL { \
|
||||
mozilla::ErrorResult rv; \
|
||||
SetInnerHTML(aInnerHTML, rv); \
|
||||
return rv.ErrorCode(); \
|
||||
}
|
||||
|
||||
/**
|
||||
* A macro to declare the NS_NewHTMLXXXElement() functions.
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
|
||||
virtual bool Draggable() const MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMHTMLAreaElement
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLBRElement
|
||||
NS_DECL_NSIDOMHTMLBRELEMENT
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLBodyElement
|
||||
NS_DECL_NSIDOMHTMLBODYELEMENT
|
||||
|
|
|
@ -69,7 +69,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMHTMLButtonElement
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLDataListElement
|
||||
NS_DECL_NSIDOMHTMLDATALISTELEMENT
|
||||
|
|
|
@ -5,50 +5,13 @@
|
|||
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "nsIDOMHTMLDivElement.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsHTMLDivElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
class nsHTMLDivElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLDivElement
|
||||
{
|
||||
public:
|
||||
nsHTMLDivElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLDivElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
|
||||
// nsIDOMHTMLDivElement
|
||||
NS_DECL_NSIDOMHTMLDIVELEMENT
|
||||
|
||||
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(Div)
|
||||
|
||||
|
||||
|
@ -77,9 +40,6 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLDivElement)
|
|||
NS_IMPL_ELEMENT_CLONE(nsHTMLDivElement)
|
||||
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLDivElement, Align, align)
|
||||
|
||||
|
||||
bool
|
||||
nsHTMLDivElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/* -*- 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 nsHTMLDivElement_h___
|
||||
#define nsHTMLDivElement_h___
|
||||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLDivElement.h"
|
||||
|
||||
class nsHTMLDivElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLDivElement
|
||||
{
|
||||
public:
|
||||
nsHTMLDivElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLDivElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLDivElement
|
||||
NS_IMETHOD GetAlign(nsAString& aAlign)
|
||||
{
|
||||
nsString align;
|
||||
GetAlign(align);
|
||||
aAlign = align;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetAlign(const nsAString& aAlign)
|
||||
{
|
||||
mozilla::ErrorResult rv;
|
||||
SetAlign(aAlign, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void GetAlign(nsString& aAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
||||
}
|
||||
void SetAlign(const nsAString& aAlign, mozilla::ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
||||
}
|
||||
|
||||
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; }
|
||||
};
|
||||
|
||||
#endif /* nsHTMLDivElement_h___ */
|
|
@ -28,7 +28,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual void GetInnerHTML(nsAString& aInnerHTML,
|
||||
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLFieldSetElement
|
||||
NS_DECL_NSIDOMHTMLFIELDSETELEMENT
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLFontElement
|
||||
NS_DECL_NSIDOMHTMLFONTELEMENT
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLFormElement
|
||||
NS_DECL_NSIDOMHTMLFORMELEMENT
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFrameElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLFrameElement
|
||||
NS_DECL_NSIDOMHTMLFRAMEELEMENT
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLFrameSetElement
|
||||
NS_DECL_NSIDOMHTMLFRAMESETELEMENT
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLHRElement
|
||||
NS_DECL_NSIDOMHTMLHRELEMENT
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLHeadingElement
|
||||
NS_DECL_NSIDOMHTMLHEADINGELEMENT
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFrameElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLIFrameElement
|
||||
NS_DECL_NSIDOMHTMLIFRAMEELEMENT
|
||||
|
|
|
@ -30,7 +30,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual bool Draggable() const MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMHTMLImageElement
|
||||
|
|
|
@ -2404,7 +2404,7 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
|||
nsCOMPtr<nsIContent> radioContent =
|
||||
do_QueryInterface(selectedRadioButton);
|
||||
if (radioContent) {
|
||||
rv = selectedRadioButton->DOMFocus();
|
||||
rv = selectedRadioButton->Focus();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aVisitor.mEvent),
|
||||
|
|
|
@ -77,7 +77,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual void Click() MOZ_OVERRIDE;
|
||||
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
|
||||
virtual void Focus(mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLLIElement
|
||||
NS_DECL_NSIDOMHTMLLIELEMENT
|
||||
|
|
|
@ -34,7 +34,8 @@ public:
|
|||
NS_DECL_NSIDOMHTMLLABELELEMENT
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual void Focus(mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
||||
|
||||
// nsIFormControl
|
||||
|
|
|
@ -30,7 +30,8 @@ public:
|
|||
NS_DECL_NSIDOMHTMLLEGENDELEMENT
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual void Focus(mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
||||
|
||||
virtual void PerformAccesskey(bool aKeyCausesActivation,
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLLinkElement
|
||||
NS_DECL_NSIDOMHTMLLINKELEMENT
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLMapElement
|
||||
NS_DECL_NSIDOMHTMLMAPELEMENT
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLMenuElement
|
||||
NS_DECL_NSIDOMHTMLMENUELEMENT
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLCommandElement
|
||||
NS_DECL_NSIDOMHTMLCOMMANDELEMENT
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLMetaElement
|
||||
NS_DECL_NSIDOMHTMLMETAELEMENT
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
/* nsIDOMHTMLElement */
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
/* nsIDOMHTMLMeterElement */
|
||||
NS_DECL_NSIDOMHTMLMETERELEMENT
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLModElement
|
||||
NS_DECL_NSIDOMHTMLMODELEMENT
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLOListElement
|
||||
NS_DECL_NSIDOMHTMLOLISTELEMENT
|
||||
|
|
|
@ -49,7 +49,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMHTMLObjectElement
|
||||
|
@ -308,8 +309,9 @@ nsHTMLObjectElement::IsFocusableForTabIndex()
|
|||
return false;
|
||||
}
|
||||
|
||||
return IsEditableRoot() || (Type() == eType_Document &&
|
||||
nsContentUtils::IsSubDocumentTabbable(this));
|
||||
return IsEditableRoot() ||
|
||||
(Type() == eType_Document &&
|
||||
nsContentUtils::IsSubDocumentTabbable(this));
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLOptGroupElement
|
||||
NS_DECL_NSIDOMHTMLOPTGROUPELEMENT
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLOptionElement
|
||||
using nsGenericElement::SetText;
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLOutputElement
|
||||
NS_DECL_NSIDOMHTMLOUTPUTELEMENT
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLParagraphElement
|
||||
NS_DECL_NSIDOMHTMLPARAGRAPHELEMENT
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLPreElement
|
||||
NS_IMETHOD GetWidth(int32_t* aWidth);
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLProgressElement
|
||||
NS_DECL_NSIDOMHTMLPROGRESSELEMENT
|
||||
|
|
|
@ -49,7 +49,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual void GetInnerHTML(nsAString& aInnerHTML,
|
||||
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
||||
virtual void SetInnerHTML(const nsAString& aInnerHTML,
|
||||
|
|
|
@ -597,40 +597,29 @@ nsHTMLSelectElement::GetSelectFrame()
|
|||
return select_frame;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement,
|
||||
nsIDOMHTMLElement* aBefore)
|
||||
void
|
||||
nsHTMLSelectElement::Add(nsGenericHTMLElement& aElement,
|
||||
nsGenericHTMLElement* aBefore,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> added;
|
||||
if (!aBefore) {
|
||||
return AppendChild(aElement, getter_AddRefs(added));
|
||||
nsGenericHTMLElement::AppendChild(aElement, aError);
|
||||
return;
|
||||
}
|
||||
|
||||
// Just in case we're not the parent, get the parent of the reference
|
||||
// element
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
aBefore->GetParentNode(getter_AddRefs(parent));
|
||||
if (!parent) {
|
||||
nsINode* parent = aBefore->GetParentNode();
|
||||
if (!nsContentUtils::ContentIsDescendantOf(parent, this)) {
|
||||
// NOT_FOUND_ERR: Raised if before is not a descendant of the SELECT
|
||||
// element.
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> ancestor(parent);
|
||||
nsCOMPtr<nsIDOMNode> temp;
|
||||
while (ancestor != static_cast<nsIDOMNode*>(this)) {
|
||||
ancestor->GetParentNode(getter_AddRefs(temp));
|
||||
if (!temp) {
|
||||
// NOT_FOUND_ERR: Raised if before is not a descendant of the SELECT
|
||||
// element.
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
}
|
||||
temp.swap(ancestor);
|
||||
aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the before parameter is not null, we are equivalent to the
|
||||
// insertBefore method on the parent of before.
|
||||
return parent->InsertBefore(aElement, aBefore, getter_AddRefs(added));
|
||||
parent->InsertBefore(aElement, aBefore, aError);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -641,10 +630,19 @@ nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement,
|
|||
nsresult rv = aBefore->GetDataType(&dataType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> element = do_QueryInterface(aElement);
|
||||
nsGenericHTMLElement* htmlElement =
|
||||
nsGenericHTMLElement::FromContentOrNull(element);
|
||||
if (!htmlElement) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// aBefore is omitted, undefined or null
|
||||
if (dataType == nsIDataType::VTYPE_EMPTY ||
|
||||
dataType == nsIDataType::VTYPE_VOID) {
|
||||
return Add(aElement);
|
||||
ErrorResult error;
|
||||
Add(*htmlElement, (nsGenericHTMLElement*)nullptr, error);
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
|
@ -652,17 +650,24 @@ nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement,
|
|||
|
||||
// whether aBefore is nsIDOMHTMLElement...
|
||||
if (NS_SUCCEEDED(aBefore->GetAsISupports(getter_AddRefs(supports)))) {
|
||||
beforeElement = do_QueryInterface(supports);
|
||||
nsCOMPtr<nsIContent> beforeElement = do_QueryInterface(supports);
|
||||
nsGenericHTMLElement* beforeHTMLElement =
|
||||
nsGenericHTMLElement::FromContentOrNull(beforeElement);
|
||||
|
||||
NS_ENSURE_TRUE(beforeElement, NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return Add(aElement, beforeElement);
|
||||
NS_ENSURE_TRUE(beforeHTMLElement, NS_ERROR_DOM_SYNTAX_ERR);
|
||||
|
||||
ErrorResult error;
|
||||
Add(*htmlElement, beforeHTMLElement, error);
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
// otherwise, whether aBefore is long
|
||||
int32_t index;
|
||||
NS_ENSURE_SUCCESS(aBefore->GetAsInt32(&index), NS_ERROR_DOM_SYNTAX_ERR);
|
||||
|
||||
return Add(aElement, index);
|
||||
ErrorResult error;
|
||||
Add(*htmlElement, index, error);
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -249,7 +249,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMHTMLSelectElement
|
||||
|
@ -404,15 +405,16 @@ public:
|
|||
/**
|
||||
* Insert aElement before the node given by aBefore
|
||||
*/
|
||||
nsresult Add(nsIDOMHTMLElement* aElement, nsIDOMHTMLElement* aBefore = nullptr);
|
||||
nsresult Add(nsIDOMHTMLElement* aElement, int32_t aIndex)
|
||||
void Add(nsGenericHTMLElement& aElement, nsGenericHTMLElement* aBefore,
|
||||
mozilla::ErrorResult& aError);
|
||||
void Add(nsGenericHTMLElement& aElement, int32_t aIndex,
|
||||
mozilla::ErrorResult& aError)
|
||||
{
|
||||
// If item index is out of range, insert to last.
|
||||
// (since beforeElement becomes null, it is inserted to last)
|
||||
nsCOMPtr<nsIDOMHTMLElement> beforeElement =
|
||||
do_QueryInterface(mOptions->GetElementAt(aIndex));
|
||||
|
||||
return Add(aElement, beforeElement);
|
||||
nsIContent* beforeContent = mOptions->GetElementAt(aIndex);
|
||||
return Add(aElement, nsGenericHTMLElement::FromContentOrNull(beforeContent),
|
||||
aError);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -660,19 +662,21 @@ nsHTMLOptionCollection::Add(const HTMLOptionOrOptGroupElement& aElement,
|
|||
const Nullable<HTMLElementOrLong>& aBefore,
|
||||
mozilla::ErrorResult& aError)
|
||||
{
|
||||
nsIDOMHTMLElement* element;
|
||||
if (aElement.IsHTMLOptionElement()) {
|
||||
element = aElement.GetAsHTMLOptionElement();
|
||||
} else {
|
||||
element = aElement.GetAsHTMLOptGroupElement();
|
||||
}
|
||||
nsGenericHTMLElement& element =
|
||||
aElement.IsHTMLOptionElement() ?
|
||||
static_cast<nsGenericHTMLElement&>(*aElement.GetAsHTMLOptionElement()) :
|
||||
static_cast<nsGenericHTMLElement&>(*aElement.GetAsHTMLOptGroupElement());
|
||||
|
||||
if (aBefore.IsNull()) {
|
||||
aError = mSelect->Add(element, (nsIDOMHTMLElement*)nullptr);
|
||||
mSelect->Add(element, (nsGenericHTMLElement*)nullptr, aError);
|
||||
} else if (aBefore.Value().IsHTMLElement()) {
|
||||
aError = mSelect->Add(element, aBefore.Value().GetAsHTMLElement());
|
||||
nsCOMPtr<nsIContent> content =
|
||||
do_QueryInterface(aBefore.Value().GetAsHTMLElement());
|
||||
nsGenericHTMLElement* before =
|
||||
static_cast<nsGenericHTMLElement*>(content.get());
|
||||
mSelect->Add(element, before, aError);
|
||||
} else {
|
||||
aError = mSelect->Add(element, aBefore.Value().GetAsLong());
|
||||
mSelect->Add(element, aBefore.Value().GetAsLong(), aError);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLParamElement
|
||||
NS_DECL_NSIDOMHTMLPARAMELEMENT
|
||||
|
|
|
@ -44,7 +44,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMHTMLAppletElement
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLSourceElement
|
||||
NS_DECL_NSIDOMHTMLSOURCEELEMENT
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual void GetInnerHTML(nsAString& aInnerHTML,
|
||||
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
||||
virtual void SetInnerHTML(const nsAString& aInnerHTML,
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLTableCaptionElement
|
||||
NS_DECL_NSIDOMHTMLTABLECAPTIONELEMENT
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLTableCellElement
|
||||
NS_DECL_NSIDOMHTMLTABLECELLELEMENT
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLTableColElement
|
||||
NS_DECL_NSIDOMHTMLTABLECOLELEMENT
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLTableElement
|
||||
NS_DECL_NSIDOMHTMLTABLEELEMENT
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLTableRowElement
|
||||
NS_DECL_NSIDOMHTMLTABLEROWELEMENT
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLTableSectionElement
|
||||
NS_DECL_NSIDOMHTMLTABLESECTIONELEMENT
|
||||
|
|
|
@ -77,7 +77,8 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMHTMLTextAreaElement
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLTitleElement
|
||||
NS_DECL_NSIDOMHTMLTITLEELEMENT
|
||||
|
|
|
@ -3,52 +3,12 @@
|
|||
* 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 "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLUnknownElement.h"
|
||||
|
||||
class nsHTMLUnknownElement : public nsGenericHTMLElement
|
||||
, public nsIDOMHTMLUnknownElement
|
||||
{
|
||||
public:
|
||||
nsHTMLUnknownElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLUnknownElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
};
|
||||
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Unknown)
|
||||
|
||||
|
||||
nsHTMLUnknownElement::nsHTMLUnknownElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLUnknownElement::~nsHTMLUnknownElement()
|
||||
{
|
||||
}
|
||||
|
||||
#include "nsHTMLUnknownElement.h"
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLUnknownElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLUnknownElement, nsGenericElement)
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Unknown)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLUnknownElement, nsHTMLUnknownElement)
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/* -*- 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 nsHTMLUnknownElement_h___
|
||||
#define nsHTMLUnknownElement_h___
|
||||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLUnknownElement.h"
|
||||
|
||||
class nsHTMLUnknownElement : public nsGenericHTMLElement
|
||||
, public nsIDOMHTMLUnknownElement
|
||||
{
|
||||
public:
|
||||
nsHTMLUnknownElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
};
|
||||
|
||||
#endif /* nsHTMLUnknownElement_h___ */
|
|
@ -27,7 +27,7 @@ public:
|
|||
// nsIContent
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
|
||||
nsIDOMCSSStyleDeclaration* GetStyle(nsresult* retval)
|
||||
nsICSSDeclaration* GetStyle(nsresult* retval)
|
||||
{
|
||||
return nsSVGStylableElementBase::GetStyle(retval);
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ interface nsIDOMHTMLElement : nsIDOMElement
|
|||
[binaryname(DOMClick)]
|
||||
void click();
|
||||
attribute long tabIndex;
|
||||
[binaryname(DOMFocus)]
|
||||
void focus();
|
||||
[binaryname(DOMBlur)]
|
||||
void blur();
|
||||
attribute DOMString accessKey;
|
||||
readonly attribute DOMString accessKeyLabel;
|
||||
|
@ -64,7 +64,6 @@ interface nsIDOMHTMLElement : nsIDOMElement
|
|||
|
||||
|
||||
// DOM Parsing and Serialization
|
||||
[binaryname(DOMInnerHTML)]
|
||||
attribute DOMString innerHTML;
|
||||
attribute DOMString outerHTML;
|
||||
void insertAdjacentHTML(in DOMString position,
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/* -*- 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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||
*
|
||||
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||
* Opera Software ASA. You are granted a license to use, reproduce
|
||||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
interface HTMLDivElement : HTMLElement {/*};
|
||||
|
||||
partial interface HTMLDivElement {
|
||||
*/
|
||||
[SetterThrows]
|
||||
attribute DOMString align;
|
||||
};
|
|
@ -0,0 +1,251 @@
|
|||
/* -*- 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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/ and
|
||||
* http://dev.w3.org/csswg/cssom-view/
|
||||
*
|
||||
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||
* Opera Software ASA. You are granted a license to use, reproduce
|
||||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
interface DOMStringMap;
|
||||
interface HTMLMenuElement;
|
||||
|
||||
interface HTMLElement : Element {
|
||||
// metadata attributes
|
||||
attribute DOMString title;
|
||||
attribute DOMString lang;
|
||||
// attribute boolean translate;
|
||||
[SetterThrows]
|
||||
attribute DOMString dir;
|
||||
readonly attribute DOMStringMap dataset;
|
||||
|
||||
// microdata
|
||||
[SetterThrows]
|
||||
attribute boolean itemScope;
|
||||
[PutForwards=value] readonly attribute DOMSettableTokenList itemType;
|
||||
[SetterThrows]
|
||||
attribute DOMString itemId;
|
||||
[PutForwards=value] readonly attribute DOMSettableTokenList itemRef;
|
||||
[PutForwards=value] readonly attribute DOMSettableTokenList itemProp;
|
||||
readonly attribute HTMLPropertiesCollection properties;
|
||||
[Throws]
|
||||
attribute any itemValue;
|
||||
|
||||
// user interaction
|
||||
[SetterThrows]
|
||||
attribute boolean hidden;
|
||||
void click();
|
||||
[SetterThrows]
|
||||
attribute long tabIndex;
|
||||
[Throws]
|
||||
void focus();
|
||||
[Throws]
|
||||
void blur();
|
||||
[SetterThrows]
|
||||
attribute DOMString accessKey;
|
||||
readonly attribute DOMString accessKeyLabel;
|
||||
[SetterThrows]
|
||||
attribute boolean draggable;
|
||||
//[PutForwards=value] readonly attribute DOMSettableTokenList dropzone;
|
||||
[SetterThrows]
|
||||
attribute DOMString contentEditable;
|
||||
readonly attribute boolean isContentEditable;
|
||||
readonly attribute HTMLMenuElement? contextMenu;
|
||||
//[SetterThrows]
|
||||
// attribute HTMLMenuElement? contextMenu;
|
||||
[SetterThrows]
|
||||
attribute boolean spellcheck;
|
||||
|
||||
// command API
|
||||
//readonly attribute DOMString? commandType;
|
||||
//readonly attribute DOMString? commandLabel;
|
||||
//readonly attribute DOMString? commandIcon;
|
||||
//readonly attribute boolean? commandHidden;
|
||||
//readonly attribute boolean? commandDisabled;
|
||||
//readonly attribute boolean? commandChecked;
|
||||
|
||||
// styling
|
||||
[Throws]
|
||||
readonly attribute CSSStyleDeclaration style;
|
||||
|
||||
// event handler IDL attributes
|
||||
[SetterThrows]
|
||||
attribute EventHandler onabort;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onblur;
|
||||
//[SetterThrows]
|
||||
// attribute EventHandler oncancel;
|
||||
[SetterThrows]
|
||||
attribute EventHandler oncanplay;
|
||||
[SetterThrows]
|
||||
attribute EventHandler oncanplaythrough;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onchange;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onclick;
|
||||
//[SetterThrows]
|
||||
// attribute EventHandler onclose;
|
||||
[SetterThrows]
|
||||
attribute EventHandler oncontextmenu;
|
||||
//[SetterThrows]
|
||||
// attribute EventHandler oncuechange;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ondblclick;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ondrag;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ondragend;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ondragenter;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ondragleave;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ondragover;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ondragstart;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ondrop;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ondurationchange;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onemptied;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onended;
|
||||
// We think the spec is wrong here.
|
||||
// attribute OnErrorEventHandler onerror;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onerror;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onfocus;
|
||||
[SetterThrows]
|
||||
attribute EventHandler oninput;
|
||||
[SetterThrows]
|
||||
attribute EventHandler oninvalid;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onkeydown;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onkeypress;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onkeyup;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onload;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onloadeddata;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onloadedmetadata;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onloadstart;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmousedown;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmousemove;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmouseout;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmouseover;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmouseup;
|
||||
//[SetterThrows]
|
||||
// attribute EventHandler onmousewheel;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onpause;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onplay;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onplaying;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onprogress;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onratechange;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onreset;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onscroll;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onseeked;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onseeking;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onselect;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onshow;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onstalled;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onsubmit;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onsuspend;
|
||||
[SetterThrows]
|
||||
attribute EventHandler ontimeupdate;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onvolumechange;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onwaiting;
|
||||
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmozfullscreenchange;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmozfullscreenerror;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmozpointerlockchange;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmozpointerlockerror;
|
||||
|
||||
// Mozilla specific stuff
|
||||
// FIXME Bug 810677 Move className from HTMLElement to Element
|
||||
attribute DOMString className;
|
||||
|
||||
[SetterThrows,LenientThis]
|
||||
attribute EventHandler onmouseenter;
|
||||
[SetterThrows,LenientThis]
|
||||
attribute EventHandler onmouseleave;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onwheel;
|
||||
|
||||
[SetterThrows,Pref="dom.w3c_touch_events.enabled"]
|
||||
attribute EventHandler ontouchstart;
|
||||
[SetterThrows,Pref="dom.w3c_touch_events.enabled"]
|
||||
attribute EventHandler ontouchend;
|
||||
[SetterThrows,Pref="dom.w3c_touch_events.enabled"]
|
||||
attribute EventHandler ontouchmove;
|
||||
[SetterThrows,Pref="dom.w3c_touch_events.enabled"]
|
||||
attribute EventHandler ontouchenter;
|
||||
[SetterThrows,Pref="dom.w3c_touch_events.enabled"]
|
||||
attribute EventHandler ontouchleave;
|
||||
[SetterThrows,Pref="dom.w3c_touch_events.enabled"]
|
||||
attribute EventHandler ontouchcancel;
|
||||
|
||||
[SetterThrows]
|
||||
attribute EventHandler oncopy;
|
||||
[SetterThrows]
|
||||
attribute EventHandler oncut;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onpaste;
|
||||
|
||||
// FIXME Bug 811701 Move innerHTML/outerHTML/insertAdjacentHTML from
|
||||
// HTMLElement to Element
|
||||
[Throws,TreatNullAs=EmptyString]
|
||||
attribute DOMString innerHTML;
|
||||
[Throws,TreatNullAs=EmptyString]
|
||||
attribute DOMString outerHTML;
|
||||
[Throws]
|
||||
void insertAdjacentHTML(DOMString position, DOMString text);
|
||||
/*
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interface
|
||||
partial interface HTMLElement {
|
||||
*/
|
||||
readonly attribute Element? offsetParent;
|
||||
readonly attribute long offsetTop;
|
||||
readonly attribute long offsetLeft;
|
||||
readonly attribute long offsetWidth;
|
||||
readonly attribute long offsetHeight;
|
||||
};
|
||||
|
||||
interface HTMLUnknownElement : HTMLElement {};
|
|
@ -480,7 +480,10 @@ customIncludes = [
|
|||
'nsSVGStylableElement.h',
|
||||
'nsHTMLDocument.h',
|
||||
'nsDOMQS.h',
|
||||
'nsDOMStringMap.h'
|
||||
'nsDOMStringMap.h',
|
||||
'HTMLPropertiesCollection.h',
|
||||
'nsHTMLMenuElement.h',
|
||||
'nsICSSDeclaration.h'
|
||||
]
|
||||
|
||||
customReturnInterfaces = [
|
||||
|
@ -833,7 +836,7 @@ customMethodCalls = {
|
|||
' self->SetTabIndex(arg0, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_DOMFocus': {
|
||||
'nsIDOMHTMLElement_Focus': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::ErrorResult error;\n'
|
||||
' self->Focus(error);\n'
|
||||
|
@ -879,7 +882,7 @@ customMethodCalls = {
|
|||
},
|
||||
'nsIDOMSVGStylable_GetStyle': {
|
||||
'thisType': 'nsSVGStylableElement',
|
||||
'code': ' nsIDOMCSSStyleDeclaration* result = '
|
||||
'code': ' nsICSSDeclaration* result = '
|
||||
'self->GetStyle(&rv);'
|
||||
},
|
||||
'nsIDOMDocument_': {
|
||||
|
@ -1037,6 +1040,168 @@ customMethodCalls = {
|
|||
'code': ' nsIHTMLCollection* result = self->Children();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetTitle': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetTitle': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetLang': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetLang': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetDir': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetDir': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::ErrorResult error;\n'
|
||||
' self->SetDir(arg0, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_GetItemScope': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' bool result = self->ItemScope();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetItemScope': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::ErrorResult error;\n'
|
||||
' self->SetItemScope(arg0, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_GetItemId': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetItemId': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::ErrorResult error;\n'
|
||||
' self->SetItemId(arg0, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_GetProperties': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' nsIDOMHTMLPropertiesCollection* result = self->Properties();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetHidden': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' bool result = self->Hidden();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetHidden': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::ErrorResult error;\n'
|
||||
' self->SetHidden(arg0, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_GetId': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetId': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetAccessKey': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetAccessKey': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::ErrorResult error;\n'
|
||||
' self->SetAccessKey(arg0, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_GetAccessKeyLabel': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetSpellcheck': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' bool result = self->Spellcheck();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetSpellcheck': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::ErrorResult error;\n'
|
||||
' self->SetSpellcheck(arg0, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_GetOuterHTML': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' nsString result;\n'
|
||||
' mozilla::ErrorResult error;\n'
|
||||
' self->GetOuterHTML(result, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_SetOuterHTML': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::ErrorResult error;\n'
|
||||
' self->SetOuterHTML(arg0, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_GetContentEditable': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetContentEditable': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::ErrorResult error;\n'
|
||||
' self->SetContentEditable(arg0, error);\n'
|
||||
' rv = error.ErrorCode();'
|
||||
},
|
||||
'nsIDOMHTMLElement_GetIsContentEditable': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' bool result = self->IsContentEditable();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetContextMenu': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' mozilla::dom::Element* result = self->GetContextMenu();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetOffsetParent': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' nsGenericElement* result = self->GetOffsetParent();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetOffsetTop': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' uint32_t result = self->OffsetTop();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetOffsetLeft': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' uint32_t result = self->OffsetLeft();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetOffsetWidth': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' uint32_t result = self->OffsetWidth();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetOffsetHeight': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'code': ' uint32_t result = self->OffsetHeight();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_GetClassName': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLElement_SetClassName': {
|
||||
'thisType' : 'nsGenericHTMLElement',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMWindow_GetOnmouseenter' : {
|
||||
'thisType' : 'nsIDOMWindow',
|
||||
'unwrapThisFailureFatal' : False
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLCanvasElement.h"
|
||||
#include "nsHTMLDivElement.h"
|
||||
#include "nsHTMLImageElement.h"
|
||||
#include "nsHTMLOptionElement.h"
|
||||
#include "nsHTMLOptGroupElement.h"
|
||||
|
@ -154,6 +155,7 @@ 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(img, nsHTMLImageElement)
|
||||
DEFINE_UNWRAP_CAST_HTML(optgroup, nsHTMLOptGroupElement)
|
||||
DEFINE_UNWRAP_CAST_HTML(option, nsHTMLOptionElement)
|
||||
|
|
Загрузка…
Ссылка в новой задаче