Bug 1449806: Merge {Servo,Generic}SpecifiedValues into MappedDeclarations. r=xidorn

The idea would be that this header is only included in cpp files, thus it's ok
to include ServoBindings, etc.

MozReview-Commit-ID: EgQEsR0cZd4
This commit is contained in:
Emilio Cobos Álvarez
2018-06-22 18:48:42 +02:00
parent eb8183300a
commit e13a620d19
67 changed files with 645 additions and 876 deletions

View File

@@ -7,7 +7,7 @@
#include "mozilla/dom/HTMLTableCellElement.h"
#include "mozilla/dom/HTMLTableElement.h"
#include "mozilla/dom/HTMLTableRowElement.h"
#include "mozilla/GenericSpecifiedValuesInlines.h"
#include "mozilla/MappedDeclarations.h"
#include "nsMappedAttributes.h"
#include "nsAttrValueInlines.h"
#include "celldata.h"
@@ -183,54 +183,54 @@ HTMLTableCellElement::ParseAttribute(int32_t aNamespaceID,
void
HTMLTableCellElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
MappedDeclarations& aDecls)
{
// width: value
if (!aData->PropertyIsSet(eCSSProperty_width)) {
if (!aDecls.PropertyIsSet(eCSSProperty_width)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
if (value && value->Type() == nsAttrValue::eInteger) {
if (value->GetIntegerValue() > 0)
aData->SetPixelValue(eCSSProperty_width, (float)value->GetIntegerValue());
aDecls.SetPixelValue(eCSSProperty_width, (float)value->GetIntegerValue());
// else 0 implies auto for compatibility.
}
else if (value && value->Type() == nsAttrValue::ePercent) {
if (value->GetPercentValue() > 0.0f)
aData->SetPercentValue(eCSSProperty_width, value->GetPercentValue());
aDecls.SetPercentValue(eCSSProperty_width, value->GetPercentValue());
// else 0 implies auto for compatibility
}
}
// height: value
if (!aData->PropertyIsSet(eCSSProperty_height)) {
if (!aDecls.PropertyIsSet(eCSSProperty_height)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
if (value && value->Type() == nsAttrValue::eInteger) {
if (value->GetIntegerValue() > 0)
aData->SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
aDecls.SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
// else 0 implies auto for compatibility.
}
else if (value && value->Type() == nsAttrValue::ePercent) {
if (value->GetPercentValue() > 0.0f)
aData->SetPercentValue(eCSSProperty_height, value->GetPercentValue());
aDecls.SetPercentValue(eCSSProperty_height, value->GetPercentValue());
// else 0 implies auto for compatibility
}
}
if (!aData->PropertyIsSet(eCSSProperty_white_space)) {
if (!aDecls.PropertyIsSet(eCSSProperty_white_space)) {
// nowrap: enum
if (aAttributes->GetAttr(nsGkAtoms::nowrap)) {
// See if our width is not a nonzero integer width.
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
nsCompatibility mode = aData->Document()->GetCompatibilityMode();
nsCompatibility mode = aDecls.Document()->GetCompatibilityMode();
if (!value || value->Type() != nsAttrValue::eInteger ||
value->GetIntegerValue() == 0 ||
eCompatibility_NavQuirks != mode) {
aData->SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Nowrap);
aDecls.SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Nowrap);
}
}
}
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aDecls);
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aDecls);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
}
NS_IMETHODIMP_(bool)