mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1746248 - Style system and plumbing for mix-blend-mode: plus-lighter. r=jrmuizel,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D137951
This commit is contained in:
parent
c409cc8128
commit
4a152fdf3e
@ -8712,6 +8712,7 @@ exports.CSS_PROPERTIES = {
|
||||
"multiply",
|
||||
"normal",
|
||||
"overlay",
|
||||
"plus-lighter",
|
||||
"revert",
|
||||
"revert-layer",
|
||||
"saturation",
|
||||
|
@ -291,6 +291,8 @@ static inline MixBlendMode ToMixBlendMode(gfx::CompositionOp compositionOp) {
|
||||
return MixBlendMode::Color;
|
||||
case gfx::CompositionOp::OP_LUMINOSITY:
|
||||
return MixBlendMode::Luminosity;
|
||||
case gfx::CompositionOp::OP_ADD:
|
||||
return MixBlendMode::PlusLighter;
|
||||
default:
|
||||
return MixBlendMode::Normal;
|
||||
}
|
||||
|
@ -238,6 +238,7 @@ const int MixBlendMode_Hue = 12;
|
||||
const int MixBlendMode_Saturation = 13;
|
||||
const int MixBlendMode_Color = 14;
|
||||
const int MixBlendMode_Luminosity = 15;
|
||||
const int MixBlendMode_PlusLighter = 16;
|
||||
|
||||
Fragment brush_fs() {
|
||||
float perspective_divisor = mix(gl_FragCoord.w, 1.0, v_perspective.x);
|
||||
@ -322,6 +323,9 @@ Fragment brush_fs() {
|
||||
case MixBlendMode_Luminosity:
|
||||
result.rgb = Luminosity(Cb.rgb, Cs.rgb);
|
||||
break;
|
||||
case MixBlendMode_PlusLighter:
|
||||
// TODO(emilio): Implement.
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
@ -3915,6 +3915,11 @@ impl Device {
|
||||
self.gl.blend_func_separate(gl::ZERO, gl::SRC_COLOR, gl::ZERO, gl::SRC_ALPHA);
|
||||
gl::FUNC_ADD
|
||||
},
|
||||
MixBlendMode::PlusLighter => {
|
||||
// TODO(emilio): Implement.
|
||||
self.gl.blend_func_separate(gl::ZERO, gl::SRC_COLOR, gl::ZERO, gl::SRC_ALPHA);
|
||||
gl::FUNC_ADD
|
||||
},
|
||||
MixBlendMode::Multiply => gl::MULTIPLY_KHR,
|
||||
MixBlendMode::Screen => gl::SCREEN_KHR,
|
||||
MixBlendMode::Overlay => gl::OVERLAY_KHR,
|
||||
|
@ -113,6 +113,7 @@ pub enum PictureCompositeKey {
|
||||
Saturation,
|
||||
Color,
|
||||
Luminosity,
|
||||
PlusLighter,
|
||||
}
|
||||
|
||||
impl From<Option<PictureCompositeMode>> for PictureCompositeKey {
|
||||
@ -136,6 +137,7 @@ impl From<Option<PictureCompositeMode>> for PictureCompositeKey {
|
||||
MixBlendMode::Saturation => PictureCompositeKey::Saturation,
|
||||
MixBlendMode::Color => PictureCompositeKey::Color,
|
||||
MixBlendMode::Luminosity => PictureCompositeKey::Luminosity,
|
||||
MixBlendMode::PlusLighter => PictureCompositeKey::PlusLighter,
|
||||
}
|
||||
}
|
||||
Some(PictureCompositeMode::Filter(op)) => {
|
||||
|
@ -974,6 +974,7 @@ pub enum MixBlendMode {
|
||||
Saturation = 13,
|
||||
Color = 14,
|
||||
Luminosity = 15,
|
||||
PlusLighter = 16,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -132,7 +132,8 @@ define_string_enum!(
|
||||
Hue = "hue",
|
||||
Saturation = "saturation",
|
||||
Color = "color",
|
||||
Luminosity = "luminosity"
|
||||
Luminosity = "luminosity",
|
||||
PlusLighter = "plus-lighter"
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -684,8 +684,8 @@ struct nsCSSRendering {
|
||||
static nsRect GetTextDecorationRect(nsPresContext* aPresContext,
|
||||
const DecorationRectParams& aParams);
|
||||
|
||||
static CompositionOp GetGFXBlendMode(mozilla::StyleBlend mBlendMode) {
|
||||
switch (mBlendMode) {
|
||||
static CompositionOp GetGFXBlendMode(mozilla::StyleBlend aBlendMode) {
|
||||
switch (aBlendMode) {
|
||||
case mozilla::StyleBlend::Normal:
|
||||
return CompositionOp::OP_OVER;
|
||||
case mozilla::StyleBlend::Multiply:
|
||||
@ -718,6 +718,8 @@ struct nsCSSRendering {
|
||||
return CompositionOp::OP_COLOR;
|
||||
case mozilla::StyleBlend::Luminosity:
|
||||
return CompositionOp::OP_LUMINOSITY;
|
||||
case mozilla::StyleBlend::PlusLighter:
|
||||
return CompositionOp::OP_ADD;
|
||||
default:
|
||||
MOZ_ASSERT(false);
|
||||
return CompositionOp::OP_OVER;
|
||||
|
@ -733,6 +733,7 @@ enum class StyleBlend : uint8_t {
|
||||
Saturation,
|
||||
Color,
|
||||
Luminosity,
|
||||
PlusLighter,
|
||||
};
|
||||
|
||||
// composite
|
||||
|
@ -4056,7 +4056,7 @@ var gCSSProperties = {
|
||||
"color",
|
||||
"luminosity",
|
||||
],
|
||||
invalid_values: ["none", "10px", "multiply multiply"],
|
||||
invalid_values: ["none", "10px", "multiply multiply", "plus-lighter"],
|
||||
},
|
||||
"background-clip": {
|
||||
/*
|
||||
@ -9047,6 +9047,7 @@ var gCSSProperties = {
|
||||
"saturation",
|
||||
"color",
|
||||
"luminosity",
|
||||
"plus-lighter",
|
||||
],
|
||||
invalid_values: [],
|
||||
},
|
||||
|
@ -111,5 +111,6 @@ ${helpers.single_keyword(
|
||||
vector=True,
|
||||
engines="gecko",
|
||||
animation_value_type="discrete",
|
||||
gecko_inexhaustive=True,
|
||||
spec="https://drafts.fxtf.org/compositing/#background-blend-mode",
|
||||
)}
|
||||
|
@ -78,7 +78,7 @@ ${helpers.single_keyword(
|
||||
"mix-blend-mode",
|
||||
"""normal multiply screen overlay darken lighten color-dodge
|
||||
color-burn hard-light soft-light difference exclusion hue
|
||||
saturation color luminosity""",
|
||||
saturation color luminosity plus-lighter""",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
gecko_enum_prefix="StyleBlend",
|
||||
animation_value_type="discrete",
|
||||
|
@ -22,7 +22,7 @@
|
||||
}
|
||||
|
||||
var blendModes = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn",
|
||||
"hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
|
||||
"hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity", "plus-lighter"];
|
||||
|
||||
for (var i = 0; i < blendModes.length; i++) {
|
||||
test(function() {assert_equals(testParse("mix-blend-mode: " + blendModes[i]), blendModes[i] )}, "Mix-blend-mode " + blendModes[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user