Bug 1449798 - Remove GenericSpecifiedValues::ShouldComputeStyleStruct and mSIDs. r=emilio

This was useful because nsRuleData in the old style system may not hold
all the data, but the only subclass ServoSpecifiedValues is always able
to hold any data, and thus passes NS_STYLE_INHERIT_MASK to mSIDS. Given
this, this method and mSIDs seems to be useless and can be removed.

MozReview-Commit-ID: 4vWcV4DRS2i

--HG--
extra : rebase_source : 4f364d431821e29838082e391c6dde08af7f5343
This commit is contained in:
Xidorn Quan 2018-03-29 12:39:07 +11:00
parent 9c4356e89b
commit 3e1eaab1ee
19 changed files with 701 additions and 817 deletions

View File

@ -55,14 +55,11 @@ void
HTMLBRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Display))) {
if (!aData->PropertyIsSet(eCSSProperty_clear)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::clear);
if (value && value->Type() == nsAttrValue::eEnum)
aData->SetKeywordValue(eCSSProperty_clear, value->GetEnumValue());
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}

View File

@ -76,8 +76,6 @@ void
HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Margin)) {
// This is the one place where we try to set the same property
// multiple times in presentation attributes. Servo does not support
// querying if a property is set (because that is O(n) behavior
@ -191,12 +189,9 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
}
}
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Display))) {
// When display if first asked for, go ahead and get our colors set up.
if (nsHTMLStyleSheet* styleSheet = aData->Document()->GetAttributeStyleSheet()) {
const nsAttrValue* value;
nscolor color;
value = aAttributes->GetAttr(nsGkAtoms::link);
if (value && value->GetColorValue(color)) {
@ -213,18 +208,15 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
styleSheet->SetVisitedLinkColor(color);
}
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Color))) {
if (!aData->PropertyIsSet(eCSSProperty_color)) {
// color: color
nscolor color;
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::text);
value = aAttributes->GetAttr(nsGkAtoms::text);
if (value && value->GetColorValue(color)) {
aData->SetColorValue(eCSSProperty_color, color);
}
}
}
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);

View File

@ -58,7 +58,6 @@ void
HTMLFontElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Font))) {
// face: string list
if (!aData->PropertyIsSet(eCSSProperty_font_family)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::face);
@ -73,8 +72,6 @@ HTMLFontElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
if (value && value->Type() == nsAttrValue::eInteger)
aData->SetKeywordValue(eCSSProperty_font_size, value->GetIntegerValue());
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Color))) {
if (!aData->PropertyIsSet(eCSSProperty_color)) {
// color: color
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::color);
@ -83,9 +80,7 @@ HTMLFontElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
aData->SetColorValue(eCSSProperty_color, color);
}
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(TextReset)) &&
aData->Document()->GetCompatibilityMode() == eCompatibility_NavQuirks) {
if (aData->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.

View File

@ -67,16 +67,12 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nscolor color;
bool colorIsSet = colorValue && colorValue->GetColorValue(color);
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Position) |
NS_STYLE_INHERIT_BIT(Border))) {
if (colorIsSet) {
noshade = true;
} else {
noshade = !!aAttributes->GetAttr(nsGkAtoms::noshade);
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Margin))) {
// align: enum
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
if (value && value->Type() == nsAttrValue::eEnum) {
@ -96,8 +92,6 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
break;
}
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Position))) {
if (!aData->PropertyIsSet(eCSSProperty_height)) {
// size: integer
if (noshade) {
@ -114,15 +108,14 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
} // else use default value from html.css
}
}
}
// if not noshade, border styles are dealt with by html.css
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Border)) && noshade) {
if (noshade) {
// size: integer
// if a size is set, use half of it per side, otherwise, use 1px per side
float sizePerSide;
bool allSides = true;
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::size);
value = aAttributes->GetAttr(nsGkAtoms::size);
if (value && value->Type() == nsAttrValue::eInteger) {
sizePerSide = (float)value->GetIntegerValue() / 2.0f;
if (sizePerSide < 1.0f) {
@ -164,13 +157,11 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
}
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Color))) {
// color: a color
// (we got the color attribute earlier)
if (colorIsSet) {
aData->SetColorValueIfUnset(eCSSProperty_color, color);
}
}
nsGenericHTMLElement::MapWidthAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);

View File

@ -84,7 +84,6 @@ void
HTMLIFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Border))) {
// frameborder: 0 | 1 (| NO | YES in quirks mode)
// If frameborder is 0 or No, set border to 0
// else leave it as the value set in html.css
@ -100,7 +99,6 @@ HTMLIFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
aData->SetPixelValueIfUnset(eCSSProperty_border_left_width, 0.0f);
}
}
}
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);

