summaryrefslogtreecommitdiff
path: root/libs/litehtml/src/el_space.cpp
blob: f5e3818ca7b767fc86e5694acb046abe4d63a965 (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
#include "html.h"
#include "document.h"
#include "el_space.h"

litehtml::el_space::el_space(const char* text, const std::shared_ptr<document>& doc) : el_text(text, doc)
{
}

bool litehtml::el_space::is_white_space() const
{
	white_space ws = css().get_white_space();
	if(	ws == white_space_normal || 
		ws == white_space_nowrap ||
		ws == white_space_pre_line )
	{
		return true;
	}
	return false;
}

bool litehtml::el_space::is_break() const
{
	white_space ws = css().get_white_space();
	if(	ws == white_space_pre ||
		ws == white_space_pre_line ||
		ws == white_space_pre_wrap)
	{
		if(m_text == "\n")
		{
			return true;
		}
	}
	return false;
}

bool litehtml::el_space::is_space() const
{
    return true;
}

litehtml::string litehtml::el_space::dump_get_name()
{
    return "space: \"" + get_escaped_string(m_text) + "\"";
}