split font style mapping from regular style mapping

This commit is contained in:
peterl%netscape.com 1999-04-15 21:23:05 +00:00
Родитель aa95291e32
Коммит fbde443a95
142 изменённых файлов: 900 добавлений и 294 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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();
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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___ */

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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();
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше