mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 09:24:57 +00:00
parent
fb4a20ade5
commit
b13fe9397d
8 changed files with 105 additions and 1 deletions
|
@ -9,6 +9,8 @@
|
|||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
|
||||
#include <LibWeb/DOM/ElementFactory.h>
|
||||
#include <LibWeb/DOM/HTMLCollection.h>
|
||||
#include <LibWeb/HTML/HTMLTableColElement.h>
|
||||
|
@ -39,6 +41,11 @@ void HTMLTableElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_t_bodies);
|
||||
}
|
||||
|
||||
static unsigned parse_border(DeprecatedString const& value)
|
||||
{
|
||||
return value.to_uint().value_or(0);
|
||||
}
|
||||
|
||||
void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
|
@ -64,6 +71,20 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
style.set_property(CSS::PropertyID::BorderSpacing, parsed_value.release_nonnull());
|
||||
return;
|
||||
}
|
||||
if (name == HTML::AttributeNames::border) {
|
||||
auto border = parse_border(value);
|
||||
if (!border)
|
||||
return;
|
||||
auto apply_border_style = [&](CSS::PropertyID style_property, CSS::PropertyID width_property) {
|
||||
auto legacy_line_style = CSS::IdentifierStyleValue::create(CSS::ValueID::Outset);
|
||||
style.set_property(style_property, legacy_line_style);
|
||||
style.set_property(width_property, CSS::LengthStyleValue::create(CSS::Length::make_px(border)));
|
||||
};
|
||||
apply_border_style(CSS::PropertyID::BorderLeftStyle, CSS::PropertyID::BorderLeftWidth);
|
||||
apply_border_style(CSS::PropertyID::BorderTopStyle, CSS::PropertyID::BorderTopWidth);
|
||||
apply_border_style(CSS::PropertyID::BorderRightStyle, CSS::PropertyID::BorderRightWidth);
|
||||
apply_border_style(CSS::PropertyID::BorderBottomStyle, CSS::PropertyID::BorderBottomWidth);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -386,4 +407,9 @@ WebIDL::ExceptionOr<void> HTMLTableElement::delete_row(long index)
|
|||
return {};
|
||||
}
|
||||
|
||||
unsigned int HTMLTableElement::border() const
|
||||
{
|
||||
return parse_border(attribute(HTML::AttributeNames::border));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue