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 "bytecode/bytecode.h"
  9. #include "bytecode/opcodes.h"
  10. #include "select/propset.h"
  11. #include "select/propget.h"
  12. #include "utils/utils.h"
  13.  
  14. #include "select/properties/properties.h"
  15. #include "select/properties/helpers.h"
  16.  
  17. css_error css__cascade_background_repeat(uint32_t opv, css_style *style,
  18.                 css_select_state *state)
  19. {
  20.         uint16_t value = CSS_BACKGROUND_REPEAT_INHERIT;
  21.  
  22.         UNUSED(style);
  23.  
  24.         if (isInherit(opv) == false) {
  25.                 switch (getValue(opv)) {
  26.                 case BACKGROUND_REPEAT_NO_REPEAT:
  27.                         value = CSS_BACKGROUND_REPEAT_NO_REPEAT;
  28.                         break;
  29.                 case BACKGROUND_REPEAT_REPEAT_X:
  30.                         value = CSS_BACKGROUND_REPEAT_REPEAT_X;
  31.                         break;
  32.                 case BACKGROUND_REPEAT_REPEAT_Y:
  33.                         value = CSS_BACKGROUND_REPEAT_REPEAT_Y;
  34.                         break;
  35.                 case BACKGROUND_REPEAT_REPEAT:
  36.                         value = CSS_BACKGROUND_REPEAT_REPEAT;
  37.                         break;
  38.                 }
  39.         }
  40.  
  41.         if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
  42.                         isInherit(opv))) {
  43.                 return set_background_repeat(state->computed, value);
  44.         }
  45.  
  46.         return CSS_OK;
  47. }
  48.  
  49. css_error css__set_background_repeat_from_hint(const css_hint *hint,
  50.                 css_computed_style *style)
  51. {
  52.         return set_background_repeat(style, hint->status);
  53. }
  54.  
  55. css_error css__initial_background_repeat(css_select_state *state)
  56. {
  57.         return set_background_repeat(state->computed,
  58.                         CSS_BACKGROUND_REPEAT_REPEAT);
  59. }
  60.  
  61. css_error css__compose_background_repeat(const css_computed_style *parent,
  62.                 const css_computed_style *child,
  63.                 css_computed_style *result)
  64. {
  65.         uint8_t type = get_background_repeat(child);
  66.  
  67.         if (type == CSS_BACKGROUND_REPEAT_INHERIT) {
  68.                 type = get_background_repeat(parent);
  69.         }
  70.  
  71.         return set_background_repeat(result, type);
  72. }
  73.  
  74.