Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Libraries/LibWeb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,6 @@ set(SOURCES
Layout/SVGTextBox.cpp
Layout/SVGTextPathBox.cpp
Layout/ScrollableOverflow.cpp
Layout/TableGrid.cpp
Layout/TableWrapper.cpp
Layout/TextAreaBox.cpp
Layout/TextInputBox.cpp
Expand Down
4 changes: 4 additions & 0 deletions Libraries/LibWeb/DOM/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,10 @@ void Element::run_attribute_change_steps(Utf16FlyString const& local_name, Optio
attribute_changed(local_name, old_value, value, namespace_);

if (old_value != value) {
if (local_name.is_one_of(HTML::AttributeNames::colspan, HTML::AttributeNames::rowspan, HTML::AttributeNames::span)) {
if (auto* layout_node = unsafe_layout_node())
layout_node->synchronize_table_span_data();
}
if (!document().suppresses_attribute_style_invalidation()) {
CSS::Invalidation::invalidate_style_after_attribute_change(
*this,
Expand Down
14 changes: 0 additions & 14 deletions Libraries/LibWeb/Layout/LayoutRustBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
#include <LibWeb/HTML/FormAssociatedElement.h>
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/HTML/HTMLTableCellElement.h>
#include <LibWeb/HTML/HTMLTableColElement.h>
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/DominantBaseline.h>
#include <LibWeb/Layout/FieldSetBox.h>
Expand Down Expand Up @@ -1065,25 +1063,13 @@ RustFFI::FfiTableBoxFacts build_table_box_facts(NodeWithStyle const& node)
{
auto const& values = node.computed_values();

size_t cell_column_span = 1;
size_t cell_row_span = 1;
u32 column_span = 1;
u32 raw_column_span = 1;
if (auto const* dom_node = node.dom_node()) {
if (auto const* cell = as_if<HTML::HTMLTableCellElement>(*dom_node)) {
cell_column_span = cell->col_span();
cell_row_span = cell->row_span();
}
if (auto const* column = as_if<HTML::HTMLTableColElement>(*dom_node))
column_span = column->span();
if (auto const* element = as_if<HTML::HTMLElement>(*dom_node))
raw_column_span = element->get_attribute_value(HTML::AttributeNames::span).to_number<u32>().value_or(1);
}

return {
.cell_column_span = cell_column_span,
.cell_row_span = cell_row_span,
.column_span = column_span,
.raw_column_span = raw_column_span,
.border_top_color = values.border_top().color.value(),
.border_right_color = values.border_right().color.value(),
Expand Down
19 changes: 19 additions & 0 deletions Libraries/LibWeb/Layout/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/HTMLHtmlElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/HTML/HTMLTableCellElement.h>
#include <LibWeb/HTML/HTMLTableColElement.h>
#include <LibWeb/HTML/LocalNavigable.h>
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/ImageBox.h>
Expand Down Expand Up @@ -770,6 +772,7 @@ NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, NonnullRe
set_flag(RustFFI::NodeFlag::HasStyle, true);
set_flag(RustFFI::NodeFlag::IsBody, node && node == document.body());
mirror_computed_values_to_node_data();
synchronize_table_span_data();
}

NodeWithStyle::ImageObserver::ImageObserver(NodeWithStyle& owner, NonnullRefPtr<CSS::ImageStyleValue const> image)
Expand Down Expand Up @@ -1091,6 +1094,22 @@ void NodeWithStyle::mirror_computed_values_to_node_data()
own_computed_style_establishes_block_formatting_context(*m_computed_values));
}

void NodeWithStyle::synchronize_table_span_data()
{
u16 column_span = 1;
u16 row_span = 1;
if (auto const* node = dom_node()) {
if (auto const* cell = as_if<HTML::HTMLTableCellElement>(*node)) {
column_span = static_cast<u16>(cell->col_span());
row_span = static_cast<u16>(cell->row_span());
} else if (auto const* column = as_if<HTML::HTMLTableColElement>(*node)) {
column_span = static_cast<u16>(column->span());
}
}
node_data().table_column_span = column_span;
node_data().table_row_span = row_span;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

void NodeWithStyle::set_display(CSS::Display display)
{
modify_computed_values([&](auto& values) {
Expand Down
3 changes: 3 additions & 0 deletions Libraries/LibWeb/Layout/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ static_assert(offsetof(RustFFI::NodeData, table_display) == 40);
static_assert(offsetof(RustFFI::NodeData, table_display_before) == 41);
static_assert(offsetof(RustFFI::NodeData, display_bits) == 42);
static_assert(offsetof(RustFFI::NodeData, slot_generation) == 43);
static_assert(offsetof(RustFFI::NodeData, table_column_span) == 44);
static_assert(offsetof(RustFFI::NodeData, table_row_span) == 46);
static_assert(offsetof(RustFFI::NodeData, style) == 48);
static_assert(offsetof(RustFFI::NodeData, shell) == 56);

Expand Down Expand Up @@ -427,6 +429,7 @@ class WEB_API NodeWithStyle : public Node {
void clear_image_observers();
void apply_style(NonnullRefPtr<CSS::ComputedValues const>);
void attach_style_resources();
void synchronize_table_span_data();

Gfx::Font const& first_available_font() const;
Vector<CSS::BackgroundLayerData> const& background_layers() const { return computed_values().background_layers(); }
Expand Down
228 changes: 0 additions & 228 deletions Libraries/LibWeb/Layout/TableGrid.cpp

This file was deleted.

Loading