summaryrefslogtreecommitdiff
path: root/libs/litehtml/src/el_table.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-10-09 18:13:40 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-10-09 18:13:40 +0300
commit0e86b853be3b5f809ed1decbf636221c1144a386 (patch)
tree4ce84d9849646a559d5afece33fc6e64d39e4a50 /libs/litehtml/src/el_table.cpp
parent834cbb58d74215980165eab257538ba918a378cd (diff)
litehtml update
Diffstat (limited to 'libs/litehtml/src/el_table.cpp')
-rw-r--r--libs/litehtml/src/el_table.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/libs/litehtml/src/el_table.cpp b/libs/litehtml/src/el_table.cpp
index 0bb8648436..82b02c6921 100644
--- a/libs/litehtml/src/el_table.cpp
+++ b/libs/litehtml/src/el_table.cpp
@@ -3,13 +3,14 @@
#include "document.h"
#include "iterators.h"
+namespace litehtml
+{
-litehtml::el_table::el_table(const std::shared_ptr<document>& doc) : html_tag(doc)
+el_table::el_table(const shared_ptr<document>& doc) : html_tag(doc)
{
}
-
-bool litehtml::el_table::appendChild(const element::ptr& el)
+bool el_table::appendChild(const element::ptr& el)
{
if(!el) return false;
if( el->tag() == _tbody_ ||
@@ -22,29 +23,29 @@ bool litehtml::el_table::appendChild(const element::ptr& el)
return false;
}
-void litehtml::el_table::parse_attributes()
+void el_table::parse_attributes()
{
+ // https://html.spec.whatwg.org/multipage/rendering.html#tables-2:attr-table-width
const char* str = get_attr("width");
- if(str)
- {
- m_style.add_property(_width_, str);
- }
+ if (str)
+ map_to_dimension_property_ignoring_zero(_width_, str);
+
+ // https://html.spec.whatwg.org/multipage/rendering.html#tables-2:attr-table-height
+ str = get_attr("height");
+ if (str)
+ map_to_dimension_property(_height_, str);
+ // https://html.spec.whatwg.org/multipage/rendering.html#tables-2:attr-table-cellspacing
str = get_attr("cellspacing");
- if(str)
- {
- string val = str;
- val += " ";
- val += str;
- m_style.add_property(_border_spacing_, val);
- }
-
+ if (str)
+ map_to_pixel_length_property(_border_spacing_, str);
+
+ // https://html.spec.whatwg.org/multipage/rendering.html#tables-2:attr-table-border
str = get_attr("border");
- if(str)
- {
- m_style.add_property(_border_width_, str);
- }
+ if (str)
+ map_to_pixel_length_property_with_default_value(_border_width_, str, 1);
+ // https://html.spec.whatwg.org/multipage/rendering.html#tables-2:attr-background
str = get_attr("bgcolor");
if (str)
{
@@ -53,3 +54,5 @@ void litehtml::el_table::parse_attributes()
html_tag::parse_attributes();
}
+
+} // namespace litehtml \ No newline at end of file