зеркало из https://github.com/mozilla/pjs.git
Cleaned up attribute parsing so that illegal values are preserved as strings
This commit is contained in:
Родитель
1495e0e7d2
Коммит
cfe146337b
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче