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_unicode_bidi(uint32_t opv, css_style *style,
  18.                 css_select_state *state)
  19. {
  20.         uint16_t value = CSS_UNICODE_BIDI_INHERIT;
  21.  
  22.         UNUSED(style);
  23.  
  24.         if (isInherit(opv) == false) {
  25.                 switch (getValue(opv)) {
  26.                 case UNICODE_BIDI_NORMAL:
  27.                         value = CSS_UNICODE_BIDI_NORMAL;
  28.                         break;
  29.                 case UNICODE_BIDI_EMBED:
  30.                         value = CSS_UNICODE_BIDI_EMBED;
  31.                         break;
  32.                 case UNICODE_BIDI_BIDI_OVERRIDE:
  33.                         value = CSS_UNICODE_BIDI_BIDI_OVERRIDE;
  34.                         break;
  35.                 }
  36.         }
  37.  
  38.         if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
  39.                         isInherit(opv))) {
  40.                 return set_unicode_bidi(state->computed, value);
  41.         }
  42.  
  43.         return CSS_OK;
  44. }
  45.  
  46. css_error css__set_unicode_bidi_from_hint(const css_hint *hint,
  47.                 css_computed_style *style)
  48. {
  49.         return set_unicode_bidi(style, hint->status);
  50. }
  51.  
  52. css_error css__initial_unicode_bidi(css_select_state *state)
  53. {
  54.         return set_unicode_bidi(state->computed, CSS_UNICODE_BIDI_NORMAL);
  55. }
  56.  
  57. css_error css__compose_unicode_bidi(const css_computed_style *parent,  
  58.                 const css_computed_style *child,
  59.                 css_computed_style *result)
  60. {
  61.         uint8_t type = get_unicode_bidi(child);
  62.  
  63.         if (type == CSS_UNICODE_BIDI_INHERIT) {
  64.                 type = get_unicode_bidi(parent);
  65.         }
  66.  
  67.         return set_unicode_bidi(result, type);
  68. }
  69.  
  70.