summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-01-02 15:11:11 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2015-01-02 15:11:11 (GMT)
commitb18347b24b31bacdb283aa036fa4880384b4c6be (patch)
tree0d6e5f0e8c14c79dd5c2fe6a0708afade8856544
parentca9fa11e374cd2e48d904e8a9f186e1a6eadf8e4 (diff)
downloadlibcss-b18347b24b31bacdb283aa036fa4880384b4c6be.tar.gz
libcss-b18347b24b31bacdb283aa036fa4880384b4c6be.tar.bz2
Trivial optimisation.
-rw-r--r--src/select/computed.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/select/computed.c b/src/select/computed.c
index 9028710..6bf1344 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -1349,21 +1349,26 @@ css_error compute_absolute_border_side_width(css_computed_style *style,
{
css_fixed length;
css_unit unit;
- uint8_t type;
- type = get(style, &length, &unit);
- if (type == CSS_BORDER_WIDTH_THIN) {
+ switch (get(style, &length, &unit)) {
+ case CSS_BORDER_WIDTH_THIN:
length = INTTOFIX(1);
unit = CSS_UNIT_PX;
- } else if (type == CSS_BORDER_WIDTH_MEDIUM) {
+ break;
+ case CSS_BORDER_WIDTH_MEDIUM:
length = INTTOFIX(2);
unit = CSS_UNIT_PX;
- } else if (type == CSS_BORDER_WIDTH_THICK) {
+ break;
+ case CSS_BORDER_WIDTH_THICK:
length = INTTOFIX(4);
unit = CSS_UNIT_PX;
- } else if (unit == CSS_UNIT_EX) {
- length = FMUL(length, ex_size->value);
- unit = ex_size->unit;
+ break;
+ case CSS_BORDER_WIDTH_WIDTH:
+ if (unit == CSS_UNIT_EX) {
+ length = FMUL(length, ex_size->value);
+ unit = ex_size->unit;
+ }
+ break;
}
return set(style, CSS_BORDER_WIDTH_WIDTH, length, unit);