77746 - Remove style from the style stack on encountering the appropritate end tag.

78202 - Added text-decoration property for GetComputedStyle.
26347 - Anchor ( special element ) should be able to close phrasel elements
78140 - Putting back list-style-image support for getComputedStyle that got removed accidently.

r=heikki
sr=jst
This commit is contained in:
harishd%netscape.com 2001-05-09 03:29:09 +00:00
parent d57ecbba94
commit 50404b6290
10 changed files with 116 additions and 40 deletions

View File

@ -174,7 +174,8 @@ private:
// Text Properties
nsresult GetTextAlign(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetTextDecoration(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetBehavior(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
@ -440,8 +441,15 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAReadableString& aPropertyName,
case eCSSProperty_outline_color:
rv = GetOutlineColor(frame, *getter_AddRefs(val)); break;
// Text properties
case eCSSProperty_text_align:
rv = GetTextAlign(frame, *getter_AddRefs(val)); break;
case eCSSProperty_text_decoration:
rv = GetTextDecoration(frame, *getter_AddRefs(val)); break;
// List properties
case eCSSProperty_list_style_image:
rv = GetListStyleImage(frame, *getter_AddRefs(val)); break;
// Z-Index property
case eCSSProperty_z_index:
@ -1281,6 +1289,30 @@ nsComputedDOMStyle::GetTextAlign(nsIFrame *aFrame,
(void **)&aValue);
}
nsresult
nsComputedDOMStyle::GetTextDecoration(nsIFrame *aFrame,
nsIDOMCSSPrimitiveValue*& aValue)
{
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleText* text=nsnull;
GetStyleData(eStyleStruct_Text,(const nsStyleStruct*&)text,aFrame);
if(text) {
const nsCString& decoration=
nsCSSProps::SearchKeywordTable(text->mTextDecoration,
nsCSSProps::kTextDecorationKTable);
val->SetString(decoration);
}
else {
val->SetString("");
}
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
(void **)&aValue);
}
#if 0
NS_IMETHODIMP
nsComputedDOMStyle::GetCaptionSide(nsAWritableString& aCaptionSide)

View File

@ -431,6 +431,8 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
mParserCommand=aParserContext.mParserCommand;
mMimeType=aParserContext.mMimeType;
mBodyContext->SetNodeAllocator(&mNodeAllocator);
if((!aParserContext.mPrevContext) && (aSink)) {
STOP_TIMER();
@ -1978,7 +1980,9 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
static eHTMLTags gBarriers[]={eHTMLTag_thead,eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_table};
if(!FindTagInSet(theParentTag,gBarriers,sizeof(gBarriers)/sizeof(theParentTag))) {
PopStyle(theChildTag);
if(nsHTMLElement::IsResidualStyleTag(theChildTag)) {
mBodyContext->RemoveStyle(theChildTag); // fix bug 77746
}
}
// If the bit kHandleStrayTag is set then we automatically open up a matching

View File

@ -1105,24 +1105,25 @@ nsCParserNode* nsDTDContext::PopStyle(eHTMLTags aTag){
*
* @update gess 01/26/00
*/
nsCParserNode* nsDTDContext::RemoveStyle(eHTMLTags aTag){
PRInt32 theLevel=0;
nsCParserNode* result=0;
for(theLevel=mStack.mCount-1;theLevel>0;theLevel--) {
nsEntryStack *theStack=mStack.mEntries[theLevel].mStyles;
if(theStack) {
if(aTag==theStack->Last()) {
result=theStack->Pop();
mResidualStyleCount--;
} else {
// NS_ERROR("bad residual style entry");
void nsDTDContext::RemoveStyle(eHTMLTags aTag){
PRInt32 theLevel=mStack.mCount;
while (theLevel) {
nsEntryStack *theStack=GetStylesAt(--theLevel);
if (theStack) {
PRInt32 index=theStack->mCount;
while (index){
nsTagEntry *theEntry=theStack->EntryAt(--index);
if (aTag==(eHTMLTags)theEntry->mNode->GetNodeType()) {
mResidualStyleCount--;
nsCParserNode* result=theStack->Remove(index,aTag);
IF_FREE(result, mNodeAllocator);
return;
}
}
}
}
return result;
}
/**

View File

@ -303,7 +303,7 @@ public:
void PushStyles(nsEntryStack *theStyles);
nsCParserNode* PopStyle(void);
nsCParserNode* PopStyle(eHTMLTags aTag);
nsCParserNode* RemoveStyle(eHTMLTags aTag);
void RemoveStyle(eHTMLTags aTag);
static void ReleaseGlobalObjects(void);

View File

@ -2119,8 +2119,9 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
//phrasal elements can close other phrasals, along with fontstyle and special tags...
if((eHTMLTag_userdefined==theTag) ||
gHTMLElements[theTag].IsSpecialEntity() ||
gHTMLElements[theTag].IsFontStyleEntity()) {
gHTMLElements[theTag].IsSpecialEntity() ||
gHTMLElements[theTag].IsFontStyleEntity()||
gHTMLElements[theTag].IsPhraseEntity()) { // Added Phrasel to fix bug 26347
continue;
}
else {

View File

@ -174,7 +174,8 @@ private:
// Text Properties
nsresult GetTextAlign(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetTextDecoration(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetBehavior(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
@ -440,8 +441,15 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAReadableString& aPropertyName,
case eCSSProperty_outline_color:
rv = GetOutlineColor(frame, *getter_AddRefs(val)); break;
// Text properties
case eCSSProperty_text_align:
rv = GetTextAlign(frame, *getter_AddRefs(val)); break;
case eCSSProperty_text_decoration:
rv = GetTextDecoration(frame, *getter_AddRefs(val)); break;
// List properties
case eCSSProperty_list_style_image:
rv = GetListStyleImage(frame, *getter_AddRefs(val)); break;
// Z-Index property
case eCSSProperty_z_index:
@ -1281,6 +1289,30 @@ nsComputedDOMStyle::GetTextAlign(nsIFrame *aFrame,
(void **)&aValue);
}
nsresult
nsComputedDOMStyle::GetTextDecoration(nsIFrame *aFrame,
nsIDOMCSSPrimitiveValue*& aValue)
{
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleText* text=nsnull;
GetStyleData(eStyleStruct_Text,(const nsStyleStruct*&)text,aFrame);
if(text) {
const nsCString& decoration=
nsCSSProps::SearchKeywordTable(text->mTextDecoration,
nsCSSProps::kTextDecorationKTable);
val->SetString(decoration);
}
else {
val->SetString("");
}
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
(void **)&aValue);
}
#if 0
NS_IMETHODIMP
nsComputedDOMStyle::GetCaptionSide(nsAWritableString& aCaptionSide)

View File

@ -431,6 +431,8 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
mParserCommand=aParserContext.mParserCommand;
mMimeType=aParserContext.mMimeType;
mBodyContext->SetNodeAllocator(&mNodeAllocator);
if((!aParserContext.mPrevContext) && (aSink)) {
STOP_TIMER();
@ -1978,7 +1980,9 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
static eHTMLTags gBarriers[]={eHTMLTag_thead,eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_table};
if(!FindTagInSet(theParentTag,gBarriers,sizeof(gBarriers)/sizeof(theParentTag))) {
PopStyle(theChildTag);
if(nsHTMLElement::IsResidualStyleTag(theChildTag)) {
mBodyContext->RemoveStyle(theChildTag); // fix bug 77746
}
}
// If the bit kHandleStrayTag is set then we automatically open up a matching

View File

@ -1105,24 +1105,25 @@ nsCParserNode* nsDTDContext::PopStyle(eHTMLTags aTag){
*
* @update gess 01/26/00
*/
nsCParserNode* nsDTDContext::RemoveStyle(eHTMLTags aTag){
PRInt32 theLevel=0;
nsCParserNode* result=0;
for(theLevel=mStack.mCount-1;theLevel>0;theLevel--) {
nsEntryStack *theStack=mStack.mEntries[theLevel].mStyles;
if(theStack) {
if(aTag==theStack->Last()) {
result=theStack->Pop();
mResidualStyleCount--;
} else {
// NS_ERROR("bad residual style entry");
void nsDTDContext::RemoveStyle(eHTMLTags aTag){
PRInt32 theLevel=mStack.mCount;
while (theLevel) {
nsEntryStack *theStack=GetStylesAt(--theLevel);
if (theStack) {
PRInt32 index=theStack->mCount;
while (index){
nsTagEntry *theEntry=theStack->EntryAt(--index);
if (aTag==(eHTMLTags)theEntry->mNode->GetNodeType()) {
mResidualStyleCount--;
nsCParserNode* result=theStack->Remove(index,aTag);
IF_FREE(result, mNodeAllocator);
return;
}
}
}
}
return result;
}
/**

View File

@ -303,7 +303,7 @@ public:
void PushStyles(nsEntryStack *theStyles);
nsCParserNode* PopStyle(void);
nsCParserNode* PopStyle(eHTMLTags aTag);
nsCParserNode* RemoveStyle(eHTMLTags aTag);
void RemoveStyle(eHTMLTags aTag);
static void ReleaseGlobalObjects(void);

View File

@ -2119,8 +2119,9 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
//phrasal elements can close other phrasals, along with fontstyle and special tags...
if((eHTMLTag_userdefined==theTag) ||
gHTMLElements[theTag].IsSpecialEntity() ||
gHTMLElements[theTag].IsFontStyleEntity()) {
gHTMLElements[theTag].IsSpecialEntity() ||
gHTMLElements[theTag].IsFontStyleEntity()||
gHTMLElements[theTag].IsPhraseEntity()) { // Added Phrasel to fix bug 26347
continue;
}
else {