2 #include "css_length.h"
\r
4 void litehtml::css_length::fromString( const tstring& str, const tstring& predefs, int defValue )
\r
6 // TODO: Make support for calc
\r
7 if(str.substr(0, 4) == _t("calc"))
\r
9 m_is_predefined = true;
\r
14 int predef = value_index(str.c_str(), predefs.c_str(), -1);
\r
17 m_is_predefined = true;
\r
21 m_is_predefined = false;
\r
25 bool is_unit = false;
\r
26 for(tstring::const_iterator chr = str.begin(); chr != str.end(); chr++)
\r
30 if(t_isdigit(*chr) || *chr == _t('.') || *chr == _t('+') || *chr == _t('-'))
\r
45 m_value = (float) t_strtod(num.c_str(), 0);
\r
46 m_units = (css_units) value_index(un.c_str(), css_units_strings, css_units_none);
\r
49 // not a number so it is predefined
\r
50 m_is_predefined = true;
\r
51 m_predef = defValue;
\r