MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / calc_width

Method calc_width

player/NymphCastPlayer/litehtml/src/element.cpp:167–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167int 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
195bool litehtml::element::is_ancestor(const ptr &el) const
196{

Callers 1

render_boxMethod · 0.80

Calls 6

is_predefinedMethod · 0.80
unitsMethod · 0.80
get_client_rectMethod · 0.80
containerMethod · 0.80
calc_percentMethod · 0.80
cvt_unitsMethod · 0.80

Tested by

no test coverage detected