In article <[email protected]>,
   Caitlin Potter <[email protected]> wrote:

> I just realized I've forgotten to attach the current version of the
> writing-mode property patch, so here :>


Thanks for the patch.

I've attached a new version.  The changes are:

  + Whitespace fixes

  + Added the writing-mode property handler to the handler table
    (The /src/parse/properties/properties.c change)

  + Moved the WRITING_MODE propstring, so the property propstrings are
    in alphabetical order.

  + Added the computed style accessor for writing-mode
    (The /include/libcss/computed.h and /src/select/computed.c changes)

  + Added parser tests for the writing-mode property's bytecode
    (The /test/data/parse/properties.dat change)

  + Added some illegal value handling tests for writing-mode property
    (The /test/data/parse2/illegal-values.dat change)

  + Updated the test code to dump writing-mode property
    (The /test/dump.h and /test/dump_computed.h changes)

  + Updated the select test data for writing-mode.

    This currently fails on a test that doesn't set writing-mode, but the
    default value in the expected and test result don't match.

    The test data expects "writing-mode: inherit" but gets
    "writing-mode: vertical-rl".

    Seems to be something to do with uncommon property defaults.

> I could use some guidance writing parse/select tests for the property
> because even after studying the test programs and data files, it's not
> really obvious what the system is

The parse ones are quite simple.  A rule is set in the #data section. 
Then in the #expected section, you write the bytecode you expect.  So
for

    writing-mode: vertical-lr ! important

>From docs/Bytecode:

    <opcode+flags+value> is 32 bits wide:
        bits 18-31: value
            bits 10-17 : flags
            bits 0-9  : opcode

    The 8 bits of flag data are defined as follows:
            bits 2-7: Must Be Zero (MBZ)
            bit 1   : value is inherit
            bit 0   : value is important

    ...

   6f - writing-mode
        <value> (14bits) :
                      bits 8-13: MBZ
                      bits 0-7 :
                                00000000 => horizontal-tb,
                                00000001 => vertical-rl,
                                00000010 => vertical-lr,
                                other    => Reserved for future expansion.

The opcode for writing-mode is 6f, we have important set, so bit 0 of
flags is set, and for value we have vertical-lr, so 0b00000010.

The expected result is those components stitched together and expressed in
hex:

    0x0008046f

-- 

Michael Drake (tlsa)                  http://www.netsurf-browser.org/
diff --git a/docs/Bytecode b/docs/Bytecode
index 900b1f9..b4154b5 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -1232,6 +1232,15 @@ Opcodes
                                bits 0-6: 0000000 => auto,
                                          other   => rffe.
 
+6f - writing-mode
+       <value> (14bits) :
+               bits 8-13: MBZ
+               bits 0-7 :
+                       00000000 => horizontal-tb,
+                       00000001 => vertical-rl,
+                       00000010 => vertical-lr,
+                       other    => Reserved for future expansion.
+
 
-6f-3ff - Reserved for future expansion.
+70-3ff - Reserved for future expansion.
 
diff --git a/include/libcss/computed.h b/include/libcss/computed.h
index 843795e..6cbb569 100644
--- a/include/libcss/computed.h
+++ b/include/libcss/computed.h
@@ -269,6 +269,9 @@ uint8_t css_computed_empty_cells(
 uint8_t css_computed_float(
                const css_computed_style *style);
   
+uint8_t css_computed_writing_mode(
+               const css_computed_style *style);
+  
 uint8_t css_computed_font_style(
                const css_computed_style *style);
   
diff --git a/include/libcss/properties.h b/include/libcss/properties.h
index feba9ce..bbb6baa 100644
--- a/include/libcss/properties.h
+++ b/include/libcss/properties.h
@@ -125,6 +125,7 @@ enum css_properties_e {
        CSS_PROP_COLUMN_RULE_WIDTH              = 0x06c,
        CSS_PROP_COLUMN_SPAN                    = 0x06d,
        CSS_PROP_COLUMN_WIDTH                   = 0x06e,
+       CSS_PROP_WRITING_MODE                   = 0x06f,
 
        CSS_N_PROPERTIES
 };
@@ -740,6 +741,13 @@ enum css_word_spacing_e {
        CSS_WORD_SPACING_NORMAL                 = 0x2
 };
 
+enum css_writing_mode_e {
+       CSS_WRITING_MODE_INHERIT                = 0x0,
+       CSS_WRITING_MODE_HORIZONTAL_TB          = 0x1,
+       CSS_WRITING_MODE_VERTICAL_RL            = 0x2,
+       CSS_WRITING_MODE_VERTICAL_LR            = 0x3
+};
+
 enum css_z_index_e {
        CSS_Z_INDEX_INHERIT                     = 0x0,
        CSS_Z_INDEX_SET                         = 0x1,
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index a0d38d4..544687a 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -718,6 +718,12 @@ enum op_word_spacing {
        WORD_SPACING_NORMAL             = 0x0000
 };
 
+enum op_writing_mode {
+       WRITING_MODE_HORIZONTAL_TB      = 0x0000,
+       WRITING_MODE_VERTICAL_RL        = 0x0001,
+       WRITING_MODE_VERTICAL_LR        = 0x0002
+};
+
 enum op_z_index {
        Z_INDEX_SET                     = 0x0080,
 
diff --git a/src/parse/properties/properties.c 
b/src/parse/properties/properties.c
index e8ca3ce..c4e939a 100644
--- a/src/parse/properties/properties.c
+++ b/src/parse/properties/properties.c
@@ -140,6 +140,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - 
FIRST_PROP] =
        css__parse_widows,
        css__parse_width,
        css__parse_word_spacing,
+       css__parse_writing_mode,
        css__parse_z_index
 };
 
diff --git a/src/parse/properties/properties.gen 
b/src/parse/properties/properties.gen
index 5a4ebe0..80f1a30 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -212,3 +212,4 @@ column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: 
NONE:0,COLUMN_SPAN_NONE ALL:0,
 
 column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: AUTO:0,COLUMN_WIDTH_AUTO 
IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET 
DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ||unit&UNIT_PCT 
LENGTH_UNIT:)
 
+writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: 
HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB 
VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR 
IDENT:)
diff --git a/src/parse/properties/properties.h 
b/src/parse/properties/properties.h
index 7280d93..59e0e58 100644
--- a/src/parse/properties/properties.h
+++ b/src/parse/properties/properties.h
@@ -406,6 +406,9 @@ css_error css__parse_width(css_language *c,
 css_error css__parse_word_spacing(css_language *c,
                const parserutils_vector *vector, int *ctx, 
                css_style *result);
+css_error css__parse_writing_mode(css_language *c,
+               const parserutils_vector *vector, int *ctx, 
+               css_style *result);
 css_error css__parse_z_index(css_language *c,
                const parserutils_vector *vector, int *ctx, 
                css_style *result);
diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c
index 35466eb..913241c 100644
--- a/src/parse/propstrings.c
+++ b/src/parse/propstrings.c
@@ -210,6 +210,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
        { "widows", SLEN("widows") },
        { "width", SLEN("width") },
        { "word-spacing", SLEN("word-spacing") },
+       { "writing-mode", SLEN("writing-mode") },
        { "z-index", SLEN("z-index") },
 
        { "inherit", SLEN("inherit") },
@@ -406,6 +407,9 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
        { "avoid-page", SLEN("avoid_page") },
        { "avoid-column", SLEN("avoid-column") },
        { "balance", SLEN("balance") },
+       { "horizontal-tb", SLEN("horizontal-tb") },
+       { "vertical-rl", SLEN("vertical-rl") },
+       { "vertical-lr", SLEN("vertical-lr") },
 
        { "aliceblue", SLEN("aliceblue") },
        { "antiquewhite", SLEN("antiquewhite") },
diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h
index 2ed0743..72a60ae 100644
--- a/src/parse/propstrings.h
+++ b/src/parse/propstrings.h
@@ -64,7 +64,8 @@ enum {
        SPEAK_HEADER, SPEAK_NUMERAL, SPEAK_PUNCTUATION, SPEAK, SPEECH_RATE,
        STRESS, TABLE_LAYOUT, TEXT_ALIGN, TEXT_DECORATION, TEXT_INDENT,
        TEXT_TRANSFORM, TOP, UNICODE_BIDI, VERTICAL_ALIGN, VISIBILITY,
-       VOICE_FAMILY, VOLUME, WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING, Z_INDEX,
+       VOICE_FAMILY, VOLUME, WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING,
+       WRITING_MODE, Z_INDEX,
 
        LAST_PROP = Z_INDEX,
 
@@ -96,7 +97,7 @@ enum {
        LINE_THROUGH, BLINK, RGB, RGBA, HSL, HSLA, LIBCSS_LEFT, LIBCSS_CENTER,
        LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL,
        FORMAT, WOFF, TRUETYPE, OPENTYPE, EMBEDDED_OPENTYPE, SVG, COLUMN,
-       AVOID_PAGE, AVOID_COLUMN, BALANCE,
+       AVOID_PAGE, AVOID_COLUMN, BALANCE, HORIZONTAL_TB, VERTICAL_RL, 
VERTICAL_LR,
 
        /* Named colours */
        FIRST_COLOUR,
diff --git a/src/select/computed.c b/src/select/computed.c
index 9f21d4a..cf2ef99 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -1504,6 +1504,27 @@ uint8_t css_computed_float(
 #undef CSS_FLOAT_SHIFT
 #undef CSS_FLOAT_INDEX
 
+#define CSS_WRITING_MODE_INDEX 4
+#define CSS_WRITING_MODE_SHIFT 1
+#define CSS_WRITING_MODE_MASK  0x6
+uint8_t css_computed_writing_mode(
+               const css_computed_style *style)
+{
+       if (style->uncommon != NULL) {
+               uint8_t bits = style->bits[CSS_WRITING_MODE_INDEX];
+               bits &= CSS_WRITING_MODE_MASK;
+               bits >>= CSS_WRITING_MODE_SHIFT;
+
+               /* 2bits: type */
+               return bits;
+       }
+
+       return CSS_WRITING_MODE_HORIZONTAL_TB;
+}
+#undef CSS_WRITING_MODE_MASK
+#undef CSS_WRITING_MODE_SHIFT
+#undef CSS_WRITING_MODE_INDEX
+
 #define CSS_FONT_STYLE_INDEX 18
 #define CSS_FONT_STYLE_SHIFT 0
 #define CSS_FONT_STYLE_MASK  0x3
diff --git a/src/select/computed.h b/src/select/computed.h
index f891047..8be3873 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -59,7 +59,7 @@ typedef struct css_computed_uncommon {
  *  2 ooooooob outline-width  | border-spacing
  *  3 bbbbbbbb border-spacing
  *  4 wwwwwwir word-spacing   | counter-increment | counter-reset
- *  5 uuuuu... cursor         | <unused>
+ *  5 uuuuumm. cursor         | writing-mode      | <unused>
  *  6 cccccccc clip
  *  7 cccccccc clip
  *  8 ccccccoo clip           | content
diff --git a/src/select/dispatch.c b/src/select/dispatch.c
index 85c1289..03d5c63 100644
--- a/src/select/dispatch.c
+++ b/src/select/dispatch.c
@@ -572,5 +572,10 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
                PROPERTY_FUNCS(column_width),
                0,
                GROUP_NORMAL
+       },
+       {
+               PROPERTY_FUNCS(writing_mode),
+               0,
+               GROUP_UNCOMMON
        }
 };
diff --git a/src/select/properties/Makefile b/src/select/properties/Makefile
index a557846..eacc240 100644
--- a/src/select/properties/Makefile
+++ b/src/select/properties/Makefile
@@ -110,6 +110,7 @@ white_space.c \
 width.c \
 windows.c \
 word_spacing.c \
+writing_mode.c \
 z_index.c
 
 include $(NSBUILD)/Makefile.subdir
diff --git a/src/select/properties/properties.h 
b/src/select/properties/properties.h
index d0bb648..63cdb17 100644
--- a/src/select/properties/properties.h
+++ b/src/select/properties/properties.h
@@ -131,6 +131,7 @@ PROPERTY_FUNCS(white_space);
 PROPERTY_FUNCS(widows);
 PROPERTY_FUNCS(width);
 PROPERTY_FUNCS(word_spacing);
+PROPERTY_FUNCS(writing_mode);
 PROPERTY_FUNCS(z_index);
 
 #undef PROPERTY_FUNCS
diff --git a/src/select/propget.h b/src/select/propget.h
index 41f6315..16b8fc2 100644
--- a/src/select/propget.h
+++ b/src/select/propget.h
@@ -174,6 +174,25 @@ static inline uint8_t get_word_spacing(
 #undef WORD_SPACING_SHIFT
 #undef WORD_SPACING_INDEX
 
+#define WRITING_MODE_INDEX 4
+#define WRITING_MODE_MASK  0x6
+#define WRITING_MODE_SHIFT 1
+static inline uint8_t get_writing_mode(
+               const css_computed_style *style)
+{
+       if (style->uncommon != NULL) {
+               uint8_t bits = style->uncommon->bits[WRITING_MODE_INDEX];
+               bits &= WRITING_MODE_MASK;
+               bits >>= WRITING_MODE_SHIFT;
+               return bits;
+       }
+
+       return CSS_WRITING_MODE_HORIZONTAL_TB;
+}
+#undef WRITING_MODE_INDEX
+#undef WRITING_MODE_MASK
+#undef WRITING_MODE_SHIFT
+
 #define COUNTER_INCREMENT_INDEX 3
 #define COUNTER_INCREMENT_SHIFT 1
 #define COUNTER_INCREMENT_MASK  0x2
diff --git a/src/select/propset.h b/src/select/propset.h
index 2b705ae..e0c6736 100644
--- a/src/select/propset.h
+++ b/src/select/propset.h
@@ -22,7 +22,7 @@ static const css_computed_uncommon default_uncommon = {
          0,
          (CSS_WORD_SPACING_INHERIT << 2) | 
                (CSS_COUNTER_INCREMENT_NONE << 1) | CSS_COUNTER_RESET_NONE,
-         (CSS_CURSOR_INHERIT << 3) | 0,
+         (CSS_CURSOR_INHERIT << 3) | (CSS_WRITING_MODE_INHERIT << 1) | 0,
          0,
          0,
          (CSS_CLIP_AUTO << 2) | CSS_CONTENT_NORMAL
@@ -214,6 +214,28 @@ static inline css_error set_word_spacing(
 #undef WORD_SPACING_SHIFT
 #undef WORD_SPACING_INDEX
 
+#define WRITING_MODE_INDEX 4
+#define WRITING_MODE_MASK  0x6
+#define WRITING_MODE_SHIFT 1
+static inline css_error set_writing_mode(
+               css_computed_style *style, uint8_t type)
+{
+       uint8_t *bits;
+
+       ENSURE_UNCOMMON;
+
+       bits = &style->uncommon->bits[WRITING_MODE_INDEX];
+
+       /* 2bits: type */
+       *bits = (*bits & ~WRITING_MODE_MASK) |
+                       ((type & 0x3) << WRITING_MODE_SHIFT);
+
+       return CSS_OK;
+}
+#undef WRITING_MODE_INDEX
+#undef WRITING_MODE_MASK
+#undef WRITING_MODE_SHIFT
+
 #define COUNTER_INCREMENT_INDEX 3
 #define COUNTER_INCREMENT_SHIFT 1
 #define COUNTER_INCREMENT_MASK  0x2
diff --git a/test/data/parse/properties.dat b/test/data/parse/properties.dat
index efe06ee..d96d826 100644
--- a/test/data/parse/properties.dat
+++ b/test/data/parse/properties.dat
@@ -4262,3 +4262,55 @@ p:before { content: open-quote 
url('http://picodrive.acornarcade.com/') " : " at
 |   0x0200006e 0x00000066 0x00000002
 #reset
 
+##
+## 6f - writing-mode
+##
+
+#data
+* { writing-mode: horizontal-tb; }
+#errors
+#expected
+| 1 *
+|   0x0000006f
+#reset
+
+#data
+* { writing-mode: vertical-rl; }
+#errors
+#expected
+| 1 *
+|   0x0004006f
+#reset
+
+#data
+* { writing-mode: vertical-lr; }
+#errors
+#expected
+| 1 *
+|   0x0008006f
+#reset
+
+#data
+* { writing-mode: inherit }
+#errors
+#expected
+| 1 *
+|   0x0000086f
+#reset
+
+#data
+* { writing-mode: inherit ! important }
+#errors
+#expected
+| 1 *
+|   0x00000c6f
+#reset
+
+#data
+* { writing-mode: vertical-lr ! important }
+#errors
+#expected
+| 1 *
+|   0x0008046f
+#reset
+
diff --git a/test/data/parse2/illegal-values.dat 
b/test/data/parse2/illegal-values.dat
index b882328..3187e18 100644
--- a/test/data/parse2/illegal-values.dat
+++ b/test/data/parse2/illegal-values.dat
@@ -4455,6 +4455,27 @@ max-height: 30%; min-height: 2em; }
 #reset
 
 #data
+* { writing-mode: em; }
+#errors
+#expected
+| *
+#reset
+
+#data
+* { writing-mode: 2em; }
+#errors
+#expected
+| *
+#reset
+
+#data
+* { writing-mode: vertical; }
+#errors
+#expected
+| *
+#reset
+
+#data
 * { z-index: - 40; }
 #errors
 #expected
diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index 4e9bf34..e610ba8 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -89,6 +89,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -184,6 +185,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -279,6 +281,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -374,6 +377,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -461,6 +465,7 @@ visibility: visible
 white-space: normal
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -546,6 +551,7 @@ visibility: visible
 white-space: normal
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -632,6 +638,7 @@ visibility: visible
 white-space: normal
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -718,6 +725,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -803,6 +811,7 @@ visibility: visible
 white-space: normal
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -893,6 +902,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -983,6 +993,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1074,6 +1085,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1168,6 +1180,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1261,6 +1274,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1360,6 +1374,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1459,6 +1474,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1558,6 +1574,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1661,6 +1678,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1763,6 +1781,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1863,6 +1882,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: normal
+writing-mode: horizontal-tb
 z-index: auto
 #reset
 
@@ -1962,6 +1982,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: inherit
+writing-mode: inherit
 z-index: auto
 #reset
 
@@ -2061,6 +2082,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: inherit
+writing-mode: inherit
 z-index: auto
 #reset
 
@@ -2160,6 +2182,7 @@ visibility: inherit
 white-space: inherit
 width: auto
 word-spacing: inherit
+writing-mode: inherit
 z-index: auto
 #reset
 
@@ -4029,3 +4052,95 @@ width: auto
 word-spacing: inherit
 z-index: auto
 #reset
+
+#tree
+| div
+|  id=foo
+|  p*
+#ua
+div, p { display: none; float: right; position: absolute; }
+#user
+p { display: block; writing-mode: vertical-lr; }
+#author
+div#foo p { letter-spacing: inherit; }
+div p { letter-spacing: horizontal-tb; }
+#errors
+#expected
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: inherit
+border-spacing: inherit
+border-top-color: currentColor
+border-right-color: currentColor
+border-bottom-color: currentColor
+border-left-color: currentColor
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: medium
+border-right-width: medium
+border-bottom-width: medium
+border-left-width: medium
+bottom: auto
+caption-side: inherit
+clear: none
+clip: auto
+color: inherit
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: inherit
+direction: inherit
+display: block
+empty-cells: inherit
+float: none
+font-family: inherit
+font-size: inherit
+font-style: inherit
+font-variant: inherit
+font-weight: inherit
+height: auto
+left: auto
+letter-spacing: inherit
+line-height: inherit
+list-style-image: inherit
+list-style-position: inherit
+list-style-type: inherit
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+outline-color: invert
+outline-style: none
+outline-width: medium
+overflow: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: absolute
+quotes: inherit
+right: auto
+table-layout: auto
+text-align: inherit
+text-decoration: none
+text-indent: inherit
+text-transform: inherit
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: inherit
+white-space: inherit
+width: auto
+word-spacing: inherit
+z-index: auto
+#reset
diff --git a/test/dump.h b/test/dump.h
index 73b61ea..941117c 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -476,6 +476,7 @@ static const char *opcode_names[] = {
        "column-rule-width",
        "column-span",
        "column-width",
+       "writing-mode",
 };
 
 static void dump_css_fixed(css_fixed f, char **ptr)
@@ -2529,6 +2530,19 @@ void dump_bytecode(css_style *style, char **ptr, 
uint32_t depth)
                                        break;
                                }
                                break;
+                       case CSS_PROP_WRITING_MODE:
+                               switch (value) {
+                               case WRITING_MODE_HORIZONTAL_TB:
+                                       *ptr += sprintf(*ptr, "horizontal-tb");
+                                       break;
+                               case WRITING_MODE_VERTICAL_RL:
+                                       *ptr += sprintf(*ptr, "vertical-rl");
+                                       break;
+                               case WRITING_MODE_VERTICAL_LR:
+                                       *ptr += sprintf(*ptr, "vertical-lr");
+                                       break;
+                               }
+                               break;
                        case CSS_PROP_Z_INDEX:
                                switch (value) {
                                case Z_INDEX_SET:
diff --git a/test/dump_computed.h b/test/dump_computed.h
index 6a29c2d..451ba1a 100644
--- a/test/dump_computed.h
+++ b/test/dump_computed.h
@@ -2472,6 +2472,28 @@ static void dump_computed_style(const css_computed_style 
*style, char *buf,
        ptr += wrote;
        *len -= wrote;
 
+       /* writing-mode */
+       val = css_computed_writing_mode(style);
+       switch (val) {
+       case CSS_WRITING_MODE_INHERIT:
+               wrote = snprintf(ptr, *len, "writing-mode: inherit\n");
+               break;
+       case CSS_WRITING_MODE_HORIZONTAL_TB:
+               wrote = snprintf(ptr, *len, "writing-mode: horizontal-tb\n");
+               break;
+       case CSS_WRITING_MODE_VERTICAL_RL:
+               wrote = snprintf(ptr, *len, "writing-mode: vertical-rl\n");
+               break;
+       case CSS_WRITING_MODE_VERTICAL_LR:
+               wrote = snprintf(ptr, *len, "writing-mode: vertical-lr\n");
+               break;
+       default:
+               wrote = 0;
+               break;
+       }
+       ptr += wrote;
+       *len -= wrote;
+
        /* z-index */
        val = css_computed_z_index(style, &zindex);
        switch (val) {

Reply via email to