diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
index 7866de06fd8..e1cedf4485a 100644
--- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
@@ -591,6 +591,12 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID,
return result;
}
else {
+ if (0 == aValue.Length()) { // ifempty string
+ val.Reset(); // set empty value
+ result = SetHTMLAttribute(aAttribute, val, aNotify);
+ NS_RELEASE(htmlContent);
+ return result;
+ }
// set as string value to avoid another string copy
PRBool impact = NS_STYLE_HINT_NONE;
htmlContent->GetMappedAttributeImpact(aAttribute, impact);
@@ -1265,8 +1271,6 @@ nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString,
return PR_TRUE;
}
- // Illegal values are mapped to empty
- aResult.SetEmptyValue();
return PR_FALSE;
}
@@ -1275,7 +1279,7 @@ nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString,
* percent (n%),
* or proportional (n*)
*/
-void
+PRBool
nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit)
@@ -1298,7 +1302,9 @@ nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString,
aResult.SetIntValue(val, aValueUnit);
}
}
+ return PR_TRUE;
}
+ return PR_FALSE;
}
PRBool
@@ -1365,8 +1371,6 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin,
return PR_TRUE;
}
- // Illegal values are mapped to empty
- aResult.SetEmptyValue();
return PR_FALSE;
}
@@ -1388,8 +1392,6 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin,
return PR_TRUE;
}
- // Illegal values are mapped to empty
- aResult.SetEmptyValue();
return PR_FALSE;
}
@@ -1435,8 +1437,6 @@ nsGenericHTMLElement::ParseColor(const nsString& aString,
}
}
- // Illegal values are mapped to empty
- aResult.SetEmptyValue();
return PR_FALSE;
}
@@ -1458,10 +1458,6 @@ nsGenericHTMLElement::ColorToString(const nsHTMLValue& aValue,
aValue.GetStringValue(aResult);
return PR_TRUE;
}
- if (aValue.GetUnit() == eHTMLUnit_Empty) { // was illegal
- aResult.Truncate();
- return PR_TRUE;
- }
return PR_FALSE;
}
@@ -1652,14 +1648,12 @@ nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute,
{
if ((aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height)) {
- ParseValueOrPercent(aString, aResult, eHTMLUnit_Pixel);
- return PR_TRUE;
+ return ParseValueOrPercent(aString, aResult, eHTMLUnit_Pixel);
}
else if ((aAttribute == nsHTMLAtoms::hspace) ||
(aAttribute == nsHTMLAtoms::vspace) ||
(aAttribute == nsHTMLAtoms::border)) {
- ParseValue(aString, 0, aResult, eHTMLUnit_Pixel);
- return PR_TRUE;
+ return ParseValue(aString, 0, aResult, eHTMLUnit_Pixel);
}
return PR_FALSE;
}
@@ -1894,7 +1888,7 @@ nsGenericHTMLElement::MapImageBorderAttributeInto(const nsIHTMLMappedAttributes*
// border: pixels
aAttributes->GetAttribute(nsHTMLAtoms::border, value);
- if (value.GetUnit() != eHTMLUnit_Pixel) {
+ if (value.GetUnit() == eHTMLUnit_Null) {
if (nsnull == aBorderColors) {
return;
}
@@ -1902,6 +1896,9 @@ nsGenericHTMLElement::MapImageBorderAttributeInto(const nsIHTMLMappedAttributes*
// the size to 2 pixels.
value.SetPixelValue(2);
}
+ else if (value.GetUnit() != eHTMLUnit_Pixel) { // something other than pixels
+ value.SetPixelValue(0);
+ }
float p2t;
aPresContext->GetScaledPixelsToTwips(&p2t);
@@ -2026,38 +2023,6 @@ nsGenericHTMLElement::GetBackgroundAttributesImpact(const nsIAtom* aAttribute,
}
-static PRBool AttributeChangeRequiresRepaint(const nsIAtom* aAttribute)
-{
- // these are attributes that always require a restyle and a repaint, but not a reflow
- // regardless of the tag they are associated with
- return (PRBool)
- (aAttribute==nsHTMLAtoms::bgcolor ||
- aAttribute==nsHTMLAtoms::color);
-}
-
-static PRBool AttributeChangeRequiresReflow(const nsIAtom* aAttribute)
-{
- // these are attributes that always require a restyle and reflow
- // regardless of the tag they are associated with
- return (PRBool)
- (aAttribute==nsHTMLAtoms::align ||
- aAttribute==nsHTMLAtoms::border ||
- aAttribute==nsHTMLAtoms::cellpadding ||
- aAttribute==nsHTMLAtoms::cellspacing ||
- aAttribute==nsHTMLAtoms::ch ||
- aAttribute==nsHTMLAtoms::choff ||
- aAttribute==nsHTMLAtoms::colspan ||
- aAttribute==nsHTMLAtoms::face ||
- aAttribute==nsHTMLAtoms::frame ||
- aAttribute==nsHTMLAtoms::height ||
- aAttribute==nsHTMLAtoms::nowrap ||
- aAttribute==nsHTMLAtoms::rowspan ||
- aAttribute==nsHTMLAtoms::rules ||
- aAttribute==nsHTMLAtoms::span ||
- aAttribute==nsHTMLAtoms::valign ||
- aAttribute==nsHTMLAtoms::width);
-}
-
//----------------------------------------------------------------------
nsGenericHTMLLeafElement::nsGenericHTMLLeafElement()
diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h
index cfa642cabbc..bc4cbc621cb 100644
--- a/mozilla/content/html/content/src/nsGenericHTMLElement.h
+++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h
@@ -151,9 +151,9 @@ public:
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit);
- static void ParseValueOrPercentOrProportional(const nsString& aString,
- nsHTMLValue& aResult,
- nsHTMLUnit aValueUnit);
+ static PRBool ParseValueOrPercentOrProportional(const nsString& aString,
+ nsHTMLValue& aResult,
+ nsHTMLUnit aValueUnit);
static PRBool ValueOrPercentToString(const nsHTMLValue& aValue,
nsString& aResult);
diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp
index 62ac54e8614..6b824d06946 100644
--- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp
@@ -221,17 +221,14 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
- eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
+ eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::href) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- if (aAttribute == nsHTMLAtoms::suppress) {
+ else if (aAttribute == nsHTMLAtoms::suppress) {
if (aValue.EqualsIgnoreCase("true")) {
- aResult.SetEmptyValue();
+ aResult.SetEmptyValue(); // XXX? shouldn't just leave "true"
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
diff --git a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp
index 01f1374c18d..56878f8f118 100644
--- a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp
@@ -408,7 +408,7 @@ nsresult BodyFixupRule::QueryInterface(const nsIID& aIID,
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
- static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
+// static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIStyleRuleIID)) {
*aInstancePtrResult = (void*) ((nsIStyleRule*)this);
NS_ADDREF_THIS();
@@ -591,22 +591,20 @@ nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
nsHTMLValue& aResult)
{
- if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
if ((aAttribute == nsHTMLAtoms::bgcolor) ||
(aAttribute == nsHTMLAtoms::text) ||
(aAttribute == nsHTMLAtoms::link) ||
(aAttribute == nsHTMLAtoms::alink) ||
(aAttribute == nsHTMLAtoms::vlink)) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if ((aAttribute == nsHTMLAtoms::marginwidth) ||
- (aAttribute == nsHTMLAtoms::marginheight)) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if ((aAttribute == nsHTMLAtoms::marginwidth) ||
+ (aAttribute == nsHTMLAtoms::marginheight)) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp
index f73dde3155f..09278f2d63e 100644
--- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp
@@ -308,11 +308,12 @@ nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
- eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
+ eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::type) {
+ else if (aAttribute == nsHTMLAtoms::type) {
nsGenericHTMLElement::EnumTable *table = kButtonTypeTable;
while (nsnull != table->tag) {
if (aValue.EqualsIgnoreCase(table->tag)) {
diff --git a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp b/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp
index 63f42cad4e3..f9781706233 100644
--- a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp
@@ -135,17 +135,17 @@ nsHTMLDirectoryElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
- if (!nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
- aResult)) {
- aResult.SetIntValue(NS_STYLE_LIST_STYLE_BASIC, eHTMLUnit_Enumerated);
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
+ aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- return NS_CONTENT_ATTR_HAS_VALUE;
}
- if (aAttribute == nsHTMLAtoms::start) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::start) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::compact) {
+ else if (aAttribute == nsHTMLAtoms::compact) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_NO_VALUE;
}
@@ -179,6 +179,9 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Enumerated) {
list->mListStyleType = value.GetIntValue();
}
+ else if (value.GetUnit() != eHTMLUnit_Null) {
+ list->mListStyleType = NS_STYLE_LIST_STYLE_BASIC;
+ }
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
diff --git a/mozilla/content/html/content/src/nsHTMLDivElement.cpp b/mozilla/content/html/content/src/nsHTMLDivElement.cpp
index 370cda5b8d7..addd2481dbf 100644
--- a/mozilla/content/html/content/src/nsHTMLDivElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLDivElement.cpp
@@ -137,18 +137,21 @@ nsHTMLDivElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- if (aAttribute == nsHTMLAtoms::cols) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::cols) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::gutter) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::gutter) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::width) {
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLFontElement.cpp b/mozilla/content/html/content/src/nsHTMLFontElement.cpp
index ee8f95bf9f3..5896073dced 100644
--- a/mozilla/content/html/content/src/nsHTMLFontElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLFontElement.cpp
@@ -154,9 +154,10 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- if (aAttribute == nsHTMLAtoms::color) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::color) {
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLFormElement.cpp b/mozilla/content/html/content/src/nsHTMLFormElement.cpp
index f1912b12693..de8a822ab48 100644
--- a/mozilla/content/html/content/src/nsHTMLFormElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLFormElement.cpp
@@ -363,12 +363,14 @@ nsHTMLFormElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::method) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kFormMethodTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kFormMethodTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::enctype) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kFormEnctypeTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kFormEnctypeTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp
index 1ee216893d2..f72b991612e 100644
--- a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp
@@ -151,31 +151,36 @@ nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::bordercolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::frameborder) {
// XXX need to check for correct mode
- nsGenericHTMLElement::ParseFrameborderValue(PR_FALSE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseFrameborderValue(PR_FALSE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::marginwidth) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::marginheight) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::noresize) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::scrolling) {
- nsGenericHTMLElement::ParseScrollingValue(PR_FALSE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseScrollingValue(PR_FALSE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp
index 09a8e5bd207..13e54b90510 100644
--- a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp
@@ -133,17 +133,20 @@ nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::bordercolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::frameborder) {
// XXX need to check for correct mode
- nsGenericHTMLElement::ParseFrameborderValue(PR_FALSE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseFrameborderValue(PR_FALSE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::border) {
- nsGenericHTMLElement::ParseValue(aValue, 0, 100, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, 100, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLHRElement.cpp b/mozilla/content/html/content/src/nsHTMLHRElement.cpp
index c3e8d6d5283..95b1828219a 100644
--- a/mozilla/content/html/content/src/nsHTMLHRElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLHRElement.cpp
@@ -172,13 +172,15 @@ nsHTMLHRElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::size) {
- nsGenericHTMLElement::ParseValue(aValue, 1, 100, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, 100, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::noshade) {
aResult.SetEmptyValue();
diff --git a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp
index a4b1cce3382..646aaa76c48 100644
--- a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp
@@ -165,32 +165,38 @@ nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::marginwidth) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::marginheight) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::frameborder) {
- nsGenericHTMLElement::ParseFrameborderValue(PR_TRUE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseFrameborderValue(PR_TRUE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::scrolling) {
- nsGenericHTMLElement::ParseScrollingValue(PR_TRUE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseScrollingValue(PR_TRUE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseEnumValue(aValue, kAlignTable, aResult)) {
diff --git a/mozilla/content/html/content/src/nsHTMLImageElement.cpp b/mozilla/content/html/content/src/nsHTMLImageElement.cpp
index c97bcbf3f47..d91affa5b96 100644
--- a/mozilla/content/html/content/src/nsHTMLImageElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLImageElement.cpp
@@ -229,12 +229,6 @@ nsHTMLImageElement::StringToAttribute(nsIAtom* aAttribute,
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_HAS_VALUE;
}
- if ((aAttribute == nsHTMLAtoms::usemap) ||
- (aAttribute == nsHTMLAtoms::src) ||
- (aAttribute == nsHTMLAtoms::lowsrc)) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (nsGenericHTMLElement::ParseImageAttribute(aAttribute,
aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp
index 8ae10b7af5b..e10aa4aed08 100644
--- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp
@@ -510,26 +510,31 @@ nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::maxlength) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::size) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (IsImage()) {
if (nsGenericHTMLElement::ParseImageAttribute(aAttribute,
@@ -538,8 +543,9 @@ nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute,
}
}
else if (aAttribute == nsHTMLAtoms::border) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLLIElement.cpp b/mozilla/content/html/content/src/nsHTMLLIElement.cpp
index 513de1cfea5..b6257eeb7b8 100644
--- a/mozilla/content/html/content/src/nsHTMLLIElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLLIElement.cpp
@@ -154,8 +154,9 @@ nsHTMLLIElement::StringToAttribute(nsIAtom* aAttribute,
}
}
else if (aAttribute == nsHTMLAtoms::value) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLLegendElement.cpp b/mozilla/content/html/content/src/nsHTMLLegendElement.cpp
index 01ec5db9ccb..e80d28a4b37 100644
--- a/mozilla/content/html/content/src/nsHTMLLegendElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLLegendElement.cpp
@@ -168,8 +168,9 @@ nsHTMLLegendElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kAlignTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kAlignTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp b/mozilla/content/html/content/src/nsHTMLMenuElement.cpp
index 08c6ddcc511..fd08afd9530 100644
--- a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLMenuElement.cpp
@@ -135,19 +135,15 @@ nsHTMLMenuElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
- if (!nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
- aResult)) {
- aResult.SetIntValue(NS_STYLE_LIST_STYLE_BASIC, eHTMLUnit_Enumerated);
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
+ aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- return NS_CONTENT_ATTR_HAS_VALUE;
}
- if (aAttribute == nsHTMLAtoms::start) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- if (aAttribute == nsHTMLAtoms::compact) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_NO_VALUE;
+ else if (aAttribute == nsHTMLAtoms::start) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -179,10 +175,13 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Enumerated) {
list->mListStyleType = value.GetIntValue();
}
+ else if (value.GetUnit() != eHTMLUnit_Null) {
+ list->mListStyleType = NS_STYLE_LIST_STYLE_BASIC;
+ }
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
- if (value.GetUnit() == eHTMLUnit_Empty) {
+ if (value.GetUnit() != eHTMLUnit_Null) {
// XXX set
}
}
diff --git a/mozilla/content/html/content/src/nsHTMLOListElement.cpp b/mozilla/content/html/content/src/nsHTMLOListElement.cpp
index fa28b3c95ff..6312947eafd 100644
--- a/mozilla/content/html/content/src/nsHTMLOListElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLOListElement.cpp
@@ -159,22 +159,19 @@ nsHTMLOListElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
- if (!nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
- aResult)) {
- if (!nsGenericHTMLElement::ParseCaseSensitiveEnumValue(aValue,
- kOldListTypeTable, aResult)) {
- aResult.SetIntValue(NS_STYLE_LIST_STYLE_DECIMAL, eHTMLUnit_Enumerated);
- }
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
+ aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
+ if (nsGenericHTMLElement::ParseCaseSensitiveEnumValue(aValue,
+ kOldListTypeTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- return NS_CONTENT_ATTR_HAS_VALUE;
}
- if (aAttribute == nsHTMLAtoms::start) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- if (aAttribute == nsHTMLAtoms::compact) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_NO_VALUE;
+ else if (aAttribute == nsHTMLAtoms::start) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -219,10 +216,13 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Enumerated) {
list->mListStyleType = value.GetIntValue();
}
+ else if (value.GetUnit() != eHTMLUnit_Null) {
+ list->mListStyleType = NS_STYLE_LIST_STYLE_DECIMAL;
+ }
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
- if (value.GetUnit() == eHTMLUnit_Empty) {
+ if (value.GetUnit() != eHTMLUnit_Null) {
// XXX set
}
}
diff --git a/mozilla/content/html/content/src/nsHTMLPreElement.cpp b/mozilla/content/html/content/src/nsHTMLPreElement.cpp
index 1ccbcaa8d71..8ace87c074e 100644
--- a/mozilla/content/html/content/src/nsHTMLPreElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLPreElement.cpp
@@ -132,24 +132,19 @@ nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
nsHTMLValue& aResult)
{
- if ((aAttribute == nsHTMLAtoms::wrap) ||
- (aAttribute == nsHTMLAtoms::variable)) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
if (aAttribute == nsHTMLAtoms::cols) {
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult,
eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- if (aAttribute == nsHTMLAtoms::width) {
+ else if (aAttribute == nsHTMLAtoms::width) {
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult,
eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- if (aAttribute == nsHTMLAtoms::tabstop) {
+ else if (aAttribute == nsHTMLAtoms::tabstop) {
PRInt32 ec, tabstop = aValue.ToInteger(&ec);
if (tabstop <= 0) {
tabstop = 8;
@@ -196,7 +191,7 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
// wrap: empty
aAttributes->GetAttribute(nsHTMLAtoms::wrap, value);
- if (value.GetUnit() == eHTMLUnit_Empty) {
+ if (value.GetUnit() != eHTMLUnit_Null) {
nsStyleText* text = (nsStyleText*)
aContext->GetMutableStyleData(eStyleStruct_Text);
text->mWhiteSpace = NS_STYLE_WHITESPACE_MOZ_PRE_WRAP;
diff --git a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp
index 727f9ad2a9b..980473233e6 100644
--- a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp
@@ -672,12 +672,14 @@ nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::size) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp
index c9364b9a155..83a3ade8301 100644
--- a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp
@@ -129,18 +129,21 @@ nsHTMLSpacerElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::size) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::align) {
- nsGenericHTMLElement::ParseAlignValue(aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseAlignValue(aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if ((aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height)) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp b/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp
index 1f675e01dff..62a6d7256e7 100644
--- a/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp
@@ -337,27 +337,31 @@ nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers with a min of 0 */
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers with a min of 1 */
- if ((aAttribute == nsHTMLAtoms::colspan) ||
+ else if ((aAttribute == nsHTMLAtoms::colspan) ||
(aAttribute == nsHTMLAtoms::rowspan)) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents */
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
@@ -366,17 +370,10 @@ nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- else if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (aAttribute == nsHTMLAtoms::bgcolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- else if (aAttribute == nsHTMLAtoms::nowrap) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::scope) {
if (nsGenericHTMLElement::ParseEnumValue(aValue, kCellScopeTable, aResult)) {
@@ -478,7 +475,7 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
// nowrap
// nowrap depends on the width attribute, so be sure to handle it after width is mapped!
aAttributes->GetAttribute(nsHTMLAtoms::nowrap, value);
- if (value.GetUnit() == eHTMLUnit_Empty)
+ if (value.GetUnit() != eHTMLUnit_Null)
{
if (widthValue.GetUnit() != eHTMLUnit_Pixel)
{
diff --git a/mozilla/content/html/content/src/nsHTMLTableColElement.cpp b/mozilla/content/html/content/src/nsHTMLTableColElement.cpp
index d0d1af3c3f5..0ad4d456075 100644
--- a/mozilla/content/html/content/src/nsHTMLTableColElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLTableColElement.cpp
@@ -162,18 +162,21 @@ nsHTMLTableColElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers */
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- else if (aAttribute == nsHTMLAtoms::span) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::span) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
diff --git a/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp b/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp
index 4e419c568dd..b91aa125b20 100644
--- a/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp
@@ -151,18 +151,21 @@ nsHTMLTableColGroupElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers */
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- else if (aAttribute == nsHTMLAtoms::span) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::span) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
diff --git a/mozilla/content/html/content/src/nsHTMLTableElement.cpp b/mozilla/content/html/content/src/nsHTMLTableElement.cpp
index 0ec9673db02..778ea7f9877 100644
--- a/mozilla/content/html/content/src/nsHTMLTableElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLTableElement.cpp
@@ -841,50 +841,37 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
/* attributes that resolve to pixels, with min=0 */
if ((aAttribute == nsHTMLAtoms::cellspacing) ||
(aAttribute == nsHTMLAtoms::cellpadding)) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that are either empty, or integers, with min=0 */
else if (aAttribute == nsHTMLAtoms::cols) {
- nsAutoString tmp(aValue);
- tmp.StripWhitespace();
- if (0 == tmp.Length()) {
- // Just set COLS, same as COLS=number of columns
- aResult.SetEmptyValue();
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- else
- {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- }
- return NS_CONTENT_ATTR_HAS_VALUE;
}
/* attributes that are either empty, or pixels */
else if (aAttribute == nsHTMLAtoms::border) {
- nsAutoString tmp(aValue);
- tmp.StripWhitespace();
- if (0 == tmp.Length()) {
- // Just enable the border; same as border=1
- aResult.SetEmptyValue();
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- else
- {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- }
- return NS_CONTENT_ATTR_HAS_VALUE;
}
/* attributes that resolve to integers or percents */
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
@@ -893,25 +880,25 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- else if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (aAttribute == nsHTMLAtoms::bgcolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::frame) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kFrameTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kFrameTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::layout) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kLayoutTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kLayoutTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::rules) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kRulesTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kRulesTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
@@ -1033,21 +1020,14 @@ MapTableBorderInto(const nsIHTMLMappedAttributes* aAttributes,
nsHTMLValue borderValue;
aAttributes->GetAttribute(nsHTMLAtoms::border, borderValue);
- if (borderValue.GetUnit() == eHTMLUnit_String)
- {
- nsAutoString borderAsString;
- borderValue.GetStringValue(borderAsString);
- nsGenericHTMLElement::ParseValue(borderAsString, 0, borderValue, eHTMLUnit_Pixel);
- }
- else if (borderValue.GetUnit() == eHTMLUnit_Null)
+ if (borderValue.GetUnit() == eHTMLUnit_Null)
{ // the absence of "border" with the presence of "frame" implies border = 1 pixel
nsHTMLValue frameValue;
aAttributes->GetAttribute(nsHTMLAtoms::frame, frameValue);
if (frameValue.GetUnit() != eHTMLUnit_Null)
borderValue.SetPixelValue(1);
}
- if ((borderValue.GetUnit() == eHTMLUnit_Pixel) ||
- (borderValue.GetUnit() == eHTMLUnit_Empty)) {
+ if (borderValue.GetUnit() != eHTMLUnit_Null) {
nsStyleSpacing* spacing = (nsStyleSpacing*)
aContext->GetMutableStyleData(eStyleStruct_Spacing);
nsStyleTable *tableStyle = (nsStyleTable*)
@@ -1055,7 +1035,7 @@ MapTableBorderInto(const nsIHTMLMappedAttributes* aAttributes,
float p2t;
aPresContext->GetScaledPixelsToTwips(&p2t);
nsStyleCoord twips;
- if (borderValue.GetUnit() == eHTMLUnit_Empty) {
+ if (borderValue.GetUnit() != eHTMLUnit_Pixel) {
tableStyle->mRules=NS_STYLE_TABLE_RULES_ALL; // non-0 values of border imply default rules=all
twips.SetCoordValue(NSIntPixelsToTwips(1, p2t));
}
diff --git a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp
index baca96d727b..194b3de251c 100644
--- a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp
@@ -497,20 +497,23 @@ nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers with default=0*/
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents */
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
@@ -519,13 +522,10 @@ nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- else if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (aAttribute == nsHTMLAtoms::bgcolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::valign) {
if (nsGenericHTMLElement::ParseTableVAlignValue(aValue, aResult)) {
diff --git a/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp b/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp
index 13c619fdfa1..437f65aaec9 100644
--- a/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp
@@ -225,14 +225,16 @@ nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers */
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents */
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
@@ -241,13 +243,10 @@ nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- else if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (aAttribute == nsHTMLAtoms::bgcolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::valign) {
if (nsGenericHTMLElement::ParseTableVAlignValue(aValue, aResult)) {
diff --git a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp
index fbb06b2d1e0..51c068fa5fa 100644
--- a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -344,20 +344,23 @@ nsHTMLTextAreaElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::cols) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::readonly) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::rows) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/content/html/content/src/nsHTMLUListElement.cpp b/mozilla/content/html/content/src/nsHTMLUListElement.cpp
index e9de64b0bf1..b73f7652f2b 100644
--- a/mozilla/content/html/content/src/nsHTMLUListElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLUListElement.cpp
@@ -137,22 +137,19 @@ nsHTMLUListElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
- if (!nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
- aResult)) {
- if (!nsGenericHTMLElement::ParseCaseSensitiveEnumValue(aValue,
- kOldListTypeTable, aResult)) {
- aResult.SetIntValue(NS_STYLE_LIST_STYLE_BASIC, eHTMLUnit_Enumerated);
- }
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
+ aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
+ if (nsGenericHTMLElement::ParseCaseSensitiveEnumValue(aValue,
+ kOldListTypeTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- return NS_CONTENT_ATTR_HAS_VALUE;
}
if (aAttribute == nsHTMLAtoms::start) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- if (aAttribute == nsHTMLAtoms::compact) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_NO_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -197,10 +194,13 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Enumerated) {
list->mListStyleType = value.GetIntValue();
}
+ else if (value.GetUnit() == eHTMLUnit_Null) {
+ list->mListStyleType = NS_STYLE_LIST_STYLE_BASIC;
+ }
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
- if (value.GetUnit() == eHTMLUnit_Empty) {
+ if (value.GetUnit() != eHTMLUnit_Null) {
// XXX set
}
}
diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp
index 7866de06fd8..e1cedf4485a 100644
--- a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp
+++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp
@@ -591,6 +591,12 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID,
return result;
}
else {
+ if (0 == aValue.Length()) { // ifempty string
+ val.Reset(); // set empty value
+ result = SetHTMLAttribute(aAttribute, val, aNotify);
+ NS_RELEASE(htmlContent);
+ return result;
+ }
// set as string value to avoid another string copy
PRBool impact = NS_STYLE_HINT_NONE;
htmlContent->GetMappedAttributeImpact(aAttribute, impact);
@@ -1265,8 +1271,6 @@ nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString,
return PR_TRUE;
}
- // Illegal values are mapped to empty
- aResult.SetEmptyValue();
return PR_FALSE;
}
@@ -1275,7 +1279,7 @@ nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString,
* percent (n%),
* or proportional (n*)
*/
-void
+PRBool
nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit)
@@ -1298,7 +1302,9 @@ nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString,
aResult.SetIntValue(val, aValueUnit);
}
}
+ return PR_TRUE;
}
+ return PR_FALSE;
}
PRBool
@@ -1365,8 +1371,6 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin,
return PR_TRUE;
}
- // Illegal values are mapped to empty
- aResult.SetEmptyValue();
return PR_FALSE;
}
@@ -1388,8 +1392,6 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin,
return PR_TRUE;
}
- // Illegal values are mapped to empty
- aResult.SetEmptyValue();
return PR_FALSE;
}
@@ -1435,8 +1437,6 @@ nsGenericHTMLElement::ParseColor(const nsString& aString,
}
}
- // Illegal values are mapped to empty
- aResult.SetEmptyValue();
return PR_FALSE;
}
@@ -1458,10 +1458,6 @@ nsGenericHTMLElement::ColorToString(const nsHTMLValue& aValue,
aValue.GetStringValue(aResult);
return PR_TRUE;
}
- if (aValue.GetUnit() == eHTMLUnit_Empty) { // was illegal
- aResult.Truncate();
- return PR_TRUE;
- }
return PR_FALSE;
}
@@ -1652,14 +1648,12 @@ nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute,
{
if ((aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height)) {
- ParseValueOrPercent(aString, aResult, eHTMLUnit_Pixel);
- return PR_TRUE;
+ return ParseValueOrPercent(aString, aResult, eHTMLUnit_Pixel);
}
else if ((aAttribute == nsHTMLAtoms::hspace) ||
(aAttribute == nsHTMLAtoms::vspace) ||
(aAttribute == nsHTMLAtoms::border)) {
- ParseValue(aString, 0, aResult, eHTMLUnit_Pixel);
- return PR_TRUE;
+ return ParseValue(aString, 0, aResult, eHTMLUnit_Pixel);
}
return PR_FALSE;
}
@@ -1894,7 +1888,7 @@ nsGenericHTMLElement::MapImageBorderAttributeInto(const nsIHTMLMappedAttributes*
// border: pixels
aAttributes->GetAttribute(nsHTMLAtoms::border, value);
- if (value.GetUnit() != eHTMLUnit_Pixel) {
+ if (value.GetUnit() == eHTMLUnit_Null) {
if (nsnull == aBorderColors) {
return;
}
@@ -1902,6 +1896,9 @@ nsGenericHTMLElement::MapImageBorderAttributeInto(const nsIHTMLMappedAttributes*
// the size to 2 pixels.
value.SetPixelValue(2);
}
+ else if (value.GetUnit() != eHTMLUnit_Pixel) { // something other than pixels
+ value.SetPixelValue(0);
+ }
float p2t;
aPresContext->GetScaledPixelsToTwips(&p2t);
@@ -2026,38 +2023,6 @@ nsGenericHTMLElement::GetBackgroundAttributesImpact(const nsIAtom* aAttribute,
}
-static PRBool AttributeChangeRequiresRepaint(const nsIAtom* aAttribute)
-{
- // these are attributes that always require a restyle and a repaint, but not a reflow
- // regardless of the tag they are associated with
- return (PRBool)
- (aAttribute==nsHTMLAtoms::bgcolor ||
- aAttribute==nsHTMLAtoms::color);
-}
-
-static PRBool AttributeChangeRequiresReflow(const nsIAtom* aAttribute)
-{
- // these are attributes that always require a restyle and reflow
- // regardless of the tag they are associated with
- return (PRBool)
- (aAttribute==nsHTMLAtoms::align ||
- aAttribute==nsHTMLAtoms::border ||
- aAttribute==nsHTMLAtoms::cellpadding ||
- aAttribute==nsHTMLAtoms::cellspacing ||
- aAttribute==nsHTMLAtoms::ch ||
- aAttribute==nsHTMLAtoms::choff ||
- aAttribute==nsHTMLAtoms::colspan ||
- aAttribute==nsHTMLAtoms::face ||
- aAttribute==nsHTMLAtoms::frame ||
- aAttribute==nsHTMLAtoms::height ||
- aAttribute==nsHTMLAtoms::nowrap ||
- aAttribute==nsHTMLAtoms::rowspan ||
- aAttribute==nsHTMLAtoms::rules ||
- aAttribute==nsHTMLAtoms::span ||
- aAttribute==nsHTMLAtoms::valign ||
- aAttribute==nsHTMLAtoms::width);
-}
-
//----------------------------------------------------------------------
nsGenericHTMLLeafElement::nsGenericHTMLLeafElement()
diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.h b/mozilla/layout/html/content/src/nsGenericHTMLElement.h
index cfa642cabbc..bc4cbc621cb 100644
--- a/mozilla/layout/html/content/src/nsGenericHTMLElement.h
+++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.h
@@ -151,9 +151,9 @@ public:
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit);
- static void ParseValueOrPercentOrProportional(const nsString& aString,
- nsHTMLValue& aResult,
- nsHTMLUnit aValueUnit);
+ static PRBool ParseValueOrPercentOrProportional(const nsString& aString,
+ nsHTMLValue& aResult,
+ nsHTMLUnit aValueUnit);
static PRBool ValueOrPercentToString(const nsHTMLValue& aValue,
nsString& aResult);
diff --git a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp
index 62ac54e8614..6b824d06946 100644
--- a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp
@@ -221,17 +221,14 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
- eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
+ eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::href) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- if (aAttribute == nsHTMLAtoms::suppress) {
+ else if (aAttribute == nsHTMLAtoms::suppress) {
if (aValue.EqualsIgnoreCase("true")) {
- aResult.SetEmptyValue();
+ aResult.SetEmptyValue(); // XXX? shouldn't just leave "true"
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
diff --git a/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp b/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp
index 01f1374c18d..56878f8f118 100644
--- a/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp
@@ -408,7 +408,7 @@ nsresult BodyFixupRule::QueryInterface(const nsIID& aIID,
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
- static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
+// static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIStyleRuleIID)) {
*aInstancePtrResult = (void*) ((nsIStyleRule*)this);
NS_ADDREF_THIS();
@@ -591,22 +591,20 @@ nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
nsHTMLValue& aResult)
{
- if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
if ((aAttribute == nsHTMLAtoms::bgcolor) ||
(aAttribute == nsHTMLAtoms::text) ||
(aAttribute == nsHTMLAtoms::link) ||
(aAttribute == nsHTMLAtoms::alink) ||
(aAttribute == nsHTMLAtoms::vlink)) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if ((aAttribute == nsHTMLAtoms::marginwidth) ||
- (aAttribute == nsHTMLAtoms::marginheight)) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if ((aAttribute == nsHTMLAtoms::marginwidth) ||
+ (aAttribute == nsHTMLAtoms::marginheight)) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp
index f73dde3155f..09278f2d63e 100644
--- a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp
@@ -308,11 +308,12 @@ nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
- eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
+ eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::type) {
+ else if (aAttribute == nsHTMLAtoms::type) {
nsGenericHTMLElement::EnumTable *table = kButtonTypeTable;
while (nsnull != table->tag) {
if (aValue.EqualsIgnoreCase(table->tag)) {
diff --git a/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp b/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp
index 63f42cad4e3..f9781706233 100644
--- a/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp
@@ -135,17 +135,17 @@ nsHTMLDirectoryElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
- if (!nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
- aResult)) {
- aResult.SetIntValue(NS_STYLE_LIST_STYLE_BASIC, eHTMLUnit_Enumerated);
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
+ aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- return NS_CONTENT_ATTR_HAS_VALUE;
}
- if (aAttribute == nsHTMLAtoms::start) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::start) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::compact) {
+ else if (aAttribute == nsHTMLAtoms::compact) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_NO_VALUE;
}
@@ -179,6 +179,9 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Enumerated) {
list->mListStyleType = value.GetIntValue();
}
+ else if (value.GetUnit() != eHTMLUnit_Null) {
+ list->mListStyleType = NS_STYLE_LIST_STYLE_BASIC;
+ }
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
diff --git a/mozilla/layout/html/content/src/nsHTMLDivElement.cpp b/mozilla/layout/html/content/src/nsHTMLDivElement.cpp
index 370cda5b8d7..addd2481dbf 100644
--- a/mozilla/layout/html/content/src/nsHTMLDivElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLDivElement.cpp
@@ -137,18 +137,21 @@ nsHTMLDivElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- if (aAttribute == nsHTMLAtoms::cols) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::cols) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::gutter) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::gutter) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::width) {
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp
index ee8f95bf9f3..5896073dced 100644
--- a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp
@@ -154,9 +154,10 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- if (aAttribute == nsHTMLAtoms::color) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::color) {
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp
index f1912b12693..de8a822ab48 100644
--- a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp
@@ -363,12 +363,14 @@ nsHTMLFormElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::method) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kFormMethodTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kFormMethodTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::enctype) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kFormEnctypeTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kFormEnctypeTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp b/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp
index 1ee216893d2..f72b991612e 100644
--- a/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp
@@ -151,31 +151,36 @@ nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::bordercolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::frameborder) {
// XXX need to check for correct mode
- nsGenericHTMLElement::ParseFrameborderValue(PR_FALSE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseFrameborderValue(PR_FALSE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::marginwidth) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::marginheight) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::noresize) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::scrolling) {
- nsGenericHTMLElement::ParseScrollingValue(PR_FALSE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseScrollingValue(PR_FALSE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp
index 09a8e5bd207..13e54b90510 100644
--- a/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp
@@ -133,17 +133,20 @@ nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::bordercolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::frameborder) {
// XXX need to check for correct mode
- nsGenericHTMLElement::ParseFrameborderValue(PR_FALSE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseFrameborderValue(PR_FALSE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::border) {
- nsGenericHTMLElement::ParseValue(aValue, 0, 100, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, 100, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLHRElement.cpp b/mozilla/layout/html/content/src/nsHTMLHRElement.cpp
index c3e8d6d5283..95b1828219a 100644
--- a/mozilla/layout/html/content/src/nsHTMLHRElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLHRElement.cpp
@@ -172,13 +172,15 @@ nsHTMLHRElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::size) {
- nsGenericHTMLElement::ParseValue(aValue, 1, 100, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, 100, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::noshade) {
aResult.SetEmptyValue();
diff --git a/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp
index a4b1cce3382..646aaa76c48 100644
--- a/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp
@@ -165,32 +165,38 @@ nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::marginwidth) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::marginheight) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::frameborder) {
- nsGenericHTMLElement::ParseFrameborderValue(PR_TRUE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseFrameborderValue(PR_TRUE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::scrolling) {
- nsGenericHTMLElement::ParseScrollingValue(PR_TRUE, aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseScrollingValue(PR_TRUE, aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseEnumValue(aValue, kAlignTable, aResult)) {
diff --git a/mozilla/layout/html/content/src/nsHTMLImageElement.cpp b/mozilla/layout/html/content/src/nsHTMLImageElement.cpp
index c97bcbf3f47..d91affa5b96 100644
--- a/mozilla/layout/html/content/src/nsHTMLImageElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLImageElement.cpp
@@ -229,12 +229,6 @@ nsHTMLImageElement::StringToAttribute(nsIAtom* aAttribute,
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_HAS_VALUE;
}
- if ((aAttribute == nsHTMLAtoms::usemap) ||
- (aAttribute == nsHTMLAtoms::src) ||
- (aAttribute == nsHTMLAtoms::lowsrc)) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (nsGenericHTMLElement::ParseImageAttribute(aAttribute,
aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
diff --git a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp
index 8ae10b7af5b..e10aa4aed08 100644
--- a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp
@@ -510,26 +510,31 @@ nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::maxlength) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::size) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (IsImage()) {
if (nsGenericHTMLElement::ParseImageAttribute(aAttribute,
@@ -538,8 +543,9 @@ nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute,
}
}
else if (aAttribute == nsHTMLAtoms::border) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLLIElement.cpp b/mozilla/layout/html/content/src/nsHTMLLIElement.cpp
index 513de1cfea5..b6257eeb7b8 100644
--- a/mozilla/layout/html/content/src/nsHTMLLIElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLLIElement.cpp
@@ -154,8 +154,9 @@ nsHTMLLIElement::StringToAttribute(nsIAtom* aAttribute,
}
}
else if (aAttribute == nsHTMLAtoms::value) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp b/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp
index 2b5c3431cb0..e9150dc2986 100644
--- a/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp
@@ -31,7 +31,7 @@
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
-#define _I32_MIN (-2147483647 - 1) /* minimum signed 32 bit value */
+//#define _I32_MIN (-2147483647 - 1) /* minimum signed 32 bit value */
static NS_DEFINE_IID(kIDOMHTMLLayerElementIID, NS_IDOMHTMLLAYERELEMENT_IID);
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
@@ -185,14 +185,10 @@ nsHTMLLayerElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
// XXX CLIP
- if (aAttribute == nsHTMLAtoms::src) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- else if ((aAttribute == nsHTMLAtoms::top) ||
- (aAttribute == nsHTMLAtoms::left) ||
- (aAttribute == nsHTMLAtoms::width) ||
- (aAttribute == nsHTMLAtoms::height)) {
+ if ((aAttribute == nsHTMLAtoms::top) ||
+ (aAttribute == nsHTMLAtoms::left) ||
+ (aAttribute == nsHTMLAtoms::width) ||
+ (aAttribute == nsHTMLAtoms::height)) {
if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
@@ -213,10 +209,6 @@ nsHTMLLayerElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- else if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
// ABOVE, BELOW, OnMouseOver, OnMouseOut, OnFocus, OnBlur, OnLoad
return NS_CONTENT_ATTR_NOT_THERE;
diff --git a/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp b/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp
index 01ec5db9ccb..e80d28a4b37 100644
--- a/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp
@@ -168,8 +168,9 @@ nsHTMLLegendElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kAlignTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kAlignTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp b/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp
index 08c6ddcc511..fd08afd9530 100644
--- a/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp
@@ -135,19 +135,15 @@ nsHTMLMenuElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
- if (!nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
- aResult)) {
- aResult.SetIntValue(NS_STYLE_LIST_STYLE_BASIC, eHTMLUnit_Enumerated);
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
+ aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- return NS_CONTENT_ATTR_HAS_VALUE;
}
- if (aAttribute == nsHTMLAtoms::start) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- if (aAttribute == nsHTMLAtoms::compact) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_NO_VALUE;
+ else if (aAttribute == nsHTMLAtoms::start) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -179,10 +175,13 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Enumerated) {
list->mListStyleType = value.GetIntValue();
}
+ else if (value.GetUnit() != eHTMLUnit_Null) {
+ list->mListStyleType = NS_STYLE_LIST_STYLE_BASIC;
+ }
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
- if (value.GetUnit() == eHTMLUnit_Empty) {
+ if (value.GetUnit() != eHTMLUnit_Null) {
// XXX set
}
}
diff --git a/mozilla/layout/html/content/src/nsHTMLOListElement.cpp b/mozilla/layout/html/content/src/nsHTMLOListElement.cpp
index fa28b3c95ff..6312947eafd 100644
--- a/mozilla/layout/html/content/src/nsHTMLOListElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLOListElement.cpp
@@ -159,22 +159,19 @@ nsHTMLOListElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
- if (!nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
- aResult)) {
- if (!nsGenericHTMLElement::ParseCaseSensitiveEnumValue(aValue,
- kOldListTypeTable, aResult)) {
- aResult.SetIntValue(NS_STYLE_LIST_STYLE_DECIMAL, eHTMLUnit_Enumerated);
- }
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
+ aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
+ if (nsGenericHTMLElement::ParseCaseSensitiveEnumValue(aValue,
+ kOldListTypeTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- return NS_CONTENT_ATTR_HAS_VALUE;
}
- if (aAttribute == nsHTMLAtoms::start) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- if (aAttribute == nsHTMLAtoms::compact) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_NO_VALUE;
+ else if (aAttribute == nsHTMLAtoms::start) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -219,10 +216,13 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Enumerated) {
list->mListStyleType = value.GetIntValue();
}
+ else if (value.GetUnit() != eHTMLUnit_Null) {
+ list->mListStyleType = NS_STYLE_LIST_STYLE_DECIMAL;
+ }
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
- if (value.GetUnit() == eHTMLUnit_Empty) {
+ if (value.GetUnit() != eHTMLUnit_Null) {
// XXX set
}
}
diff --git a/mozilla/layout/html/content/src/nsHTMLPreElement.cpp b/mozilla/layout/html/content/src/nsHTMLPreElement.cpp
index 1ccbcaa8d71..8ace87c074e 100644
--- a/mozilla/layout/html/content/src/nsHTMLPreElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLPreElement.cpp
@@ -132,24 +132,19 @@ nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
nsHTMLValue& aResult)
{
- if ((aAttribute == nsHTMLAtoms::wrap) ||
- (aAttribute == nsHTMLAtoms::variable)) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
if (aAttribute == nsHTMLAtoms::cols) {
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult,
eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- if (aAttribute == nsHTMLAtoms::width) {
+ else if (aAttribute == nsHTMLAtoms::width) {
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult,
eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- if (aAttribute == nsHTMLAtoms::tabstop) {
+ else if (aAttribute == nsHTMLAtoms::tabstop) {
PRInt32 ec, tabstop = aValue.ToInteger(&ec);
if (tabstop <= 0) {
tabstop = 8;
@@ -196,7 +191,7 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
// wrap: empty
aAttributes->GetAttribute(nsHTMLAtoms::wrap, value);
- if (value.GetUnit() == eHTMLUnit_Empty) {
+ if (value.GetUnit() != eHTMLUnit_Null) {
nsStyleText* text = (nsStyleText*)
aContext->GetMutableStyleData(eStyleStruct_Text);
text->mWhiteSpace = NS_STYLE_WHITESPACE_MOZ_PRE_WRAP;
diff --git a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp
index 727f9ad2a9b..980473233e6 100644
--- a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp
@@ -672,12 +672,14 @@ nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::size) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp b/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp
index c9364b9a155..83a3ade8301 100644
--- a/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp
@@ -129,18 +129,21 @@ nsHTMLSpacerElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::size) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::align) {
- nsGenericHTMLElement::ParseAlignValue(aValue, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseAlignValue(aValue, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if ((aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height)) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
- eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult,
+ eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp
index 1f675e01dff..62a6d7256e7 100644
--- a/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp
@@ -337,27 +337,31 @@ nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers with a min of 0 */
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers with a min of 1 */
- if ((aAttribute == nsHTMLAtoms::colspan) ||
+ else if ((aAttribute == nsHTMLAtoms::colspan) ||
(aAttribute == nsHTMLAtoms::rowspan)) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents */
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
@@ -366,17 +370,10 @@ nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- else if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (aAttribute == nsHTMLAtoms::bgcolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- else if (aAttribute == nsHTMLAtoms::nowrap) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::scope) {
if (nsGenericHTMLElement::ParseEnumValue(aValue, kCellScopeTable, aResult)) {
@@ -478,7 +475,7 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
// nowrap
// nowrap depends on the width attribute, so be sure to handle it after width is mapped!
aAttributes->GetAttribute(nsHTMLAtoms::nowrap, value);
- if (value.GetUnit() == eHTMLUnit_Empty)
+ if (value.GetUnit() != eHTMLUnit_Null)
{
if (widthValue.GetUnit() != eHTMLUnit_Pixel)
{
diff --git a/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp
index d0d1af3c3f5..0ad4d456075 100644
--- a/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp
@@ -162,18 +162,21 @@ nsHTMLTableColElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers */
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- else if (aAttribute == nsHTMLAtoms::span) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::span) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
diff --git a/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp
index 4e419c568dd..b91aa125b20 100644
--- a/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp
@@ -151,18 +151,21 @@ nsHTMLTableColGroupElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers */
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
- else if (aAttribute == nsHTMLAtoms::span) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ else if (aAttribute == nsHTMLAtoms::span) {
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
diff --git a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp
index 0ec9673db02..778ea7f9877 100644
--- a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp
@@ -841,50 +841,37 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
/* attributes that resolve to pixels, with min=0 */
if ((aAttribute == nsHTMLAtoms::cellspacing) ||
(aAttribute == nsHTMLAtoms::cellpadding)) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that are either empty, or integers, with min=0 */
else if (aAttribute == nsHTMLAtoms::cols) {
- nsAutoString tmp(aValue);
- tmp.StripWhitespace();
- if (0 == tmp.Length()) {
- // Just set COLS, same as COLS=number of columns
- aResult.SetEmptyValue();
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- else
- {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- }
- return NS_CONTENT_ATTR_HAS_VALUE;
}
/* attributes that are either empty, or pixels */
else if (aAttribute == nsHTMLAtoms::border) {
- nsAutoString tmp(aValue);
- tmp.StripWhitespace();
- if (0 == tmp.Length()) {
- // Just enable the border; same as border=1
- aResult.SetEmptyValue();
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- else
- {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel);
- }
- return NS_CONTENT_ATTR_HAS_VALUE;
}
/* attributes that resolve to integers or percents */
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
@@ -893,25 +880,25 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- else if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (aAttribute == nsHTMLAtoms::bgcolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::frame) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kFrameTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kFrameTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::layout) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kLayoutTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kLayoutTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::rules) {
- nsGenericHTMLElement::ParseEnumValue(aValue, kRulesTable, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kRulesTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
@@ -1033,21 +1020,14 @@ MapTableBorderInto(const nsIHTMLMappedAttributes* aAttributes,
nsHTMLValue borderValue;
aAttributes->GetAttribute(nsHTMLAtoms::border, borderValue);
- if (borderValue.GetUnit() == eHTMLUnit_String)
- {
- nsAutoString borderAsString;
- borderValue.GetStringValue(borderAsString);
- nsGenericHTMLElement::ParseValue(borderAsString, 0, borderValue, eHTMLUnit_Pixel);
- }
- else if (borderValue.GetUnit() == eHTMLUnit_Null)
+ if (borderValue.GetUnit() == eHTMLUnit_Null)
{ // the absence of "border" with the presence of "frame" implies border = 1 pixel
nsHTMLValue frameValue;
aAttributes->GetAttribute(nsHTMLAtoms::frame, frameValue);
if (frameValue.GetUnit() != eHTMLUnit_Null)
borderValue.SetPixelValue(1);
}
- if ((borderValue.GetUnit() == eHTMLUnit_Pixel) ||
- (borderValue.GetUnit() == eHTMLUnit_Empty)) {
+ if (borderValue.GetUnit() != eHTMLUnit_Null) {
nsStyleSpacing* spacing = (nsStyleSpacing*)
aContext->GetMutableStyleData(eStyleStruct_Spacing);
nsStyleTable *tableStyle = (nsStyleTable*)
@@ -1055,7 +1035,7 @@ MapTableBorderInto(const nsIHTMLMappedAttributes* aAttributes,
float p2t;
aPresContext->GetScaledPixelsToTwips(&p2t);
nsStyleCoord twips;
- if (borderValue.GetUnit() == eHTMLUnit_Empty) {
+ if (borderValue.GetUnit() != eHTMLUnit_Pixel) {
tableStyle->mRules=NS_STYLE_TABLE_RULES_ALL; // non-0 values of border imply default rules=all
twips.SetCoordValue(NSIntPixelsToTwips(1, p2t));
}
diff --git a/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp
index baca96d727b..194b3de251c 100644
--- a/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp
@@ -497,20 +497,23 @@ nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers with default=0*/
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents */
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents or proportions */
else if (aAttribute == nsHTMLAtoms::width) {
- nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
@@ -519,13 +522,10 @@ nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- else if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (aAttribute == nsHTMLAtoms::bgcolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::valign) {
if (nsGenericHTMLElement::ParseTableVAlignValue(aValue, aResult)) {
diff --git a/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp
index 13c619fdfa1..437f65aaec9 100644
--- a/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp
@@ -225,14 +225,16 @@ nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute,
*/
/* attributes that resolve to integers */
if (aAttribute == nsHTMLAtoms::choff) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* attributes that resolve to integers or percents */
else if (aAttribute == nsHTMLAtoms::height) {
- nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
/* other attributes */
@@ -241,13 +243,10 @@ nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
- else if (aAttribute == nsHTMLAtoms::background) {
- aResult.SetStringValue(aValue);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
else if (aAttribute == nsHTMLAtoms::bgcolor) {
- nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::valign) {
if (nsGenericHTMLElement::ParseTableVAlignValue(aValue, aResult)) {
diff --git a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp
index fbb06b2d1e0..51c068fa5fa 100644
--- a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp
@@ -344,20 +344,23 @@ nsHTMLTextAreaElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::cols) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::readonly) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::rows) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
else if (aAttribute == nsHTMLAtoms::tabindex) {
- nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
diff --git a/mozilla/layout/html/content/src/nsHTMLUListElement.cpp b/mozilla/layout/html/content/src/nsHTMLUListElement.cpp
index e9de64b0bf1..b73f7652f2b 100644
--- a/mozilla/layout/html/content/src/nsHTMLUListElement.cpp
+++ b/mozilla/layout/html/content/src/nsHTMLUListElement.cpp
@@ -137,22 +137,19 @@ nsHTMLUListElement::StringToAttribute(nsIAtom* aAttribute,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
- if (!nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
- aResult)) {
- if (!nsGenericHTMLElement::ParseCaseSensitiveEnumValue(aValue,
- kOldListTypeTable, aResult)) {
- aResult.SetIntValue(NS_STYLE_LIST_STYLE_BASIC, eHTMLUnit_Enumerated);
- }
+ if (nsGenericHTMLElement::ParseEnumValue(aValue, kListTypeTable,
+ aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
+ if (nsGenericHTMLElement::ParseCaseSensitiveEnumValue(aValue,
+ kOldListTypeTable, aResult)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
}
- return NS_CONTENT_ATTR_HAS_VALUE;
}
if (aAttribute == nsHTMLAtoms::start) {
- nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer);
- return NS_CONTENT_ATTR_HAS_VALUE;
- }
- if (aAttribute == nsHTMLAtoms::compact) {
- aResult.SetEmptyValue();
- return NS_CONTENT_ATTR_NO_VALUE;
+ if (nsGenericHTMLElement::ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
+ return NS_CONTENT_ATTR_HAS_VALUE;
+ }
}
return NS_CONTENT_ATTR_NOT_THERE;
}
@@ -197,10 +194,13 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Enumerated) {
list->mListStyleType = value.GetIntValue();
}
+ else if (value.GetUnit() == eHTMLUnit_Null) {
+ list->mListStyleType = NS_STYLE_LIST_STYLE_BASIC;
+ }
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
- if (value.GetUnit() == eHTMLUnit_Empty) {
+ if (value.GetUnit() != eHTMLUnit_Null) {
// XXX set
}
}