servo: Merge #20163 - Don't panic on cells with both a rowspan and colspan in include_sizes_from_previous_rows (from Manishearth:rowspan-crash); r=mbrubeck
authorManish Goregaokar <manishsmail@gmail.com>
Thu, 01 Mar 2018 20:36:50 -0500
changeset 461242 81695cb901cfc2253ba074c67221748782db51fe
parent 461241 4d2c0a5cf2cf19b5f808b83c94aa1c7b32b1daf8
child 461243 9f0ee2f582a28742d8a4c5025418d71934b55401
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #20163 - Don't panic on cells with both a rowspan and colspan in include_sizes_from_previous_rows (from Manishearth:rowspan-crash); r=mbrubeck fixes #20162 Source-Repo: https://github.com/servo/servo Source-Revision: e446897cf603dd2f179c361523cc82ecad6e657b
servo/components/layout/table_row.rs
--- a/servo/components/layout/table_row.rs
+++ b/servo/components/layout/table_row.rs
@@ -118,17 +118,26 @@ impl TableRowFlow {
         fn include_sizes_from_previous_rows(col: &mut usize,
                                             incoming_rowspan: &[u32],
                                             incoming_rowspan_data: &mut Vec<Au>,
                                             max_block_size: &mut Au) {
             while let Some(span) = incoming_rowspan.get(*col) {
                 if *span == 1 {
                     break;
                 }
-                let incoming = incoming_rowspan_data[*col];
+                let incoming = if let Some(incoming) = incoming_rowspan_data.get(*col) {
+                    *incoming
+                } else {
+                    // This happens when we have a cell with both rowspan and colspan
+                    // incoming_rowspan_data only records the data for the first column,
+                    // but that's ok because we only need to account for each spanning cell
+                    // once. So we skip ahead.
+                    *col += 1;
+                    continue;
+                };
                 *max_block_size = max(*max_block_size, incoming);
                 *col += 1;
             }
         }
         // Per CSS 2.1 ยง 17.5.3, find max_y = max(computed `block-size`, minimum block-size of
         // all cells).
         let mut max_block_size = Au(0);
         let thread_id = self.block_flow.base.thread_id;