From ae015c0f0f7a09ba3e428a5e21395eaed7ff7a09 Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Thu, 15 Apr 1999 21:23:05 +0000 Subject: [PATCH] split font style mapping from regular style mapping git-svn-id: svn://10.0.0.236/trunk@27701 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/public/nsIStyleRule.h | 3 + mozilla/content/base/src/nsStyleContext.cpp | 10 +++ .../html/content/public/nsIHTMLContent.h | 3 +- .../html/content/src/nsGenericHTMLElement.cpp | 5 +- .../html/content/src/nsGenericHTMLElement.h | 6 +- .../html/content/src/nsHTMLAnchorElement.cpp | 4 +- .../html/content/src/nsHTMLAppletElement.cpp | 4 +- .../html/content/src/nsHTMLAreaElement.cpp | 4 +- .../html/content/src/nsHTMLBRElement.cpp | 4 +- .../html/content/src/nsHTMLBaseElement.cpp | 4 +- .../content/src/nsHTMLBaseFontElement.cpp | 13 ++- .../html/content/src/nsHTMLBodyElement.cpp | 42 ++++++--- .../html/content/src/nsHTMLButtonElement.cpp | 4 +- .../html/content/src/nsHTMLDListElement.cpp | 4 +- .../html/content/src/nsHTMLDelElement.cpp | 4 +- .../content/src/nsHTMLDirectoryElement.cpp | 4 +- .../html/content/src/nsHTMLDivElement.cpp | 4 +- .../html/content/src/nsHTMLEmbedElement.cpp | 4 +- .../content/src/nsHTMLFieldSetElement.cpp | 4 +- .../html/content/src/nsHTMLFontElement.cpp | 26 ++++-- .../html/content/src/nsHTMLFormElement.cpp | 4 +- .../html/content/src/nsHTMLFrameElement.cpp | 4 +- .../content/src/nsHTMLFrameSetElement.cpp | 4 +- .../html/content/src/nsHTMLHRElement.cpp | 4 +- .../html/content/src/nsHTMLHeadElement.cpp | 4 +- .../html/content/src/nsHTMLHeadingElement.cpp | 4 +- .../html/content/src/nsHTMLHtmlElement.cpp | 4 +- .../html/content/src/nsHTMLIFrameElement.cpp | 4 +- .../html/content/src/nsHTMLImageElement.cpp | 4 +- .../html/content/src/nsHTMLInputElement.cpp | 4 +- .../html/content/src/nsHTMLInsElement.cpp | 4 +- .../html/content/src/nsHTMLIsIndexElement.cpp | 4 +- .../html/content/src/nsHTMLLIElement.cpp | 4 +- .../html/content/src/nsHTMLLabelElement.cpp | 4 +- .../html/content/src/nsHTMLLegendElement.cpp | 4 +- .../html/content/src/nsHTMLLinkElement.cpp | 4 +- .../html/content/src/nsHTMLMapElement.cpp | 4 +- .../html/content/src/nsHTMLMenuElement.cpp | 4 +- .../html/content/src/nsHTMLMetaElement.cpp | 4 +- .../html/content/src/nsHTMLModElement.cpp | 4 +- .../html/content/src/nsHTMLOListElement.cpp | 4 +- .../html/content/src/nsHTMLObjectElement.cpp | 4 +- .../content/src/nsHTMLOptGroupElement.cpp | 4 +- .../html/content/src/nsHTMLOptionElement.cpp | 4 +- .../content/src/nsHTMLParagraphElement.cpp | 4 +- .../html/content/src/nsHTMLParamElement.cpp | 4 +- .../html/content/src/nsHTMLPreElement.cpp | 30 +++++-- .../html/content/src/nsHTMLQuoteElement.cpp | 4 +- .../html/content/src/nsHTMLScriptElement.cpp | 4 +- .../html/content/src/nsHTMLSelectElement.cpp | 4 +- .../content/src/nsHTMLSharedObjectElement.cpp | 4 +- .../html/content/src/nsHTMLSpacerElement.cpp | 4 +- .../html/content/src/nsHTMLSpanElement.cpp | 4 +- .../html/content/src/nsHTMLStyleElement.cpp | 4 +- .../content/src/nsHTMLTableCaptionElement.cpp | 4 +- .../content/src/nsHTMLTableCellElement.cpp | 4 +- .../content/src/nsHTMLTableColElement.cpp | 4 +- .../src/nsHTMLTableColGroupElement.cpp | 4 +- .../html/content/src/nsHTMLTableElement.cpp | 4 +- .../content/src/nsHTMLTableRowElement.cpp | 4 +- .../content/src/nsHTMLTableSectionElement.cpp | 4 +- .../content/src/nsHTMLTextAreaElement.cpp | 4 +- .../html/content/src/nsHTMLTitleElement.cpp | 4 +- .../html/content/src/nsHTMLUListElement.cpp | 4 +- .../html/content/src/nsHTMLWBRElement.cpp | 4 +- .../content/html/style/src/nsCSSStyleRule.cpp | 41 ++++++++- .../html/style/src/nsHTMLAttributes.cpp | 32 +++++-- .../html/style/src/nsHTMLStyleSheet.cpp | 88 ++++++++++++------- .../html/style/src/nsIHTMLAttributes.h | 3 +- mozilla/layout/base/public/nsIStyleRule.h | 3 + mozilla/layout/base/src/nsStyleContext.cpp | 10 +++ mozilla/layout/html/base/src/nsIHTMLContent.h | 3 +- .../html/content/src/nsGenericHTMLElement.cpp | 5 +- .../html/content/src/nsGenericHTMLElement.h | 6 +- .../html/content/src/nsHTMLAnchorElement.cpp | 4 +- .../html/content/src/nsHTMLAppletElement.cpp | 4 +- .../html/content/src/nsHTMLAreaElement.cpp | 4 +- .../html/content/src/nsHTMLBRElement.cpp | 4 +- .../html/content/src/nsHTMLBaseElement.cpp | 4 +- .../content/src/nsHTMLBaseFontElement.cpp | 13 ++- .../html/content/src/nsHTMLBodyElement.cpp | 42 ++++++--- .../html/content/src/nsHTMLButtonElement.cpp | 4 +- .../html/content/src/nsHTMLDListElement.cpp | 4 +- .../html/content/src/nsHTMLDelElement.cpp | 4 +- .../content/src/nsHTMLDirectoryElement.cpp | 4 +- .../html/content/src/nsHTMLDivElement.cpp | 4 +- .../html/content/src/nsHTMLEmbedElement.cpp | 4 +- .../content/src/nsHTMLFieldSetElement.cpp | 4 +- .../html/content/src/nsHTMLFontElement.cpp | 26 ++++-- .../html/content/src/nsHTMLFormElement.cpp | 4 +- .../html/content/src/nsHTMLFrameElement.cpp | 4 +- .../content/src/nsHTMLFrameSetElement.cpp | 4 +- .../html/content/src/nsHTMLHRElement.cpp | 4 +- .../html/content/src/nsHTMLHeadElement.cpp | 4 +- .../html/content/src/nsHTMLHeadingElement.cpp | 4 +- .../html/content/src/nsHTMLHtmlElement.cpp | 4 +- .../html/content/src/nsHTMLIFrameElement.cpp | 4 +- .../html/content/src/nsHTMLImageElement.cpp | 4 +- .../html/content/src/nsHTMLInputElement.cpp | 4 +- .../html/content/src/nsHTMLInsElement.cpp | 4 +- .../html/content/src/nsHTMLIsIndexElement.cpp | 4 +- .../html/content/src/nsHTMLLIElement.cpp | 4 +- .../html/content/src/nsHTMLLabelElement.cpp | 4 +- .../html/content/src/nsHTMLLayerElement.cpp | 4 +- .../html/content/src/nsHTMLLegendElement.cpp | 4 +- .../html/content/src/nsHTMLLinkElement.cpp | 4 +- .../html/content/src/nsHTMLMapElement.cpp | 4 +- .../html/content/src/nsHTMLMenuElement.cpp | 4 +- .../html/content/src/nsHTMLMetaElement.cpp | 4 +- .../html/content/src/nsHTMLModElement.cpp | 4 +- .../html/content/src/nsHTMLOListElement.cpp | 4 +- .../html/content/src/nsHTMLObjectElement.cpp | 4 +- .../content/src/nsHTMLOptGroupElement.cpp | 4 +- .../html/content/src/nsHTMLOptionElement.cpp | 4 +- .../content/src/nsHTMLParagraphElement.cpp | 4 +- .../html/content/src/nsHTMLParamElement.cpp | 4 +- .../html/content/src/nsHTMLPreElement.cpp | 30 +++++-- .../html/content/src/nsHTMLQuoteElement.cpp | 4 +- .../html/content/src/nsHTMLScriptElement.cpp | 4 +- .../html/content/src/nsHTMLSelectElement.cpp | 4 +- .../html/content/src/nsHTMLSpacerElement.cpp | 4 +- .../html/content/src/nsHTMLSpanElement.cpp | 4 +- .../html/content/src/nsHTMLStyleElement.cpp | 4 +- .../content/src/nsHTMLTableCaptionElement.cpp | 4 +- .../content/src/nsHTMLTableCellElement.cpp | 4 +- .../content/src/nsHTMLTableColElement.cpp | 4 +- .../src/nsHTMLTableColGroupElement.cpp | 4 +- .../html/content/src/nsHTMLTableElement.cpp | 4 +- .../content/src/nsHTMLTableRowElement.cpp | 4 +- .../content/src/nsHTMLTableSectionElement.cpp | 4 +- .../content/src/nsHTMLTextAreaElement.cpp | 4 +- .../html/content/src/nsHTMLTitleElement.cpp | 4 +- .../html/content/src/nsHTMLUListElement.cpp | 4 +- .../html/content/src/nsHTMLWBRElement.cpp | 4 +- .../layout/html/style/src/nsCSSStyleRule.cpp | 41 ++++++++- .../html/style/src/nsHTMLAttributes.cpp | 32 +++++-- .../html/style/src/nsHTMLStyleSheet.cpp | 88 ++++++++++++------- .../layout/html/style/src/nsIHTMLAttributes.h | 3 +- mozilla/layout/style/nsCSSStyleRule.cpp | 41 ++++++++- mozilla/layout/style/nsHTMLStyleSheet.cpp | 88 ++++++++++++------- mozilla/layout/style/nsIStyleRule.h | 3 + mozilla/layout/style/nsStyleContext.cpp | 10 +++ 142 files changed, 900 insertions(+), 294 deletions(-) diff --git a/mozilla/content/base/public/nsIStyleRule.h b/mozilla/content/base/public/nsIStyleRule.h index af538ce969d..ee7852f50de 100644 --- a/mozilla/content/base/public/nsIStyleRule.h +++ b/mozilla/content/base/public/nsIStyleRule.h @@ -44,6 +44,9 @@ public: // Strength is an out-of-band weighting, useful for mapping CSS ! important NS_IMETHOD GetStrength(PRInt32& aStrength) const = 0; + // Map only font data into style context + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) = 0; + // Map all non-font info into style context NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) = 0; NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; diff --git a/mozilla/content/base/src/nsStyleContext.cpp b/mozilla/content/base/src/nsStyleContext.cpp index 7686e760b0f..6ba9be560af 100644 --- a/mozilla/content/base/src/nsStyleContext.cpp +++ b/mozilla/content/base/src/nsStyleContext.cpp @@ -1715,6 +1715,14 @@ struct MapStyleData { nsIPresContext* mPresContext; }; +static PRBool MapStyleRuleFont(nsISupports* aRule, void* aData) +{ + nsIStyleRule* rule = (nsIStyleRule*)aRule; + MapStyleData* data = (MapStyleData*)aData; + rule->MapFontStyleInto(data->mStyleContext, data->mPresContext); + return PR_TRUE; +} + static PRBool MapStyleRule(nsISupports* aRule, void* aData) { nsIStyleRule* rule = (nsIStyleRule*)aRule; @@ -1748,6 +1756,7 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext) if ((nsnull != mRules) && (0 < mRules->Count())) { MapStyleData data(this, aPresContext); + mRules->EnumerateForwards(MapStyleRuleFont, &data); mRules->EnumerateForwards(MapStyleRule, &data); } if (-1 == mDataCode) { @@ -1778,6 +1787,7 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext) if ((nsnull != mRules) && (0 < mRules->Count())) { MapStyleData data(this, aPresContext); + mRules->EnumerateForwards(MapStyleRuleFont, &data); mRules->EnumerateForwards(MapStyleRule, &data); } // reset all font data for tables again diff --git a/mozilla/content/html/content/public/nsIHTMLContent.h b/mozilla/content/html/content/public/nsIHTMLContent.h index 936780f9251..8bbf9fb24cc 100644 --- a/mozilla/content/html/content/public/nsIHTMLContent.h +++ b/mozilla/content/html/content/public/nsIHTMLContent.h @@ -55,7 +55,8 @@ public: NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute, nsHTMLValue& aValue) const = 0; - NS_IMETHOD GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const = 0; + NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const = 0; NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 702d825b3f7..d910db1ffeb 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -224,10 +224,11 @@ static nsresult EnsureWritableAttributes(nsIHTMLContent* aContent, if (nsnull == aAttributes) { if (PR_TRUE == aCreate) { + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - result = aContent->GetAttributeMappingFunction(mapFunc); + result = aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); if (NS_OK == result) { - result = NS_NewHTMLAttributes(&aAttributes, nsnull, mapFunc); + result = NS_NewHTMLAttributes(&aAttributes, nsnull, fontMapFunc, mapFunc); if (NS_OK == result) { aAttributes->AddContentRef(); } diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index c1d5f77c9e7..5dcdee92d7f 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -455,7 +455,8 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \ const nsHTMLValue& aValue, \ nsString& aResult) const; \ - NS_IMETHOD GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const; \ + NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ + nsMapAttributesFunc& aMapFunc) const; \ NS_IMETHOD GetStyleHintForAttributeChange(const nsIAtom* aAttribute, \ PRInt32 *aHint) const; @@ -500,7 +501,8 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \ const nsHTMLValue& aValue, \ nsString& aResult) const; \ - NS_IMETHOD GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const; \ + NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ + nsMapAttributesFunc& aMapFunc) const; \ NS_IMETHOD GetStyleHintForAttributeChange(const nsIAtom* aAttribute, \ PRInt32 *aHint) const; diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index 686fb0ca215..083bdae46b5 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -257,8 +257,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLAnchorElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLAnchorElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp b/mozilla/content/html/content/src/nsHTMLAppletElement.cpp index 1f8d7d24f61..b028b3306de 100644 --- a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAppletElement.cpp @@ -223,8 +223,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLAppletElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLAppletElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp index bfc090cc14c..72a6b730924 100644 --- a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp @@ -183,8 +183,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLAreaElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLAreaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLBRElement.cpp b/mozilla/content/html/content/src/nsHTMLBRElement.cpp index f4e287ac96c..79e6e82ac58 100644 --- a/mozilla/content/html/content/src/nsHTMLBRElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBRElement.cpp @@ -178,8 +178,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLBRElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLBaseElement.cpp b/mozilla/content/html/content/src/nsHTMLBaseElement.cpp index 1d91e1fdff4..850a1be4f75 100644 --- a/mozilla/content/html/content/src/nsHTMLBaseElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBaseElement.cpp @@ -152,8 +152,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLBaseElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLBaseElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp b/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp index 41f92743dae..7afb9f15ce9 100644 --- a/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp @@ -148,18 +148,27 @@ nsHTMLBaseFontElement::AttributeToString(nsIAtom* aAttribute, return mInner.AttributeToString(aAttribute, aValue, aResult); } +static void +MapFontAttributesInto(nsIHTMLAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me +} + static void MapAttributesInto(nsIHTMLAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { - // XXX write me nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } NS_IMETHODIMP -nsHTMLBaseFontElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLBaseFontElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = &MapFontAttributesInto; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp index 27464a93faf..7f899ed9407 100644 --- a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp @@ -63,6 +63,8 @@ public: // Strength is an out-of-band weighting, always 0 here NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); @@ -87,6 +89,8 @@ public: // Strength is an out-of-band weighting, always maxint here NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); @@ -250,6 +254,22 @@ BodyRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +BodyRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + // set up the basefont (defaults to 3) + nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font); + const nsFont& defaultFont = aPresContext->GetDefaultFontDeprecated(); + const nsFont& defaultFixedFont = aPresContext->GetDefaultFixedFontDeprecated(); + PRInt32 scaler; + aPresContext->GetFontScaler(&scaler); + float scaleFactor = nsStyleUtil::GetScalingFactor(scaler); + font->mFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFont.size, scaleFactor); + font->mFixedFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFixedFont.size, scaleFactor); + + return NS_OK; +} + NS_IMETHODIMP BodyRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -295,8 +315,9 @@ BodyRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) } if (count < attrCount) { // more to go... + nsMapAttributesFunc fontFunc; nsMapAttributesFunc func; - mPart->GetAttributeMappingFunction(func); + mPart->GetAttributeMappingFunctions(fontFunc, func); (*func)(mPart->mInner.mAttributes, aContext, aPresContext); } } @@ -447,6 +468,12 @@ BodyFixupRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +BodyFixupRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + return NS_OK; +} + NS_IMETHODIMP BodyFixupRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -723,22 +750,15 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, spacing->mPadding.SetBottom(c); } - // set up the basefont (defaults to 3) - nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font); - const nsFont& defaultFont = aPresContext->GetDefaultFontDeprecated(); - const nsFont& defaultFixedFont = aPresContext->GetDefaultFixedFontDeprecated(); - PRInt32 scaler; - aPresContext->GetFontScaler(&scaler); - float scaleFactor = nsStyleUtil::GetScalingFactor(scaler); - font->mFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFont.size, scaleFactor); - font->mFixedFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFixedFont.size, scaleFactor); } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } NS_IMETHODIMP -nsHTMLBodyElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLBodyElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp index 4ca8a1e14e3..25667eeb083 100644 --- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp @@ -349,8 +349,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLButtonElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLButtonElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLDListElement.cpp b/mozilla/content/html/content/src/nsHTMLDListElement.cpp index 333bd6093b5..5df67fefb4d 100644 --- a/mozilla/content/html/content/src/nsHTMLDListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDListElement.cpp @@ -162,8 +162,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLDListElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLDListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLDelElement.cpp b/mozilla/content/html/content/src/nsHTMLDelElement.cpp index d747d22e06b..56670de721f 100644 --- a/mozilla/content/html/content/src/nsHTMLDelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDelElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLDelElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLDelElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp b/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp index 0ed6f704546..58801c4894b 100644 --- a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp @@ -190,8 +190,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLDirectoryElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLDirectoryElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLDivElement.cpp b/mozilla/content/html/content/src/nsHTMLDivElement.cpp index b658d6cb1bf..1663e3e09f5 100644 --- a/mozilla/content/html/content/src/nsHTMLDivElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDivElement.cpp @@ -185,8 +185,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLDivElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLDivElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp b/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp index 1ab107e0b0e..b523e90cb7e 100644 --- a/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp @@ -171,8 +171,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLEmbedElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLEmbedElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp b/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp index ce7de5daa2d..1bf56cc1685 100644 --- a/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp @@ -229,8 +229,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLFieldSetElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFieldSetElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLFontElement.cpp b/mozilla/content/html/content/src/nsHTMLFontElement.cpp index 0d68b56096f..3a29b969bc1 100644 --- a/mozilla/content/html/content/src/nsHTMLFontElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFontElement.cpp @@ -188,9 +188,9 @@ nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext) +MapFontAttributesInto(nsIHTMLAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) { if (nsnull != aAttributes) { nsHTMLValue value; @@ -292,8 +292,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, font->mFixedFont.weight = weight; } + NS_IF_RELEASE(parentContext); + } +} + +static void +MapAttributesInto(nsIHTMLAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + if (nsnull != aAttributes) { + nsHTMLValue value; + // color: color if (NS_CONTENT_ATTR_NOT_THERE != aAttributes->GetAttribute(nsHTMLAtoms::color, value)) { + const nsStyleFont* font = (const nsStyleFont*) + aContext->GetStyleData(eStyleStruct_Font); nsStyleColor* color = (nsStyleColor*) aContext->GetMutableStyleData(eStyleStruct_Color); nsStyleText* text = (nsStyleText*) @@ -312,15 +326,15 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, text->mTextDecoration = font->mFont.decorations; // re-apply inherited text decoration, so colors sync } } - - NS_IF_RELEASE(parentContext); } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } NS_IMETHODIMP -nsHTMLFontElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFontElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = &MapFontAttributesInto; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLFormElement.cpp b/mozilla/content/html/content/src/nsHTMLFormElement.cpp index 3ef153028bc..b5fc3dd0413 100644 --- a/mozilla/content/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFormElement.cpp @@ -382,8 +382,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLFormElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFormElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp index 2dcbbd0f684..430c34a8e59 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp @@ -205,8 +205,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLFrameElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFrameElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp index aa35471e7a2..a9da35f1faf 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -170,8 +170,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLFrameSetElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFrameSetElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLHRElement.cpp b/mozilla/content/html/content/src/nsHTMLHRElement.cpp index 74866b490e4..5f07cbc55cf 100644 --- a/mozilla/content/html/content/src/nsHTMLHRElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHRElement.cpp @@ -263,8 +263,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLHRElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLHRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLHeadElement.cpp b/mozilla/content/html/content/src/nsHTMLHeadElement.cpp index 6e30e2c383c..f37dac205a6 100644 --- a/mozilla/content/html/content/src/nsHTMLHeadElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHeadElement.cpp @@ -149,8 +149,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLHeadElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLHeadElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp b/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp index 5c203455601..5c811921ecf 100644 --- a/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp @@ -170,8 +170,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLHeadingElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLHeadingElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp b/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp index 7fabb8a3373..5deb8030e2b 100644 --- a/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLHtmlElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLHtmlElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp index 8fc6f81f7d3..4356abda7b9 100644 --- a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp @@ -261,8 +261,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLIFrameElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLIFrameElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLImageElement.cpp b/mozilla/content/html/content/src/nsHTMLImageElement.cpp index 8b06ab3723f..cd1c72153bc 100644 --- a/mozilla/content/html/content/src/nsHTMLImageElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLImageElement.cpp @@ -283,8 +283,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLImageElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLImageElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index a0990be4388..a1b24138a09 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -656,8 +656,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLInputElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLInputElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLInsElement.cpp b/mozilla/content/html/content/src/nsHTMLInsElement.cpp index dcca1aa6e6a..76b21125193 100644 --- a/mozilla/content/html/content/src/nsHTMLInsElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInsElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLInsElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLInsElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp b/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp index 909c1e1f02c..9069e841b50 100644 --- a/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp @@ -161,8 +161,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLIsIndexElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLIsIndexElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLLIElement.cpp b/mozilla/content/html/content/src/nsHTMLLIElement.cpp index 27e8e36b6fd..3a40b283520 100644 --- a/mozilla/content/html/content/src/nsHTMLLIElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLIElement.cpp @@ -193,8 +193,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLLIElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLLIElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp index f3df2074067..41a2f24ccd3 100644 --- a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp @@ -253,8 +253,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLLabelElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLLabelElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLLegendElement.cpp b/mozilla/content/html/content/src/nsHTMLLegendElement.cpp index aee04afeec5..26fbb8e96da 100644 --- a/mozilla/content/html/content/src/nsHTMLLegendElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLegendElement.cpp @@ -197,8 +197,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLLegendElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLLegendElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLLinkElement.cpp b/mozilla/content/html/content/src/nsHTMLLinkElement.cpp index a2fc9cbc092..3c6dc6f0be3 100644 --- a/mozilla/content/html/content/src/nsHTMLLinkElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLinkElement.cpp @@ -250,8 +250,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLLinkElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLLinkElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLMapElement.cpp b/mozilla/content/html/content/src/nsHTMLMapElement.cpp index 93afb6eb9da..5313e2574ef 100644 --- a/mozilla/content/html/content/src/nsHTMLMapElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMapElement.cpp @@ -311,8 +311,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLMapElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLMapElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp b/mozilla/content/html/content/src/nsHTMLMenuElement.cpp index 8fc9c7af4f2..24538a48aec 100644 --- a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMenuElement.cpp @@ -190,8 +190,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLMenuElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLMenuElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLMetaElement.cpp b/mozilla/content/html/content/src/nsHTMLMetaElement.cpp index 02f8ef2ba6e..b937dae4637 100644 --- a/mozilla/content/html/content/src/nsHTMLMetaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMetaElement.cpp @@ -158,8 +158,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLMetaElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLMetaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLModElement.cpp b/mozilla/content/html/content/src/nsHTMLModElement.cpp index 5ef2ccf8df7..e0c9a696784 100644 --- a/mozilla/content/html/content/src/nsHTMLModElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLModElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLModElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLModElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLOListElement.cpp b/mozilla/content/html/content/src/nsHTMLOListElement.cpp index bc85ac64170..0782afd204c 100644 --- a/mozilla/content/html/content/src/nsHTMLOListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOListElement.cpp @@ -217,8 +217,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLOListElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLOListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp index c84a4280277..9e86beaab19 100644 --- a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp @@ -227,8 +227,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLObjectElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLObjectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp b/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp index 34f52c44072..ac7c21a9401 100644 --- a/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLOptGroupElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLOptGroupElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLOptionElement.cpp b/mozilla/content/html/content/src/nsHTMLOptionElement.cpp index 5013117d6bf..7e596105ac8 100644 --- a/mozilla/content/html/content/src/nsHTMLOptionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOptionElement.cpp @@ -329,8 +329,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLOptionElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLOptionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp b/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp index e1bb451d06b..5fad36aec26 100644 --- a/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp @@ -177,8 +177,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLParagraphElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLParagraphElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLParamElement.cpp b/mozilla/content/html/content/src/nsHTMLParamElement.cpp index 42738210bc1..2b96e7d58ad 100644 --- a/mozilla/content/html/content/src/nsHTMLParamElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLParamElement.cpp @@ -161,8 +161,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLParamElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLParamElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLPreElement.cpp b/mozilla/content/html/content/src/nsHTMLPreElement.cpp index 51e82028067..a663ea38120 100644 --- a/mozilla/content/html/content/src/nsHTMLPreElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLPreElement.cpp @@ -168,6 +168,24 @@ nsHTMLPreElement::AttributeToString(nsIAtom* aAttribute, return mInner.AttributeToString(aAttribute, aValue, aResult); } +static void +MapFontAttributesInto(nsIHTMLAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + if (nsnull != aAttributes) { + nsHTMLValue value; + + // variable: empty + aAttributes->GetAttribute(nsHTMLAtoms::variable, value); + if (value.GetUnit() == eHTMLUnit_Empty) { + nsStyleFont* font = (nsStyleFont*) + aContext->GetMutableStyleData(eStyleStruct_Font); + font->mFont.name = "serif"; + } + } +} + static void MapAttributesInto(nsIHTMLAttributes* aAttributes, nsIStyleContext* aContext, @@ -184,14 +202,6 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, text->mWhiteSpace = NS_STYLE_WHITESPACE_MOZ_PRE_WRAP; } - // variable: empty - aAttributes->GetAttribute(nsHTMLAtoms::variable, value); - if (value.GetUnit() == eHTMLUnit_Empty) { - nsStyleFont* font = (nsStyleFont*) - aContext->GetMutableStyleData(eStyleStruct_Font); - font->mFont.name = "serif"; - } - // cols: int (nav4 attribute) aAttributes->GetAttribute(nsHTMLAtoms::cols, value); if (value.GetUnit() == eHTMLUnit_Integer) { @@ -229,8 +239,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLPreElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLPreElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = &MapFontAttributesInto; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp b/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp index bb77fb6f7c2..50e7a0afd84 100644 --- a/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp @@ -152,8 +152,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLQuoteElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLQuoteElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp index dba36bb1dcd..92cd9301bbc 100644 --- a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp @@ -213,8 +213,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLScriptElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLScriptElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp index 71da7a9f6a9..39a0215bcae 100644 --- a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp @@ -494,8 +494,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLSelectElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLSelectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp b/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp index c84a4280277..9e86beaab19 100644 --- a/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -227,8 +227,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLObjectElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLObjectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp index 79583bca2cc..757755de636 100644 --- a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp @@ -201,8 +201,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLSpacerElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLSpacerElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp index 07dcea1e553..ed224b3d7fa 100644 --- a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp @@ -138,8 +138,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLSpanElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLSpanElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLStyleElement.cpp b/mozilla/content/html/content/src/nsHTMLStyleElement.cpp index c9aa3fcda69..60b75a9a35f 100644 --- a/mozilla/content/html/content/src/nsHTMLStyleElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLStyleElement.cpp @@ -234,8 +234,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLStyleElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLStyleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp b/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp index 79b8c6e71bc..21828141e6a 100644 --- a/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp @@ -187,8 +187,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableCaptionElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableCaptionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp b/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp index e33fa2169d2..722561f927d 100644 --- a/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp @@ -465,8 +465,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableCellElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableCellElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLTableColElement.cpp b/mozilla/content/html/content/src/nsHTMLTableColElement.cpp index baeacbec8b0..f63a41aee75 100644 --- a/mozilla/content/html/content/src/nsHTMLTableColElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableColElement.cpp @@ -286,8 +286,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, NS_IMETHODIMP -nsHTMLTableColElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableColElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp b/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp index 153ed9ebc9e..462e55832e7 100644 --- a/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp @@ -275,8 +275,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, NS_IMETHODIMP -nsHTMLTableColGroupElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableColGroupElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLTableElement.cpp b/mozilla/content/html/content/src/nsHTMLTableElement.cpp index 5fb7fb80a01..d2c818975cb 100644 --- a/mozilla/content/html/content/src/nsHTMLTableElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableElement.cpp @@ -1217,8 +1217,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp index e4a67b46110..6b6ab687473 100644 --- a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp @@ -608,8 +608,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableRowElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableRowElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp b/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp index 49381b2e2d5..fa345e4417b 100644 --- a/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp @@ -332,8 +332,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableSectionElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableSectionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp index 6db3361426a..81ccea623be 100644 --- a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -407,8 +407,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTextAreaElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTextAreaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLTitleElement.cpp b/mozilla/content/html/content/src/nsHTMLTitleElement.cpp index 300e8d6d588..240c641ef51 100644 --- a/mozilla/content/html/content/src/nsHTMLTitleElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTitleElement.cpp @@ -153,8 +153,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTitleElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTitleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLUListElement.cpp b/mozilla/content/html/content/src/nsHTMLUListElement.cpp index ca47f7c37c4..a628b8ce56b 100644 --- a/mozilla/content/html/content/src/nsHTMLUListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLUListElement.cpp @@ -195,8 +195,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLUListElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLUListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLWBRElement.cpp b/mozilla/content/html/content/src/nsHTMLWBRElement.cpp index c1556c0d385..97fcd7b684a 100644 --- a/mozilla/content/html/content/src/nsHTMLWBRElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLWBRElement.cpp @@ -147,8 +147,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLWBRElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLWBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/content/html/style/src/nsCSSStyleRule.cpp b/mozilla/content/html/style/src/nsCSSStyleRule.cpp index c7704990f44..c95633687bc 100644 --- a/mozilla/content/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleRule.cpp @@ -401,6 +401,9 @@ static PRBool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord, PRInt32 aMask, const nsStyleFont* aFont, nsIPresContext* aPresContext); +static void MapDeclarationFontInto(nsICSSDeclaration* aDeclaration, + nsIStyleContext* aContext, + nsIPresContext* aPresContext); static void MapDeclarationInto(nsICSSDeclaration* aDeclaration, nsIStyleContext* aContext, nsIPresContext* aPresContext); @@ -421,6 +424,7 @@ public: // Strength is an out-of-band weighting, useful for mapping CSS ! important NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; @@ -479,6 +483,13 @@ CSSImportantRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +CSSImportantRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + MapDeclarationFontInto(mDeclaration, aContext, aPresContext); + return NS_OK; +} + NS_IMETHODIMP CSSImportantRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -642,6 +653,7 @@ public: NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const; NS_IMETHOD SetStyleSheet(nsICSSStyleSheet* aSheet); + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; @@ -1145,6 +1157,13 @@ static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor, nsc return result; } +NS_IMETHODIMP +CSSStyleRuleImpl::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + MapDeclarationFontInto(mDeclaration, aContext, aPresContext); + return NS_OK; +} + NS_IMETHODIMP CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -1167,8 +1186,8 @@ nsString& Unquote(nsString& aString) return aString; } -void MapDeclarationInto(nsICSSDeclaration* aDeclaration, - nsIStyleContext* aContext, nsIPresContext* aPresContext) +void MapDeclarationFontInto(nsICSSDeclaration* aDeclaration, + nsIStyleContext* aContext, nsIPresContext* aPresContext) { if (nsnull != aDeclaration) { nsIStyleContext* parentContext = aContext->GetParent(); @@ -1321,6 +1340,21 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration, } } + NS_IF_RELEASE(parentContext); + } +} + +void MapDeclarationInto(nsICSSDeclaration* aDeclaration, + nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + if (nsnull != aDeclaration) { + nsIStyleContext* parentContext = aContext->GetParent(); + nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font); + const nsStyleFont* parentFont = font; + if (nsnull != parentContext) { + parentFont = (const nsStyleFont*)parentContext->GetStyleData(eStyleStruct_Font); + } + nsCSSText* ourText; if (NS_OK == aDeclaration->GetData(kCSSTextSID, (nsCSSStruct**)&ourText)) { if (nsnull != ourText) { @@ -2300,6 +2334,9 @@ static void ListSelector(FILE* out, const nsCSSSelector* aSelector) aSelector->mTag->ToString(buffer); fputs(buffer, out); } + else { + fputs("*", out); + } if (nsnull != aSelector->mID) { aSelector->mID->ToString(buffer); fputs("#", out); diff --git a/mozilla/content/html/style/src/nsHTMLAttributes.cpp b/mozilla/content/html/style/src/nsHTMLAttributes.cpp index bae6cb92862..c6d0fafe931 100644 --- a/mozilla/content/html/style/src/nsHTMLAttributes.cpp +++ b/mozilla/content/html/style/src/nsHTMLAttributes.cpp @@ -183,7 +183,9 @@ public: void* operator new(size_t size, nsIArena* aArena); void operator delete(void* ptr); - HTMLAttributesImpl(nsIHTMLStyleSheet* aSheet, nsMapAttributesFunc aMapFunc); + HTMLAttributesImpl(nsIHTMLStyleSheet* aSheet, + nsMapAttributesFunc aFontMapFunc, + nsMapAttributesFunc aMapFunc); HTMLAttributesImpl(const HTMLAttributesImpl& aCopy); ~HTMLAttributesImpl(void); @@ -218,7 +220,7 @@ public: NS_IMETHOD Clone(nsIHTMLAttributes** aInstancePtrResult) const; NS_IMETHOD Reset(void); - NS_IMETHOD SetMappingFunction(nsMapAttributesFunc aMapFunc); + NS_IMETHOD SetMappingFunctions(nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc); // nsIStyleRule NS_IMETHOD Equals(const nsIStyleRule* aRule, PRBool& aResult) const; @@ -226,6 +228,7 @@ public: NS_IMETHOD SetStyleSheet(nsIHTMLStyleSheet* aSheet); // Strength is an out-of-band weighting, always 0 here NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; @@ -244,6 +247,7 @@ protected: HTMLAttribute mFirst; nsIAtom* mID; nsClassList* mClassList; + nsMapAttributesFunc mFontMapper; nsMapAttributesFunc mMapper; #ifdef DEBUG_REFS @@ -294,6 +298,7 @@ void HTMLAttributesImpl::operator delete(void* ptr) HTMLAttributesImpl::HTMLAttributesImpl(nsIHTMLStyleSheet* aSheet, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc) : mSheet(aSheet), mFirst(), @@ -301,6 +306,7 @@ HTMLAttributesImpl::HTMLAttributesImpl(nsIHTMLStyleSheet* aSheet, mID(nsnull), mClassList(nsnull), mContentRefCount(0), + mFontMapper(aFontMapFunc), mMapper(aMapFunc) { NS_INIT_REFCNT(); @@ -318,6 +324,7 @@ HTMLAttributesImpl::HTMLAttributesImpl(const HTMLAttributesImpl& aCopy) mID(aCopy.mID), mClassList(nsnull), mContentRefCount(0), + mFontMapper(aCopy.mFontMapper), mMapper(aCopy.mMapper) { NS_INIT_REFCNT(); @@ -789,22 +796,35 @@ HTMLAttributesImpl::Reset(void) delete mClassList; mClassList = nsnull; } + mFontMapper = nsnull; mMapper = nsnull; return NS_OK; } NS_IMETHODIMP -HTMLAttributesImpl::SetMappingFunction(nsMapAttributesFunc aMapFunc) +HTMLAttributesImpl::SetMappingFunctions(nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc) { + mFontMapper = aFontMapFunc; mMapper = aMapFunc; return NS_OK; } +NS_IMETHODIMP +HTMLAttributesImpl::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + if (0 < mCount) { + if (nsnull != mFontMapper) { + (*mFontMapper)(this, aContext, aPresContext); + } + } + return NS_OK; +} + NS_IMETHODIMP HTMLAttributesImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { if (0 < mCount) { - NS_ASSERTION(nsnull != mMapper, "no mapping function"); + NS_ASSERTION(mMapper || mFontMapper, "no mapping function"); if (nsnull != mMapper) { (*mMapper)(this, aContext, aPresContext); } @@ -853,13 +873,13 @@ HTMLAttributesImpl::List(FILE* out, PRInt32 aIndent) const extern NS_HTML nsresult NS_NewHTMLAttributes(nsIHTMLAttributes** aInstancePtrResult, nsIHTMLStyleSheet* aSheet, - nsMapAttributesFunc aMapFunc) + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc) { if (aInstancePtrResult == nsnull) { return NS_ERROR_NULL_POINTER; } - HTMLAttributesImpl *it = new HTMLAttributesImpl(aSheet, aMapFunc); + HTMLAttributesImpl *it = new HTMLAttributesImpl(aSheet, aFontMapFunc, aMapFunc); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; diff --git a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp index 3b8a037e843..9795d527ab2 100644 --- a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp @@ -60,6 +60,7 @@ public: // Strength is an out-of-band weighting, always 0 here NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; @@ -110,6 +111,12 @@ HTMLAnchorRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +HTMLAnchorRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + return NS_OK; +} + NS_IMETHODIMP HTMLAnchorRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -132,7 +139,9 @@ HTMLAnchorRule::List(FILE* out, PRInt32 aIndent) const class AttributeKey: public nsHashKey { public: - AttributeKey(nsMapAttributesFunc aMapFunc, nsIHTMLAttributes* aAttributes); + AttributeKey(nsMapAttributesFunc aFontMapFunc, + nsMapAttributesFunc aMapFunc, + nsIHTMLAttributes* aAttributes); virtual ~AttributeKey(void); PRBool Equals(const nsHashKey* aOther) const; @@ -145,19 +154,27 @@ private: AttributeKey& operator=(const AttributeKey& aCopy); public: + nsMapAttributesFunc mFontMapFunc; nsMapAttributesFunc mMapFunc; nsIHTMLAttributes* mAttributes; - PRUint32 mHashSet: 1; - PRUint32 mHashCode: 31; + union { + struct { + PRUint32 mHashSet: 1; + PRUint32 mHashCode: 31; + } mBits; + PRUint32 mInitializer; + } mHash; }; -AttributeKey::AttributeKey(nsMapAttributesFunc aMapFunc, nsIHTMLAttributes* aAttributes) - : mMapFunc(aMapFunc), +AttributeKey::AttributeKey(nsMapAttributesFunc aFontMapFunc, + nsMapAttributesFunc aMapFunc, + nsIHTMLAttributes* aAttributes) + : mFontMapFunc(aFontMapFunc), + mMapFunc(aMapFunc), mAttributes(aAttributes) { NS_ADDREF(mAttributes); - mHashSet = 0; - mHashCode = 0; + mHash.mInitializer = 0; } AttributeKey::~AttributeKey(void) @@ -168,7 +185,7 @@ AttributeKey::~AttributeKey(void) PRBool AttributeKey::Equals(const nsHashKey* aOther) const { const AttributeKey* other = (const AttributeKey*)aOther; - if (mMapFunc == other->mMapFunc) { + if ((mMapFunc == other->mMapFunc) && (mFontMapFunc == other->mFontMapFunc)) { PRBool equals; mAttributes->Equals(other->mAttributes, equals); return equals; @@ -178,23 +195,23 @@ PRBool AttributeKey::Equals(const nsHashKey* aOther) const PRUint32 AttributeKey::HashValue(void) const { - if (0 == mHashSet) { + if (0 == mHash.mBits.mHashSet) { AttributeKey* self = (AttributeKey*)this; // break const PRUint32 hash; mAttributes->HashValue(hash); - self->mHashCode = (0x7FFFFFFF & hash); - self->mHashCode |= (0x7FFFFFFF & PRUint32(mMapFunc)); - self->mHashSet = 1; + self->mHash.mBits.mHashCode = (0x7FFFFFFF & hash); + self->mHash.mBits.mHashCode |= (0x7FFFFFFF & PRUint32(mFontMapFunc)); + self->mHash.mBits.mHashCode |= (0x7FFFFFFF & PRUint32(mMapFunc)); + self->mHash.mBits.mHashSet = 1; } - return mHashCode; + return mHash.mBits.mHashCode; } nsHashKey* AttributeKey::Clone(void) const { - AttributeKey* clown = new AttributeKey(mMapFunc, mAttributes); + AttributeKey* clown = new AttributeKey(mFontMapFunc, mMapFunc, mAttributes); if (nsnull != clown) { - clown->mHashSet = mHashSet; - clown->mHashCode = mHashCode; + clown->mHash.mInitializer = mHash.mInitializer; } return clown; } @@ -269,10 +286,12 @@ protected: virtual ~HTMLStyleSheetImpl(); NS_IMETHOD EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRBool aCreate, nsIHTMLAttributes*& aSingleAttrs); NS_IMETHOD UniqueAttributes(nsIHTMLAttributes*& aSingleAttrs, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRInt32 aAttrCount, nsIHTMLAttributes*& aAttributes); @@ -663,9 +682,10 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributesFor(nsIHTMLContent* aContent, nsI nsIHTMLAttributes* attrs = aAttributes; if (nsnull != attrs) { + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); - AttributeKey key(mapFunc, attrs); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); + AttributeKey key(fontMapFunc, mapFunc, attrs); nsIHTMLAttributes* sharedAttrs = (nsIHTMLAttributes*)mAttrTable.Get(&key); if (nsnull == sharedAttrs) { // we have a new unique set mAttrTable.Put(&key, attrs); @@ -692,17 +712,18 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, { nsresult result = NS_OK; nsIHTMLAttributes* attrs; + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - result = EnsureSingleAttributes(aAttributes, mapFunc, PR_TRUE, attrs); + result = EnsureSingleAttributes(aAttributes, fontMapFunc, mapFunc, PR_TRUE, attrs); if ((NS_OK == result) && (nsnull != attrs)) { PRInt32 count; attrs->SetAttribute(aAttribute, aValue, count); - result = UniqueAttributes(attrs, mapFunc, count, aAttributes); + result = UniqueAttributes(attrs, fontMapFunc, mapFunc, count, aAttributes); } return result; @@ -720,6 +741,7 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, NS_IMETHODIMP HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRBool aCreate, nsIHTMLAttributes*& aSingleAttrs) @@ -733,10 +755,10 @@ HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, NS_ASSERT_REFCOUNT(mRecycledAttrs, 1, "attributes used elsewhere"); aSingleAttrs = mRecycledAttrs; mRecycledAttrs = nsnull; - aSingleAttrs->SetMappingFunction(aMapFunc); + aSingleAttrs->SetMappingFunctions(aFontMapFunc, aMapFunc); } else { - result = NS_NewHTMLAttributes(&aSingleAttrs, this, aMapFunc); + result = NS_NewHTMLAttributes(&aSingleAttrs, this, aFontMapFunc, aMapFunc); } } else { @@ -763,7 +785,7 @@ HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, } else { // one content ref, ok to use, remove from table because hash may change if (1 == contentRefCount) { - AttributeKey key(aMapFunc, aSingleAttrs); + AttributeKey key(aFontMapFunc, aMapFunc, aSingleAttrs); mAttrTable.Remove(&key); NS_ADDREF(aSingleAttrs); // add a local ref so we match up } @@ -778,14 +800,14 @@ HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, NS_IMETHODIMP HTMLStyleSheetImpl::UniqueAttributes(nsIHTMLAttributes*& aSingleAttrs, - nsMapAttributesFunc aMapFunc, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRInt32 aAttrCount, nsIHTMLAttributes*& aAttributes) { nsresult result = NS_OK; if (0 < aAttrCount) { - AttributeKey key(aMapFunc, aSingleAttrs); + AttributeKey key(aFontMapFunc, aMapFunc, aSingleAttrs); nsIHTMLAttributes* sharedAttrs = (nsIHTMLAttributes*)mAttrTable.Get(&key); if (nsnull == sharedAttrs) { // we have a new unique set mAttrTable.Put(&key, aSingleAttrs); @@ -838,17 +860,18 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, nsresult result = NS_OK; nsIHTMLAttributes* attrs; PRBool hasValue = PRBool(eHTMLUnit_Null != aValue.GetUnit()); + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - result = EnsureSingleAttributes(aAttributes, mapFunc, hasValue, attrs); + result = EnsureSingleAttributes(aAttributes, fontMapFunc, mapFunc, hasValue, attrs); if ((NS_OK == result) && (nsnull != attrs)) { PRInt32 count; attrs->SetAttribute(aAttribute, aValue, count); - result = UniqueAttributes(attrs, mapFunc, count, aAttributes); + result = UniqueAttributes(attrs, fontMapFunc, mapFunc, count, aAttributes); } return result; @@ -860,17 +883,18 @@ NS_IMETHODIMP HTMLStyleSheetImpl::UnsetAttributeFor(nsIAtom* aAttribute, { nsresult result = NS_OK; nsIHTMLAttributes* attrs; + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - result = EnsureSingleAttributes(aAttributes, mapFunc, PR_FALSE, attrs); + result = EnsureSingleAttributes(aAttributes, fontMapFunc, mapFunc, PR_FALSE, attrs); if ((NS_OK == result) && (nsnull != attrs)) { PRInt32 count; attrs->UnsetAttribute(aAttribute, count); - result = UniqueAttributes(attrs, mapFunc, count, aAttributes); + result = UniqueAttributes(attrs, fontMapFunc, mapFunc, count, aAttributes); } return result; diff --git a/mozilla/content/html/style/src/nsIHTMLAttributes.h b/mozilla/content/html/style/src/nsIHTMLAttributes.h index 19c00447d70..1a2ef1f1983 100644 --- a/mozilla/content/html/style/src/nsIHTMLAttributes.h +++ b/mozilla/content/html/style/src/nsIHTMLAttributes.h @@ -63,7 +63,7 @@ public: NS_IMETHOD Clone(nsIHTMLAttributes** aInstancePtrResult) const = 0; NS_IMETHOD Reset(void) = 0; - NS_IMETHOD SetMappingFunction(nsMapAttributesFunc aMapFunc) = 0; + NS_IMETHOD SetMappingFunctions(nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc) = 0; NS_IMETHOD SetStyleSheet(nsIHTMLStyleSheet* aSheet) = 0; NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; @@ -72,6 +72,7 @@ public: extern NS_HTML nsresult NS_NewHTMLAttributes(nsIHTMLAttributes** aInstancePtrResult, nsIHTMLStyleSheet* aSheet, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc); #endif /* nsIHTMLAttributes_h___ */ diff --git a/mozilla/layout/base/public/nsIStyleRule.h b/mozilla/layout/base/public/nsIStyleRule.h index af538ce969d..ee7852f50de 100644 --- a/mozilla/layout/base/public/nsIStyleRule.h +++ b/mozilla/layout/base/public/nsIStyleRule.h @@ -44,6 +44,9 @@ public: // Strength is an out-of-band weighting, useful for mapping CSS ! important NS_IMETHOD GetStrength(PRInt32& aStrength) const = 0; + // Map only font data into style context + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) = 0; + // Map all non-font info into style context NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) = 0; NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; diff --git a/mozilla/layout/base/src/nsStyleContext.cpp b/mozilla/layout/base/src/nsStyleContext.cpp index 7686e760b0f..6ba9be560af 100644 --- a/mozilla/layout/base/src/nsStyleContext.cpp +++ b/mozilla/layout/base/src/nsStyleContext.cpp @@ -1715,6 +1715,14 @@ struct MapStyleData { nsIPresContext* mPresContext; }; +static PRBool MapStyleRuleFont(nsISupports* aRule, void* aData) +{ + nsIStyleRule* rule = (nsIStyleRule*)aRule; + MapStyleData* data = (MapStyleData*)aData; + rule->MapFontStyleInto(data->mStyleContext, data->mPresContext); + return PR_TRUE; +} + static PRBool MapStyleRule(nsISupports* aRule, void* aData) { nsIStyleRule* rule = (nsIStyleRule*)aRule; @@ -1748,6 +1756,7 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext) if ((nsnull != mRules) && (0 < mRules->Count())) { MapStyleData data(this, aPresContext); + mRules->EnumerateForwards(MapStyleRuleFont, &data); mRules->EnumerateForwards(MapStyleRule, &data); } if (-1 == mDataCode) { @@ -1778,6 +1787,7 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext) if ((nsnull != mRules) && (0 < mRules->Count())) { MapStyleData data(this, aPresContext); + mRules->EnumerateForwards(MapStyleRuleFont, &data); mRules->EnumerateForwards(MapStyleRule, &data); } // reset all font data for tables again diff --git a/mozilla/layout/html/base/src/nsIHTMLContent.h b/mozilla/layout/html/base/src/nsIHTMLContent.h index 936780f9251..8bbf9fb24cc 100644 --- a/mozilla/layout/html/base/src/nsIHTMLContent.h +++ b/mozilla/layout/html/base/src/nsIHTMLContent.h @@ -55,7 +55,8 @@ public: NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute, nsHTMLValue& aValue) const = 0; - NS_IMETHOD GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const = 0; + NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const = 0; NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp index 702d825b3f7..d910db1ffeb 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp @@ -224,10 +224,11 @@ static nsresult EnsureWritableAttributes(nsIHTMLContent* aContent, if (nsnull == aAttributes) { if (PR_TRUE == aCreate) { + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - result = aContent->GetAttributeMappingFunction(mapFunc); + result = aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); if (NS_OK == result) { - result = NS_NewHTMLAttributes(&aAttributes, nsnull, mapFunc); + result = NS_NewHTMLAttributes(&aAttributes, nsnull, fontMapFunc, mapFunc); if (NS_OK == result) { aAttributes->AddContentRef(); } diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.h b/mozilla/layout/html/content/src/nsGenericHTMLElement.h index c1d5f77c9e7..5dcdee92d7f 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.h @@ -455,7 +455,8 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \ const nsHTMLValue& aValue, \ nsString& aResult) const; \ - NS_IMETHOD GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const; \ + NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ + nsMapAttributesFunc& aMapFunc) const; \ NS_IMETHOD GetStyleHintForAttributeChange(const nsIAtom* aAttribute, \ PRInt32 *aHint) const; @@ -500,7 +501,8 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \ const nsHTMLValue& aValue, \ nsString& aResult) const; \ - NS_IMETHOD GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const; \ + NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ + nsMapAttributesFunc& aMapFunc) const; \ NS_IMETHOD GetStyleHintForAttributeChange(const nsIAtom* aAttribute, \ PRInt32 *aHint) const; diff --git a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp index 686fb0ca215..083bdae46b5 100644 --- a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp @@ -257,8 +257,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLAnchorElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLAnchorElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp b/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp index 1f8d7d24f61..b028b3306de 100644 --- a/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp @@ -223,8 +223,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLAppletElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLAppletElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp b/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp index bfc090cc14c..72a6b730924 100644 --- a/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp @@ -183,8 +183,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLAreaElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLAreaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLBRElement.cpp b/mozilla/layout/html/content/src/nsHTMLBRElement.cpp index f4e287ac96c..79e6e82ac58 100644 --- a/mozilla/layout/html/content/src/nsHTMLBRElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBRElement.cpp @@ -178,8 +178,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLBRElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp b/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp index 1d91e1fdff4..850a1be4f75 100644 --- a/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp @@ -152,8 +152,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLBaseElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLBaseElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp b/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp index 41f92743dae..7afb9f15ce9 100644 --- a/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp @@ -148,18 +148,27 @@ nsHTMLBaseFontElement::AttributeToString(nsIAtom* aAttribute, return mInner.AttributeToString(aAttribute, aValue, aResult); } +static void +MapFontAttributesInto(nsIHTMLAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me +} + static void MapAttributesInto(nsIHTMLAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { - // XXX write me nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } NS_IMETHODIMP -nsHTMLBaseFontElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLBaseFontElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = &MapFontAttributesInto; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp b/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp index 27464a93faf..7f899ed9407 100644 --- a/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp @@ -63,6 +63,8 @@ public: // Strength is an out-of-band weighting, always 0 here NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); @@ -87,6 +89,8 @@ public: // Strength is an out-of-band weighting, always maxint here NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); @@ -250,6 +254,22 @@ BodyRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +BodyRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + // set up the basefont (defaults to 3) + nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font); + const nsFont& defaultFont = aPresContext->GetDefaultFontDeprecated(); + const nsFont& defaultFixedFont = aPresContext->GetDefaultFixedFontDeprecated(); + PRInt32 scaler; + aPresContext->GetFontScaler(&scaler); + float scaleFactor = nsStyleUtil::GetScalingFactor(scaler); + font->mFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFont.size, scaleFactor); + font->mFixedFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFixedFont.size, scaleFactor); + + return NS_OK; +} + NS_IMETHODIMP BodyRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -295,8 +315,9 @@ BodyRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) } if (count < attrCount) { // more to go... + nsMapAttributesFunc fontFunc; nsMapAttributesFunc func; - mPart->GetAttributeMappingFunction(func); + mPart->GetAttributeMappingFunctions(fontFunc, func); (*func)(mPart->mInner.mAttributes, aContext, aPresContext); } } @@ -447,6 +468,12 @@ BodyFixupRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +BodyFixupRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + return NS_OK; +} + NS_IMETHODIMP BodyFixupRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -723,22 +750,15 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, spacing->mPadding.SetBottom(c); } - // set up the basefont (defaults to 3) - nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font); - const nsFont& defaultFont = aPresContext->GetDefaultFontDeprecated(); - const nsFont& defaultFixedFont = aPresContext->GetDefaultFixedFontDeprecated(); - PRInt32 scaler; - aPresContext->GetFontScaler(&scaler); - float scaleFactor = nsStyleUtil::GetScalingFactor(scaler); - font->mFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFont.size, scaleFactor); - font->mFixedFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFixedFont.size, scaleFactor); } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } NS_IMETHODIMP -nsHTMLBodyElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLBodyElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp index 4ca8a1e14e3..25667eeb083 100644 --- a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp @@ -349,8 +349,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLButtonElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLButtonElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLDListElement.cpp b/mozilla/layout/html/content/src/nsHTMLDListElement.cpp index 333bd6093b5..5df67fefb4d 100644 --- a/mozilla/layout/html/content/src/nsHTMLDListElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDListElement.cpp @@ -162,8 +162,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLDListElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLDListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLDelElement.cpp b/mozilla/layout/html/content/src/nsHTMLDelElement.cpp index d747d22e06b..56670de721f 100644 --- a/mozilla/layout/html/content/src/nsHTMLDelElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDelElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLDelElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLDelElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp b/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp index 0ed6f704546..58801c4894b 100644 --- a/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp @@ -190,8 +190,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLDirectoryElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLDirectoryElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLDivElement.cpp b/mozilla/layout/html/content/src/nsHTMLDivElement.cpp index b658d6cb1bf..1663e3e09f5 100644 --- a/mozilla/layout/html/content/src/nsHTMLDivElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDivElement.cpp @@ -185,8 +185,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLDivElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLDivElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp b/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp index 1ab107e0b0e..b523e90cb7e 100644 --- a/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp @@ -171,8 +171,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLEmbedElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLEmbedElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp b/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp index ce7de5daa2d..1bf56cc1685 100644 --- a/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp @@ -229,8 +229,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLFieldSetElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFieldSetElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp index 0d68b56096f..3a29b969bc1 100644 --- a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp @@ -188,9 +188,9 @@ nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext) +MapFontAttributesInto(nsIHTMLAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) { if (nsnull != aAttributes) { nsHTMLValue value; @@ -292,8 +292,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, font->mFixedFont.weight = weight; } + NS_IF_RELEASE(parentContext); + } +} + +static void +MapAttributesInto(nsIHTMLAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + if (nsnull != aAttributes) { + nsHTMLValue value; + // color: color if (NS_CONTENT_ATTR_NOT_THERE != aAttributes->GetAttribute(nsHTMLAtoms::color, value)) { + const nsStyleFont* font = (const nsStyleFont*) + aContext->GetStyleData(eStyleStruct_Font); nsStyleColor* color = (nsStyleColor*) aContext->GetMutableStyleData(eStyleStruct_Color); nsStyleText* text = (nsStyleText*) @@ -312,15 +326,15 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, text->mTextDecoration = font->mFont.decorations; // re-apply inherited text decoration, so colors sync } } - - NS_IF_RELEASE(parentContext); } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } NS_IMETHODIMP -nsHTMLFontElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFontElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = &MapFontAttributesInto; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp index 3ef153028bc..b5fc3dd0413 100644 --- a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp @@ -382,8 +382,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLFormElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFormElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp b/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp index 2dcbbd0f684..430c34a8e59 100644 --- a/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp @@ -205,8 +205,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLFrameElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFrameElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp index aa35471e7a2..a9da35f1faf 100644 --- a/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp @@ -170,8 +170,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLFrameSetElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLFrameSetElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLHRElement.cpp b/mozilla/layout/html/content/src/nsHTMLHRElement.cpp index 74866b490e4..5f07cbc55cf 100644 --- a/mozilla/layout/html/content/src/nsHTMLHRElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHRElement.cpp @@ -263,8 +263,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLHRElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLHRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp b/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp index 6e30e2c383c..f37dac205a6 100644 --- a/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp @@ -149,8 +149,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLHeadElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLHeadElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp b/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp index 5c203455601..5c811921ecf 100644 --- a/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp @@ -170,8 +170,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLHeadingElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLHeadingElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp b/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp index 7fabb8a3373..5deb8030e2b 100644 --- a/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLHtmlElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLHtmlElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp index 8fc6f81f7d3..4356abda7b9 100644 --- a/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp @@ -261,8 +261,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLIFrameElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLIFrameElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLImageElement.cpp b/mozilla/layout/html/content/src/nsHTMLImageElement.cpp index 8b06ab3723f..cd1c72153bc 100644 --- a/mozilla/layout/html/content/src/nsHTMLImageElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLImageElement.cpp @@ -283,8 +283,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLImageElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLImageElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp index a0990be4388..a1b24138a09 100644 --- a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp @@ -656,8 +656,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLInputElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLInputElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLInsElement.cpp b/mozilla/layout/html/content/src/nsHTMLInsElement.cpp index dcca1aa6e6a..76b21125193 100644 --- a/mozilla/layout/html/content/src/nsHTMLInsElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLInsElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLInsElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLInsElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp b/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp index 909c1e1f02c..9069e841b50 100644 --- a/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp @@ -161,8 +161,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLIsIndexElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLIsIndexElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLLIElement.cpp b/mozilla/layout/html/content/src/nsHTMLLIElement.cpp index 27e8e36b6fd..3a40b283520 100644 --- a/mozilla/layout/html/content/src/nsHTMLLIElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLIElement.cpp @@ -193,8 +193,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLLIElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLLIElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp b/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp index f3df2074067..41a2f24ccd3 100644 --- a/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp @@ -253,8 +253,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLLabelElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLLabelElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp b/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp index 870387b5ca3..886159ceec5 100644 --- a/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp @@ -268,8 +268,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLLayerElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLLayerElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp b/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp index aee04afeec5..26fbb8e96da 100644 --- a/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp @@ -197,8 +197,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLLegendElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLLegendElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp b/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp index a2fc9cbc092..3c6dc6f0be3 100644 --- a/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp @@ -250,8 +250,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLLinkElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLLinkElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLMapElement.cpp b/mozilla/layout/html/content/src/nsHTMLMapElement.cpp index 93afb6eb9da..5313e2574ef 100644 --- a/mozilla/layout/html/content/src/nsHTMLMapElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLMapElement.cpp @@ -311,8 +311,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLMapElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLMapElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp b/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp index 8fc9c7af4f2..24538a48aec 100644 --- a/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp @@ -190,8 +190,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLMenuElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLMenuElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp b/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp index 02f8ef2ba6e..b937dae4637 100644 --- a/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp @@ -158,8 +158,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLMetaElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLMetaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLModElement.cpp b/mozilla/layout/html/content/src/nsHTMLModElement.cpp index 5ef2ccf8df7..e0c9a696784 100644 --- a/mozilla/layout/html/content/src/nsHTMLModElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLModElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLModElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLModElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLOListElement.cpp b/mozilla/layout/html/content/src/nsHTMLOListElement.cpp index bc85ac64170..0782afd204c 100644 --- a/mozilla/layout/html/content/src/nsHTMLOListElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLOListElement.cpp @@ -217,8 +217,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLOListElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLOListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp b/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp index c84a4280277..9e86beaab19 100644 --- a/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp @@ -227,8 +227,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLObjectElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLObjectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp b/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp index 34f52c44072..ac7c21a9401 100644 --- a/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp @@ -155,8 +155,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLOptGroupElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLOptGroupElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp b/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp index 5013117d6bf..7e596105ac8 100644 --- a/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp @@ -329,8 +329,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLOptionElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLOptionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp b/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp index e1bb451d06b..5fad36aec26 100644 --- a/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp @@ -177,8 +177,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLParagraphElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLParagraphElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLParamElement.cpp b/mozilla/layout/html/content/src/nsHTMLParamElement.cpp index 42738210bc1..2b96e7d58ad 100644 --- a/mozilla/layout/html/content/src/nsHTMLParamElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLParamElement.cpp @@ -161,8 +161,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLParamElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLParamElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLPreElement.cpp b/mozilla/layout/html/content/src/nsHTMLPreElement.cpp index 51e82028067..a663ea38120 100644 --- a/mozilla/layout/html/content/src/nsHTMLPreElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLPreElement.cpp @@ -168,6 +168,24 @@ nsHTMLPreElement::AttributeToString(nsIAtom* aAttribute, return mInner.AttributeToString(aAttribute, aValue, aResult); } +static void +MapFontAttributesInto(nsIHTMLAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + if (nsnull != aAttributes) { + nsHTMLValue value; + + // variable: empty + aAttributes->GetAttribute(nsHTMLAtoms::variable, value); + if (value.GetUnit() == eHTMLUnit_Empty) { + nsStyleFont* font = (nsStyleFont*) + aContext->GetMutableStyleData(eStyleStruct_Font); + font->mFont.name = "serif"; + } + } +} + static void MapAttributesInto(nsIHTMLAttributes* aAttributes, nsIStyleContext* aContext, @@ -184,14 +202,6 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, text->mWhiteSpace = NS_STYLE_WHITESPACE_MOZ_PRE_WRAP; } - // variable: empty - aAttributes->GetAttribute(nsHTMLAtoms::variable, value); - if (value.GetUnit() == eHTMLUnit_Empty) { - nsStyleFont* font = (nsStyleFont*) - aContext->GetMutableStyleData(eStyleStruct_Font); - font->mFont.name = "serif"; - } - // cols: int (nav4 attribute) aAttributes->GetAttribute(nsHTMLAtoms::cols, value); if (value.GetUnit() == eHTMLUnit_Integer) { @@ -229,8 +239,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLPreElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLPreElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = &MapFontAttributesInto; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp b/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp index bb77fb6f7c2..50e7a0afd84 100644 --- a/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp @@ -152,8 +152,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLQuoteElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLQuoteElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp b/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp index dba36bb1dcd..92cd9301bbc 100644 --- a/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp @@ -213,8 +213,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLScriptElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLScriptElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp index 71da7a9f6a9..39a0215bcae 100644 --- a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp @@ -494,8 +494,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLSelectElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLSelectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp b/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp index 79583bca2cc..757755de636 100644 --- a/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp @@ -201,8 +201,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLSpacerElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLSpacerElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp b/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp index 07dcea1e553..ed224b3d7fa 100644 --- a/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp @@ -138,8 +138,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLSpanElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLSpanElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp b/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp index c9aa3fcda69..60b75a9a35f 100644 --- a/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp @@ -234,8 +234,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLStyleElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLStyleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp index 79b8c6e71bc..21828141e6a 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp @@ -187,8 +187,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableCaptionElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableCaptionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp index e33fa2169d2..722561f927d 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp @@ -465,8 +465,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableCellElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableCellElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp index baeacbec8b0..f63a41aee75 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp @@ -286,8 +286,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, NS_IMETHODIMP -nsHTMLTableColElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableColElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp index 153ed9ebc9e..462e55832e7 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp @@ -275,8 +275,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, NS_IMETHODIMP -nsHTMLTableColGroupElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableColGroupElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp index 5fb7fb80a01..d2c818975cb 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp @@ -1217,8 +1217,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp index e4a67b46110..6b6ab687473 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp @@ -608,8 +608,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableRowElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableRowElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp index 49381b2e2d5..fa345e4417b 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp @@ -332,8 +332,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTableSectionElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTableSectionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp index 6db3361426a..81ccea623be 100644 --- a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp @@ -407,8 +407,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTextAreaElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTextAreaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp b/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp index 300e8d6d588..240c641ef51 100644 --- a/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp @@ -153,8 +153,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTitleElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLTitleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLUListElement.cpp b/mozilla/layout/html/content/src/nsHTMLUListElement.cpp index ca47f7c37c4..a628b8ce56b 100644 --- a/mozilla/layout/html/content/src/nsHTMLUListElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLUListElement.cpp @@ -195,8 +195,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLUListElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLUListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp b/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp index c1556c0d385..97fcd7b684a 100644 --- a/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp @@ -147,8 +147,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLWBRElement::GetAttributeMappingFunction(nsMapAttributesFunc& aMapFunc) const +nsHTMLWBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, + nsMapAttributesFunc& aMapFunc) const { + aFontMapFunc = nsnull; aMapFunc = &MapAttributesInto; return NS_OK; } diff --git a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp index c7704990f44..c95633687bc 100644 --- a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp @@ -401,6 +401,9 @@ static PRBool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord, PRInt32 aMask, const nsStyleFont* aFont, nsIPresContext* aPresContext); +static void MapDeclarationFontInto(nsICSSDeclaration* aDeclaration, + nsIStyleContext* aContext, + nsIPresContext* aPresContext); static void MapDeclarationInto(nsICSSDeclaration* aDeclaration, nsIStyleContext* aContext, nsIPresContext* aPresContext); @@ -421,6 +424,7 @@ public: // Strength is an out-of-band weighting, useful for mapping CSS ! important NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; @@ -479,6 +483,13 @@ CSSImportantRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +CSSImportantRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + MapDeclarationFontInto(mDeclaration, aContext, aPresContext); + return NS_OK; +} + NS_IMETHODIMP CSSImportantRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -642,6 +653,7 @@ public: NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const; NS_IMETHOD SetStyleSheet(nsICSSStyleSheet* aSheet); + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; @@ -1145,6 +1157,13 @@ static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor, nsc return result; } +NS_IMETHODIMP +CSSStyleRuleImpl::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + MapDeclarationFontInto(mDeclaration, aContext, aPresContext); + return NS_OK; +} + NS_IMETHODIMP CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -1167,8 +1186,8 @@ nsString& Unquote(nsString& aString) return aString; } -void MapDeclarationInto(nsICSSDeclaration* aDeclaration, - nsIStyleContext* aContext, nsIPresContext* aPresContext) +void MapDeclarationFontInto(nsICSSDeclaration* aDeclaration, + nsIStyleContext* aContext, nsIPresContext* aPresContext) { if (nsnull != aDeclaration) { nsIStyleContext* parentContext = aContext->GetParent(); @@ -1321,6 +1340,21 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration, } } + NS_IF_RELEASE(parentContext); + } +} + +void MapDeclarationInto(nsICSSDeclaration* aDeclaration, + nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + if (nsnull != aDeclaration) { + nsIStyleContext* parentContext = aContext->GetParent(); + nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font); + const nsStyleFont* parentFont = font; + if (nsnull != parentContext) { + parentFont = (const nsStyleFont*)parentContext->GetStyleData(eStyleStruct_Font); + } + nsCSSText* ourText; if (NS_OK == aDeclaration->GetData(kCSSTextSID, (nsCSSStruct**)&ourText)) { if (nsnull != ourText) { @@ -2300,6 +2334,9 @@ static void ListSelector(FILE* out, const nsCSSSelector* aSelector) aSelector->mTag->ToString(buffer); fputs(buffer, out); } + else { + fputs("*", out); + } if (nsnull != aSelector->mID) { aSelector->mID->ToString(buffer); fputs("#", out); diff --git a/mozilla/layout/html/style/src/nsHTMLAttributes.cpp b/mozilla/layout/html/style/src/nsHTMLAttributes.cpp index bae6cb92862..c6d0fafe931 100644 --- a/mozilla/layout/html/style/src/nsHTMLAttributes.cpp +++ b/mozilla/layout/html/style/src/nsHTMLAttributes.cpp @@ -183,7 +183,9 @@ public: void* operator new(size_t size, nsIArena* aArena); void operator delete(void* ptr); - HTMLAttributesImpl(nsIHTMLStyleSheet* aSheet, nsMapAttributesFunc aMapFunc); + HTMLAttributesImpl(nsIHTMLStyleSheet* aSheet, + nsMapAttributesFunc aFontMapFunc, + nsMapAttributesFunc aMapFunc); HTMLAttributesImpl(const HTMLAttributesImpl& aCopy); ~HTMLAttributesImpl(void); @@ -218,7 +220,7 @@ public: NS_IMETHOD Clone(nsIHTMLAttributes** aInstancePtrResult) const; NS_IMETHOD Reset(void); - NS_IMETHOD SetMappingFunction(nsMapAttributesFunc aMapFunc); + NS_IMETHOD SetMappingFunctions(nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc); // nsIStyleRule NS_IMETHOD Equals(const nsIStyleRule* aRule, PRBool& aResult) const; @@ -226,6 +228,7 @@ public: NS_IMETHOD SetStyleSheet(nsIHTMLStyleSheet* aSheet); // Strength is an out-of-band weighting, always 0 here NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; @@ -244,6 +247,7 @@ protected: HTMLAttribute mFirst; nsIAtom* mID; nsClassList* mClassList; + nsMapAttributesFunc mFontMapper; nsMapAttributesFunc mMapper; #ifdef DEBUG_REFS @@ -294,6 +298,7 @@ void HTMLAttributesImpl::operator delete(void* ptr) HTMLAttributesImpl::HTMLAttributesImpl(nsIHTMLStyleSheet* aSheet, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc) : mSheet(aSheet), mFirst(), @@ -301,6 +306,7 @@ HTMLAttributesImpl::HTMLAttributesImpl(nsIHTMLStyleSheet* aSheet, mID(nsnull), mClassList(nsnull), mContentRefCount(0), + mFontMapper(aFontMapFunc), mMapper(aMapFunc) { NS_INIT_REFCNT(); @@ -318,6 +324,7 @@ HTMLAttributesImpl::HTMLAttributesImpl(const HTMLAttributesImpl& aCopy) mID(aCopy.mID), mClassList(nsnull), mContentRefCount(0), + mFontMapper(aCopy.mFontMapper), mMapper(aCopy.mMapper) { NS_INIT_REFCNT(); @@ -789,22 +796,35 @@ HTMLAttributesImpl::Reset(void) delete mClassList; mClassList = nsnull; } + mFontMapper = nsnull; mMapper = nsnull; return NS_OK; } NS_IMETHODIMP -HTMLAttributesImpl::SetMappingFunction(nsMapAttributesFunc aMapFunc) +HTMLAttributesImpl::SetMappingFunctions(nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc) { + mFontMapper = aFontMapFunc; mMapper = aMapFunc; return NS_OK; } +NS_IMETHODIMP +HTMLAttributesImpl::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + if (0 < mCount) { + if (nsnull != mFontMapper) { + (*mFontMapper)(this, aContext, aPresContext); + } + } + return NS_OK; +} + NS_IMETHODIMP HTMLAttributesImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { if (0 < mCount) { - NS_ASSERTION(nsnull != mMapper, "no mapping function"); + NS_ASSERTION(mMapper || mFontMapper, "no mapping function"); if (nsnull != mMapper) { (*mMapper)(this, aContext, aPresContext); } @@ -853,13 +873,13 @@ HTMLAttributesImpl::List(FILE* out, PRInt32 aIndent) const extern NS_HTML nsresult NS_NewHTMLAttributes(nsIHTMLAttributes** aInstancePtrResult, nsIHTMLStyleSheet* aSheet, - nsMapAttributesFunc aMapFunc) + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc) { if (aInstancePtrResult == nsnull) { return NS_ERROR_NULL_POINTER; } - HTMLAttributesImpl *it = new HTMLAttributesImpl(aSheet, aMapFunc); + HTMLAttributesImpl *it = new HTMLAttributesImpl(aSheet, aFontMapFunc, aMapFunc); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; diff --git a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp index 3b8a037e843..9795d527ab2 100644 --- a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -60,6 +60,7 @@ public: // Strength is an out-of-band weighting, always 0 here NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; @@ -110,6 +111,12 @@ HTMLAnchorRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +HTMLAnchorRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + return NS_OK; +} + NS_IMETHODIMP HTMLAnchorRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -132,7 +139,9 @@ HTMLAnchorRule::List(FILE* out, PRInt32 aIndent) const class AttributeKey: public nsHashKey { public: - AttributeKey(nsMapAttributesFunc aMapFunc, nsIHTMLAttributes* aAttributes); + AttributeKey(nsMapAttributesFunc aFontMapFunc, + nsMapAttributesFunc aMapFunc, + nsIHTMLAttributes* aAttributes); virtual ~AttributeKey(void); PRBool Equals(const nsHashKey* aOther) const; @@ -145,19 +154,27 @@ private: AttributeKey& operator=(const AttributeKey& aCopy); public: + nsMapAttributesFunc mFontMapFunc; nsMapAttributesFunc mMapFunc; nsIHTMLAttributes* mAttributes; - PRUint32 mHashSet: 1; - PRUint32 mHashCode: 31; + union { + struct { + PRUint32 mHashSet: 1; + PRUint32 mHashCode: 31; + } mBits; + PRUint32 mInitializer; + } mHash; }; -AttributeKey::AttributeKey(nsMapAttributesFunc aMapFunc, nsIHTMLAttributes* aAttributes) - : mMapFunc(aMapFunc), +AttributeKey::AttributeKey(nsMapAttributesFunc aFontMapFunc, + nsMapAttributesFunc aMapFunc, + nsIHTMLAttributes* aAttributes) + : mFontMapFunc(aFontMapFunc), + mMapFunc(aMapFunc), mAttributes(aAttributes) { NS_ADDREF(mAttributes); - mHashSet = 0; - mHashCode = 0; + mHash.mInitializer = 0; } AttributeKey::~AttributeKey(void) @@ -168,7 +185,7 @@ AttributeKey::~AttributeKey(void) PRBool AttributeKey::Equals(const nsHashKey* aOther) const { const AttributeKey* other = (const AttributeKey*)aOther; - if (mMapFunc == other->mMapFunc) { + if ((mMapFunc == other->mMapFunc) && (mFontMapFunc == other->mFontMapFunc)) { PRBool equals; mAttributes->Equals(other->mAttributes, equals); return equals; @@ -178,23 +195,23 @@ PRBool AttributeKey::Equals(const nsHashKey* aOther) const PRUint32 AttributeKey::HashValue(void) const { - if (0 == mHashSet) { + if (0 == mHash.mBits.mHashSet) { AttributeKey* self = (AttributeKey*)this; // break const PRUint32 hash; mAttributes->HashValue(hash); - self->mHashCode = (0x7FFFFFFF & hash); - self->mHashCode |= (0x7FFFFFFF & PRUint32(mMapFunc)); - self->mHashSet = 1; + self->mHash.mBits.mHashCode = (0x7FFFFFFF & hash); + self->mHash.mBits.mHashCode |= (0x7FFFFFFF & PRUint32(mFontMapFunc)); + self->mHash.mBits.mHashCode |= (0x7FFFFFFF & PRUint32(mMapFunc)); + self->mHash.mBits.mHashSet = 1; } - return mHashCode; + return mHash.mBits.mHashCode; } nsHashKey* AttributeKey::Clone(void) const { - AttributeKey* clown = new AttributeKey(mMapFunc, mAttributes); + AttributeKey* clown = new AttributeKey(mFontMapFunc, mMapFunc, mAttributes); if (nsnull != clown) { - clown->mHashSet = mHashSet; - clown->mHashCode = mHashCode; + clown->mHash.mInitializer = mHash.mInitializer; } return clown; } @@ -269,10 +286,12 @@ protected: virtual ~HTMLStyleSheetImpl(); NS_IMETHOD EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRBool aCreate, nsIHTMLAttributes*& aSingleAttrs); NS_IMETHOD UniqueAttributes(nsIHTMLAttributes*& aSingleAttrs, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRInt32 aAttrCount, nsIHTMLAttributes*& aAttributes); @@ -663,9 +682,10 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributesFor(nsIHTMLContent* aContent, nsI nsIHTMLAttributes* attrs = aAttributes; if (nsnull != attrs) { + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); - AttributeKey key(mapFunc, attrs); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); + AttributeKey key(fontMapFunc, mapFunc, attrs); nsIHTMLAttributes* sharedAttrs = (nsIHTMLAttributes*)mAttrTable.Get(&key); if (nsnull == sharedAttrs) { // we have a new unique set mAttrTable.Put(&key, attrs); @@ -692,17 +712,18 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, { nsresult result = NS_OK; nsIHTMLAttributes* attrs; + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - result = EnsureSingleAttributes(aAttributes, mapFunc, PR_TRUE, attrs); + result = EnsureSingleAttributes(aAttributes, fontMapFunc, mapFunc, PR_TRUE, attrs); if ((NS_OK == result) && (nsnull != attrs)) { PRInt32 count; attrs->SetAttribute(aAttribute, aValue, count); - result = UniqueAttributes(attrs, mapFunc, count, aAttributes); + result = UniqueAttributes(attrs, fontMapFunc, mapFunc, count, aAttributes); } return result; @@ -720,6 +741,7 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, NS_IMETHODIMP HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRBool aCreate, nsIHTMLAttributes*& aSingleAttrs) @@ -733,10 +755,10 @@ HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, NS_ASSERT_REFCOUNT(mRecycledAttrs, 1, "attributes used elsewhere"); aSingleAttrs = mRecycledAttrs; mRecycledAttrs = nsnull; - aSingleAttrs->SetMappingFunction(aMapFunc); + aSingleAttrs->SetMappingFunctions(aFontMapFunc, aMapFunc); } else { - result = NS_NewHTMLAttributes(&aSingleAttrs, this, aMapFunc); + result = NS_NewHTMLAttributes(&aSingleAttrs, this, aFontMapFunc, aMapFunc); } } else { @@ -763,7 +785,7 @@ HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, } else { // one content ref, ok to use, remove from table because hash may change if (1 == contentRefCount) { - AttributeKey key(aMapFunc, aSingleAttrs); + AttributeKey key(aFontMapFunc, aMapFunc, aSingleAttrs); mAttrTable.Remove(&key); NS_ADDREF(aSingleAttrs); // add a local ref so we match up } @@ -778,14 +800,14 @@ HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, NS_IMETHODIMP HTMLStyleSheetImpl::UniqueAttributes(nsIHTMLAttributes*& aSingleAttrs, - nsMapAttributesFunc aMapFunc, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRInt32 aAttrCount, nsIHTMLAttributes*& aAttributes) { nsresult result = NS_OK; if (0 < aAttrCount) { - AttributeKey key(aMapFunc, aSingleAttrs); + AttributeKey key(aFontMapFunc, aMapFunc, aSingleAttrs); nsIHTMLAttributes* sharedAttrs = (nsIHTMLAttributes*)mAttrTable.Get(&key); if (nsnull == sharedAttrs) { // we have a new unique set mAttrTable.Put(&key, aSingleAttrs); @@ -838,17 +860,18 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, nsresult result = NS_OK; nsIHTMLAttributes* attrs; PRBool hasValue = PRBool(eHTMLUnit_Null != aValue.GetUnit()); + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - result = EnsureSingleAttributes(aAttributes, mapFunc, hasValue, attrs); + result = EnsureSingleAttributes(aAttributes, fontMapFunc, mapFunc, hasValue, attrs); if ((NS_OK == result) && (nsnull != attrs)) { PRInt32 count; attrs->SetAttribute(aAttribute, aValue, count); - result = UniqueAttributes(attrs, mapFunc, count, aAttributes); + result = UniqueAttributes(attrs, fontMapFunc, mapFunc, count, aAttributes); } return result; @@ -860,17 +883,18 @@ NS_IMETHODIMP HTMLStyleSheetImpl::UnsetAttributeFor(nsIAtom* aAttribute, { nsresult result = NS_OK; nsIHTMLAttributes* attrs; + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - result = EnsureSingleAttributes(aAttributes, mapFunc, PR_FALSE, attrs); + result = EnsureSingleAttributes(aAttributes, fontMapFunc, mapFunc, PR_FALSE, attrs); if ((NS_OK == result) && (nsnull != attrs)) { PRInt32 count; attrs->UnsetAttribute(aAttribute, count); - result = UniqueAttributes(attrs, mapFunc, count, aAttributes); + result = UniqueAttributes(attrs, fontMapFunc, mapFunc, count, aAttributes); } return result; diff --git a/mozilla/layout/html/style/src/nsIHTMLAttributes.h b/mozilla/layout/html/style/src/nsIHTMLAttributes.h index 19c00447d70..1a2ef1f1983 100644 --- a/mozilla/layout/html/style/src/nsIHTMLAttributes.h +++ b/mozilla/layout/html/style/src/nsIHTMLAttributes.h @@ -63,7 +63,7 @@ public: NS_IMETHOD Clone(nsIHTMLAttributes** aInstancePtrResult) const = 0; NS_IMETHOD Reset(void) = 0; - NS_IMETHOD SetMappingFunction(nsMapAttributesFunc aMapFunc) = 0; + NS_IMETHOD SetMappingFunctions(nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc) = 0; NS_IMETHOD SetStyleSheet(nsIHTMLStyleSheet* aSheet) = 0; NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; @@ -72,6 +72,7 @@ public: extern NS_HTML nsresult NS_NewHTMLAttributes(nsIHTMLAttributes** aInstancePtrResult, nsIHTMLStyleSheet* aSheet, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc); #endif /* nsIHTMLAttributes_h___ */ diff --git a/mozilla/layout/style/nsCSSStyleRule.cpp b/mozilla/layout/style/nsCSSStyleRule.cpp index c7704990f44..c95633687bc 100644 --- a/mozilla/layout/style/nsCSSStyleRule.cpp +++ b/mozilla/layout/style/nsCSSStyleRule.cpp @@ -401,6 +401,9 @@ static PRBool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord, PRInt32 aMask, const nsStyleFont* aFont, nsIPresContext* aPresContext); +static void MapDeclarationFontInto(nsICSSDeclaration* aDeclaration, + nsIStyleContext* aContext, + nsIPresContext* aPresContext); static void MapDeclarationInto(nsICSSDeclaration* aDeclaration, nsIStyleContext* aContext, nsIPresContext* aPresContext); @@ -421,6 +424,7 @@ public: // Strength is an out-of-band weighting, useful for mapping CSS ! important NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; @@ -479,6 +483,13 @@ CSSImportantRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +CSSImportantRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + MapDeclarationFontInto(mDeclaration, aContext, aPresContext); + return NS_OK; +} + NS_IMETHODIMP CSSImportantRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -642,6 +653,7 @@ public: NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const; NS_IMETHOD SetStyleSheet(nsICSSStyleSheet* aSheet); + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; @@ -1145,6 +1157,13 @@ static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor, nsc return result; } +NS_IMETHODIMP +CSSStyleRuleImpl::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + MapDeclarationFontInto(mDeclaration, aContext, aPresContext); + return NS_OK; +} + NS_IMETHODIMP CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -1167,8 +1186,8 @@ nsString& Unquote(nsString& aString) return aString; } -void MapDeclarationInto(nsICSSDeclaration* aDeclaration, - nsIStyleContext* aContext, nsIPresContext* aPresContext) +void MapDeclarationFontInto(nsICSSDeclaration* aDeclaration, + nsIStyleContext* aContext, nsIPresContext* aPresContext) { if (nsnull != aDeclaration) { nsIStyleContext* parentContext = aContext->GetParent(); @@ -1321,6 +1340,21 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration, } } + NS_IF_RELEASE(parentContext); + } +} + +void MapDeclarationInto(nsICSSDeclaration* aDeclaration, + nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + if (nsnull != aDeclaration) { + nsIStyleContext* parentContext = aContext->GetParent(); + nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font); + const nsStyleFont* parentFont = font; + if (nsnull != parentContext) { + parentFont = (const nsStyleFont*)parentContext->GetStyleData(eStyleStruct_Font); + } + nsCSSText* ourText; if (NS_OK == aDeclaration->GetData(kCSSTextSID, (nsCSSStruct**)&ourText)) { if (nsnull != ourText) { @@ -2300,6 +2334,9 @@ static void ListSelector(FILE* out, const nsCSSSelector* aSelector) aSelector->mTag->ToString(buffer); fputs(buffer, out); } + else { + fputs("*", out); + } if (nsnull != aSelector->mID) { aSelector->mID->ToString(buffer); fputs("#", out); diff --git a/mozilla/layout/style/nsHTMLStyleSheet.cpp b/mozilla/layout/style/nsHTMLStyleSheet.cpp index 3b8a037e843..9795d527ab2 100644 --- a/mozilla/layout/style/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLStyleSheet.cpp @@ -60,6 +60,7 @@ public: // Strength is an out-of-band weighting, always 0 here NS_IMETHOD GetStrength(PRInt32& aStrength) const; + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext); NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; @@ -110,6 +111,12 @@ HTMLAnchorRule::GetStrength(PRInt32& aStrength) const return NS_OK; } +NS_IMETHODIMP +HTMLAnchorRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) +{ + return NS_OK; +} + NS_IMETHODIMP HTMLAnchorRule::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -132,7 +139,9 @@ HTMLAnchorRule::List(FILE* out, PRInt32 aIndent) const class AttributeKey: public nsHashKey { public: - AttributeKey(nsMapAttributesFunc aMapFunc, nsIHTMLAttributes* aAttributes); + AttributeKey(nsMapAttributesFunc aFontMapFunc, + nsMapAttributesFunc aMapFunc, + nsIHTMLAttributes* aAttributes); virtual ~AttributeKey(void); PRBool Equals(const nsHashKey* aOther) const; @@ -145,19 +154,27 @@ private: AttributeKey& operator=(const AttributeKey& aCopy); public: + nsMapAttributesFunc mFontMapFunc; nsMapAttributesFunc mMapFunc; nsIHTMLAttributes* mAttributes; - PRUint32 mHashSet: 1; - PRUint32 mHashCode: 31; + union { + struct { + PRUint32 mHashSet: 1; + PRUint32 mHashCode: 31; + } mBits; + PRUint32 mInitializer; + } mHash; }; -AttributeKey::AttributeKey(nsMapAttributesFunc aMapFunc, nsIHTMLAttributes* aAttributes) - : mMapFunc(aMapFunc), +AttributeKey::AttributeKey(nsMapAttributesFunc aFontMapFunc, + nsMapAttributesFunc aMapFunc, + nsIHTMLAttributes* aAttributes) + : mFontMapFunc(aFontMapFunc), + mMapFunc(aMapFunc), mAttributes(aAttributes) { NS_ADDREF(mAttributes); - mHashSet = 0; - mHashCode = 0; + mHash.mInitializer = 0; } AttributeKey::~AttributeKey(void) @@ -168,7 +185,7 @@ AttributeKey::~AttributeKey(void) PRBool AttributeKey::Equals(const nsHashKey* aOther) const { const AttributeKey* other = (const AttributeKey*)aOther; - if (mMapFunc == other->mMapFunc) { + if ((mMapFunc == other->mMapFunc) && (mFontMapFunc == other->mFontMapFunc)) { PRBool equals; mAttributes->Equals(other->mAttributes, equals); return equals; @@ -178,23 +195,23 @@ PRBool AttributeKey::Equals(const nsHashKey* aOther) const PRUint32 AttributeKey::HashValue(void) const { - if (0 == mHashSet) { + if (0 == mHash.mBits.mHashSet) { AttributeKey* self = (AttributeKey*)this; // break const PRUint32 hash; mAttributes->HashValue(hash); - self->mHashCode = (0x7FFFFFFF & hash); - self->mHashCode |= (0x7FFFFFFF & PRUint32(mMapFunc)); - self->mHashSet = 1; + self->mHash.mBits.mHashCode = (0x7FFFFFFF & hash); + self->mHash.mBits.mHashCode |= (0x7FFFFFFF & PRUint32(mFontMapFunc)); + self->mHash.mBits.mHashCode |= (0x7FFFFFFF & PRUint32(mMapFunc)); + self->mHash.mBits.mHashSet = 1; } - return mHashCode; + return mHash.mBits.mHashCode; } nsHashKey* AttributeKey::Clone(void) const { - AttributeKey* clown = new AttributeKey(mMapFunc, mAttributes); + AttributeKey* clown = new AttributeKey(mFontMapFunc, mMapFunc, mAttributes); if (nsnull != clown) { - clown->mHashSet = mHashSet; - clown->mHashCode = mHashCode; + clown->mHash.mInitializer = mHash.mInitializer; } return clown; } @@ -269,10 +286,12 @@ protected: virtual ~HTMLStyleSheetImpl(); NS_IMETHOD EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRBool aCreate, nsIHTMLAttributes*& aSingleAttrs); NS_IMETHOD UniqueAttributes(nsIHTMLAttributes*& aSingleAttrs, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRInt32 aAttrCount, nsIHTMLAttributes*& aAttributes); @@ -663,9 +682,10 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributesFor(nsIHTMLContent* aContent, nsI nsIHTMLAttributes* attrs = aAttributes; if (nsnull != attrs) { + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); - AttributeKey key(mapFunc, attrs); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); + AttributeKey key(fontMapFunc, mapFunc, attrs); nsIHTMLAttributes* sharedAttrs = (nsIHTMLAttributes*)mAttrTable.Get(&key); if (nsnull == sharedAttrs) { // we have a new unique set mAttrTable.Put(&key, attrs); @@ -692,17 +712,18 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, { nsresult result = NS_OK; nsIHTMLAttributes* attrs; + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - result = EnsureSingleAttributes(aAttributes, mapFunc, PR_TRUE, attrs); + result = EnsureSingleAttributes(aAttributes, fontMapFunc, mapFunc, PR_TRUE, attrs); if ((NS_OK == result) && (nsnull != attrs)) { PRInt32 count; attrs->SetAttribute(aAttribute, aValue, count); - result = UniqueAttributes(attrs, mapFunc, count, aAttributes); + result = UniqueAttributes(attrs, fontMapFunc, mapFunc, count, aAttributes); } return result; @@ -720,6 +741,7 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, NS_IMETHODIMP HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRBool aCreate, nsIHTMLAttributes*& aSingleAttrs) @@ -733,10 +755,10 @@ HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, NS_ASSERT_REFCOUNT(mRecycledAttrs, 1, "attributes used elsewhere"); aSingleAttrs = mRecycledAttrs; mRecycledAttrs = nsnull; - aSingleAttrs->SetMappingFunction(aMapFunc); + aSingleAttrs->SetMappingFunctions(aFontMapFunc, aMapFunc); } else { - result = NS_NewHTMLAttributes(&aSingleAttrs, this, aMapFunc); + result = NS_NewHTMLAttributes(&aSingleAttrs, this, aFontMapFunc, aMapFunc); } } else { @@ -763,7 +785,7 @@ HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, } else { // one content ref, ok to use, remove from table because hash may change if (1 == contentRefCount) { - AttributeKey key(aMapFunc, aSingleAttrs); + AttributeKey key(aFontMapFunc, aMapFunc, aSingleAttrs); mAttrTable.Remove(&key); NS_ADDREF(aSingleAttrs); // add a local ref so we match up } @@ -778,14 +800,14 @@ HTMLStyleSheetImpl::EnsureSingleAttributes(nsIHTMLAttributes*& aAttributes, NS_IMETHODIMP HTMLStyleSheetImpl::UniqueAttributes(nsIHTMLAttributes*& aSingleAttrs, - nsMapAttributesFunc aMapFunc, + nsMapAttributesFunc aFontMapFunc, nsMapAttributesFunc aMapFunc, PRInt32 aAttrCount, nsIHTMLAttributes*& aAttributes) { nsresult result = NS_OK; if (0 < aAttrCount) { - AttributeKey key(aMapFunc, aSingleAttrs); + AttributeKey key(aFontMapFunc, aMapFunc, aSingleAttrs); nsIHTMLAttributes* sharedAttrs = (nsIHTMLAttributes*)mAttrTable.Get(&key); if (nsnull == sharedAttrs) { // we have a new unique set mAttrTable.Put(&key, aSingleAttrs); @@ -838,17 +860,18 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, nsresult result = NS_OK; nsIHTMLAttributes* attrs; PRBool hasValue = PRBool(eHTMLUnit_Null != aValue.GetUnit()); + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - result = EnsureSingleAttributes(aAttributes, mapFunc, hasValue, attrs); + result = EnsureSingleAttributes(aAttributes, fontMapFunc, mapFunc, hasValue, attrs); if ((NS_OK == result) && (nsnull != attrs)) { PRInt32 count; attrs->SetAttribute(aAttribute, aValue, count); - result = UniqueAttributes(attrs, mapFunc, count, aAttributes); + result = UniqueAttributes(attrs, fontMapFunc, mapFunc, count, aAttributes); } return result; @@ -860,17 +883,18 @@ NS_IMETHODIMP HTMLStyleSheetImpl::UnsetAttributeFor(nsIAtom* aAttribute, { nsresult result = NS_OK; nsIHTMLAttributes* attrs; + nsMapAttributesFunc fontMapFunc; nsMapAttributesFunc mapFunc; - aContent->GetAttributeMappingFunction(mapFunc); + aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - result = EnsureSingleAttributes(aAttributes, mapFunc, PR_FALSE, attrs); + result = EnsureSingleAttributes(aAttributes, fontMapFunc, mapFunc, PR_FALSE, attrs); if ((NS_OK == result) && (nsnull != attrs)) { PRInt32 count; attrs->UnsetAttribute(aAttribute, count); - result = UniqueAttributes(attrs, mapFunc, count, aAttributes); + result = UniqueAttributes(attrs, fontMapFunc, mapFunc, count, aAttributes); } return result; diff --git a/mozilla/layout/style/nsIStyleRule.h b/mozilla/layout/style/nsIStyleRule.h index af538ce969d..ee7852f50de 100644 --- a/mozilla/layout/style/nsIStyleRule.h +++ b/mozilla/layout/style/nsIStyleRule.h @@ -44,6 +44,9 @@ public: // Strength is an out-of-band weighting, useful for mapping CSS ! important NS_IMETHOD GetStrength(PRInt32& aStrength) const = 0; + // Map only font data into style context + NS_IMETHOD MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) = 0; + // Map all non-font info into style context NS_IMETHOD MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext) = 0; NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; diff --git a/mozilla/layout/style/nsStyleContext.cpp b/mozilla/layout/style/nsStyleContext.cpp index 7686e760b0f..6ba9be560af 100644 --- a/mozilla/layout/style/nsStyleContext.cpp +++ b/mozilla/layout/style/nsStyleContext.cpp @@ -1715,6 +1715,14 @@ struct MapStyleData { nsIPresContext* mPresContext; }; +static PRBool MapStyleRuleFont(nsISupports* aRule, void* aData) +{ + nsIStyleRule* rule = (nsIStyleRule*)aRule; + MapStyleData* data = (MapStyleData*)aData; + rule->MapFontStyleInto(data->mStyleContext, data->mPresContext); + return PR_TRUE; +} + static PRBool MapStyleRule(nsISupports* aRule, void* aData) { nsIStyleRule* rule = (nsIStyleRule*)aRule; @@ -1748,6 +1756,7 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext) if ((nsnull != mRules) && (0 < mRules->Count())) { MapStyleData data(this, aPresContext); + mRules->EnumerateForwards(MapStyleRuleFont, &data); mRules->EnumerateForwards(MapStyleRule, &data); } if (-1 == mDataCode) { @@ -1778,6 +1787,7 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext) if ((nsnull != mRules) && (0 < mRules->Count())) { MapStyleData data(this, aPresContext); + mRules->EnumerateForwards(MapStyleRuleFont, &data); mRules->EnumerateForwards(MapStyleRule, &data); } // reset all font data for tables again