Bug 949879 - Drop support for the "cols" attribute of <pre> elements. r=dbaron

This commit is contained in:
Masatoshi Kimura 2013-12-17 01:56:20 +09:00
parent 4ac6f8e94a
commit b166c0491e

View File

@ -35,9 +35,6 @@ HTMLPreElement::ParseAttribute(int32_t aNamespaceID,
nsAttrValue& aResult) nsAttrValue& aResult)
{ {
if (aNamespaceID == kNameSpaceID_None) { if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::cols) {
return aResult.ParseIntWithBounds(aValue, 0);
}
if (aAttribute == nsGkAtoms::width) { if (aAttribute == nsGkAtoms::width) {
return aResult.ParseIntWithBounds(aValue, 0); return aResult.ParseIntWithBounds(aValue, 0);
} }
@ -54,13 +51,8 @@ HTMLPreElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) { if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
nsCSSValue* width = aData->ValueForWidth(); nsCSSValue* width = aData->ValueForWidth();
if (width->GetUnit() == eCSSUnit_Null) { if (width->GetUnit() == eCSSUnit_Null) {
// width: int (html4 attribute == nav4 cols) // width: int (html4 attribute)
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width); const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
if (!value || value->Type() != nsAttrValue::eInteger) {
// cols: int (nav4 attribute)
value = aAttributes->GetAttr(nsGkAtoms::cols);
}
if (value && value->Type() == nsAttrValue::eInteger) if (value && value->Type() == nsAttrValue::eInteger)
width->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Char); width->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Char);
} }
@ -72,13 +64,8 @@ HTMLPreElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
if (aAttributes->GetAttr(nsGkAtoms::wrap)) if (aAttributes->GetAttr(nsGkAtoms::wrap))
whiteSpace->SetIntValue(NS_STYLE_WHITESPACE_PRE_WRAP, eCSSUnit_Enumerated); whiteSpace->SetIntValue(NS_STYLE_WHITESPACE_PRE_WRAP, eCSSUnit_Enumerated);
// width: int (html4 attribute == nav4 cols) // width: int (html4 attribute)
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width); const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
if (!value || value->Type() != nsAttrValue::eInteger) {
// cols: int (nav4 attribute)
value = aAttributes->GetAttr(nsGkAtoms::cols);
}
if (value && value->Type() == nsAttrValue::eInteger) { if (value && value->Type() == nsAttrValue::eInteger) {
// Force wrap property on since we want to wrap at a width // Force wrap property on since we want to wrap at a width
// boundary not just a newline. // boundary not just a newline.
@ -95,7 +82,6 @@ HTMLPreElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{ {
static const MappedAttributeEntry attributes[] = { static const MappedAttributeEntry attributes[] = {
{ &nsGkAtoms::wrap }, { &nsGkAtoms::wrap },
{ &nsGkAtoms::cols },
{ &nsGkAtoms::width }, { &nsGkAtoms::width },
{ nullptr }, { nullptr },
}; };