forked from mirrors/gecko-dev
Bug 1747595 - Make color-adjust an alias of print-color-adjust as per spec. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D134779
This commit is contained in:
parent
0fe787991e
commit
6b5a53d800
18 changed files with 59 additions and 32 deletions
|
|
@ -39,7 +39,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
|
|||
"caption-side",
|
||||
"clear",
|
||||
"clip-rule",
|
||||
"color-adjust",
|
||||
"color-interpolation",
|
||||
"color-interpolation-filters",
|
||||
"color-scheme",
|
||||
|
|
@ -134,6 +133,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
|
|||
"paint-order",
|
||||
"pointer-events",
|
||||
"position",
|
||||
"print-color-adjust",
|
||||
"quotes",
|
||||
"resize",
|
||||
"ruby-align",
|
||||
|
|
|
|||
|
|
@ -3043,7 +3043,7 @@ exports.CSS_PROPERTIES = {
|
|||
"visibility",
|
||||
"writing-mode",
|
||||
"text-orientation",
|
||||
"color-adjust",
|
||||
"print-color-adjust",
|
||||
"image-rendering",
|
||||
"image-orientation",
|
||||
"dominant-baseline",
|
||||
|
|
@ -5662,7 +5662,7 @@ exports.CSS_PROPERTIES = {
|
|||
"color-adjust": {
|
||||
"isInherited": true,
|
||||
"subproperties": [
|
||||
"color-adjust"
|
||||
"print-color-adjust"
|
||||
],
|
||||
"supports": [],
|
||||
"values": [
|
||||
|
|
@ -9624,6 +9624,22 @@ exports.CSS_PROPERTIES = {
|
|||
"unset"
|
||||
]
|
||||
},
|
||||
"print-color-adjust": {
|
||||
"isInherited": true,
|
||||
"subproperties": [
|
||||
"print-color-adjust"
|
||||
],
|
||||
"supports": [],
|
||||
"values": [
|
||||
"economy",
|
||||
"exact",
|
||||
"inherit",
|
||||
"initial",
|
||||
"revert",
|
||||
"revert-layer",
|
||||
"unset"
|
||||
]
|
||||
},
|
||||
"quotes": {
|
||||
"isInherited": true,
|
||||
"subproperties": [
|
||||
|
|
|
|||
|
|
@ -5447,7 +5447,8 @@ static bool ShouldDarkenColors(nsIFrame* aFrame) {
|
|||
if (pc->GetBackgroundColorDraw() || pc->GetBackgroundImageDraw()) {
|
||||
return false;
|
||||
}
|
||||
return aFrame->StyleVisibility()->mColorAdjust != StyleColorAdjust::Exact;
|
||||
return aFrame->StyleVisibility()->mPrintColorAdjust !=
|
||||
StylePrintColorAdjust::Exact;
|
||||
}
|
||||
|
||||
nscolor nsLayoutUtils::DarkenColorIfNeeded(nsIFrame* aFrame, nscolor aColor) {
|
||||
|
|
|
|||
|
|
@ -2557,7 +2557,7 @@ auto nsIFrame::ComputeShouldPaintBackground() const -> ShouldPaintBackground {
|
|||
}
|
||||
|
||||
if (!HonorPrintBackgroundSettings() ||
|
||||
StyleVisibility()->mColorAdjust == StyleColorAdjust::Exact) {
|
||||
StyleVisibility()->mPrintColorAdjust == StylePrintColorAdjust::Exact) {
|
||||
return {true, true};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ rusty-enums = [
|
|||
"mozilla::StyleScrollbarWidth",
|
||||
"mozilla::StyleWhiteSpace",
|
||||
"mozilla::StyleTextRendering",
|
||||
"mozilla::StyleColorAdjust",
|
||||
"mozilla::StyleFlexDirection",
|
||||
"mozilla::StyleStrokeLinecap",
|
||||
"mozilla::StyleStrokeLinejoin",
|
||||
|
|
@ -588,6 +587,7 @@ cbindgen-types = [
|
|||
{ gecko = "StylePageSize", servo = "crate::values::computed::page::PageSize" },
|
||||
{ gecko = "StyleDProperty", servo = "crate::values::specified::svg::DProperty" },
|
||||
{ gecko = "StyleImageRendering", servo = "crate::values::computed::ImageRendering" },
|
||||
{ gecko = "StylePrintColorAdjust", servo = "crate::values::computed::PrintColorAdjust" },
|
||||
{ gecko = "StyleScrollbarGutter", servo = "crate::values::computed::ScrollbarGutter" },
|
||||
{ gecko = "StyleHyphenateCharacter", servo = "crate::values::computed::HyphenateCharacter" },
|
||||
]
|
||||
|
|
|
|||
|
|
@ -700,12 +700,6 @@ enum class StyleTextRendering : uint8_t {
|
|||
Geometricprecision,
|
||||
};
|
||||
|
||||
// color-adjust
|
||||
enum class StyleColorAdjust : uint8_t {
|
||||
Economy = 0,
|
||||
Exact = 1,
|
||||
};
|
||||
|
||||
// color-interpolation and color-interpolation-filters
|
||||
enum class StyleColorInterpolation : uint8_t {
|
||||
Auto = 0,
|
||||
|
|
|
|||
|
|
@ -2705,7 +2705,7 @@ nsStyleVisibility::nsStyleVisibility(const Document& aDocument)
|
|||
mImageRendering(StyleImageRendering::Auto),
|
||||
mWritingMode(StyleWritingModeProperty::HorizontalTb),
|
||||
mTextOrientation(StyleTextOrientation::Mixed),
|
||||
mColorAdjust(StyleColorAdjust::Economy) {
|
||||
mPrintColorAdjust(StylePrintColorAdjust::Economy) {
|
||||
MOZ_COUNT_CTOR(nsStyleVisibility);
|
||||
}
|
||||
|
||||
|
|
@ -2716,7 +2716,7 @@ nsStyleVisibility::nsStyleVisibility(const nsStyleVisibility& aSource)
|
|||
mImageRendering(aSource.mImageRendering),
|
||||
mWritingMode(aSource.mWritingMode),
|
||||
mTextOrientation(aSource.mTextOrientation),
|
||||
mColorAdjust(aSource.mColorAdjust) {
|
||||
mPrintColorAdjust(aSource.mPrintColorAdjust) {
|
||||
MOZ_COUNT_CTOR(nsStyleVisibility);
|
||||
}
|
||||
|
||||
|
|
@ -2754,7 +2754,7 @@ nsChangeHint nsStyleVisibility::CalcDifference(
|
|||
if (mImageRendering != aNewData.mImageRendering) {
|
||||
hint |= nsChangeHint_RepaintFrame;
|
||||
}
|
||||
if (mColorAdjust != aNewData.mColorAdjust) {
|
||||
if (mPrintColorAdjust != aNewData.mPrintColorAdjust) {
|
||||
// color-adjust only affects media where dynamic changes can't happen.
|
||||
hint |= nsChangeHint_NeutralChange;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1067,7 +1067,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility {
|
|||
mozilla::StyleImageRendering mImageRendering;
|
||||
mozilla::StyleWritingModeProperty mWritingMode;
|
||||
mozilla::StyleTextOrientation mTextOrientation;
|
||||
mozilla::StyleColorAdjust mColorAdjust;
|
||||
mozilla::StylePrintColorAdjust mPrintColorAdjust;
|
||||
|
||||
bool IsVisible() const {
|
||||
return mVisible == mozilla::StyleVisibility::Visible;
|
||||
|
|
|
|||
|
|
@ -2543,14 +2543,21 @@ var gCSSProperties = {
|
|||
alias_for: "box-sizing",
|
||||
subproperties: ["box-sizing"],
|
||||
},
|
||||
"color-adjust": {
|
||||
domProp: "colorAdjust",
|
||||
"print-color-adjust": {
|
||||
domProp: "printColorAdjust",
|
||||
inherited: true,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: ["economy"],
|
||||
other_values: ["exact"],
|
||||
invalid_values: [],
|
||||
},
|
||||
"color-adjust": {
|
||||
domProp: "colorAdjust",
|
||||
inherited: true,
|
||||
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
|
||||
alias_for: "print-color-adjust",
|
||||
subproperties: ["print-color-adjust"],
|
||||
},
|
||||
columns: {
|
||||
domProp: "columns",
|
||||
inherited: false,
|
||||
|
|
|
|||
|
|
@ -501,6 +501,7 @@ class Longhand(Property):
|
|||
"OverscrollBehavior",
|
||||
"Percentage",
|
||||
"PositiveIntegerOrNone",
|
||||
"PrintColorAdjust",
|
||||
"Resize",
|
||||
"RubyPosition",
|
||||
"SVGOpacity",
|
||||
|
|
|
|||
|
|
@ -56,15 +56,14 @@ ${helpers.single_keyword(
|
|||
spec="https://drafts.csswg.org/css-writing-modes/#propdef-text-orientation",
|
||||
)}
|
||||
|
||||
// CSS Color Module Level 4
|
||||
// https://drafts.csswg.org/css-color/
|
||||
${helpers.single_keyword(
|
||||
"color-adjust",
|
||||
"economy exact",
|
||||
${helpers.predefined_type(
|
||||
"print-color-adjust",
|
||||
"PrintColorAdjust",
|
||||
"computed::PrintColorAdjust::Economy",
|
||||
engines="gecko",
|
||||
gecko_enum_prefix="StyleColorAdjust",
|
||||
aliases="color-adjust",
|
||||
spec="https://drafts.csswg.org/css-color-adjust/#print-color-adjust",
|
||||
animation_value_type="discrete",
|
||||
spec="https://drafts.csswg.org/css-color/#propdef-color-adjust",
|
||||
)}
|
||||
|
||||
// According to to CSS-IMAGES-3, `optimizespeed` and `optimizequality` are synonyms for `auto`
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use cssparser::{Color as CSSParserColor, RGBA};
|
|||
use std::fmt;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
|
||||
pub use crate::values::specified::color::ColorScheme;
|
||||
pub use crate::values::specified::color::{ColorScheme, PrintColorAdjust};
|
||||
|
||||
/// The computed value of the `color` property.
|
||||
pub type ColorPropertyValue = RGBA;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty};
|
|||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStrictness, ScrollSnapType};
|
||||
pub use self::box_::{TouchAction, VerticalAlign, WillChange};
|
||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, ColorScheme};
|
||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, ColorScheme, PrintColorAdjust};
|
||||
pub use self::column::ColumnCount;
|
||||
pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset, CounterSet};
|
||||
pub use self::easing::TimingFunction;
|
||||
|
|
|
|||
|
|
@ -983,3 +983,13 @@ impl ToCss for ColorScheme {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-color-adjust/#print-color-adjust
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[repr(u8)]
|
||||
pub enum PrintColorAdjust {
|
||||
/// Ignore backgrounds and darken text.
|
||||
Economy,
|
||||
/// Respect specified colors.
|
||||
Exact,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ pub use self::box_::{Clear, Float, Overflow, OverflowAnchor};
|
|||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStrictness, ScrollSnapType};
|
||||
pub use self::box_::{TouchAction, TransitionProperty, VerticalAlign, WillChange};
|
||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, ColorScheme};
|
||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, ColorScheme, PrintColorAdjust};
|
||||
pub use self::column::ColumnCount;
|
||||
pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset, CounterSet};
|
||||
pub use self::easing::TimingFunction;
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ include = [
|
|||
"PageSize",
|
||||
"DProperty",
|
||||
"ImageRendering",
|
||||
"PrintColorAdjust",
|
||||
"ScrollbarGutter",
|
||||
"ScrollDirection",
|
||||
"HyphenateCharacter",
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
[print-color-adjust-parsing.html]
|
||||
expected: ERROR
|
||||
|
|
@ -4,9 +4,9 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<link rel=help href="https://www.w3.org/TR/css-color-adjust-1/#perf">
|
||||
<link rel=author title="Tab Atkins-Bittner" href="https://www.xanthir.com/contact/">"
|
||||
<link rel=author title="Tab Atkins-Bittner" href="https://www.xanthir.com/contact/">
|
||||
|
||||
<script src="/css/supports/parsing-testcommon.js"></script>
|
||||
<script src="/css/support/parsing-testcommon.js"></script>
|
||||
|
||||
<script>
|
||||
test_valid_value('print-color-adjust', 'exact', 'exact');
|
||||
|
|
|
|||
Loading…
Reference in a new issue