// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_TABLE_LAYOUT_TABLE_COLUMN_VISITOR_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_TABLE_LAYOUT_TABLE_COLUMN_VISITOR_H_ #include "third_party/blink/renderer/core/layout/block_node.h" #include "third_party/blink/renderer/core/layout/table/layout_table_column.h" namespace blink { // Rules for computed spans of COLGROUP/COL elements are complicated. // 1) Spans cannot protrude outside of table boundary. // 2) Colgroup span is // a) sum of children COL spans if it has children. // b) span attribute if it has no children. // // This function implements a Visitor pattern for LayoutTableColumn // traversal, and computes correct spans. // // class Visitor { // void VisitCol(const BlockNode& column, // wtf_size_t start_column_index, // wtf_size_t span); // void EnterColgroup(const BlockNode& colgroup, // wtf_size_t start_column_index); // void LeaveColgroup(const BlockNode& colgroup, // wtf_size_t start_column_index, // wtf_size_t span, // bool has_children); // } template <typename Visitor> void VisitLayoutTableColumn(const HeapVector<BlockNode>& columns, wtf_size_t table_column_count, Visitor* visitor) { … } } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_TABLE_LAYOUT_TABLE_COLUMN_VISITOR_H_