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_clear(uint32_t opv, css_style *style,
  18.                 css_select_state *state)
  19. {
  20.         uint16_t value = CSS_CLEAR_INHERIT;
  21.  
  22.         UNUSED(style);
  23.  
  24.         if (isInherit(opv) == false) {
  25.                 switch (getValue(opv)) {
  26.                 case CLEAR_NONE:
  27.                         value = CSS_CLEAR_NONE;
  28.                         break;
  29.                 case CLEAR_LEFT:
  30.                         value = CSS_CLEAR_LEFT;
  31.                         break;
  32.                 case CLEAR_RIGHT:
  33.                         value = CSS_CLEAR_RIGHT;
  34.                         break;
  35.                 case CLEAR_BOTH:
  36.                         value = CSS_CLEAR_BOTH;
  37.                         break;
  38.                 }
  39.         }
  40.  
  41.         if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
  42.                         isInherit(opv))) {
  43.                 return set_clear(state->computed, value);
  44.         }
  45.  
  46.         return CSS_OK;
  47. }
  48.  
  49. css_error css__set_clear_from_hint(const css_hint *hint,
  50.                 css_computed_style *style)
  51. {
  52.         return set_clear(style, hint->status);
  53. }
  54.  
  55. css_error css__initial_clear(css_select_state *state)
  56. {
  57.         return set_clear(state->computed, CSS_CLEAR_NONE);
  58. }
  59.  
  60. css_error css__compose_clear(const css_computed_style *parent,
  61.                 const css_computed_style *child,
  62.                 css_computed_style *result)
  63. {
  64.         uint8_t type = get_clear(child);
  65.  
  66.         if (type == CSS_CLEAR_INHERIT) {
  67.                 type = get_clear(parent);
  68.         }
  69.  
  70.         return set_clear(result, type);
  71. }
  72.  
  73.