From a21eaed68f3750f8195d64c87ba7c094aa4b7bb2 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Fri, 23 Oct 1998 04:20:08 +0000 Subject: [PATCH] Turned back on support for LAYER element git-svn-id: svn://10.0.0.236/trunk@13361 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLContentSink.cpp | 3 ++ .../html/content/src/nsHTMLLayerElement.cpp | 50 +++++++++---------- .../html/document/src/nsHTMLContentSink.cpp | 3 ++ 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 6c80899ee1b..01ed1aeb8fc 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -577,6 +577,9 @@ MakeContentObject(nsHTMLTag aNodeType, rv = NS_NewHTMLLabelElement(aResult, aAtom); SetForm(*aResult, aForm); break; + case eHTMLTag_layer: + rv = NS_NewHTMLLayerElement(aResult, aAtom); + break; case eHTMLTag_legend: rv = NS_NewHTMLLegendElement(aResult, aAtom); break; diff --git a/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp b/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp index d949532f25c..7315dda93d2 100644 --- a/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp @@ -28,6 +28,8 @@ #include "nsIPresContext.h" #include "nsIHTMLAttributes.h" +#define _I32_MIN (-2147483647i32 - 1) /* minimum signed 32 bit value */ + static NS_DEFINE_IID(kIDOMHTMLLayerElementIID, NS_IDOMHTMLELEMENT_IID); class nsHTMLLayerElement : public nsIDOMHTMLElement,/* XXX need layer api */ @@ -134,57 +136,52 @@ static nsGenericHTMLElement::EnumTable kVisibilityTable[] = { }; NS_IMETHODIMP -nsHTMLLayerElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, - nsHTMLValue& aResult) +nsHTMLLayerElement::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) { -#if 0 // XXX CLIP - nsHTMLValue val; if (aAttribute == nsHTMLAtoms::src) { - nsAutoString src(aString); + nsAutoString src(aValue); src.StripWhitespace(); - val.SetStringValue(src); - return nsHTMLTagContent::SetAttribute(aAttribute, val, aNotify); + aResult.SetStringValue(src); + return NS_CONTENT_ATTR_HAS_VALUE; } else if ((aAttribute == nsHTMLAtoms::left) || - (aAttribute == nsHTMLAtoms::top)) { - nsHTMLValue val; - if (ParseValue(aString, _I32_MIN, val, eHTMLUnit_Pixel)) { - return nsHTMLTagContent::SetAttribute(aAttribute, val, aNotify); + (aAttribute == nsHTMLAtoms::top)) { + if (nsGenericHTMLElement::ParseValue(aValue, _I32_MIN, aResult, eHTMLUnit_Pixel)) { + return NS_CONTENT_ATTR_HAS_VALUE; } } else if ((aAttribute == nsHTMLAtoms::width) || (aAttribute == nsHTMLAtoms::height)) { - nsHTMLValue val; - if (ParseValueOrPercent(aString, val, eHTMLUnit_Pixel)) { - return nsHTMLTagContent::SetAttribute(aAttribute, val, aNotify); + if (nsGenericHTMLElement::ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) { + return NS_CONTENT_ATTR_HAS_VALUE; } } else if (aAttribute == nsHTMLAtoms::zindex) { - nsHTMLValue val; - if (ParseValue(aString, 0, val, eHTMLUnit_Integer)) { - return nsHTMLTagContent::SetAttribute(aAttribute, val, aNotify); + if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) { + return NS_CONTENT_ATTR_HAS_VALUE; } } else if (aAttribute == nsHTMLAtoms::visibility) { - if (ParseEnumValue(aString, kVisibilityTable, val)) { - return nsHTMLTagContent::SetAttribute(aAttribute, val, aNotify); + if (nsGenericHTMLElement::ParseEnumValue(aValue, kVisibilityTable, aResult)) { + return NS_CONTENT_ATTR_HAS_VALUE; } } else if (aAttribute == nsHTMLAtoms::bgcolor) { - ParseColor(aString, val); - return nsHTMLTagContent::SetAttribute(aAttribute, val, aNotify); + if (nsGenericHTMLElement::ParseColor(aValue, aResult)) { + return NS_CONTENT_ATTR_HAS_VALUE; + } } else if (aAttribute == nsHTMLAtoms::background) { - nsAutoString url(aString); + nsAutoString url(aValue); url.StripWhitespace(); - val.SetStringValue(url); - return nsHTMLTagContent::SetAttribute(aAttribute, val, aNotify); + aResult.SetStringValue(url); + return NS_CONTENT_ATTR_HAS_VALUE; } // ABOVE, BELOW, OnMouseOver, OnMouseOut, OnFocus, OnBlur, OnLoad -#endif return NS_CONTENT_ATTR_NOT_THERE; } @@ -199,7 +196,6 @@ nsHTMLLayerElement::AttributeToString(nsIAtom* aAttribute, return NS_CONTENT_ATTR_HAS_VALUE; } } - // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index 6c80899ee1b..01ed1aeb8fc 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -577,6 +577,9 @@ MakeContentObject(nsHTMLTag aNodeType, rv = NS_NewHTMLLabelElement(aResult, aAtom); SetForm(*aResult, aForm); break; + case eHTMLTag_layer: + rv = NS_NewHTMLLayerElement(aResult, aAtom); + break; case eHTMLTag_legend: rv = NS_NewHTMLLegendElement(aResult, aAtom); break;