summaryrefslogtreecommitdiff
path: root/libs/litehtml/src/el_table.cpp
blob: 0bb8648436694dcc0730c653b39a4af04e6edf21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "html.h"
#include "el_table.h"
#include "document.h"
#include "iterators.h"


litehtml::el_table::el_table(const std::shared_ptr<document>& doc) : html_tag(doc)
{
}


bool litehtml::el_table::appendChild(const element::ptr& el)
{
	if(!el)	return false;
	if( el->tag() == _tbody_ ||
		el->tag() == _thead_ ||
		el->tag() == _tfoot_ ||
		el->tag() == _caption_)
	{
		return html_tag::appendChild(el);
	}
	return false;
}

void litehtml::el_table::parse_attributes()
{
	const char* str = get_attr("width");
	if(str)
	{
		m_style.add_property(_width_, str);
	}

	str = get_attr("cellspacing");
	if(str)
	{
		string val = str;
		val += " ";
		val += str;
		m_style.add_property(_border_spacing_, val);
	}
	
	str = get_attr("border");
	if(str)
	{
		m_style.add_property(_border_width_, str);
	}

	str = get_attr("bgcolor");
	if (str)
	{
		m_style.add_property(_background_color_, str, "", false, get_document()->container());
	}

	html_tag::parse_attributes();
}