View File

@ -69,14 +69,12 @@ void
HTMLLIElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(List))) {
if (!aData->PropertyIsSet(eCSSProperty_list_style_type)) {
// type: enum
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
if (value && value->Type() == nsAttrValue::eEnum)
aData->SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}

View File

@ -45,13 +45,11 @@ void
HTMLPreElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Text))) {
if (!aData->PropertyIsSet(eCSSProperty_white_space)) {
// wrap: empty
if (aAttributes->GetAttr(nsGkAtoms::wrap))
aData->SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::PreWrap);
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}

View File

@ -81,7 +81,6 @@ static void
DirectoryMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(List))) {
if (!aData->PropertyIsSet(eCSSProperty_list_style_type)) {
// type: enum
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
@ -93,7 +92,6 @@ DirectoryMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
}
}
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}

View File

@ -83,7 +83,6 @@ void
HTMLSharedListElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(List))) {
if (!aData->PropertyIsSet(eCSSProperty_list_style_type)) {
// type: enum
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
@ -91,7 +90,6 @@ HTMLSharedListElement::MapAttributesIntoRule(const nsMappedAttributes* aAttribut
aData->SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
}
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}

View File

@ -55,13 +55,11 @@ void
HTMLTableCaptionElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(TableBorder))) {
if (!aData->PropertyIsSet(eCSSProperty_caption_side)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
if (value && value->Type() == nsAttrValue::eEnum)
aData->SetKeywordValue(eCSSProperty_caption_side, value->GetEnumValue());
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}

View File

@ -185,7 +185,6 @@ void
HTMLTableCellElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Position))) {
// width: value
if (!aData->PropertyIsSet(eCSSProperty_width)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
@ -214,8 +213,6 @@ HTMLTableCellElement::MapAttributesIntoRule(const nsMappedAttributes* aAttribute
// else 0 implies auto for compatibility
}
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Text))) {
if (!aData->PropertyIsSet(eCSSProperty_white_space)) {
// nowrap: enum
if (aAttributes->GetAttr(nsGkAtoms::nowrap)) {
@ -229,7 +226,6 @@ HTMLTableCellElement::MapAttributesIntoRule(const nsMappedAttributes* aAttribute
}
}
}
}
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aData);

View File

@ -67,7 +67,6 @@ void
HTMLTableColElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Table))) {
if (!aData->PropertyIsSet(eCSSProperty__x_span)) {
// span: int
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::span);
@ -81,7 +80,6 @@ HTMLTableColElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes
}
}
}
}
nsGenericHTMLElement::MapWidthAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);

View File

@ -946,19 +946,15 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsCompatibility mode = aData->Document()->GetCompatibilityMode();
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(TableBorder))) {
// cellspacing
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::cellspacing);
if (value && value->Type() == nsAttrValue::eInteger &&
!aData->PropertyIsSet(eCSSProperty_border_spacing)) {
aData->SetPixelValue(eCSSProperty_border_spacing, float(value->GetIntegerValue()));
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Margin))) {
// align; Check for enumerated type (it may be another type if
// illegal)
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
value = aAttributes->GetAttr(nsGkAtoms::align);
if (value && value->Type() == nsAttrValue::eEnum) {
if (value->GetEnumValue() == NS_STYLE_TEXT_ALIGN_CENTER ||
value->GetEnumValue() == NS_STYLE_TEXT_ALIGN_MOZ_CENTER) {
@ -985,10 +981,8 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
aData->SetPixelValueIfUnset(eCSSProperty_margin_bottom, (float)value->GetIntegerValue());
}
}
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Border))) {
// bordercolor
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::bordercolor);
value = aAttributes->GetAttr(nsGkAtoms::bordercolor);
nscolor color;
if (value && value->GetColorValue(color)) {
aData->SetColorValueIfUnset(eCSSProperty_border_top_color, color);
@ -1012,7 +1006,7 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
aData->SetPixelValueIfUnset(eCSSProperty_border_bottom_width, (float)borderThickness);
aData->SetPixelValueIfUnset(eCSSProperty_border_right_width, (float)borderThickness);
}
}
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
@ -1055,7 +1049,6 @@ static void
MapInheritedTableAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Padding))) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::cellpadding);
if (value && value->Type() == nsAttrValue::eInteger) {
// We have cellpadding. This will override our padding values if we
@ -1068,7 +1061,6 @@ MapInheritedTableAttributesIntoRule(const nsMappedAttributes* aAttributes,
aData->SetPixelValueIfUnset(eCSSProperty_padding_left, pad);
}
}
}
nsMappedAttributes*
HTMLTableElement::GetAttributesMappedForCell()

