diff --git a/layout/html/content/src/nsHTMLAnchor.cpp b/layout/html/content/src/nsHTMLAnchor.cpp
index 017c69f27345..defdb0751ae6 100644
--- a/layout/html/content/src/nsHTMLAnchor.cpp
+++ b/layout/html/content/src/nsHTMLAnchor.cpp
@@ -149,169 +149,18 @@ nsHTMLAnchor::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLAnchor::GetAccessKey(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::accesskey, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetAccessKey(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::accesskey, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetCharset(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::charset, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetCharset(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::charset, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetCoords(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::coords, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetCoords(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::coords, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetHref(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::href, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetHref(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::href, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetHreflang(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::hreflang, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetHreflang(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::hreflang, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetName(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::name, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetName(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::name, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetRel(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::rel, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetRel(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::rel, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetRev(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::rev, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetRev(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::rev, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetShape(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::shape, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetShape(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::shape, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetTabIndex(PRInt32* aValue)
-{
- nsHTMLValue value;
- *aValue = -1;
- if (NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::tabindex, value)) {
- if (value.GetUnit() == eHTMLUnit_Integer) {
- *aValue = value.GetIntValue();
- }
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetTabIndex(PRInt32 aValue)
-{
- nsHTMLValue value(aValue, eHTMLUnit_Integer);
- return mInner.SetAttr(nsHTMLAtoms::tabindex, value, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetTarget(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::target, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetTarget(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::target, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::GetType(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::type, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchor::SetType(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::type, aValue, eSetAttrNotify_None);
-}
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, AccessKey, accesskey, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Charset, charset, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Coords, coords, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Href, href, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Hreflang, hreflang, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Name, name, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Rel, rel, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Rev, rev, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Shape, shape, eSetAttrNotify_None)
+NS_IMPL_INT_ATTR(nsHTMLAnchor, TabIndex, tabindex, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Target, target, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLAnchor, Type, type, eSetAttrNotify_None)
NS_IMETHODIMP
nsHTMLAnchor::Blur()
diff --git a/layout/html/content/src/nsHTMLApplet.cpp b/layout/html/content/src/nsHTMLApplet.cpp
index d7d295ae0399..88d62d408591 100644
--- a/layout/html/content/src/nsHTMLApplet.cpp
+++ b/layout/html/content/src/nsHTMLApplet.cpp
@@ -142,148 +142,17 @@ nsHTMLApplet::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLApplet::GetAlign(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::align, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetAlign(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::align, aValue, eSetAttrNotify_Reflow);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetAlt(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::alt, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetAlt(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::alt, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetArchive(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::archive, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetArchive(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::archive, aValue, eSetAttrNotify_Restart);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetCode(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::code, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetCode(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::code, aValue, eSetAttrNotify_Restart);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetCodeBase(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::codebase, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetCodeBase(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::codebase, aValue, eSetAttrNotify_Restart);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetHeight(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::height, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetHeight(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::height, aValue, eSetAttrNotify_Reflow);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetHspace(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::hspace, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetHspace(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::hspace, aValue, eSetAttrNotify_Reflow);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetName(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::name, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetName(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::name, aValue, eSetAttrNotify_Restart);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetObject(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::object, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetObject(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::object, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetVspace(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::vspace, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetVspace(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::vspace, aValue, eSetAttrNotify_Reflow);
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::GetWidth(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::width, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLApplet::SetWidth(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::width, aValue, eSetAttrNotify_Reflow);
-}
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Align, align, eSetAttrNotify_Reflow)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Alt, alt, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Archive, archive, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Code, code, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, CodeBase, codebase, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Height, height, eSetAttrNotify_Reflow)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Hspace, hspace, eSetAttrNotify_Reflow)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Name, name, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Object, object, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Vspace, vspace, eSetAttrNotify_Reflow)
+NS_IMPL_STRING_ATTR(nsHTMLApplet, Width, width, eSetAttrNotify_Reflow)
NS_IMETHODIMP
nsHTMLApplet::StringToAttribute(nsIAtom* aAttribute,
diff --git a/layout/html/content/src/nsHTMLArea.cpp b/layout/html/content/src/nsHTMLArea.cpp
index c2ad502f9007..4e5711c23867 100644
--- a/layout/html/content/src/nsHTMLArea.cpp
+++ b/layout/html/content/src/nsHTMLArea.cpp
@@ -136,126 +136,14 @@ nsHTMLArea::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLArea::GetAccessKey(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::accesskey, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLArea::SetAccessKey(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::accesskey, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLArea::GetAlt(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::alt, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLArea::SetAlt(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::alt, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLArea::GetCoords(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::coords, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLArea::SetCoords(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::coords, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLArea::GetHref(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::href, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLArea::SetHref(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::href, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLArea::GetNoHref(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::nohref, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLArea::SetNoHref(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::nohref, empty, eSetAttrNotify_None);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::nohref);
- return NS_OK;
- }
-}
-
-NS_IMETHODIMP
-nsHTMLArea::GetShape(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::shape, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLArea::SetShape(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::shape, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLArea::GetTabIndex(PRInt32* aValue)
-{
- nsHTMLValue value;
- *aValue = -1;
- if (NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::tabindex, value)) {
- if (value.GetUnit() == eHTMLUnit_Integer) {
- *aValue = value.GetIntValue();
- }
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLArea::SetTabIndex(PRInt32 aValue)
-{
- nsHTMLValue value(aValue, eHTMLUnit_Integer);
- return mInner.SetAttr(nsHTMLAtoms::tabindex, value, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLArea::GetTarget(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::target, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLArea::SetTarget(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::target, aValue, eSetAttrNotify_None);
-}
+NS_IMPL_STRING_ATTR(nsHTMLArea, AccessKey, accesskey, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLArea, Alt, alt, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLArea, Coords, coords, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLArea, Href, href, eSetAttrNotify_None)
+NS_IMPL_BOOL_ATTR(nsHTMLArea, NoHref, nohref, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLArea, Shape, shape, eSetAttrNotify_None)
+NS_IMPL_INT_ATTR(nsHTMLArea, TabIndex, tabindex, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLArea, Target, target, eSetAttrNotify_None)
NS_IMETHODIMP
nsHTMLArea::StringToAttribute(nsIAtom* aAttribute,
diff --git a/layout/html/content/src/nsHTMLBR.cpp b/layout/html/content/src/nsHTMLBR.cpp
index a841d745076f..797bd84da496 100644
--- a/layout/html/content/src/nsHTMLBR.cpp
+++ b/layout/html/content/src/nsHTMLBR.cpp
@@ -122,16 +122,7 @@ nsHTMLBR::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLBR::GetClear(nsString& aValue) {
- mInner.GetAttribute(nsHTMLAtoms::clear, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBR::SetClear(const nsString& aValue) {
- return mInner.SetAttr(nsHTMLAtoms::clear, aValue, eSetAttrNotify_Reflow);
-}
+NS_IMPL_STRING_ATTR(nsHTMLBR, Clear, clear, eSetAttrNotify_Reflow)
static nsHTMLGenericContent::EnumTable kClearTable[] = {
{ "left", NS_STYLE_CLEAR_LEFT },
diff --git a/layout/html/content/src/nsHTMLBase.cpp b/layout/html/content/src/nsHTMLBase.cpp
index 8d4779fc2aea..da3b42bfb0de 100644
--- a/layout/html/content/src/nsHTMLBase.cpp
+++ b/layout/html/content/src/nsHTMLBase.cpp
@@ -124,31 +124,8 @@ nsHTMLBase::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLBase::GetHref(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::href, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBase::SetHref(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::href, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLBase::GetTarget(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::target, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBase::SetTarget(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::target, aValue, eSetAttrNotify_None);
-}
+NS_IMPL_STRING_ATTR(nsHTMLBase, Href, href, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLBase, Target, target, eSetAttrNotify_None)
NS_IMETHODIMP
nsHTMLBase::StringToAttribute(nsIAtom* aAttribute,
diff --git a/layout/html/content/src/nsHTMLBaseFont.cpp b/layout/html/content/src/nsHTMLBaseFont.cpp
index 36614cf1423d..e1c792cc0424 100644
--- a/layout/html/content/src/nsHTMLBaseFont.cpp
+++ b/layout/html/content/src/nsHTMLBaseFont.cpp
@@ -126,50 +126,16 @@ nsHTMLBaseFont::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLBaseFont::GetColor(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::color, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBaseFont::SetColor(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::color, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLBaseFont::GetFace(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::face, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBaseFont::SetFace(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::face, aValue, eSetAttrNotify_Reflow);
-}
-
-NS_IMETHODIMP
-nsHTMLBaseFont::GetSize(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::size, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBaseFont::SetSize(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::size, aValue, eSetAttrNotify_Reflow);
-}
+NS_IMPL_STRING_ATTR(nsHTMLBaseFont, Color, color, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLBaseFont, Face, face, eSetAttrNotify_Reflow)
+NS_IMPL_STRING_ATTR(nsHTMLBaseFont, Size, size, eSetAttrNotify_Reflow)
NS_IMETHODIMP
nsHTMLBaseFont::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
nsHTMLValue& aResult)
{
+ // XXX write me
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -178,6 +144,7 @@ nsHTMLBaseFont::AttributeToString(nsIAtom* aAttribute,
nsHTMLValue& aValue,
nsString& aResult) const
{
+ // XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
@@ -185,6 +152,7 @@ NS_IMETHODIMP
nsHTMLBaseFont::MapAttributesInto(nsIStyleContext* aContext,
nsIPresContext* aPresContext)
{
+ // XXX write me?
return NS_OK;
}
diff --git a/layout/html/content/src/nsHTMLBody.cpp b/layout/html/content/src/nsHTMLBody.cpp
index b65b7ae3361f..a3da83b070ad 100644
--- a/layout/html/content/src/nsHTMLBody.cpp
+++ b/layout/html/content/src/nsHTMLBody.cpp
@@ -132,90 +132,19 @@ nsHTMLBody::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLBody::GetALink(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::alink, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBody::SetALink(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::alink, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLBody::GetBackground(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::background, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBody::SetBackground(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::background, aValue,
- eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLBody::GetBgColor(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::bgcolor, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBody::SetBgColor(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::bgcolor, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLBody::GetLink(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::link, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBody::SetLink(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::link, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLBody::GetText(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::text, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBody::SetText(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::text, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLBody::GetVLink(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::vlink, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLBody::SetVLink(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::vlink, aValue, eSetAttrNotify_Render);
-}
+NS_IMPL_STRING_ATTR(nsHTMLBody, ALink, alink, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLBody, Background, background, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLBody, BgColor, bgcolor, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLBody, Link, link, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLBody, Text, text, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLBody, VLink, vlink, eSetAttrNotify_Render)
NS_IMETHODIMP
nsHTMLBody::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
nsHTMLValue& aResult)
{
+ // XXX write me
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -224,6 +153,7 @@ nsHTMLBody::AttributeToString(nsIAtom* aAttribute,
nsHTMLValue& aValue,
nsString& aResult) const
{
+ // XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
@@ -231,6 +161,7 @@ NS_IMETHODIMP
nsHTMLBody::MapAttributesInto(nsIStyleContext* aContext,
nsIPresContext* aPresContext)
{
+ // XXX write me
return NS_OK;
}
diff --git a/layout/html/content/src/nsHTMLDList.cpp b/layout/html/content/src/nsHTMLDList.cpp
index e6245acb034e..c828c8a8a82d 100644
--- a/layout/html/content/src/nsHTMLDList.cpp
+++ b/layout/html/content/src/nsHTMLDList.cpp
@@ -30,9 +30,9 @@
static NS_DEFINE_IID(kIDOMHTMLDListElementIID, NS_IDOMHTMLDLISTELEMENT_IID);
class nsHTMLDList : public nsIDOMHTMLDListElement,
- public nsIScriptObjectOwner,
- public nsIDOMEventReceiver,
- public nsIHTMLContent
+ public nsIScriptObjectOwner,
+ public nsIDOMEventReceiver,
+ public nsIHTMLContent
{
public:
nsHTMLDList(nsIAtom* aTag);
@@ -122,48 +122,31 @@ nsHTMLDList::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLDList::GetCompact(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::compact, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLDList::SetCompact(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::compact, empty, eSetAttrNotify_Reflow);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::compact);
- return NS_OK;
- }
-}
+NS_IMPL_BOOL_ATTR(nsHTMLDList, Compact, compact, eSetAttrNotify_Reflow)
NS_IMETHODIMP
nsHTMLDList::StringToAttribute(nsIAtom* aAttribute,
- const nsString& aValue,
- nsHTMLValue& aResult)
+ const nsString& aValue,
+ nsHTMLValue& aResult)
{
+ // XXX write me
return NS_CONTENT_ATTR_NOT_THERE;
}
NS_IMETHODIMP
nsHTMLDList::AttributeToString(nsIAtom* aAttribute,
- nsHTMLValue& aValue,
- nsString& aResult) const
+ nsHTMLValue& aValue,
+ nsString& aResult) const
{
+ // XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
NS_IMETHODIMP
nsHTMLDList::MapAttributesInto(nsIStyleContext* aContext,
- nsIPresContext* aPresContext)
+ nsIPresContext* aPresContext)
{
+ // XXX write me
return NS_OK;
}
diff --git a/layout/html/content/src/nsHTMLDel.cpp b/layout/html/content/src/nsHTMLDel.cpp
index 940537528d8a..719b6c598c08 100644
--- a/layout/html/content/src/nsHTMLDel.cpp
+++ b/layout/html/content/src/nsHTMLDel.cpp
@@ -124,37 +124,15 @@ nsHTMLDel::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLDel::GetCite(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::cite, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLDel::SetCite(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::cite, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLDel::GetDateTime(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::datetime, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLDel::SetDateTime(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::datetime, aValue, eSetAttrNotify_None);
-}
+NS_IMPL_STRING_ATTR(nsHTMLDel, Cite, cite, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLDel, DateTime, datetime, eSetAttrNotify_None)
NS_IMETHODIMP
nsHTMLDel::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
nsHTMLValue& aResult)
{
+ // XXX write me
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -163,6 +141,7 @@ nsHTMLDel::AttributeToString(nsIAtom* aAttribute,
nsHTMLValue& aValue,
nsString& aResult) const
{
+ // XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
@@ -170,6 +149,7 @@ NS_IMETHODIMP
nsHTMLDel::MapAttributesInto(nsIStyleContext* aContext,
nsIPresContext* aPresContext)
{
+ // XXX write me
return NS_OK;
}
diff --git a/layout/html/content/src/nsHTMLDirectory.cpp b/layout/html/content/src/nsHTMLDirectory.cpp
index 688faa4f57d9..39340b485df3 100644
--- a/layout/html/content/src/nsHTMLDirectory.cpp
+++ b/layout/html/content/src/nsHTMLDirectory.cpp
@@ -122,33 +122,14 @@ nsHTMLDirectory::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLDirectory::GetCompact(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::compact, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLDirectory::SetCompact(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::compact, empty, eSetAttrNotify_Reflow);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::compact);
- return NS_OK;
- }
-}
+NS_IMPL_BOOL_ATTR(nsHTMLDirectory, Compact, compact, eSetAttrNotify_Reflow)
NS_IMETHODIMP
nsHTMLDirectory::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
nsHTMLValue& aResult)
{
+ // XXX write me
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -157,6 +138,7 @@ nsHTMLDirectory::AttributeToString(nsIAtom* aAttribute,
nsHTMLValue& aValue,
nsString& aResult) const
{
+ // XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
@@ -164,6 +146,7 @@ NS_IMETHODIMP
nsHTMLDirectory::MapAttributesInto(nsIStyleContext* aContext,
nsIPresContext* aPresContext)
{
+ // XXX write me
return NS_OK;
}
diff --git a/layout/html/content/src/nsHTMLDiv.cpp b/layout/html/content/src/nsHTMLDiv.cpp
index eee52e4eda74..a61b4d198544 100644
--- a/layout/html/content/src/nsHTMLDiv.cpp
+++ b/layout/html/content/src/nsHTMLDiv.cpp
@@ -124,18 +124,7 @@ nsHTMLDiv::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLDiv::GetAlign(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::align, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLDiv::SetAlign(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::align, aValue, eSetAttrNotify_Reflow);
-}
+NS_IMPL_STRING_ATTR(nsHTMLDiv, Align, align, eSetAttrNotify_Reflow)
NS_IMETHODIMP
nsHTMLDiv::StringToAttribute(nsIAtom* aAttribute,
@@ -168,6 +157,7 @@ NS_IMETHODIMP
nsHTMLDiv::MapAttributesInto(nsIStyleContext* aContext,
nsIPresContext* aPresContext)
{
+ // XXX write me
return NS_OK;
}
diff --git a/layout/html/content/src/nsHTMLGenericContent.h b/layout/html/content/src/nsHTMLGenericContent.h
index 931c875a5365..cc65be72ebb4 100644
--- a/layout/html/content/src/nsHTMLGenericContent.h
+++ b/layout/html/content/src/nsHTMLGenericContent.h
@@ -740,4 +740,75 @@ struct nsHTMLGenericContainerContent : public nsHTMLGenericContent {
return NS_OK; \
}
+/**
+ * A macro to implement the getter and setter for a given string
+ * valued content property. The method uses the generic SetAttr and
+ * GetAttribute methods.
+ */
+#define NS_IMPL_STRING_ATTR(_class, _method, _atom, _notify) \
+ NS_IMETHODIMP \
+ _class::Get##_method(nsString& aValue) \
+ { \
+ mInner.GetAttribute(nsHTMLAtoms::_atom, aValue); \
+ return NS_OK; \
+ } \
+ NS_IMETHODIMP \
+ _class::Set##_method(const nsString& aValue) \
+ { \
+ return mInner.SetAttr(nsHTMLAtoms::_atom, aValue, _notify); \
+ }
+
+/**
+ * A macro to implement the getter and setter for a given boolean
+ * valued content property. The method uses the generic SetAttr and
+ * GetAttribute methods.
+ */
+#define NS_IMPL_BOOL_ATTR(_class, _method, _atom, _notify) \
+ NS_IMETHODIMP \
+ _class::Get##_method(PRBool* aValue) \
+ { \
+ nsHTMLValue val; \
+ nsresult rv = mInner.GetAttribute(nsHTMLAtoms::_atom, val); \
+ *aValue = NS_CONTENT_ATTR_NOT_THERE != rv; \
+ return NS_OK; \
+ } \
+ NS_IMETHODIMP \
+ _class::Set##_method(PRBool aValue) \
+ { \
+ nsAutoString empty; \
+ if (aValue) { \
+ return mInner.SetAttr(nsHTMLAtoms::_atom, empty, _notify); \
+ } \
+ else { \
+ mInner.UnsetAttribute(nsHTMLAtoms::_atom); \
+ return NS_OK; \
+ } \
+ }
+
+/**
+ * A macro to implement the getter and setter for a given integer
+ * valued content property. The method uses the generic SetAttr and
+ * GetAttribute methods.
+ */
+#define NS_IMPL_INT_ATTR(_class, _method, _atom, _notify) \
+ NS_IMETHODIMP \
+ _class::Get##_method(PRInt32* aValue) \
+ { \
+ nsHTMLValue value; \
+ *aValue = -1; \
+ if (NS_CONTENT_ATTR_HAS_VALUE == \
+ mInner.GetAttribute(nsHTMLAtoms::_atom, value)) { \
+ if (value.GetUnit() == eHTMLUnit_Integer) { \
+ *aValue = value.GetIntValue(); \
+ } \
+ } \
+ return NS_OK; \
+ } \
+ NS_IMETHODIMP \
+ _class::Set##_method(PRInt32 aValue) \
+ { \
+ nsHTMLValue value(aValue, eHTMLUnit_Integer); \
+ return mInner.SetAttr(nsHTMLAtoms::_atom, value, _notify); \
+ }
+
#endif /* nsHTMLLeafContent_h___ */
diff --git a/layout/html/content/src/nsHTMLHR.cpp b/layout/html/content/src/nsHTMLHR.cpp
index 6537e1732022..e1facf2f0246 100644
--- a/layout/html/content/src/nsHTMLHR.cpp
+++ b/layout/html/content/src/nsHTMLHR.cpp
@@ -128,66 +128,10 @@ nsHTMLHR::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLHR::GetAlign(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::align, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLHR::SetAlign(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::align, aValue, eSetAttrNotify_Reflow);
-}
-
-NS_IMETHODIMP
-nsHTMLHR::GetNoShade(PRBool* aValue)
-{
- nsHTMLValue val;
- nsresult rv = mInner.GetAttribute(nsHTMLAtoms::noshade, val);
- *aValue = NS_CONTENT_ATTR_NOT_THERE != rv;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLHR::SetNoShade(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::noshade, empty, eSetAttrNotify_Render);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::noshade);
- return NS_OK;
- }
-}
-
-NS_IMETHODIMP
-nsHTMLHR::GetSize(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::size, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLHR::SetSize(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::size, aValue, eSetAttrNotify_Reflow);
-}
-
-NS_IMETHODIMP
-nsHTMLHR::GetWidth(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::width, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLHR::SetWidth(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::width, aValue, eSetAttrNotify_Reflow);
-}
+NS_IMPL_STRING_ATTR(nsHTMLHR, Align, align, eSetAttrNotify_Reflow)
+NS_IMPL_BOOL_ATTR(nsHTMLHR, NoShade, noshade, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLHR, Size, size, eSetAttrNotify_Reflow)
+NS_IMPL_STRING_ATTR(nsHTMLHR, Width, width, eSetAttrNotify_Reflow)
static nsHTMLGenericContent::EnumTable kAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
diff --git a/layout/html/content/src/nsHTMLInput.cpp b/layout/html/content/src/nsHTMLInput.cpp
index 8ae49b75dfa5..4c5fc79bf949 100644
--- a/layout/html/content/src/nsHTMLInput.cpp
+++ b/layout/html/content/src/nsHTMLInput.cpp
@@ -160,43 +160,6 @@ nsHTMLInput::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLInput::GetDefaultValue(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::defaultvalue, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetDefaultValue(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::defaultvalue, aValue,
- eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetDefaultChecked(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::defaultchecked, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetDefaultChecked(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::defaultchecked, empty,
- eSetAttrNotify_Render);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::defaultchecked);
- return NS_OK;
- }
-}
-
NS_IMETHODIMP
nsHTMLInput::GetForm(nsIDOMHTMLFormElement** aForm)
{
@@ -204,203 +167,22 @@ nsHTMLInput::GetForm(nsIDOMHTMLFormElement** aForm)
return NS_OK;
}
-NS_IMETHODIMP
-nsHTMLInput::GetAccept(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::accept, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetAccept(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::accept, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetAccessKey(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::accesskey, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetAccessKey(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::accesskey, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetAlign(nsString& aValue)
-{
- return NS_OK;/* XXX */
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetAlign(const nsString& aValue)
-{
- return NS_OK;/* XXX */
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetAlt(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::alt, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetAlt(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::alt, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetChecked(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::checked, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetChecked(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::checked, empty, eSetAttrNotify_Render);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::checked);
- return NS_OK;
- }
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetDisabled(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::disabled, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetDisabled(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::disabled, empty, eSetAttrNotify_Render);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::disabled);
- return NS_OK;
- }
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetMaxLength(PRInt32* aValue)
-{
- nsHTMLValue value;
- *aValue = -1;
- if (NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::maxlength, value)) {
- if (value.GetUnit() == eHTMLUnit_Integer) {
- *aValue = value.GetIntValue();
- }
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetMaxLength(PRInt32 aValue)
-{
- nsHTMLValue value(aValue, eHTMLUnit_Integer);
- return mInner.SetAttr(nsHTMLAtoms::maxlength, value, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetName(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::name, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetName(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::name, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetReadOnly(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::readonly, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetReadOnly(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::readonly, empty, eSetAttrNotify_Render);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::readonly);
- return NS_OK;
- }
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetSize(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::size, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetSize(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::size, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetSrc(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::src, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetSrc(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::src, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetTabIndex(PRInt32* aValue)
-{
- nsHTMLValue value;
- *aValue = -1;
- if (NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::tabindex, value)) {
- if (value.GetUnit() == eHTMLUnit_Integer) {
- *aValue = value.GetIntValue();
- }
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetTabIndex(PRInt32 aValue)
-{
- nsHTMLValue value(aValue, eHTMLUnit_Integer);
- return mInner.SetAttr(nsHTMLAtoms::tabindex, value, eSetAttrNotify_None);
-}
+NS_IMPL_STRING_ATTR(nsHTMLInput, DefaultValue, defaultvalue, eSetAttrNotify_None)
+NS_IMPL_BOOL_ATTR(nsHTMLInput, DefaultChecked, defaultchecked, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLInput, Accept, accept, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLInput, AccessKey, accesskey, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLInput, Align, align, eSetAttrNotify_Reflow)
+NS_IMPL_STRING_ATTR(nsHTMLInput, Alt, alt, eSetAttrNotify_None)
+NS_IMPL_BOOL_ATTR(nsHTMLInput, Checked, checked, eSetAttrNotify_Render)
+NS_IMPL_BOOL_ATTR(nsHTMLInput, Disabled, disabled, eSetAttrNotify_Render)
+NS_IMPL_INT_ATTR(nsHTMLInput, MaxLength, maxlength, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLInput, Name, name, eSetAttrNotify_Restart)
+NS_IMPL_BOOL_ATTR(nsHTMLInput, ReadOnly, readonly, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLInput, Size, size, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLInput, Src, src, eSetAttrNotify_Render)
+NS_IMPL_INT_ATTR(nsHTMLInput, TabIndex, tabindex, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLInput, UseMap, usemap, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLInput, Value, value, eSetAttrNotify_Render)
NS_IMETHODIMP
nsHTMLInput::GetType(nsString& aValue)
@@ -409,32 +191,6 @@ nsHTMLInput::GetType(nsString& aValue)
return NS_OK;
}
-NS_IMETHODIMP
-nsHTMLInput::GetUseMap(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::usemap, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetUseMap(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::usemap, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLInput::GetValue(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::value, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLInput::SetValue(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::value, aValue, eSetAttrNotify_Render);
-}
-
NS_IMETHODIMP
nsHTMLInput::Blur()
{
@@ -485,6 +241,7 @@ NS_IMETHODIMP
nsHTMLInput::MapAttributesInto(nsIStyleContext* aContext,
nsIPresContext* aPresContext)
{
+ // XXX align
return NS_OK;
}
diff --git a/layout/html/content/src/nsHTMLLink.cpp b/layout/html/content/src/nsHTMLLink.cpp
index 041cec12e690..49f57d8b9950 100644
--- a/layout/html/content/src/nsHTMLLink.cpp
+++ b/layout/html/content/src/nsHTMLLink.cpp
@@ -138,131 +138,15 @@ nsHTMLLink::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLLink::GetCharset(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::charset, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLLink::SetCharset(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::charset, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLLink::GetDisabled(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::disabled, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLLink::SetDisabled(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::disabled, empty, eSetAttrNotify_Render);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::disabled);
- return NS_OK;
- }
-}
-
-NS_IMETHODIMP
-nsHTMLLink::GetHref(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::href, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLLink::SetHref(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::href, aValue, eSetAttrNotify_Render);
-}
-
-NS_IMETHODIMP
-nsHTMLLink::GetHreflang(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::hreflang, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLLink::SetHreflang(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::hreflang, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLLink::GetMedia(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::media, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLLink::SetMedia(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::media, aValue, eSetAttrNotify_Restart);
-}
-
-NS_IMETHODIMP
-nsHTMLLink::GetRel(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::rel, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLLink::SetRel(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::rel, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLLink::GetRev(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::rev, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLLink::SetRev(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::rev, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLLink::GetTarget(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::target, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLLink::SetTarget(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::target, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLLink::GetType(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::type, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLLink::SetType(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::type, aValue, eSetAttrNotify_None);
-}
+NS_IMPL_BOOL_ATTR(nsHTMLLink, Disabled, disabled, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLLink, Charset, charset, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLLink, Href, href, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLLink, Hreflang, hreflang, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLLink, Media, media, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLLink, Rel, rel, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLLink, Rev, rev, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLLink, Target, target, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLLink, Type, type, eSetAttrNotify_Restart)
NS_IMETHODIMP
nsHTMLLink::StringToAttribute(nsIAtom* aAttribute,
diff --git a/layout/html/content/src/nsHTMLParam.cpp b/layout/html/content/src/nsHTMLParam.cpp
index a1081cafd8cc..131215382ba9 100644
--- a/layout/html/content/src/nsHTMLParam.cpp
+++ b/layout/html/content/src/nsHTMLParam.cpp
@@ -128,63 +128,17 @@ nsHTMLParam::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLParam::GetName(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::name, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLParam::SetName(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::name, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLParam::GetType(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::type, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLParam::SetType(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::type, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLParam::GetValue(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::value, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLParam::SetValue(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::value, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLParam::GetValueType(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::valuetype, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLParam::SetValueType(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::valuetype, aValue, eSetAttrNotify_None);
-}
+NS_IMPL_STRING_ATTR(nsHTMLParam, Name, name, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLParam, Type, type, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLParam, Value, value, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLParam, ValueType, valuetype, eSetAttrNotify_Restart)
NS_IMETHODIMP
nsHTMLParam::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
nsHTMLValue& aResult)
{
+ // XXX write me
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -193,6 +147,7 @@ nsHTMLParam::AttributeToString(nsIAtom* aAttribute,
nsHTMLValue& aValue,
nsString& aResult) const
{
+ // XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
@@ -200,6 +155,7 @@ NS_IMETHODIMP
nsHTMLParam::MapAttributesInto(nsIStyleContext* aContext,
nsIPresContext* aPresContext)
{
+ // XXX write me
return NS_OK;
}
diff --git a/layout/html/content/src/nsHTMLScript.cpp b/layout/html/content/src/nsHTMLScript.cpp
index 6ca7ff15e83f..b1dfcd83969e 100644
--- a/layout/html/content/src/nsHTMLScript.cpp
+++ b/layout/html/content/src/nsHTMLScript.cpp
@@ -183,66 +183,10 @@ nsHTMLScript::SetEvent(const nsString& aValue)
return NS_OK;
}
-NS_IMETHODIMP
-nsHTMLScript::GetCharset(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::charset, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLScript::SetCharset(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::charset, aValue, eSetAttrNotify_None);
-}
-
-NS_IMETHODIMP
-nsHTMLScript::GetDefer(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::defer, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLScript::SetDefer(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::defer, empty, eSetAttrNotify_None);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::defer);
- return NS_OK;
- }
-}
-
-NS_IMETHODIMP
-nsHTMLScript::GetSrc(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::src, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLScript::SetSrc(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::src, aValue, eSetAttrNotify_Restart);
-}
-
-NS_IMETHODIMP
-nsHTMLScript::GetType(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::type, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLScript::SetType(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::type, aValue, eSetAttrNotify_None);
-}
+NS_IMPL_STRING_ATTR(nsHTMLScript, Charset, charset, eSetAttrNotify_None)
+NS_IMPL_BOOL_ATTR(nsHTMLScript, Defer, defer, eSetAttrNotify_None)
+NS_IMPL_STRING_ATTR(nsHTMLScript, Src, src, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLScript, Type, type, eSetAttrNotify_Restart)
NS_IMETHODIMP
nsHTMLScript::StringToAttribute(nsIAtom* aAttribute,
diff --git a/layout/html/content/src/nsHTMLStyle.cpp b/layout/html/content/src/nsHTMLStyle.cpp
index 3dae98a78fe6..ad5989616306 100644
--- a/layout/html/content/src/nsHTMLStyle.cpp
+++ b/layout/html/content/src/nsHTMLStyle.cpp
@@ -128,53 +128,9 @@ nsHTMLStyle::CloneNode(nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
-NS_IMETHODIMP
-nsHTMLStyle::GetDisabled(PRBool* aValue)
-{
- nsHTMLValue val;
- *aValue = NS_CONTENT_ATTR_HAS_VALUE ==
- mInner.GetAttribute(nsHTMLAtoms::disabled, val);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLStyle::SetDisabled(PRBool aValue)
-{
- nsAutoString empty;
- if (aValue) {
- return mInner.SetAttr(nsHTMLAtoms::disabled, empty, eSetAttrNotify_Render);
- }
- else {
- mInner.UnsetAttribute(nsHTMLAtoms::disabled);
- return NS_OK;
- }
-}
-
-NS_IMETHODIMP
-nsHTMLStyle::GetMedia(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::media, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLStyle::SetMedia(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::media, aValue, eSetAttrNotify_Restart);
-}
-
-NS_IMETHODIMP
-nsHTMLStyle::GetType(nsString& aValue)
-{
- mInner.GetAttribute(nsHTMLAtoms::type, aValue);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLStyle::SetType(const nsString& aValue)
-{
- return mInner.SetAttr(nsHTMLAtoms::type, aValue, eSetAttrNotify_Restart);
-}
+NS_IMPL_BOOL_ATTR(nsHTMLStyle, Disabled, disabled, eSetAttrNotify_Render)
+NS_IMPL_STRING_ATTR(nsHTMLStyle, Media, media, eSetAttrNotify_Restart)
+NS_IMPL_STRING_ATTR(nsHTMLStyle, Type, type, eSetAttrNotify_Restart)
NS_IMETHODIMP
nsHTMLStyle::StringToAttribute(nsIAtom* aAttribute,