mirror of
https://git.checksum.fail/alec/erythros
synced 2025-12-11 13:39:55 +02:00
System/Libraries/Html/Renderer: Apply HTML width/height attributes to node
This commit is contained in:
@@ -413,6 +413,33 @@ U0 @set_css_distance(U8* str, F64* value, I64* type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
U0 @set_css_distance_from_attribute(U8* str, F64* value, I64* type)
|
||||||
|
{
|
||||||
|
if (!str || !value || !type)
|
||||||
|
return;
|
||||||
|
if (!StrICmp(str, "0")) {
|
||||||
|
*value = 0;
|
||||||
|
*type = CSS_DISTANCE_UNDEFINED;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
U8 buf[128];
|
||||||
|
StrCpy(buf, str);
|
||||||
|
if (String.EndsWith("em", buf)) {
|
||||||
|
buf[StrLen(buf) - 2] = NULL;
|
||||||
|
*value = Str2F64(buf);
|
||||||
|
*type = CSS_DISTANCE_EM;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (String.EndsWith("%", buf)) {
|
||||||
|
buf[StrLen(buf) - 1] = NULL;
|
||||||
|
*value = Str2F64(buf);
|
||||||
|
*type = CSS_DISTANCE_PERCENT;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*value = Str2F64(str);
|
||||||
|
*type = CSS_DISTANCE_PIXELS;
|
||||||
|
}
|
||||||
|
|
||||||
U0 @set_css_border_style(U8* str, I64* style)
|
U0 @set_css_border_style(U8* str, I64* style)
|
||||||
{
|
{
|
||||||
I64 i;
|
I64 i;
|
||||||
@@ -1652,6 +1679,14 @@ U0 @apply_attribute_values_to_node(@html_dom_node* node)
|
|||||||
node->textAlign = CSS_TEXT_ALIGN_RIGHT;
|
node->textAlign = CSS_TEXT_ALIGN_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node->attributes->@("width") && node->widthDistanceType == CSS_DISTANCE_UNDEFINED) {
|
||||||
|
@set_css_distance_from_attribute(node->attributes->@("width"), &node->width, &node->widthDistanceType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node->attributes->@("height") && node->heightDistanceType == CSS_DISTANCE_UNDEFINED) {
|
||||||
|
@set_css_distance_from_attribute(node->attributes->@("height"), &node->height, &node->heightDistanceType);
|
||||||
|
}
|
||||||
|
|
||||||
if (!StrICmp(node->tagName, "center"))
|
if (!StrICmp(node->tagName, "center"))
|
||||||
node->textAlign = CSS_TEXT_ALIGN_CENTER;
|
node->textAlign = CSS_TEXT_ALIGN_CENTER;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user