View File

@ -165,14 +165,12 @@ void
HTMLTableSectionElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Position))) {
// height: value
if (!aData->PropertyIsSet(eCSSProperty_height)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
if (value && value->Type() == nsAttrValue::eInteger)
aData->SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
}
}
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);

View File

@ -450,7 +450,6 @@ void
HTMLTextAreaElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Text))) {
// wrap=off
if (!aData->PropertyIsSet(eCSSProperty_white_space)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::wrap);
@ -459,7 +458,6 @@ HTMLTextAreaElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes
aData->SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Pre);
}
}
}
nsGenericHTMLFormElementWithState::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aData);

View File

@ -1161,21 +1161,13 @@ nsGenericHTMLElement::ParseScrollingValue(const nsAString& aString,
static inline void
MapLangAttributeInto(const nsMappedAttributes* aAttributes, GenericSpecifiedValues* aData)
{
if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Font) |
NS_STYLE_INHERIT_BIT(Text))) {
return;
}
const nsAttrValue* langValue = aAttributes->GetAttr(nsGkAtoms::lang);
if (!langValue) {
return;
}
MOZ_ASSERT(langValue->Type() == nsAttrValue::eAtom);
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Font))) {
aData->SetIdentAtomValueIfUnset(eCSSProperty__x_lang,
langValue->GetAtomValue());
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Text))) {
if (!aData->PropertyIsSet(eCSSProperty_text_emphasis_position)) {
const nsAtom* lang = langValue->GetAtomValue();
if (nsStyleUtil::MatchesLanguagePrefix(lang, u"zh")) {
@ -1190,7 +1182,6 @@ MapLangAttributeInto(const nsMappedAttributes* aAttributes, GenericSpecifiedValu
}
}
}
}
/**
* Handle attributes common to all html elements
@ -1199,7 +1190,6 @@ void
nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(UserInterface))) {
if (!aData->PropertyIsSet(eCSSProperty__moz_user_modify)) {
const nsAttrValue* value =
aAttributes->GetAttr(nsGkAtoms::contenteditable);
@ -1215,7 +1205,6 @@ nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(const nsMappedAttribut
}
}
}
}
MapLangAttributeInto(aAttributes, aData);
}
@ -1226,14 +1215,12 @@ nsGenericHTMLElement::MapCommonAttributesInto(const nsMappedAttributes* aAttribu
{
MapCommonAttributesIntoExceptHidden(aAttributes, aData);
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Display))) {
if (!aData->PropertyIsSet(eCSSProperty_display)) {
if (aAttributes->IndexOfAttr(nsGkAtoms::hidden) >= 0) {
aData->SetKeywordValue(eCSSProperty_display, StyleDisplay::None);
}
}
}
}
/* static */ const nsGenericHTMLElement::MappedAttributeEntry
nsGenericHTMLElement::sCommonAttributeMap[] = {
@ -1287,7 +1274,6 @@ void
nsGenericHTMLElement::MapImageAlignAttributeInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Display))) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
if (value && value->Type() == nsAttrValue::eEnum) {
int32_t align = value->GetEnumValue();
@ -1310,13 +1296,11 @@ nsGenericHTMLElement::MapImageAlignAttributeInto(const nsMappedAttributes* aAttr
}
}
}
}
void
nsGenericHTMLElement::MapDivAlignAttributeInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Text))) {
if (!aData->PropertyIsSet(eCSSProperty_text_align)) {
// align: enum
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
@ -1324,13 +1308,11 @@ nsGenericHTMLElement::MapDivAlignAttributeInto(const nsMappedAttributes* aAttrib
aData->SetKeywordValue(eCSSProperty_text_align, value->GetEnumValue());
}
}
}
void
nsGenericHTMLElement::MapVAlignAttributeInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Display))) {
if (!aData->PropertyIsSet(eCSSProperty_vertical_align)) {
// align: enum
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::valign);
@ -1338,15 +1320,11 @@ nsGenericHTMLElement::MapVAlignAttributeInto(const nsMappedAttributes* aAttribut
aData->SetKeywordValue(eCSSProperty_vertical_align, value->GetEnumValue());
}
}
}
void
nsGenericHTMLElement::MapImageMarginAttributeInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Margin)))
return;
const nsAttrValue* value;
// hspace: value
@ -1386,10 +1364,6 @@ void
nsGenericHTMLElement::MapWidthAttributeInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Position))) {
return;
}
// width: value
if (!aData->PropertyIsSet(eCSSProperty_width)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
@ -1407,9 +1381,6 @@ void
nsGenericHTMLElement::MapHeightAttributeInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Position)))
return;
// height: value
if (!aData->PropertyIsSet(eCSSProperty_height)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
@ -1435,9 +1406,6 @@ void
nsGenericHTMLElement::MapImageBorderAttributeInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (!(aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Border))))
return;
// border: pixels
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::border);
if (!value)
@ -1472,9 +1440,6 @@ nsGenericHTMLElement::MapBackgroundInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Background)))
return;
if (!aData->PropertyIsSet(eCSSProperty_background_image)) {
// background
nsAttrValue* value =
@ -1489,9 +1454,6 @@ void
nsGenericHTMLElement::MapBGColorInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Background)))
return;
if (!aData->PropertyIsSet(eCSSProperty_background_color)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::bgcolor);
nscolor color;

