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_list_style_position(uint32_t opv, css_style *style,
  18.                 css_select_state *state)
  19. {
  20.         uint16_t value = CSS_LIST_STYLE_POSITION_INHERIT;
  21.  
  22.         UNUSED(style);
  23.  
  24.         if (isInherit(opv) == false) {
  25.                 switch (getValue(opv)) {
  26.                 case LIST_STYLE_POSITION_INSIDE:
  27.                         value = CSS_LIST_STYLE_POSITION_INSIDE;
  28.                         break;
  29.                 case LIST_STYLE_POSITION_OUTSIDE:
  30.                         value = CSS_LIST_STYLE_POSITION_OUTSIDE;
  31.                         break;
  32.                 }
  33.         }
  34.  
  35.         if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
  36.                         isInherit(opv))) {
  37.                 return set_list_style_position(state->computed, value);
  38.         }
  39.  
  40.         return CSS_OK;
  41. }
  42.  
  43. css_error css__set_list_style_position_from_hint(const css_hint *hint,
  44.                 css_computed_style *style)
  45. {
  46.         return set_list_style_position(style, hint->status);
  47. }
  48.  
  49. css_error css__initial_list_style_position(css_select_state *state)
  50. {
  51.         return set_list_style_position(state->computed,
  52.                         CSS_LIST_STYLE_POSITION_OUTSIDE);
  53. }
  54.  
  55. css_error css__compose_list_style_position(const css_computed_style *parent,
  56.                 const css_computed_style *child,
  57.                 css_computed_style *result)
  58. {
  59.         uint8_t type = get_list_style_position(child);
  60.  
  61.         if (type == CSS_LIST_STYLE_POSITION_INHERIT) {
  62.                 type = get_list_style_position(parent);
  63.         }
  64.  
  65.         return set_list_style_position(result, type);
  66. }
  67.  
  68.