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