Subversion Repositories Kolibri OS

Rev

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

  1. /*
  2.  * This file is part of LibCSS.
  3.  * Licensed under the MIT License,
  4.  *                http://www.opensource.org/licenses/mit-license.php
  5.  * Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
  6.  */
  7.  
  8. #include <assert.h>
  9. #include <string.h>
  10.  
  11. #include "bytecode/bytecode.h"
  12. #include "bytecode/opcodes.h"
  13. #include "parse/properties/properties.h"
  14. #include "parse/properties/utils.h"
  15.  
  16. /**
  17.  * Parse border shorthand
  18.  *
  19.  * \param c       Parsing context
  20.  * \param vector  Vector of tokens to process
  21.  * \param ctx     Pointer to vector iteration context
  22.  * \param result  Pointer to location to receive resulting style
  23.  * \return CSS_OK on success,
  24.  *         CSS_NOMEM on memory exhaustion,
  25.  *         CSS_INVALID if the input is not valid
  26.  *
  27.  * Post condition: \a *ctx is updated with the next token to process
  28.  *                 If the input is invalid, then \a *ctx remains unchanged.
  29.  */
  30. css_error css__parse_border(css_language *c,
  31.                 const parserutils_vector *vector, int *ctx,
  32.                 css_style *result)
  33. {
  34.         int orig_ctx = *ctx;
  35.         css_error error;
  36.  
  37.         error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_TOP);
  38.         if (error != CSS_OK) {
  39.                 *ctx = orig_ctx;
  40.                 return error;
  41.         }
  42.  
  43.         *ctx = orig_ctx;
  44.         error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_RIGHT);
  45.         if (error != CSS_OK) {
  46.                 *ctx = orig_ctx;
  47.                 return error;
  48.         }
  49.  
  50.         *ctx = orig_ctx;
  51.         error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_BOTTOM);
  52.         if (error != CSS_OK) {
  53.                 *ctx = orig_ctx;
  54.                 return error;
  55.         }
  56.  
  57.         *ctx = orig_ctx;
  58.         error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_LEFT);
  59.         if (error != CSS_OK)
  60.                 *ctx = orig_ctx;
  61.        
  62.         return error;
  63.                
  64. }
  65.