diff --git a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp index 45fb922edcc..693250b70d3 100644 --- a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp +++ b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp @@ -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) diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp index 8606e19acf9..df96e56b787 100644 --- a/mozilla/htmlparser/src/CNavDTD.cpp +++ b/mozilla/htmlparser/src/CNavDTD.cpp @@ -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 diff --git a/mozilla/htmlparser/src/nsDTDUtils.cpp b/mozilla/htmlparser/src/nsDTDUtils.cpp index 43f41bead4e..68799060cb7 100644 --- a/mozilla/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/htmlparser/src/nsDTDUtils.cpp @@ -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; } /** diff --git a/mozilla/htmlparser/src/nsDTDUtils.h b/mozilla/htmlparser/src/nsDTDUtils.h index 6ac83431574..5c154cd6d10 100644 --- a/mozilla/htmlparser/src/nsDTDUtils.h +++ b/mozilla/htmlparser/src/nsDTDUtils.h @@ -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); diff --git a/mozilla/htmlparser/src/nsElementTable.cpp b/mozilla/htmlparser/src/nsElementTable.cpp index 17ce52db521..958986ca0d9 100644 --- a/mozilla/htmlparser/src/nsElementTable.cpp +++ b/mozilla/htmlparser/src/nsElementTable.cpp @@ -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 { diff --git a/mozilla/layout/style/nsComputedDOMStyle.cpp b/mozilla/layout/style/nsComputedDOMStyle.cpp index 45fb922edcc..693250b70d3 100644 --- a/mozilla/layout/style/nsComputedDOMStyle.cpp +++ b/mozilla/layout/style/nsComputedDOMStyle.cpp @@ -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) diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index 8606e19acf9..df96e56b787 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -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 diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp index 43f41bead4e..68799060cb7 100644 --- a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp @@ -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; } /** diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.h b/mozilla/parser/htmlparser/src/nsDTDUtils.h index 6ac83431574..5c154cd6d10 100644 --- a/mozilla/parser/htmlparser/src/nsDTDUtils.h +++ b/mozilla/parser/htmlparser/src/nsDTDUtils.h @@ -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); diff --git a/mozilla/parser/htmlparser/src/nsElementTable.cpp b/mozilla/parser/htmlparser/src/nsElementTable.cpp index 17ce52db521..958986ca0d9 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.cpp +++ b/mozilla/parser/htmlparser/src/nsElementTable.cpp @@ -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 {