Issue #2045 - Part 7: Override revert values during presentation hint cascade

This commit is contained in:
Francis Dominic Fajardo 2025-06-30 16:35:46 +08:00 committed by roytam1
commit 166e98d2b9

View file

@ -46,9 +46,11 @@ nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Color)) {
nsCSSValue* color = aRuleData->ValueForColor();
if (color->GetUnit() == eCSSUnit_Null &&
aRuleData->mPresContext->UseDocumentColors())
if ((color->GetUnit() == eCSSUnit_Null ||
color->GetUnit() == eCSSUnit_Revert) &&
aRuleData->mPresContext->UseDocumentColors()) {
color->SetColorValue(mColor);
}
}
}
@ -98,7 +100,8 @@ nsHTMLStyleSheet::TableTHRule::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) {
nsCSSValue* textAlign = aRuleData->ValueForTextAlign();
if (textAlign->GetUnit() == eCSSUnit_Null) {
if (textAlign->GetUnit() == eCSSUnit_Null ||
textAlign->GetUnit() == eCSSUnit_Revert) {
textAlign->SetIntValue(NS_STYLE_TEXT_ALIGN_MOZ_CENTER_OR_INHERIT,
eCSSUnit_Enumerated);
}
@ -126,9 +129,11 @@ nsHTMLStyleSheet::TableQuirkColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
nsCSSValue* color = aRuleData->ValueForColor();
// We do not check UseDocumentColors() here, because we want to
// use the body color no matter what.
if (color->GetUnit() == eCSSUnit_Null)
if (color->GetUnit() == eCSSUnit_Null ||
color->GetUnit() == eCSSUnit_Revert) {
color->SetIntValue(NS_STYLE_COLOR_INHERIT_FROM_BODY,
eCSSUnit_Enumerated);
}
}
}
@ -153,7 +158,8 @@ nsHTMLStyleSheet::LangRule::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
nsCSSValue* lang = aRuleData->ValueForLang();
if (lang->GetUnit() == eCSSUnit_Null) {
if (lang->GetUnit() == eCSSUnit_Null ||
lang->GetUnit() == eCSSUnit_Revert) {
lang->SetStringValue(mLang, eCSSUnit_Ident);
}
}