Fix for bug 824907 (Convert HTML table elements to WebIDL) - convert HTMLTableColElement to WebIDL. r=bz.

--HG--
rename : content/html/content/src/nsHTMLTableCellElement.cpp => content/html/content/src/HTMLTableCellElement.cpp
rename : content/html/content/src/nsHTMLTableColElement.cpp => content/html/content/src/HTMLTableColElement.cpp
rename : content/html/content/src/nsHTMLTableColElement.cpp => content/html/content/src/HTMLTableColElement.h
rename : content/html/content/src/nsHTMLTableElement.h => content/html/content/src/HTMLTableElement.h
rename : content/html/content/src/nsHTMLTableRowElement.cpp => content/html/content/src/HTMLTableRowElement.cpp
rename : content/html/content/src/nsHTMLTableRowElement.cpp => content/html/content/src/HTMLTableRowElement.h
extra : rebase_source : 4654bf54c41231eed6f73a35118d58be0c9af9a0
This commit is contained in:
Peter Van der Beken 2012-12-29 15:07:57 +01:00
Родитель b355be85c1
Коммит 15549f5c0e
7 изменённых файлов: 191 добавлений и 12 удалений

Просмотреть файл

@ -8,9 +8,8 @@
#include "mozilla/dom/HTMLTableColElement.h"
#include "nsMappedAttributes.h"
#include "nsAttrValueInlines.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsRuleData.h"
#include "mozilla/dom/HTMLTableColElementBinding.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(TableCol)
DOMCI_NODE_DATA(HTMLTableColElement, mozilla::dom::HTMLTableColElement)
@ -26,6 +25,13 @@ HTMLTableColElement::~HTMLTableColElement()
{
}
JSObject*
HTMLTableColElement::WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap)
{
return HTMLTableColElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
NS_IMPL_ADDREF_INHERITED(HTMLTableColElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLTableColElement, Element)
@ -39,14 +45,105 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLTableColElement)
NS_IMPL_ELEMENT_CLONE(HTMLTableColElement)
NS_IMETHODIMP
HTMLTableColElement::SetSpan(int32_t aSpan)
{
ErrorResult rv;
SetSpan(aSpan, rv);
return rv.ErrorCode();
}
NS_IMPL_STRING_ATTR(HTMLTableColElement, Align, align)
NS_IMPL_STRING_ATTR(HTMLTableColElement, Ch, _char)
NS_IMPL_STRING_ATTR(HTMLTableColElement, ChOff, charoff)
NS_IMPL_INT_ATTR_DEFAULT_VALUE(HTMLTableColElement, Span, span, 1)
NS_IMPL_STRING_ATTR(HTMLTableColElement, VAlign, valign)
NS_IMPL_STRING_ATTR(HTMLTableColElement, Width, width)
NS_IMETHODIMP
HTMLTableColElement::GetSpan(int32_t* aSpan)
{
*aSpan = Span();
return NS_OK;
}
NS_IMETHODIMP
HTMLTableColElement::SetAlign(const nsAString& aAlign)
{
ErrorResult rv;
SetAlign(aAlign, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableColElement::GetAlign(nsAString& aAlign)
{
nsString align;
GetAlign(align);
aAlign = align;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableColElement::SetVAlign(const nsAString& aVAlign)
{
ErrorResult rv;
SetVAlign(aVAlign, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableColElement::GetVAlign(nsAString& aVAlign)
{
nsString vAlign;
GetVAlign(vAlign);
aVAlign = vAlign;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableColElement::SetCh(const nsAString& aCh)
{
ErrorResult rv;
SetCh(aCh, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableColElement::GetCh(nsAString& aCh)
{
nsString ch;
GetCh(ch);
aCh = ch;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableColElement::SetChOff(const nsAString& aChOff)
{
ErrorResult rv;
SetChOff(aChOff, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableColElement::GetChOff(nsAString& aChOff)
{
nsString chOff;
GetChOff(chOff);
aChOff = chOff;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableColElement::SetWidth(const nsAString& aWidth)
{
ErrorResult rv;
SetWidth(aWidth, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableColElement::GetWidth(nsAString& aWidth)
{
nsString width;
GetWidth(width);
aWidth = width;
return NS_OK;
}
bool
HTMLTableColElement::ParseAttribute(int32_t aNamespaceID,

Просмотреть файл

@ -18,6 +18,7 @@ public:
HTMLTableColElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
SetIsDOMBinding();
}
virtual ~HTMLTableColElement();
@ -36,6 +37,56 @@ public:
// nsIDOMHTMLTableColElement
NS_DECL_NSIDOMHTMLTABLECOLELEMENT
uint32_t Span() const
{
return GetIntAttr(nsGkAtoms::span, 1);
}
void SetSpan(uint32_t aSpan, ErrorResult& aError)
{
SetHTMLIntAttr(nsGkAtoms::span, aSpan, aError);
}
void GetAlign(nsString& aAlign)
{
GetHTMLAttr(nsGkAtoms::align, aAlign);
}
void SetAlign(const nsAString& aAlign, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
}
void GetCh(nsString& aCh)
{
GetHTMLAttr(nsGkAtoms::_char, aCh);
}
void SetCh(const nsAString& aCh, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
}
void GetChOff(nsString& aChOff)
{
GetHTMLAttr(nsGkAtoms::charoff, aChOff);
}
void SetChOff(const nsAString& aChOff, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError);
}
void GetVAlign(nsString& aVAlign)
{
GetHTMLAttr(nsGkAtoms::valign, aVAlign);
}
void SetVAlign(const nsAString& aVAlign, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError);
}
void GetWidth(nsString& aWidth)
{
GetHTMLAttr(nsGkAtoms::width, aWidth);
}
void SetWidth(const nsAString& aWidth, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
}
virtual bool ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
@ -48,6 +99,10 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;
};
} // namespace dom

Просмотреть файл

@ -57,8 +57,6 @@ function reflectString(aParameters)
element[idlAttr] = null;
// TODO: remove this ugly hack when null stringification will work as expected.
var todoAttrs = {
col: [ "align", "vAlign", "ch" ],
colgroup: [ "align", "vAlign", "ch" ],
form: [ "acceptCharset", "name", "target" ],
img: [ "align" ],
input: [ "accept", "alt", "formTarget", "max", "min", "name", "pattern", "placeholder", "step", "defaultValue" ],

Просмотреть файл

@ -426,6 +426,10 @@ DOMInterfaces = {
'hasInstanceInterface': 'nsIDOMHTMLTableCellElement'
},
'HTMLTableColElement': {
'hasInstanceInterface': 'nsIDOMHTMLTableColElement'
},
'HTMLTableElement': {
'hasInstanceInterface': 'nsIDOMHTMLTableElement',
'resultNotAddRefed': [

Просмотреть файл

@ -0,0 +1,26 @@
/* -*- 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 HTMLTableColElement : HTMLElement {
attribute unsigned long span;
/*
};
partial interface HTMLTableColElement {
*/
attribute DOMString align;
attribute DOMString ch;
attribute DOMString chOff;
attribute DOMString vAlign;
attribute DOMString width;
};

Просмотреть файл

@ -75,6 +75,7 @@ webidl_files = \
HTMLSpanElement.webidl \
HTMLTableCaptionElement.webidl \
HTMLTableCellElement.webidl \
HTMLTableColElement.webidl \
HTMLTableElement.webidl \
HTMLTableRowElement.webidl \
HTMLTableSectionElement.webidl \

Просмотреть файл

@ -180,8 +180,6 @@ members = [
'nsIDOMHTMLSelectElement.options',
'nsIDOMHTMLSelectElement.size',
'nsIDOMHTMLStyleElement.disabled',
'nsIDOMHTMLTableColElement.span',
'nsIDOMHTMLTableColElement.width',
'nsIDOMHTMLTextAreaElement.rows',
'nsIDOMHTMLTextAreaElement.name',
'nsIDOMHTMLTextAreaElement.form',