From 5cd15eeb54bf4e2f53059a8ba2245d919f36cafe Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 14 Feb 2018 14:12:22 -0800 Subject: [PATCH] Don't redraw backgrounds that we've already drawn --- components/layout/table.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/components/layout/table.rs b/components/layout/table.rs index b888df65fe5..8c2d4e86c96 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -20,8 +20,7 @@ use gfx_traits::print_tree::PrintTree; use layout_debug; use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto}; use servo_arc::Arc; -use std::cmp; -use std::fmt; +use std::{cmp, fmt, ptr}; use style::computed_values::{border_collapse, border_spacing, table_layout}; use style::context::SharedStyleContext; use style::logical_geometry::LogicalSize; @@ -1074,12 +1073,20 @@ impl<'table> TableCellStyleInfo<'table> { }; { let cell_flow = &self.cell.block_flow; + let mut bg_ptr = ptr::null(); + // XXXManishearth the color should be resolved relative to the style itself // which we don't have here - let build_dl = |bg, state: &mut &mut DisplayListBuildState| { + let mut build_dl = |bg, state: &mut &mut DisplayListBuildState| { + // Don't redraw backgrounds that we've already drawn + if bg_ptr == bg as *const _ { + return; + } cell_flow.build_display_list_for_background_if_applicable_with_background( state, bg, table_style.resolve_color(bg.background_color) - ) + ); + + bg_ptr = bg as *const _; };