mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Make spacer attribute mapping code not depend on data in the style context (which attribute mapping code should not do). (Bug 449435) r+sr=bzbarsky
This commit is contained in:
parent
ff14b5b6ad
commit
2cf88dfb3f
@ -47,7 +47,6 @@
|
|||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
#include "nsRuleData.h"
|
#include "nsRuleData.h"
|
||||||
#include "nsMappedAttributes.h"
|
#include "nsMappedAttributes.h"
|
||||||
#include "nsStyleContext.h"
|
|
||||||
|
|
||||||
// XXX nav4 has type= start= (same as OL/UL)
|
// XXX nav4 has type= start= (same as OL/UL)
|
||||||
extern nsAttrValue::EnumTable kListTypeTable[];
|
extern nsAttrValue::EnumTable kListTypeTable[];
|
||||||
@ -239,11 +238,23 @@ SpacerMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||||||
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
|
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
|
||||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||||
|
|
||||||
|
if (aData->mSIDs & (NS_STYLE_INHERIT_BIT(Position) |
|
||||||
|
NS_STYLE_INHERIT_BIT(Display))) {
|
||||||
|
PRBool typeIsBlock = PR_FALSE;
|
||||||
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
|
||||||
|
if (value && value->Type() == nsAttrValue::eString) {
|
||||||
|
const nsString& tmp(value->GetStringValue());
|
||||||
|
if (tmp.LowerCaseEqualsLiteral("line") ||
|
||||||
|
tmp.LowerCaseEqualsLiteral("vert") ||
|
||||||
|
tmp.LowerCaseEqualsLiteral("vertical") ||
|
||||||
|
tmp.LowerCaseEqualsLiteral("block")) {
|
||||||
|
// This is not strictly 100% compatible: if the spacer is given
|
||||||
|
// a width of zero then it is basically ignored.
|
||||||
|
typeIsBlock = PR_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
|
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
|
||||||
const nsStyleDisplay* display = aData->mStyleContext->GetStyleDisplay();
|
|
||||||
|
|
||||||
PRBool typeIsBlock = (display->mDisplay == NS_STYLE_DISPLAY_BLOCK);
|
|
||||||
|
|
||||||
if (typeIsBlock) {
|
if (typeIsBlock) {
|
||||||
// width: value
|
// width: value
|
||||||
if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
|
if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
|
||||||
@ -281,6 +292,7 @@ SpacerMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
|
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
|
||||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
|
||||||
if (value && value->Type() == nsAttrValue::eEnum) {
|
if (value && value->Type() == nsAttrValue::eEnum) {
|
||||||
@ -295,21 +307,15 @@ SpacerMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeIsBlock) {
|
||||||
if (aData->mDisplayData->mDisplay.GetUnit() == eCSSUnit_Null) {
|
if (aData->mDisplayData->mDisplay.GetUnit() == eCSSUnit_Null) {
|
||||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
|
|
||||||
if (value && value->Type() == nsAttrValue::eString) {
|
|
||||||
nsAutoString tmp(value->GetStringValue());
|
|
||||||
if (tmp.LowerCaseEqualsLiteral("line") ||
|
|
||||||
tmp.LowerCaseEqualsLiteral("vert") ||
|
|
||||||
tmp.LowerCaseEqualsLiteral("vertical") ||
|
|
||||||
tmp.LowerCaseEqualsLiteral("block")) {
|
|
||||||
// This is not strictly 100% compatible: if the spacer is given
|
|
||||||
// a width of zero then it is basically ignored.
|
|
||||||
aData->mDisplayData->mDisplay.SetIntValue(NS_STYLE_DISPLAY_BLOCK,
|
aData->mDisplayData->mDisplay.SetIntValue(NS_STYLE_DISPLAY_BLOCK,
|
||||||
eCSSUnit_Enumerated);
|
eCSSUnit_Enumerated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Any new structs that don't need typeIsBlock should go outside
|
||||||
|
// the code that calculates it.
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||||
|
Loading…
Reference in New Issue
Block a user