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

@@ -6,7 +6,7 @@
#include "HTMLFontElement.h"
#include "mozilla/dom/HTMLFontElementBinding.h"
#include "mozilla/GenericSpecifiedValuesInlines.h"
#include "mozilla/MappedDeclarations.h"
#include "nsAttrValueInlines.h"
#include "nsMappedAttributes.h"
#include "nsContentUtils.h"
@@ -55,42 +55,42 @@ HTMLFontElement::ParseAttribute(int32_t aNamespaceID,
void
HTMLFontElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
MappedDeclarations& aDecls)
{
// face: string list
if (!aData->PropertyIsSet(eCSSProperty_font_family)) {
if (!aDecls.PropertyIsSet(eCSSProperty_font_family)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::face);
if (value && value->Type() == nsAttrValue::eString &&
!value->IsEmptyString()) {
aData->SetFontFamily(value->GetStringValue());
aDecls.SetFontFamily(value->GetStringValue());
}
}
// size: int
if (!aData->PropertyIsSet(eCSSProperty_font_size)) {
if (!aDecls.PropertyIsSet(eCSSProperty_font_size)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::size);
if (value && value->Type() == nsAttrValue::eInteger)
aData->SetKeywordValue(eCSSProperty_font_size, value->GetIntegerValue());
aDecls.SetKeywordValue(eCSSProperty_font_size, value->GetIntegerValue());
}
if (!aData->PropertyIsSet(eCSSProperty_color)) {
if (!aDecls.PropertyIsSet(eCSSProperty_color)) {
// color: color
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::color);
nscolor color;
if (value && value->GetColorValue(color)) {
aData->SetColorValue(eCSSProperty_color, color);
aDecls.SetColorValue(eCSSProperty_color, color);
}
}
if (aData->Document()->GetCompatibilityMode() == eCompatibility_NavQuirks) {
if (aDecls.Document()->GetCompatibilityMode() == eCompatibility_NavQuirks) {
// Make <a><font color="red">text</font></a> give the text a red underline
// in quirks mode. The NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL flag only
// affects quirks mode rendering.
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::color);
nscolor color;
if (value && value->GetColorValue(color)) {
aData->SetTextDecorationColorOverride();
aDecls.SetTextDecorationColorOverride();
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
}
NS_IMETHODIMP_(bool)