View File

@ -502,7 +502,6 @@ void
nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
// scriptsizemultiplier
//
// "Specifies the multiplier to be used to adjust font size due to changes
@ -777,7 +776,6 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
}
}
}
}
// mathbackground
//
@ -797,9 +795,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
// values: color | "transparent"
// default: "transparent"
//
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Background)) {
const nsAttrValue* value =
aAttributes->GetAttr(nsGkAtoms::mathbackground_);
value = aAttributes->GetAttr(nsGkAtoms::mathbackground_);
if (!value) {
value = aAttributes->GetAttr(nsGkAtoms::background);
if (value) {
@ -814,7 +810,6 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
aData->SetColorValueIfUnset(eCSSProperty_background_color, color);
}
}
}
// mathcolor
//
@ -833,8 +828,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
// values: color
// default: inherited
//
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Color)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::mathcolor_);
value = aAttributes->GetAttr(nsGkAtoms::mathcolor_);
if (!value) {
value = aAttributes->GetAttr(nsGkAtoms::color);
if (value) {
@ -847,9 +841,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
if (value && value->GetColorValue(color)) {
aData->SetColorValueIfUnset(eCSSProperty_color, color);
}
}
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
// width
//
// "Specifies the desired width of the entire table and is intended for
@ -876,7 +868,6 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
}
}
}
}
// dir
//
@ -898,8 +889,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
// values: "ltr" | "rtl"
// default: inherited
//
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Visibility)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::dir);
value = aAttributes->GetAttr(nsGkAtoms::dir);
if (value && value->Type() == nsAttrValue::eString &&
!aData->PropertyIsSet(eCSSProperty_direction)) {
nsAutoString str(value->GetStringValue());
@ -915,7 +905,6 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
}
}
}
}
nsresult
nsMathMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)

View File

@ -18,7 +18,6 @@
#include "nsCSSValue.h"
class nsAttrValue;
struct nsRuleData;
namespace mozilla {
@ -31,9 +30,8 @@ class ServoSpecifiedValues;
class GenericSpecifiedValues
{
protected:
explicit GenericSpecifiedValues(nsIDocument* aDoc, uint32_t aSIDs)
explicit GenericSpecifiedValues(nsIDocument* aDoc)
: mDocument(aDoc)
, mSIDs(aSIDs)
{}
public:
@ -47,14 +45,6 @@ public:
// Check if we already contain a certain longhand
inline bool PropertyIsSet(nsCSSPropertyID aId);
// Check if we are able to hold longhands from a given
// style struct. Pass the result of NS_STYLE_INHERIT_BIT to this
// function. Can accept multiple inherit bits or'd together.
inline bool ShouldComputeStyleStruct(uint64_t aInheritBits)
{
return aInheritBits & mSIDs;
}
// Set a property to an identifier (string)
inline void SetIdentStringValue(nsCSSPropertyID aId, const nsString& aValue);
inline void SetIdentStringValueIfUnset(nsCSSPropertyID aId,
@ -118,7 +108,6 @@ public:
inline void SetBackgroundImage(nsAttrValue& value);
nsIDocument* const mDocument;
const uint32_t mSIDs;
};
} // namespace mozilla

View File

@ -14,7 +14,6 @@
#include "mozilla/GenericSpecifiedValues.h"
#include "mozilla/ServoBindingTypes.h"
#include "nsStyleStruct.h"
namespace mozilla {
@ -22,7 +21,7 @@ class ServoSpecifiedValues final : public GenericSpecifiedValues
{
public:
ServoSpecifiedValues(nsIDocument* aDocument, RawServoDeclarationBlock* aDecl)
: GenericSpecifiedValues(aDocument, NS_STYLE_INHERIT_MASK)
: GenericSpecifiedValues(aDocument)
, mDecl(aDecl)
{}