Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webrender/src/frame_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ impl FrameBuilder {
// we handle subpixel blending.
if let Some(sc_index) = self.stacking_context_stack.last() {
let stacking_context = &self.stacking_context_store[sc_index.0];
if stacking_context.composite_ops.count() > 0 {
if !stacking_context.allow_subpixel_aa {
render_mode = FontRenderMode::Alpha;
}
}
Expand Down
8 changes: 8 additions & 0 deletions webrender/src/tiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,11 @@ pub struct StackingContext {

/// Current stacking context visibility of backface.
pub is_backface_visible: bool,

/// Allow subpixel AA for text runs on this stacking context.
/// This is a temporary hack while we don't support subpixel AA
/// on transparent stacking contexts.
pub allow_subpixel_aa: bool,
}

impl StackingContext {
Expand All @@ -1618,6 +1623,8 @@ impl StackingContext {
TransformStyle::Flat => ContextIsolation::None,
TransformStyle::Preserve3D => ContextIsolation::Items,
};
let allow_subpixel_aa = composite_ops.count() == 0 &&
isolation == ContextIsolation::None;
StackingContext {
pipeline_id,
reference_frame_offset,
Expand All @@ -1630,6 +1637,7 @@ impl StackingContext {
is_pipeline_root,
is_visible: false,
is_backface_visible,
allow_subpixel_aa,
}
}

Expand Down
Binary file added wrench/reftests/text/isolated-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions wrench/reftests/text/isolated-text.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root:
items:
- type: stacking-context
bounds: [0, 0, 1000, 100]
transform: perspective(1000)
items:
- type: stacking-context
bounds: [0, 0, 1000, 100]
transform-style: preserve-3d
items:
- text: "Cats making all the muffins knock over christmas tree"
origin: 20 30
size: 20
font: "FreeSans.ttf"
2 changes: 2 additions & 0 deletions wrench/reftests/text/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ fuzzy(1,160) == shadow-grey.yaml shadow-grey-ref.yaml
# enable when synthetic-italics implemented on mac
platform(linux) != synthetic-italics.yaml synthetic-italics-ref.yaml
options(disable-subpixel) == ahem.yaml ahem-ref.yaml
platform(linux) == isolated-text.yaml isolated-text.png

3 changes: 3 additions & 0 deletions wrench/src/yaml_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ impl YamlHelper for Yaml {
"rotate-y" if args.len() == 1 => {
make_rotation(transform_origin, args[0].parse().unwrap(), 0.0, 1.0, 0.0)
}
"perspective" if args.len() == 1 => {
LayoutTransform::create_perspective(args[0].parse().unwrap())
}
_ => {
println!("unknown function {}", function);
break;
Expand Down