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_word_spacing(uint32_t opv, css_style *style,
  18.                 css_select_state *state)
  19. {
  20.         return css__cascade_length_normal(opv, style, state, set_word_spacing);
  21. }
  22.  
  23. css_error css__set_word_spacing_from_hint(const css_hint *hint,
  24.                 css_computed_style *style)
  25. {
  26.         return set_word_spacing(style, hint->status,
  27.                         hint->data.length.value, hint->data.length.unit);
  28. }
  29.  
  30. css_error css__initial_word_spacing(css_select_state *state)
  31. {
  32.         return set_word_spacing(state->computed, CSS_WORD_SPACING_NORMAL,
  33.                         0, CSS_UNIT_PX);
  34. }
  35.  
  36. css_error css__compose_word_spacing(const css_computed_style *parent,
  37.                 const css_computed_style *child,
  38.                 css_computed_style *result)
  39. {
  40.         css_fixed length = 0;
  41.         css_unit unit = CSS_UNIT_PX;
  42.         uint8_t type = get_word_spacing(child, &length, &unit);
  43.  
  44.         if ((child->uncommon == NULL && parent->uncommon != NULL) ||
  45.                         type == CSS_WORD_SPACING_INHERIT ||
  46.                         (child->uncommon != NULL && result != child)) {
  47.                 if ((child->uncommon == NULL && parent->uncommon != NULL) ||
  48.                                 type == CSS_WORD_SPACING_INHERIT) {
  49.                         type = get_word_spacing(parent, &length, &unit);
  50.                 }
  51.  
  52.                 return set_word_spacing(result, type, length, unit);
  53.         }
  54.  
  55.         return CSS_OK;
  56. }
  57.  
  58.