| 165 | } |
| 166 | |
| 167 | int litehtml::element::calc_width(int defVal) const |
| 168 | { |
| 169 | css_length w = get_css_width(); |
| 170 | if(w.is_predefined()) |
| 171 | { |
| 172 | return defVal; |
| 173 | } |
| 174 | if(w.units() == css_units_percentage) |
| 175 | { |
| 176 | element::ptr el_parent = parent(); |
| 177 | if (!el_parent) |
| 178 | { |
| 179 | position client_pos; |
| 180 | get_document()->container()->get_client_rect(client_pos); |
| 181 | return w.calc_percent(client_pos.width); |
| 182 | } else |
| 183 | { |
| 184 | int pw = el_parent->calc_width(defVal); |
| 185 | if (is_body()) |
| 186 | { |
| 187 | pw -= content_margins_width(); |
| 188 | } |
| 189 | return w.calc_percent(pw); |
| 190 | } |
| 191 | } |
| 192 | return get_document()->cvt_units(w, get_font_size()); |
| 193 | } |
| 194 | |
| 195 | bool litehtml::element::is_ancestor(const ptr &el) const |
| 196 | { |
no test coverage detected