mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Implement 'empty-cells' for layout 2020 (#32331)
https://drafts.csswg.org/css-tables/#empty-cell-rendering Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
9d57c0de77
commit
5b13604bd8
11 changed files with 46 additions and 133 deletions
26
Cargo.lock
generated
26
Cargo.lock
generated
|
@ -1261,7 +1261,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "derive_common"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
|
@ -3636,7 +3636,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "malloc_size_of"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"accountable-refcell",
|
||||
"app_units",
|
||||
|
@ -5241,7 +5241,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "selectors"
|
||||
version = "0.24.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"cssparser",
|
||||
|
@ -5529,7 +5529,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo_arc"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"nodrop",
|
||||
"serde",
|
||||
|
@ -5539,7 +5539,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo_atoms"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"string_cache",
|
||||
"string_cache_codegen",
|
||||
|
@ -5737,7 +5737,7 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
|
|||
[[package]]
|
||||
name = "size_of_test"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
@ -5878,7 +5878,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
|||
[[package]]
|
||||
name = "static_prefs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
|
||||
[[package]]
|
||||
name = "strict-num"
|
||||
|
@ -5915,7 +5915,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"app_units",
|
||||
"arrayvec",
|
||||
|
@ -5974,7 +5974,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style_config"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
@ -5982,7 +5982,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style_derive"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"derive_common",
|
||||
|
@ -6013,7 +6013,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style_traits"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"app_units",
|
||||
"bitflags 2.5.0",
|
||||
|
@ -6376,7 +6376,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
[[package]]
|
||||
name = "to_shmem"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"cssparser",
|
||||
"servo_arc",
|
||||
|
@ -6389,7 +6389,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "to_shmem_derive"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#fde1b946c24db389f150752cc24c6496b1f537c5"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-04-16#ac65c5a27c1b9faf9e7bb5bbcb3a4837a810ef6b"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"derive_common",
|
||||
|
|
|
@ -32,7 +32,7 @@ use crate::context::LayoutContext;
|
|||
use crate::display_list::conversions::ToWebRender;
|
||||
use crate::display_list::stacking_context::StackingContextSection;
|
||||
use crate::fragment_tree::{
|
||||
BackgroundMode, BoxFragment, Fragment, FragmentTree, Tag, TextFragment,
|
||||
BackgroundMode, BoxFragment, Fragment, FragmentFlags, FragmentTree, Tag, TextFragment,
|
||||
};
|
||||
use crate::geom::{LogicalRect, PhysicalPoint, PhysicalRect};
|
||||
use crate::replaced::IntrinsicSizes;
|
||||
|
@ -631,6 +631,14 @@ impl<'a> BuilderForBoxFragment<'a> {
|
|||
self.build_outline(builder);
|
||||
} else {
|
||||
self.build_hit_test(builder);
|
||||
if self
|
||||
.fragment
|
||||
.base
|
||||
.flags
|
||||
.contains(FragmentFlags::DO_NOT_PAINT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
self.build_background(builder);
|
||||
self.build_box_shadow(builder);
|
||||
self.build_border(builder);
|
||||
|
|
|
@ -94,6 +94,9 @@ bitflags! {
|
|||
/// Whether or not this Fragment was created to contain a list item marker
|
||||
/// with a used value of `list-style-position: outside`.
|
||||
const IS_OUTSIDE_LIST_ITEM_MARKER = 0b00001000;
|
||||
/// Avoid painting the fragment, this is used for empty table cells when 'empty-cells' is 'hide'.
|
||||
/// This flag doesn't avoid hit-testing.
|
||||
const DO_NOT_PAINT = 0b00010000;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use servo_arc::Arc;
|
|||
use style::computed_values::border_collapse::T as BorderCollapse;
|
||||
use style::logical_geometry::WritingMode;
|
||||
use style::properties::longhands::box_sizing::computed_value::T as BoxSizing;
|
||||
use style::properties::longhands::empty_cells::computed_value::T as EmptyCells;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{
|
||||
CSSPixelLength, Length, LengthPercentage as ComputedLengthPercentage, Percentage,
|
||||
|
@ -60,6 +61,15 @@ impl CellLayout {
|
|||
fn is_empty(&self) -> bool {
|
||||
self.layout.fragments.is_empty()
|
||||
}
|
||||
|
||||
/// Whether the cell is considered empty for the purpose of the 'empty-cells' property.
|
||||
fn is_empty_for_empty_cells(&self) -> bool {
|
||||
!self
|
||||
.layout
|
||||
.fragments
|
||||
.iter()
|
||||
.any(|fragment| !matches!(fragment, Fragment::AbsoluteOrFixedPositioned(_)))
|
||||
}
|
||||
}
|
||||
|
||||
/// Information stored during the layout of rows.
|
||||
|
@ -1616,6 +1626,7 @@ impl<'a> TableLayout<'a> {
|
|||
row_relative_cell_rect,
|
||||
row_baseline,
|
||||
positioning_context,
|
||||
&self.table.style,
|
||||
);
|
||||
let column = self.table.columns.get(column_index);
|
||||
let column_group = column
|
||||
|
@ -2142,6 +2153,7 @@ impl TableSlotCell {
|
|||
cell_rect: LogicalRect<Au>,
|
||||
cell_baseline: Au,
|
||||
positioning_context: &mut PositioningContext,
|
||||
table_style: &ComputedValues,
|
||||
) -> BoxFragment {
|
||||
// This must be scoped to this function because it conflicts with euclid's Zero.
|
||||
use style::Zero as StyleZero;
|
||||
|
@ -2162,6 +2174,14 @@ impl TableSlotCell {
|
|||
},
|
||||
};
|
||||
|
||||
let mut base_fragment_info = self.base_fragment_info;
|
||||
if self.style.get_inherited_table().empty_cells == EmptyCells::Hide &&
|
||||
table_style.get_inherited_table().border_collapse != BorderCollapse::Collapse &&
|
||||
layout.is_empty_for_empty_cells()
|
||||
{
|
||||
base_fragment_info.flags.insert(FragmentFlags::DO_NOT_PAINT);
|
||||
}
|
||||
|
||||
// Create an `AnonymousFragment` to move the cell contents to the cell baseline.
|
||||
let mut vertical_align_fragment_rect = cell_content_rect.clone();
|
||||
vertical_align_fragment_rect.start_corner = LogicalVec2 {
|
||||
|
@ -2190,7 +2210,7 @@ impl TableSlotCell {
|
|||
positioning_context.append(layout.positioning_context);
|
||||
|
||||
BoxFragment::new(
|
||||
self.base_fragment_info,
|
||||
base_fragment_info,
|
||||
self.style.clone(),
|
||||
vec![Fragment::Positioning(vertical_align_fragment)],
|
||||
cell_content_rect,
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[empty-cells-applies-to-014.xht]
|
||||
expected: FAIL
|
|
@ -8,60 +8,6 @@
|
|||
[CSS Transitions: property <empty-cells> from [initial\] to [hide\] at (0.3) should be [initial\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions: property <empty-cells> from [initial\] to [hide\] at (0.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions: property <empty-cells> from [initial\] to [hide\] at (0.6) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions: property <empty-cells> from [initial\] to [hide\] at (1) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions: property <empty-cells> from [initial\] to [hide\] at (1.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition: all: property <empty-cells> from [initial\] to [hide\] at (-0.3) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition: all: property <empty-cells> from [initial\] to [hide\] at (0) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition: all: property <empty-cells> from [initial\] to [hide\] at (0.3) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition: all: property <empty-cells> from [initial\] to [hide\] at (0.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition: all: property <empty-cells> from [initial\] to [hide\] at (0.6) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition: all: property <empty-cells> from [initial\] to [hide\] at (1) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition: all: property <empty-cells> from [initial\] to [hide\] at (1.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Animations: property <empty-cells> from [initial\] to [hide\] at (-0.3) should be [initial\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Animations: property <empty-cells> from [initial\] to [hide\] at (0) should be [initial\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Animations: property <empty-cells> from [initial\] to [hide\] at (0.3) should be [initial\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Animations: property <empty-cells> from [initial\] to [hide\] at (0.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Animations: property <empty-cells> from [initial\] to [hide\] at (0.6) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Animations: property <empty-cells> from [initial\] to [hide\] at (1) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Animations: property <empty-cells> from [initial\] to [hide\] at (1.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[Web Animations: property <empty-cells> from [initial\] to [hide\] at (-0.3) should be [initial\]]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -83,15 +29,6 @@
|
|||
[Web Animations: property <empty-cells> from [initial\] to [hide\] at (1.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions: property <empty-cells> from [initial\] to [hide\] at (-0.3) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions: property <empty-cells> from [initial\] to [hide\] at (0) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions: property <empty-cells> from [initial\] to [hide\] at (0.3) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-behavior:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (-0.3) should be [initial\]]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -101,18 +38,6 @@
|
|||
[CSS Transitions with transition-behavior:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (0.3) should be [initial\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-behavior:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (0.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-behavior:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (0.6) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-behavior:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (1) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-behavior:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (1.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (-0.3) should be [initial\]]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -121,15 +46,3 @@
|
|||
|
||||
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (0.3) should be [initial\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (0.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (0.6) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (1) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <empty-cells> from [initial\] to [hide\] at (1.5) should be [hide\]]
|
||||
expected: FAIL
|
||||
|
|
|
@ -8,12 +8,6 @@
|
|||
[Property caption-side inherits]
|
||||
expected: FAIL
|
||||
|
||||
[Property empty-cells has initial value show]
|
||||
expected: FAIL
|
||||
|
||||
[Property empty-cells inherits]
|
||||
expected: FAIL
|
||||
|
||||
[Property table-layout has initial value auto]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[empty-cells-computed.html]
|
||||
[Property empty-cells value 'show']
|
||||
expected: FAIL
|
||||
|
||||
[Property empty-cells value 'hide']
|
||||
expected: FAIL
|
|
@ -1,6 +0,0 @@
|
|||
[empty-cells-valid.html]
|
||||
[e.style['empty-cells'\] = "show" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['empty-cells'\] = "hide" should set the property value]
|
||||
expected: FAIL
|
|
@ -101,15 +101,6 @@
|
|||
[direction: inherit]
|
||||
expected: FAIL
|
||||
|
||||
[empty-cells: show]
|
||||
expected: FAIL
|
||||
|
||||
[empty-cells: hide]
|
||||
expected: FAIL
|
||||
|
||||
[empty-cells: inherit]
|
||||
expected: FAIL
|
||||
|
||||
[table-layout: auto]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[empty_cells_a.html]
|
||||
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue