mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-12 05:49:19 +03:00
CSS: Update to latest libcss: Remove weird units.
The 'rlh', 'ic' and 'cap' units were never implemented by anyone.
This commit is contained in:
parent
a6e825833d
commit
638a408dde
@ -113,24 +113,15 @@ static void dump_css_unit(FILE *stream, css_fixed val, css_unit unit)
|
||||
case CSS_UNIT_KHZ:
|
||||
fprintf(stream, "kHz");
|
||||
break;
|
||||
case CSS_UNIT_CAP:
|
||||
fprintf(stream, "cap");
|
||||
break;
|
||||
case CSS_UNIT_CH:
|
||||
fprintf(stream, "ch");
|
||||
break;
|
||||
case CSS_UNIT_IC:
|
||||
fprintf(stream, "ic");
|
||||
break;
|
||||
case CSS_UNIT_REM:
|
||||
fprintf(stream, "rem");
|
||||
break;
|
||||
case CSS_UNIT_LH:
|
||||
fprintf(stream, "lh");
|
||||
break;
|
||||
case CSS_UNIT_RLH:
|
||||
fprintf(stream, "rlh");
|
||||
break;
|
||||
case CSS_UNIT_VH:
|
||||
fprintf(stream, "vh");
|
||||
break;
|
||||
|
@ -423,9 +423,7 @@ css_error nscss_compute_font_size(void *pw, const css_hint *parent,
|
||||
size->data.length.unit = parent_size.unit;
|
||||
} else if (size->data.length.unit == CSS_UNIT_EM ||
|
||||
size->data.length.unit == CSS_UNIT_EX ||
|
||||
size->data.length.unit == CSS_UNIT_CAP ||
|
||||
size->data.length.unit == CSS_UNIT_CH ||
|
||||
size->data.length.unit == CSS_UNIT_IC) {
|
||||
size->data.length.unit == CSS_UNIT_CH) {
|
||||
size->data.length.value =
|
||||
FMUL(size->data.length.value, parent_size.value);
|
||||
|
||||
@ -435,21 +433,11 @@ css_error nscss_compute_font_size(void *pw, const css_hint *parent,
|
||||
size->data.length.value = FMUL(size->data.length.value,
|
||||
FLTTOFIX(0.6));
|
||||
break;
|
||||
case CSS_UNIT_CAP:
|
||||
/* Height of captals. 1cap = 0.9em in NetSurf. */
|
||||
size->data.length.value = FMUL(size->data.length.value,
|
||||
FLTTOFIX(0.9));
|
||||
break;
|
||||
case CSS_UNIT_CH:
|
||||
/* Width of '0'. 1ch = 0.4em in NetSurf. */
|
||||
size->data.length.value = FMUL(size->data.length.value,
|
||||
FLTTOFIX(0.4));
|
||||
break;
|
||||
case CSS_UNIT_IC:
|
||||
/* Width of U+6C43. 1ic = 1.1em in NetSurf. */
|
||||
size->data.length.value = FMUL(size->data.length.value,
|
||||
FLTTOFIX(1.1));
|
||||
break;
|
||||
default:
|
||||
/* No scaling required for EM. */
|
||||
break;
|
||||
@ -473,12 +461,6 @@ css_error nscss_compute_font_size(void *pw, const css_hint *parent,
|
||||
size->data.length.value,
|
||||
parent_size.value);
|
||||
}
|
||||
} else if (size->data.length.unit == CSS_UNIT_RLH) {
|
||||
/** TODO: Convert root element line-height to absolute value. */
|
||||
size->data.length.value = FMUL(size->data.length.value, FDIV(
|
||||
INTTOFIX(nsoption_int(font_size)),
|
||||
INTTOFIX(10)));
|
||||
size->data.length.unit = CSS_UNIT_PT;
|
||||
}
|
||||
|
||||
size->status = CSS_FONT_SIZE_DIMENSION;
|
||||
|
@ -91,11 +91,8 @@ css_fixed nscss_len2pt(
|
||||
/* Length must not be relative */
|
||||
assert(unit != CSS_UNIT_EM &&
|
||||
unit != CSS_UNIT_EX &&
|
||||
unit != CSS_UNIT_CAP &&
|
||||
unit != CSS_UNIT_CH &&
|
||||
unit != CSS_UNIT_IC &&
|
||||
unit != CSS_UNIT_REM &&
|
||||
unit != CSS_UNIT_RLH);
|
||||
unit != CSS_UNIT_REM);
|
||||
|
||||
unit = css_utils__fudge_viewport_units(ctx, unit);
|
||||
|
||||
@ -140,9 +137,7 @@ css_fixed nscss_len2px(
|
||||
switch (unit) {
|
||||
case CSS_UNIT_EM:
|
||||
case CSS_UNIT_EX:
|
||||
case CSS_UNIT_CAP:
|
||||
case CSS_UNIT_CH:
|
||||
case CSS_UNIT_IC:
|
||||
{
|
||||
css_fixed font_size = 0;
|
||||
css_unit font_unit = CSS_UNIT_PT;
|
||||
@ -168,15 +163,9 @@ css_fixed nscss_len2px(
|
||||
case CSS_UNIT_EX:
|
||||
px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.6));
|
||||
break;
|
||||
case CSS_UNIT_CAP:
|
||||
px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.9));
|
||||
break;
|
||||
case CSS_UNIT_CH:
|
||||
px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.4));
|
||||
break;
|
||||
case CSS_UNIT_IC:
|
||||
px_per_unit = FMUL(px_per_unit, FLTTOFIX(1.1));
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@ -231,12 +220,6 @@ css_fixed nscss_len2px(
|
||||
px_per_unit = FDIV(FMUL(font_size, F_96), F_72);
|
||||
break;
|
||||
}
|
||||
/* 1rlh = <user_font_size>pt => 1rlh = (DPI/user_font_size)px */
|
||||
case CSS_UNIT_RLH:
|
||||
px_per_unit = FDIV(F_96, FDIV(
|
||||
INTTOFIX(nsoption_int(font_size)),
|
||||
INTTOFIX(10)));
|
||||
break;
|
||||
case CSS_UNIT_VH:
|
||||
px_per_unit = FDIV(ctx->vh, F_100);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user