-
Notifications
You must be signed in to change notification settings - Fork 1
/
el_li.cpp
38 lines (32 loc) · 804 Bytes
/
el_li.cpp
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
#include "litehtml/html.h"
#include "litehtml/el_li.h"
#include "litehtml/document.h"
litehtml::el_li::el_li(const std::shared_ptr<litehtml::document>& doc) : litehtml::html_tag(doc)
{
}
litehtml::el_li::~el_li()
{
}
int litehtml::el_li::render(int x, int y, int max_width, bool second_pass)
{
if (m_list_style_type >= list_style_type_armenian && !m_index_initialized)
{
if (auto p = parent())
{
tchar_t val[2] = { 1, 0 };
for (int i = 0, n = (int)p->get_children_count(); i < n; ++i)
{
auto child = p->get_child(i);
if (child.get() == this)
{
set_attr(_t("list_index"), val);
break;
}
else if (!t_strcmp(child->get_tagName(), _t("li")))
++val[0];
}
}
m_index_initialized = true;
}
return html_tag::render(x, y, max_width, second_pass);
}