mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Speculatively evaluate paint functions during style.
This commit is contained in:
parent
b35791f86f
commit
936dd3ef63
13 changed files with 279 additions and 52 deletions
|
@ -1181,24 +1181,18 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
.map(|argument| argument.to_css_string())
|
||||
.collect();
|
||||
|
||||
// Get the painter, and the computed values for its properties.
|
||||
// TODO: less copying.
|
||||
let (properties, painter) = match state.layout_context.registered_painters.read().get(&name) {
|
||||
Some(registered_painter) => (
|
||||
registered_painter.properties
|
||||
.iter()
|
||||
let mut draw_result = match state.layout_context.registered_painters.get(&name) {
|
||||
Some(painter) => {
|
||||
debug!("Drawing a paint image {}({},{}).", name, size_in_px.width, size_in_px.height);
|
||||
let properties = painter.properties().iter()
|
||||
.filter_map(|(name, id)| id.as_shorthand().err().map(|id| (name, id)))
|
||||
.map(|(name, id)| (name.clone(), style.computed_value_to_string(id)))
|
||||
.collect(),
|
||||
registered_painter.painter.clone()
|
||||
),
|
||||
.collect();
|
||||
painter.draw_a_paint_image(size_in_px, device_pixel_ratio, properties, arguments)
|
||||
},
|
||||
None => return debug!("Worklet {} called before registration.", name),
|
||||
};
|
||||
|
||||
// TODO: add a one-place cache to avoid drawing the paint image every time.
|
||||
// https://github.com/servo/servo/issues/17369
|
||||
debug!("Drawing a paint image {}({},{}).", name, size_in_px.width, size_in_px.height);
|
||||
let mut draw_result = painter.draw_a_paint_image(size_in_px, device_pixel_ratio, properties, arguments);
|
||||
let webrender_image = WebRenderImageInfo {
|
||||
width: draw_result.width,
|
||||
height: draw_result.height,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue