瀏覽代碼

LibWeb: Use intrinsic_percentage instead of percentage_{width, height}

Follow the terminology from specification.
Andi Gallo 2 年之前
父節點
當前提交
1f3fca996c

+ 13 - 13
Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp

@@ -230,13 +230,13 @@ void TableFormattingContext::compute_cell_measures(AvailableSpace const& availab
         auto const& computed_values = cell.box->computed_values();
 
         if (computed_values.width().is_percentage()) {
-            m_columns[cell.column_index].has_percentage_width = true;
-            m_columns[cell.column_index].percentage_width = max(m_columns[cell.column_index].percentage_width, computed_values.width().percentage().value());
+            m_columns[cell.column_index].has_intrinsic_percentage = true;
+            m_columns[cell.column_index].intrinsic_percentage = max(m_columns[cell.column_index].intrinsic_percentage, computed_values.width().percentage().value());
         }
 
         if (computed_values.height().is_percentage()) {
-            m_rows[cell.row_index].has_percentage_height = true;
-            m_rows[cell.row_index].percentage_height = max(m_rows[cell.row_index].percentage_height, computed_values.height().percentage().value());
+            m_rows[cell.row_index].has_intrinsic_percentage = true;
+            m_rows[cell.row_index].intrinsic_percentage = max(m_rows[cell.row_index].intrinsic_percentage, computed_values.height().percentage().value());
         }
     }
 
@@ -633,7 +633,7 @@ bool TableFormattingContext::distribute_excess_width_by_intrinsic_percentage(CSS
     for (auto const& column : m_columns) {
         if (column_filter(column)) {
             found_matching_columns = true;
-            total_percentage_width += column.percentage_width;
+            total_percentage_width += column.intrinsic_percentage;
         }
     }
     if (!found_matching_columns) {
@@ -641,7 +641,7 @@ bool TableFormattingContext::distribute_excess_width_by_intrinsic_percentage(CSS
     }
     for (auto& column : m_columns) {
         if (column_filter(column)) {
-            column.used_width += excess_width * column.percentage_width / total_percentage_width;
+            column.used_width += excess_width * column.intrinsic_percentage / total_percentage_width;
         }
     }
     return true;
@@ -677,8 +677,8 @@ void TableFormattingContext::distribute_width_to_columns()
     //    - all other columns are assigned their min-content width.
     for (size_t i = 0; i < m_columns.size(); ++i) {
         auto& column = m_columns[i];
-        if (column.has_percentage_width) {
-            candidate_widths[i] = max(column.min_size, column.percentage_width / 100 * available_width);
+        if (column.has_intrinsic_percentage) {
+            candidate_widths[i] = max(column.min_size, column.intrinsic_percentage / 100 * available_width);
         }
     }
 
@@ -718,7 +718,7 @@ void TableFormattingContext::distribute_width_to_columns()
     //    - all other columns are assigned their max-content width.
     for (size_t i = 0; i < m_columns.size(); ++i) {
         auto& column = m_columns[i];
-        if (!column.has_percentage_width) {
+        if (!column.has_intrinsic_percentage) {
             candidate_widths[i] = column.max_size;
         }
     }
@@ -753,7 +753,7 @@ void TableFormattingContext::distribute_excess_width_to_columns(CSSPixels availa
     if (distribute_excess_width_proportionally_to_max_width(
             excess_width,
             [](auto const& column) {
-                return !column.is_constrained && column.has_originating_cells && column.percentage_width == 0 && column.max_size > 0;
+                return !column.is_constrained && column.has_originating_cells && column.intrinsic_percentage == 0 && column.max_size > 0;
             })) {
         excess_width = available_width - compute_columns_total_used_width();
     }
@@ -765,7 +765,7 @@ void TableFormattingContext::distribute_excess_width_to_columns(CSSPixels availa
     //    columns allowed to grow by this rule are increased by equal amounts so the total increase adds to the excess width.
     if (distribute_excess_width_equally(excess_width,
             [](auto const& column) {
-                return !column.is_constrained && column.has_originating_cells && column.percentage_width == 0;
+                return !column.is_constrained && column.has_originating_cells && column.intrinsic_percentage == 0;
             })) {
         excess_width = available_width - compute_columns_total_used_width();
     }
@@ -778,7 +778,7 @@ void TableFormattingContext::distribute_excess_width_to_columns(CSSPixels availa
     if (distribute_excess_width_proportionally_to_max_width(
             excess_width,
             [](auto const& column) {
-                return column.is_constrained && column.percentage_width == 0 && column.max_size > 0;
+                return column.is_constrained && column.intrinsic_percentage == 0 && column.max_size > 0;
             })) {
         excess_width = available_width - compute_columns_total_used_width();
     }
@@ -789,7 +789,7 @@ void TableFormattingContext::distribute_excess_width_to_columns(CSSPixels availa
     //    which, due to other rules, must have originating cells), the distributed widths of the columns allowed to grow by this rule are
     //    increased in proportion to intrinsic percentage width so the total increase adds to the excess width.
     if (distribute_excess_width_by_intrinsic_percentage(excess_width, [](auto const& column) {
-            return column.percentage_width > 0;
+            return column.intrinsic_percentage > 0;
         })) {
         excess_width = available_width - compute_columns_total_used_width();
     }

+ 4 - 4
Userland/Libraries/LibWeb/Layout/TableFormattingContext.h

@@ -77,8 +77,8 @@ private:
         CSSPixels min_size { 0 };
         CSSPixels max_size { 0 };
         CSSPixels used_width { 0 };
-        bool has_percentage_width { false };
-        double percentage_width { 0 };
+        bool has_intrinsic_percentage { false };
+        double intrinsic_percentage { 0 };
         // Store whether the column is constrained: https://www.w3.org/TR/css-tables-3/#constrainedness
         bool is_constrained { false };
         // Store whether the column has originating cells, defined in https://www.w3.org/TR/css-tables-3/#terminology.
@@ -93,8 +93,8 @@ private:
         CSSPixels baseline { 0 };
         CSSPixels min_size { 0 };
         CSSPixels max_size { 0 };
-        bool has_percentage_height { false };
-        double percentage_height { 0 };
+        bool has_intrinsic_percentage { false };
+        double intrinsic_percentage { 0 };
         // Store whether the row is constrained: https://www.w3.org/TR/css-tables-3/#constrainedness
         bool is_constrained { false };
     };