Commit 4c36a7b2 authored by Aleks Totic's avatar Aleks Totic Committed by Commit Bot

[TablesNG] Box order for painting

Use box order to resolve intersection edge precedence.

Makes 9 additional tests pass:

css2.1/20110323/border-conflict-element-001d.htm
external/wpt/css/CSS2/tables/border-conflict-element-001d.xht
external/wpt/css/CSS2/tables/border-conflict-element-001e.xht
fast/css/table-rules-attribute-groups-with-frame.html
fast/table/colgroup-spanning-groups-rules.html
fast/table/border-collapsing/002-vertical.html
fast/table/border-collapsing/002.html
tables/mozilla/core/table_rules.html
tables/mozilla/marvin/x_table_rules_groups.xml

Bug: 958381
Change-Id: I53f87d716aada00edec5f06129842fc1fc10eb68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519882
Commit-Queue: Aleks Totic <atotic@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824701}
parent 09dd36ac
......@@ -80,6 +80,11 @@ class NGTableBorders : public RefCounted<NGTableBorders> {
struct Edge {
scoped_refptr<const ComputedStyle> style;
EdgeSide edge_side;
// Box order is used to compute edge painting precedence.
// Lower box order has precedence.
// The order value is defined as "box visited index" while
// computing collapsed edges.
wtf_size_t box_order;
};
static LayoutUnit BorderWidth(const ComputedStyle* style,
......@@ -172,6 +177,10 @@ class NGTableBorders : public RefCounted<NGTableBorders> {
edges_[edge_index].edge_side);
}
wtf_size_t BoxOrder(wtf_size_t edge_index) const {
return edges_[edge_index].box_order;
}
using Edges = Vector<Edge>;
struct Section {
......@@ -219,8 +228,9 @@ class NGTableBorders : public RefCounted<NGTableBorders> {
wtf_size_t start_column,
wtf_size_t rowspan,
wtf_size_t colspan,
const ComputedStyle* source_style,
const ComputedStyle& source_style,
EdgeSource source,
wtf_size_t box_order,
WritingDirectionMode table_writing_direction,
wtf_size_t section_index = kNotFound);
......@@ -297,13 +307,15 @@ class NGTableBorders : public RefCounted<NGTableBorders> {
void MergeRowAxisBorder(wtf_size_t start_row,
wtf_size_t start_column,
wtf_size_t colspan,
const ComputedStyle* source_style,
const ComputedStyle& source_style,
wtf_size_t box_order,
EdgeSide side);
void MergeColumnAxisBorder(wtf_size_t start_row,
wtf_size_t start_column,
wtf_size_t rowspan,
const ComputedStyle* source_style,
const ComputedStyle& source_style,
wtf_size_t box_order,
EdgeSide side);
void MarkInnerBordersAsDoNotFill(wtf_size_t start_row,
......
......@@ -69,6 +69,16 @@ class NGTableCollapsedEdge {
Color BorderColor() const { return borders_.BorderColor(edge_index_); }
int CompareBoxOrder(wtf_size_t other_edge_index) const {
wtf_size_t box_order = borders_.BoxOrder(edge_index_);
wtf_size_t other_box_order = borders_.BoxOrder(other_edge_index);
if (box_order < other_box_order)
return 1;
if (box_order > other_box_order)
return -1;
return 0;
}
bool IsInlineAxis() const {
DCHECK(Exists());
DCHECK_NE(edge_index_, UINT_MAX);
......@@ -103,7 +113,7 @@ class NGTableCollapsedEdge {
// Paint border style comparison for paint has different
// rules than for winning edge border (hidden does not win).
if (lhs.border_style_ == rhs.border_style_)
return 0;
return lhs.CompareBoxOrder(rhs.edge_index_);
if (rhs.border_style_ == EBorderStyle::kHidden)
return 1;
if (lhs.border_style_ == EBorderStyle::kHidden)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment