Skip to content
Permalink
Browse files

WR update: update root background color behavior

  • Loading branch information...
paulrouget committed Mar 12, 2019
1 parent 4c94f54 commit 2a2c491515520f2d8528adac0ef032dbced2f087
Showing with 14 additions and 11 deletions.
  1. +13 −11 components/layout_thread/lib.rs
  2. +1 −0 components/servo/lib.rs
@@ -1861,11 +1861,8 @@ impl ProfilerMetadataFactory for LayoutThread {
// http://dev.w3.org/csswg/css-backgrounds/#background-color). However, we
// need to propagate the background color from the root HTML/Body
// element (http://dev.w3.org/csswg/css-backgrounds/#special-backgrounds) if
// it is non-transparent. The phrase in the spec "If the canvas background
// is not opaque, what shows through is UA-dependent." is handled by rust-layers
// clearing the frame buffer to white. This ensures that setting a background
// color on an iframe element, while the iframe content itself has a default
// transparent background color is handled correctly.
// it is non-transparent. The spec says "If the canvas background is not opaque,
// what shows through is UA-dependent.". Here we fallback to white.
fn get_root_flow_background_color(flow: &mut dyn Flow) -> webrender_api::ColorF {
let transparent = webrender_api::ColorF {
r: 0.0,
@@ -1894,12 +1891,17 @@ fn get_root_flow_background_color(flow: &mut dyn Flow) -> webrender_api::ColorF
.get_background()
.background_color,
);
webrender_api::ColorF::new(
color.red_f32(),
color.green_f32(),
color.blue_f32(),
color.alpha_f32(),
)

if color.alpha == 0 {
webrender_api::ColorF::WHITE
} else {
webrender_api::ColorF::new(
color.red_f32(),
color.green_f32(),
color.blue_f32(),
color.alpha_f32(),
)
}
}

fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
@@ -242,6 +242,7 @@ where
},
renderer_kind: renderer_kind,
enable_subpixel_aa: opts.enable_subpixel_text_antialiasing,
clear_color: None,
..Default::default()
},
None,

0 comments on commit 2a2c491

Please sign in to comment.
You can’t perform that action at this time.