Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file was generated by LibCSS gen_parser
  3.  *
  4.  * Generated from:
  5.  *
  6.  * border_side_color:op GENERIC: IDENT:( INHERIT: IDENT:) COLOR:BORDER_COLOR_SET
  7.  *
  8.  * Licensed under the MIT License,
  9.  *                http://www.opensource.org/licenses/mit-license.php
  10.  * Copyright 2010 The NetSurf Browser Project.
  11.  */
  12.  
  13. #include <assert.h>
  14. #include <string.h>
  15.  
  16. #include "bytecode/bytecode.h"
  17. #include "bytecode/opcodes.h"
  18. #include "parse/properties/properties.h"
  19. #include "parse/properties/utils.h"
  20.  
  21. /**
  22.  * Parse border_side_color
  23.  *
  24.  * \param c       Parsing context
  25.  * \param vector  Vector of tokens to process
  26.  * \param ctx     Pointer to vector iteration context
  27.  * \param result  resulting style
  28.  * \param op     Bytecode OpCode for CSS property to encode
  29.  * \return CSS_OK on success,
  30.  *         CSS_NOMEM on memory exhaustion,
  31.  *         CSS_INVALID if the input is not valid
  32.  *
  33.  * Post condition: \a *ctx is updated with the next token to process
  34.  *                 If the input is invalid, then \a *ctx remains unchanged.
  35.  */
  36. css_error css__parse_border_side_color(css_language *c,
  37.                 const parserutils_vector *vector, int *ctx,
  38.                 css_style *result, enum css_properties_e op)
  39. {
  40.         int orig_ctx = *ctx;
  41.         css_error error;
  42.         const css_token *token;
  43.         bool match;
  44.  
  45.         token = parserutils_vector_iterate(vector, ctx);
  46.         if (token == NULL) {
  47.                 *ctx = orig_ctx;
  48.                 return CSS_INVALID;
  49.         }
  50.  
  51.         if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) {
  52.                         error = css_stylesheet_style_inherit(result, op);
  53.         } else {
  54.                 uint16_t value = 0;
  55.                 uint32_t color = 0;
  56.                 *ctx = orig_ctx;
  57.  
  58.                 error = css__parse_colour_specifier(c, vector, ctx, &value, &color);
  59.                 if (error != CSS_OK) {
  60.                         *ctx = orig_ctx;
  61.                         return error;
  62.                 }
  63.  
  64.                 error = css__stylesheet_style_appendOPV(result, op, 0, value);
  65.                 if (error != CSS_OK) {
  66.                         *ctx = orig_ctx;
  67.                         return error;
  68.                 }
  69.  
  70.                 if (value == COLOR_SET)
  71.                         error = css__stylesheet_style_append(result, color);
  72.         }
  73.  
  74.         if (error != CSS_OK)
  75.                 *ctx = orig_ctx;
  76.        
  77.         return error;
  78. }
  79.  
  80.