summaryrefslogtreecommitdiff
path: root/src/parse/properties/elevation.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-01-19 23:12:37 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-01-19 23:12:37 +0000
commit6a50bef84ae6a0a67e03ac1356f8d85d15fe09d6 (patch)
tree01f78f04b22517899f603787f6005f70b359271e /src/parse/properties/elevation.c
parent63c21aca7c77b1d37cb64ad2b1fa76d6b0b92f48 (diff)
downloadlibcss-6a50bef84ae6a0a67e03ac1356f8d85d15fe09d6.tar.gz
libcss-6a50bef84ae6a0a67e03ac1356f8d85d15fe09d6.tar.bz2
Merge parser autogeneration and string handling refactor branch r=jmb,kinnison,vince
svn path=/trunk/libcss/; revision=11408
Diffstat (limited to 'src/parse/properties/elevation.c')
-rw-r--r--src/parse/properties/elevation.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/parse/properties/elevation.c b/src/parse/properties/elevation.c
index d29a9b7..d0c47d8 100644
--- a/src/parse/properties/elevation.c
+++ b/src/parse/properties/elevation.c
@@ -29,17 +29,15 @@
*/
css_error parse_elevation(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style **result)
+ css_style *result)
{
int orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
uint16_t value = 0;
- uint32_t opv;
css_fixed length = 0;
uint32_t unit = 0;
- uint32_t required_size;
bool match;
/* angle | IDENT(below, level, above, higher, lower, inherit) */
@@ -119,26 +117,18 @@ css_error parse_elevation(css_language *c,
value = ELEVATION_ANGLE;
}
- opv = buildOPV(CSS_PROP_ELEVATION, flags, value);
-
- required_size = sizeof(opv);
- if ((flags & FLAG_INHERIT) == false && value == ELEVATION_ANGLE)
- required_size += sizeof(length) + sizeof(unit);
-
- /* Allocate result */
- error = css_stylesheet_style_create(c->sheet, required_size, result);
+ error = css_stylesheet_style_appendOPV(result, CSS_PROP_ELEVATION, flags, value);
if (error != CSS_OK) {
*ctx = orig_ctx;
return error;
}
- /* Copy the bytecode to it */
- memcpy((*result)->bytecode, &opv, sizeof(opv));
- if ((flags & FLAG_INHERIT) == false && value == ELEVATION_ANGLE) {
- memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv),
- &length, sizeof(length));
- memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv) +
- sizeof(length), &unit, sizeof(unit));
+ if (((flags & FLAG_INHERIT) == false) && (value == ELEVATION_ANGLE)) {
+ error = css_stylesheet_style_vappend(result, 2, length, unit);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
}
return CSS_OK;