summaryrefslogtreecommitdiff
path: root/src/parse/properties.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-01-16 18:01:07 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-01-16 18:01:07 +0000
commitb92d42ce99aefc5b8926df09ba4729bc3603848b (patch)
tree1afc87cc1b1df17ef90a84ed6d725b7a5dc05ff7 /src/parse/properties.c
parent75fa13632a001806b77bf75347efff319e328b7a (diff)
downloadlibcss-b92d42ce99aefc5b8926df09ba4729bc3603848b.tar.gz
libcss-b92d42ce99aefc5b8926df09ba4729bc3603848b.tar.bz2
Fix parse_clip to actually stand a chance of working.
svn path=/trunk/libcss/; revision=6091
Diffstat (limited to 'src/parse/properties.c')
-rw-r--r--src/parse/properties.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/parse/properties.c b/src/parse/properties.c
index 132fa8c..86747d3 100644
--- a/src/parse/properties.c
+++ b/src/parse/properties.c
@@ -1359,9 +1359,9 @@ css_error parse_clip(css_language *c,
token->ilower == c->strings[RECT]) {
value = CLIP_SHAPE_RECT;
- consumeWhitespace(vector, ctx);
-
for (int i = 0; i < 4; i++) {
+ consumeWhitespace(vector, ctx);
+
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
@@ -1370,19 +1370,23 @@ css_error parse_clip(css_language *c,
/* Slightly magical way of generating the auto
* values. These are bits 3-6 of the value. */
if (token->ilower == c->strings[AUTO])
- value |= (i+1) << 3;
+ value |= 1 << (i + 3);
else
return CSS_INVALID;
+
+ parserutils_vector_iterate(vector, ctx);
} else {
error = parse_unit_specifier(c, vector, ctx,
- UNIT_PX, &length[i], &unit[i]);
+ UNIT_PX,
+ &length[num_lengths],
+ &unit[num_lengths]);
if (error != CSS_OK)
return error;
- if (unit[i] & UNIT_ANGLE ||
- unit[i] & UNIT_TIME ||
- unit[i] & UNIT_FREQ ||
- unit[i] & UNIT_PCT)
+ if (unit[num_lengths] & UNIT_ANGLE ||
+ unit[num_lengths] & UNIT_TIME ||
+ unit[num_lengths] & UNIT_FREQ ||
+ unit[num_lengths] & UNIT_PCT)
return CSS_INVALID;
num_lengths++;
@@ -1418,7 +1422,8 @@ css_error parse_clip(css_language *c,
opv = buildOPV(OP_CLIP, flags, value);
required_size = sizeof(opv);
- if ((flags & FLAG_INHERIT) == false && value == CLIP_SHAPE_RECT) {
+ if ((flags & FLAG_INHERIT) == false &&
+ (value & CLIP_SHAPE_MASK) == CLIP_SHAPE_RECT) {
required_size +=
num_lengths * (sizeof(length[0]) + sizeof(unit[0]));
}
@@ -1430,7 +1435,8 @@ css_error parse_clip(css_language *c,
/* Copy the bytecode to it */
memcpy((*result)->bytecode, &opv, sizeof(opv));
- if ((flags & FLAG_INHERIT) == false && value == CLIP_SHAPE_RECT) {
+ if ((flags & FLAG_INHERIT) == false &&
+ (value & CLIP_SHAPE_MASK) == CLIP_SHAPE_RECT) {
uint8_t *ptr = ((uint8_t *) (*result)->bytecode) + sizeof(opv);
for (int i = 0; i < num_lengths; i++) {