Backed out changeset 6515e55d4fb9 (bug 893117)

This commit is contained in:
Reuben Morais 2013-07-18 20:02:00 -07:00
parent 90a6661c77
commit 14523b53f5
3 changed files with 305 additions and 11 deletions

View File

@ -344,6 +344,219 @@ NS_IMPL_ELEMENT_CLONE(HTMLTableElement)
// in fact, they are integers or they are meaningless. so we store them
// here as ints.
NS_IMETHODIMP
HTMLTableElement::SetAlign(const nsAString& aAlign)
{
ErrorResult rv;
SetAlign(aAlign, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetAlign(nsAString& aAlign)
{
nsString align;
GetAlign(align);
aAlign = align;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetBgColor(const nsAString& aBgColor)
{
ErrorResult rv;
SetBgColor(aBgColor, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetBgColor(nsAString& aBgColor)
{
nsString bgColor;
GetBgColor(bgColor);
aBgColor = bgColor;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetBorder(const nsAString& aBorder)
{
ErrorResult rv;
SetBorder(aBorder, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetBorder(nsAString& aBorder)
{
nsString border;
GetBorder(border);
aBorder = border;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetCellPadding(const nsAString& aCellPadding)
{
ErrorResult rv;
SetCellPadding(aCellPadding, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetCellPadding(nsAString& aCellPadding)
{
nsString cellPadding;
GetCellPadding(cellPadding);
aCellPadding = cellPadding;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetCellSpacing(const nsAString& aCellSpacing)
{
ErrorResult rv;
SetCellSpacing(aCellSpacing, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetCellSpacing(nsAString& aCellSpacing)
{
nsString cellSpacing;
GetCellSpacing(cellSpacing);
aCellSpacing = cellSpacing;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetFrame(const nsAString& aFrame)
{
ErrorResult rv;
SetFrame(aFrame, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetFrame(nsAString& aFrame)
{
nsString frame;
GetFrame(frame);
aFrame = frame;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetRules(const nsAString& aRules)
{
ErrorResult rv;
SetRules(aRules, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetRules(nsAString& aRules)
{
nsString rules;
GetRules(rules);
aRules = rules;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetSummary(const nsAString& aSummary)
{
ErrorResult rv;
SetSummary(aSummary, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetSummary(nsAString& aSummary)
{
nsString summary;
GetSummary(summary);
aSummary = summary;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetWidth(const nsAString& aWidth)
{
ErrorResult rv;
SetWidth(aWidth, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetWidth(nsAString& aWidth)
{
nsString width;
GetWidth(width);
aWidth = width;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::GetCaption(nsIDOMHTMLTableCaptionElement** aValue)
{
nsCOMPtr<nsIDOMHTMLTableCaptionElement> caption = GetCaption();
caption.forget(aValue);
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetCaption(nsIDOMHTMLTableCaptionElement* aValue)
{
HTMLTableCaptionElement* caption =
static_cast<HTMLTableCaptionElement*>(aValue);
SetCaption(caption);
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::GetTHead(nsIDOMHTMLTableSectionElement** aValue)
{
NS_IF_ADDREF(*aValue = GetTHead());
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetTHead(nsIDOMHTMLTableSectionElement* aValue)
{
HTMLTableSectionElement* section =
static_cast<HTMLTableSectionElement*>(aValue);
ErrorResult rv;
SetTHead(section, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetTFoot(nsIDOMHTMLTableSectionElement** aValue)
{
NS_IF_ADDREF(*aValue = GetTFoot());
return NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::SetTFoot(nsIDOMHTMLTableSectionElement* aValue)
{
HTMLTableSectionElement* section =
static_cast<HTMLTableSectionElement*>(aValue);
ErrorResult rv;
SetTFoot(section, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue)
{
NS_ADDREF(*aValue = Rows());
return NS_OK;
}
nsIHTMLCollection*
HTMLTableElement::Rows()
{
@ -354,6 +567,13 @@ HTMLTableElement::Rows()
return mRows;
}
NS_IMETHODIMP
HTMLTableElement::GetTBodies(nsIDOMHTMLCollection** aValue)
{
NS_ADDREF(*aValue = TBodies());
return NS_OK;
}
nsIHTMLCollection*
HTMLTableElement::TBodies()
{
@ -390,7 +610,14 @@ HTMLTableElement::CreateTHead()
return head.forget();
}
void
NS_IMETHODIMP
HTMLTableElement::CreateTHead(nsIDOMHTMLElement** aValue)
{
nsRefPtr<nsGenericHTMLElement> thead = CreateTHead();
return thead ? CallQueryInterface(thead, aValue) : NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::DeleteTHead()
{
HTMLTableSectionElement* tHead = GetTHead();
@ -399,6 +626,8 @@ HTMLTableElement::DeleteTHead()
nsINode::RemoveChild(*tHead, rv);
MOZ_ASSERT(!rv.Failed());
}
return NS_OK;
}
already_AddRefed<nsGenericHTMLElement>
@ -421,7 +650,14 @@ HTMLTableElement::CreateTFoot()
return foot.forget();
}
void
NS_IMETHODIMP
HTMLTableElement::CreateTFoot(nsIDOMHTMLElement** aValue)
{
nsRefPtr<nsGenericHTMLElement> tfoot = CreateTFoot();
return tfoot ? CallQueryInterface(tfoot, aValue) : NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::DeleteTFoot()
{
HTMLTableSectionElement* tFoot = GetTFoot();
@ -430,6 +666,8 @@ HTMLTableElement::DeleteTFoot()
nsINode::RemoveChild(*tFoot, rv);
MOZ_ASSERT(!rv.Failed());
}
return NS_OK;
}
already_AddRefed<nsGenericHTMLElement>
@ -452,7 +690,14 @@ HTMLTableElement::CreateCaption()
return caption.forget();
}
void
NS_IMETHODIMP
HTMLTableElement::CreateCaption(nsIDOMHTMLElement** aValue)
{
nsRefPtr<nsGenericHTMLElement> caption = CreateCaption();
return caption ? CallQueryInterface(caption, aValue) : NS_OK;
}
NS_IMETHODIMP
HTMLTableElement::DeleteCaption()
{
HTMLTableCaptionElement* caption = GetCaption();
@ -461,6 +706,8 @@ HTMLTableElement::DeleteCaption()
nsINode::RemoveChild(*caption, rv);
MOZ_ASSERT(!rv.Failed());
}
return NS_OK;
}
already_AddRefed<nsGenericHTMLElement>
@ -496,7 +743,7 @@ already_AddRefed<nsGenericHTMLElement>
HTMLTableElement::InsertRow(int32_t aIndex, ErrorResult& aError)
{
/* get the ref row at aIndex
if there is one,
if there is one,
get its parent
insert the new row just before the ref row
else
@ -601,6 +848,14 @@ HTMLTableElement::InsertRow(int32_t aIndex, ErrorResult& aError)
return newRow.forget();
}
NS_IMETHODIMP
HTMLTableElement::InsertRow(int32_t aIndex, nsIDOMHTMLElement** aValue)
{
ErrorResult rv;
nsRefPtr<nsGenericHTMLElement> newRow = InsertRow(aIndex, rv);
return rv.Failed() ? rv.ErrorCode() : CallQueryInterface(newRow, aValue);
}
void
HTMLTableElement::DeleteRow(int32_t aIndex, ErrorResult& aError)
{
@ -631,6 +886,14 @@ HTMLTableElement::DeleteRow(int32_t aIndex, ErrorResult& aError)
row->RemoveFromParent();
}
NS_IMETHODIMP
HTMLTableElement::DeleteRow(int32_t aValue)
{
ErrorResult rv;
DeleteRow(aValue, rv);
return rv.ErrorCode();
}
static const nsAttrValue::EnumTable kFrameTable[] = {
{ "void", NS_STYLE_TABLE_FRAME_NONE },
{ "above", NS_STYLE_TABLE_FRAME_ABOVE },

View File

@ -39,6 +39,9 @@ public:
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLTableElement
NS_DECL_NSIDOMHTMLTABLEELEMENT
HTMLTableCaptionElement* GetCaption() const
{
return static_cast<HTMLTableCaptionElement*>(GetChild(nsGkAtoms::caption));
@ -51,13 +54,8 @@ public:
nsINode::AppendChild(*aCaption, rv);
}
}
void DeleteTFoot();
already_AddRefed<nsGenericHTMLElement> CreateCaption();
void DeleteCaption();
HTMLTableSectionElement* GetTHead() const
{
return static_cast<HTMLTableSectionElement*>(GetChild(nsGkAtoms::thead));
@ -76,8 +74,6 @@ public:
}
already_AddRefed<nsGenericHTMLElement> CreateTHead();
void DeleteTHead();
HTMLTableSectionElement* GetTFoot() const
{
return static_cast<HTMLTableSectionElement*>(GetChild(nsGkAtoms::tfoot));

View File

@ -19,4 +19,39 @@
[scriptable, uuid(1a7bf1f1-5d6c-4200-9ceb-455874322315)]
interface nsIDOMHTMLTableElement : nsIDOMHTMLElement
{
// Modified in DOM Level 2:
attribute nsIDOMHTMLTableCaptionElement caption;
// raises(DOMException) on setting
// Modified in DOM Level 2:
attribute nsIDOMHTMLTableSectionElement tHead;
// raises(DOMException) on setting
// Modified in DOM Level 2:
attribute nsIDOMHTMLTableSectionElement tFoot;
// raises(DOMException) on setting
readonly attribute nsIDOMHTMLCollection rows;
readonly attribute nsIDOMHTMLCollection tBodies;
attribute DOMString align;
attribute DOMString bgColor;
attribute DOMString border;
attribute DOMString cellPadding;
attribute DOMString cellSpacing;
attribute DOMString frame;
attribute DOMString rules;
attribute DOMString summary;
attribute DOMString width;
nsIDOMHTMLElement createTHead();
void deleteTHead();
nsIDOMHTMLElement createTFoot();
void deleteTFoot();
nsIDOMHTMLElement createCaption();
void deleteCaption();
// Modified in DOM Level 2:
nsIDOMHTMLElement insertRow(in long index)
raises(DOMException);
// Modified in DOM Level 2:
void deleteRow(in long index)
raises(DOMException);
};