summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yaml76
-rw-r--r--.github/workflows/static-analysis.yaml61
-rw-r--r--Makefile3
-rwxr-xr-xbuild/mkprops.pl6
-rw-r--r--docs/Bytecode70
-rw-r--r--examples/example1.c89
-rw-r--r--include/libcss/computed.h14
-rw-r--r--include/libcss/fpmath.h10
-rw-r--r--include/libcss/properties.h38
-rw-r--r--include/libcss/select.h9
-rw-r--r--include/libcss/types.h31
-rw-r--r--include/libcss/unit.h156
-rw-r--r--src/bytecode/bytecode.h52
-rw-r--r--src/bytecode/opcodes.h33
-rw-r--r--src/parse/font_face.c20
-rw-r--r--src/parse/font_face.h2
-rw-r--r--src/parse/important.c16
-rw-r--r--src/parse/important.h2
-rw-r--r--src/parse/language.c54
-rw-r--r--src/parse/language.h2
-rw-r--r--src/parse/mq.c84
-rw-r--r--src/parse/mq.h2
-rw-r--r--src/parse/properties/Makefile2
-rw-r--r--src/parse/properties/azimuth.c25
-rw-r--r--src/parse/properties/background.c25
-rw-r--r--src/parse/properties/background_position.c22
-rw-r--r--src/parse/properties/border.c4
-rw-r--r--src/parse/properties/border_color.c21
-rw-r--r--src/parse/properties/border_spacing.c19
-rw-r--r--src/parse/properties/border_style.c21
-rw-r--r--src/parse/properties/border_width.c21
-rw-r--r--src/parse/properties/clip.c19
-rw-r--r--src/parse/properties/column_rule.c16
-rw-r--r--src/parse/properties/columns.c13
-rw-r--r--src/parse/properties/content.c14
-rw-r--r--src/parse/properties/css_property_parser_gen.c50
-rw-r--r--src/parse/properties/cue.c20
-rw-r--r--src/parse/properties/cursor.c15
-rw-r--r--src/parse/properties/elevation.c22
-rw-r--r--src/parse/properties/fill_opacity.c82
-rw-r--r--src/parse/properties/flex.c25
-rw-r--r--src/parse/properties/flex_flow.c22
-rw-r--r--src/parse/properties/font.c74
-rw-r--r--src/parse/properties/font_family.c29
-rw-r--r--src/parse/properties/font_weight.c25
-rw-r--r--src/parse/properties/list_style.c19
-rw-r--r--src/parse/properties/list_style_type.c22
-rw-r--r--src/parse/properties/margin.c25
-rw-r--r--src/parse/properties/opacity.c14
-rw-r--r--src/parse/properties/outline.c19
-rw-r--r--src/parse/properties/overflow.c15
-rw-r--r--src/parse/properties/padding.c21
-rw-r--r--src/parse/properties/pause.c20
-rw-r--r--src/parse/properties/play_during.c22
-rw-r--r--src/parse/properties/properties.c4
-rw-r--r--src/parse/properties/properties.gen186
-rw-r--r--src/parse/properties/properties.h300
-rw-r--r--src/parse/properties/quotes.c16
-rw-r--r--src/parse/properties/stroke_opacity.c82
-rw-r--r--src/parse/properties/text_decoration.c11
-rw-r--r--src/parse/properties/utils.c47
-rw-r--r--src/parse/properties/utils.h53
-rw-r--r--src/parse/properties/voice_family.c17
-rw-r--r--src/parse/propstrings.c12
-rw-r--r--src/parse/propstrings.h41
-rw-r--r--src/select/Makefile3
-rw-r--r--src/select/autogenerated_computed.h88
-rw-r--r--src/select/autogenerated_propget.h1608
-rw-r--r--src/select/autogenerated_propset.h956
-rw-r--r--src/select/bloom.h48
-rw-r--r--src/select/computed.c79
-rw-r--r--src/select/computed.h10
-rw-r--r--src/select/dispatch.c9
-rw-r--r--src/select/dispatch.h2
-rw-r--r--src/select/format_list_style.c115
-rw-r--r--src/select/hash.c40
-rw-r--r--src/select/hash.h5
-rw-r--r--src/select/helpers.h3
-rw-r--r--src/select/mq.h223
-rw-r--r--src/select/overrides.py32
-rw-r--r--src/select/properties/Makefile2
-rw-r--r--src/select/properties/align_content.c23
-rw-r--r--src/select/properties/align_items.c23
-rw-r--r--src/select/properties/align_self.c23
-rw-r--r--src/select/properties/azimuth.c14
-rw-r--r--src/select/properties/background_attachment.c23
-rw-r--r--src/select/properties/background_color.c22
-rw-r--r--src/select/properties/background_image.c22
-rw-r--r--src/select/properties/background_position.c30
-rw-r--r--src/select/properties/background_repeat.c23
-rw-r--r--src/select/properties/border_bottom_color.c22
-rw-r--r--src/select/properties/border_bottom_style.c19
-rw-r--r--src/select/properties/border_bottom_width.c31
-rw-r--r--src/select/properties/border_collapse.c23
-rw-r--r--src/select/properties/border_left_color.c22
-rw-r--r--src/select/properties/border_left_style.c19
-rw-r--r--src/select/properties/border_left_width.c23
-rw-r--r--src/select/properties/border_right_color.c22
-rw-r--r--src/select/properties/border_right_style.c19
-rw-r--r--src/select/properties/border_right_width.c23
-rw-r--r--src/select/properties/border_spacing.c29
-rw-r--r--src/select/properties/border_top_color.c22
-rw-r--r--src/select/properties/border_top_style.c19
-rw-r--r--src/select/properties/border_top_width.c23
-rw-r--r--src/select/properties/bottom.c23
-rw-r--r--src/select/properties/box_sizing.c26
-rw-r--r--src/select/properties/break_after.c19
-rw-r--r--src/select/properties/break_before.c19
-rw-r--r--src/select/properties/break_inside.c23
-rw-r--r--src/select/properties/caption_side.c23
-rw-r--r--src/select/properties/clear.c23
-rw-r--r--src/select/properties/clip.c28
-rw-r--r--src/select/properties/color.c30
-rw-r--r--src/select/properties/column_count.c26
-rw-r--r--src/select/properties/column_fill.c23
-rw-r--r--src/select/properties/column_gap.c23
-rw-r--r--src/select/properties/column_rule_color.c29
-rw-r--r--src/select/properties/column_rule_style.c19
-rw-r--r--src/select/properties/column_rule_width.c23
-rw-r--r--src/select/properties/column_span.c23
-rw-r--r--src/select/properties/column_width.c27
-rw-r--r--src/select/properties/content.c51
-rw-r--r--src/select/properties/counter_increment.c48
-rw-r--r--src/select/properties/counter_reset.c48
-rw-r--r--src/select/properties/cue_after.c10
-rw-r--r--src/select/properties/cue_before.c10
-rw-r--r--src/select/properties/cursor.c52
-rw-r--r--src/select/properties/direction.c23
-rw-r--r--src/select/properties/display.c29
-rw-r--r--src/select/properties/elevation.c14
-rw-r--r--src/select/properties/empty_cells.c23
-rw-r--r--src/select/properties/fill_opacity.c73
-rw-r--r--src/select/properties/flex_basis.c27
-rw-r--r--src/select/properties/flex_direction.c23
-rw-r--r--src/select/properties/flex_grow.c26
-rw-r--r--src/select/properties/flex_shrink.c26
-rw-r--r--src/select/properties/flex_wrap.c25
-rw-r--r--src/select/properties/float.c23
-rw-r--r--src/select/properties/font_family.c61
-rw-r--r--src/select/properties/font_size.c27
-rw-r--r--src/select/properties/font_style.c23
-rw-r--r--src/select/properties/font_variant.c23
-rw-r--r--src/select/properties/font_weight.c23
-rw-r--r--src/select/properties/height.c23
-rw-r--r--src/select/properties/helpers.c48
-rw-r--r--src/select/properties/helpers.h133
-rw-r--r--src/select/properties/justify_content.c23
-rw-r--r--src/select/properties/left.c23
-rw-r--r--src/select/properties/letter_spacing.c23
-rw-r--r--src/select/properties/line_height.c27
-rw-r--r--src/select/properties/list_style_image.c22
-rw-r--r--src/select/properties/list_style_position.c23
-rw-r--r--src/select/properties/list_style_type.c38
-rw-r--r--src/select/properties/margin_bottom.c23
-rw-r--r--src/select/properties/margin_left.c23
-rw-r--r--src/select/properties/margin_right.c23
-rw-r--r--src/select/properties/margin_top.c23
-rw-r--r--src/select/properties/max_height.c23
-rw-r--r--src/select/properties/max_width.c23
-rw-r--r--src/select/properties/min_height.c23
-rw-r--r--src/select/properties/min_width.c23
-rw-r--r--src/select/properties/opacity.c28
-rw-r--r--src/select/properties/order.c26
-rw-r--r--src/select/properties/orphans.c22
-rw-r--r--src/select/properties/outline_color.c26
-rw-r--r--src/select/properties/outline_style.c19
-rw-r--r--src/select/properties/outline_width.c23
-rw-r--r--src/select/properties/overflow_x.c23
-rw-r--r--src/select/properties/overflow_y.c23
-rw-r--r--src/select/properties/padding_bottom.c23
-rw-r--r--src/select/properties/padding_left.c23
-rw-r--r--src/select/properties/padding_right.c23
-rw-r--r--src/select/properties/padding_top.c23
-rw-r--r--src/select/properties/page_break_after.c19
-rw-r--r--src/select/properties/page_break_before.c19
-rw-r--r--src/select/properties/page_break_inside.c19
-rw-r--r--src/select/properties/pause_after.c10
-rw-r--r--src/select/properties/pause_before.c10
-rw-r--r--src/select/properties/pitch.c14
-rw-r--r--src/select/properties/pitch_range.c10
-rw-r--r--src/select/properties/play_during.c14
-rw-r--r--src/select/properties/position.c26
-rw-r--r--src/select/properties/properties.h3
-rw-r--r--src/select/properties/quotes.c60
-rw-r--r--src/select/properties/richness.c10
-rw-r--r--src/select/properties/right.c23
-rw-r--r--src/select/properties/speak.c14
-rw-r--r--src/select/properties/speak_header.c14
-rw-r--r--src/select/properties/speak_numeral.c14
-rw-r--r--src/select/properties/speak_punctuation.c14
-rw-r--r--src/select/properties/speech_rate.c14
-rw-r--r--src/select/properties/stress.c10
-rw-r--r--src/select/properties/stroke_opacity.c73
-rw-r--r--src/select/properties/table_layout.c23
-rw-r--r--src/select/properties/text_align.c28
-rw-r--r--src/select/properties/text_decoration.c23
-rw-r--r--src/select/properties/text_indent.c23
-rw-r--r--src/select/properties/text_transform.c23
-rw-r--r--src/select/properties/top.c23
-rw-r--r--src/select/properties/unicode_bidi.c23
-rw-r--r--src/select/properties/vertical_align.c27
-rw-r--r--src/select/properties/visibility.c23
-rw-r--r--src/select/properties/voice_family.c14
-rw-r--r--src/select/properties/volume.c14
-rw-r--r--src/select/properties/white_space.c23
-rw-r--r--src/select/properties/widows.c22
-rw-r--r--src/select/properties/width.c23
-rw-r--r--src/select/properties/word_spacing.c23
-rw-r--r--src/select/properties/writing_mode.c27
-rw-r--r--src/select/properties/z_index.c26
-rw-r--r--src/select/select.c552
-rw-r--r--src/select/select.h21
-rw-r--r--src/select/select_config.py2
-rw-r--r--src/select/select_generator.py278
-rw-r--r--src/select/strings.c264
-rw-r--r--src/select/strings.h52
-rw-r--r--src/select/unit.c513
-rw-r--r--src/select/unit.h42
-rw-r--r--src/stylesheet.h44
-rw-r--r--test/data/parse/properties.dat8
-rw-r--r--test/data/parse2/INDEX2
-rw-r--r--test/data/parse2/dodgy-media-block.dat2
-rw-r--r--test/data/parse2/eof.dat30
-rw-r--r--test/data/parse2/mq.dat83
-rw-r--r--test/data/parse2/svg.dat79
-rw-r--r--test/data/parse2/units.dat24
-rw-r--r--test/data/select/INDEX1
-rw-r--r--test/data/select/defaulting.dat1478
-rw-r--r--test/data/select/tests1.dat841
-rw-r--r--test/dump.h45
-rw-r--r--test/dump_computed.h66
-rw-r--r--test/select.c1718
232 files changed, 10651 insertions, 4320 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 0000000..629c048
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,76 @@
+name: "Linux Build"
+
+on: [push]
+
+jobs:
+ linux:
+ name: '${{ matrix.os }}: ${{ matrix.compiler.vendor }}'
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os:
+ - ubuntu-22.04
+ - ubuntu-20.04
+ compiler:
+ # The NetSurf build system can't find LLVM AR (it looks for it
+ # in /usr/lib instead of /usr/bin:
+ # `make: /usr/lib/llvm-ar: No such file or directory`).
+ # So we need to make it explicit for llvm.
+ - { vendor: gnu, CC: gcc, AR: ar }
+ - { vendor: llvm, CC: clang, AR: llvm-ar }
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 1
+
+ - name: apt-get install packages
+ run: sudo apt-get update -qq &&
+ sudo apt-get install --no-install-recommends -y
+ bison
+ build-essential
+ check
+ clang
+ flex
+ git
+ gperf
+ llvm
+ pkg-config
+
+ - name: Get env.sh
+ run: |
+ mkdir projects
+ wget -O projects/env.sh https://git.netsurf-browser.org/netsurf.git/plain/docs/env.sh
+
+ - name: Build and install project deps
+ env:
+ CC: ${{ matrix.compiler.CC }}
+ AR: ${{ matrix.compiler.AR }}
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ ns-clone -d -s
+ ns-make-libs install
+
+ - name: Build Library
+ env:
+ CC: ${{ matrix.compiler.CC }}
+ AR: ${{ matrix.compiler.AR }}
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ make -j"$(nproc)"
+
+ - name: Unit Tests
+ env:
+ CC: ${{ matrix.compiler.CC }}
+ AR: ${{ matrix.compiler.AR }}
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ make test
diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml
new file mode 100644
index 0000000..ec5171f
--- /dev/null
+++ b/.github/workflows/static-analysis.yaml
@@ -0,0 +1,61 @@
+name: "Static Analysis"
+
+on: [push]
+
+jobs:
+ codeql:
+ name: codeql
+ runs-on: ubuntu-22.04
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: ['cpp']
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 1
+
+ - name: apt-get install packages
+ run: sudo apt-get update -qq &&
+ sudo apt-get install --no-install-recommends -y
+ bison
+ build-essential
+ check
+ clang
+ flex
+ git
+ gperf
+ llvm
+ pkg-config
+
+ - name: Get env.sh
+ run: |
+ mkdir projects
+ wget -O projects/env.sh https://git.netsurf-browser.org/netsurf.git/plain/docs/env.sh
+
+ - name: Build and install project deps
+ env:
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ ns-clone -d -s
+ ns-make-libs install
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+
+ - name: Build Library
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ make -j"$(nproc)"
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
diff --git a/Makefile b/Makefile
index 0835c8f..43e9a80 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@
# Component settings
COMPONENT := css
-COMPONENT_VERSION := 0.9.1
+COMPONENT_VERSION := 0.9.2
# Default to a static library
COMPONENT_TYPE ?= lib-static
@@ -65,5 +65,6 @@ INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/properties.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/select.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/stylesheet.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/types.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/unit.h
INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in
INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT)
diff --git a/build/mkprops.pl b/build/mkprops.pl
index 33fb0f8..6e38007 100755
--- a/build/mkprops.pl
+++ b/build/mkprops.pl
@@ -24,7 +24,7 @@ EOF
foreach my $prop (@PROPS) {
print <<EOF
static css_error parse_$prop(css_css21 *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style **result);
EOF
}
@@ -35,7 +35,7 @@ print <<EOF
* Type of property handler function
*/
typedef css_error (*css_prop_handler)(css_css21 *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style **result);
/**
@@ -56,7 +56,7 @@ foreach my $prop (@PROPS) {
print <<EOF
css_error parse_$prop(css_css21 *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style **result)
{
UNUSED(c);
diff --git a/docs/Bytecode b/docs/Bytecode
index d691923..272fd07 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -12,8 +12,13 @@ Format
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
+ bits 4-7: Must Be Zero (MBZ)
+ bits 1-3: Generic value
+ 000 => no generic value
+ 001 => inherit
+ 010 => initial
+ 011 => revert
+ 100 => unset
bit 0 : value is important
The 14 bits of value are opcode-specific.
@@ -44,19 +49,16 @@ Length is a 32bit numeric value (as described above) and unit is as follows:
00000101 => mm
00000110 => pt
00000111 => pc
- 00001000 => cap
- 00001001 => ch
- 00001010 => ic
- 00001011 => rem
- 00001100 => lh
- 00001101 => rlh
- 00001110 => vh
- 00001111 => vw
- 00010000 => vi
- 00010001 => vb
- 00010010 => vmin
- 00010011 => vmax
- 00010100 => q
+ 00001000 => ch
+ 00001001 => rem
+ 00001010 => lh
+ 00001011 => vh
+ 00001100 => vw
+ 00001101 => vi
+ 00001110 => vb
+ 00001111 => vmin
+ 00010000 => vmax
+ 00010001 => q
bit 9 set => percentage unit
bits 9-31: MBZ
@@ -356,10 +358,11 @@ Opcodes
0000101 => no-close-quote,
other => rffe.
- If the value is not "normal", "none", or "inherit", then there is
- a parameter list. Each item is preceded by a <value> word which
- declares the type of the next item. The list is terminated by a
- word with all bits set to zero (the encoding for "normal").
+ If the value is not "normal", "none", or a generic value ("inherit",
+ "initial", "unset", or "revert"), then there is a parameter list.
+ Each item is preceded by a <value> word which declares the type of
+ the next item. The list is terminated by a word with all bits set
+ to zero (the encoding for "normal").
For example,
content: open-quote url('http://example.com/')
@@ -388,7 +391,8 @@ Opcodes
bits 0-6: 0000000 => none,
other => rffe.
- If the value is not "none", or "inherit", then there is a parameter
+ If the value is not "none", or a generic value ("inherit",
+ "initial", "unset", or "revert"), then there is a parameter
list. Each item is preceded by a <value> word which declares the type
of the next item. The list is terminated by a word with all bits set to
zero (the encoding for "none").
@@ -404,7 +408,8 @@ Opcodes
bits 0-6: 0000000 => none,
other => rffe.
- If the value is not "none", or "inherit", then there is a parameter
+ If the value is not "none", or a generic value ("inherit",
+ "initial", "unset", or "revert"), then there is a parameter
list. Each item is preceded by a <value> word which declares the type
of the next item. The list is terminated by a word with all bits set to
zero (the encoding for "none").
@@ -486,6 +491,8 @@ Opcodes
f => none,
10 => flex,
11 => inline-flex,
+ 12 => grid,
+ 13 => inline-grid
other => Reserved for future expansion.
21 - elevation
@@ -869,6 +876,7 @@ Opcodes
1 => relative,
2 => absolute,
3 => fixed,
+ 4 => sticky,
other => Reserved for future expansion.
4a - quotes
@@ -1375,4 +1383,22 @@ Opcodes
bit 7 clear => Reserved for future expansion
bits 0-6: MBZ
-7c-3ff - Reserved for future expansion.
+7c - fill-opacity
+ <value> (14bits) :
+ bits 8-13: MBZ
+ bits 0-7 :
+ bit 7 set => number follows
+ bits 0-6: MBZ
+ bit 7 clear => Reserved for future expansion
+ bits 0-6: MBZ
+
+7d - stroke-opacity
+ <value> (14bits) :
+ bits 8-13: MBZ
+ bits 0-7 :
+ bit 7 set => number follows
+ bits 0-6: MBZ
+ bit 7 clear => Reserved for future expansion
+ bits 0-6: MBZ
+
+7e-3ff - Reserved for future expansion.
diff --git a/examples/example1.c b/examples/example1.c
index c36a94d..06313e5 100644
--- a/examples/example1.c
+++ b/examples/example1.c
@@ -98,13 +98,22 @@ static css_error node_presentational_hint(void *pw, void *node,
uint32_t *nhints, css_hint **hints);
static css_error ua_default_for_property(void *pw, uint32_t property,
css_hint *hint);
-static css_error compute_font_size(void *pw, const css_hint *parent,
- css_hint *size);
static css_error set_libcss_node_data(void *pw, void *n,
void *libcss_node_data);
static css_error get_libcss_node_data(void *pw, void *n,
void **libcss_node_data);
+static css_unit_ctx unit_len_ctx = {
+ .viewport_width = 800 * (1 << CSS_RADIX_POINT),
+ .viewport_height = 600 * (1 << CSS_RADIX_POINT),
+ .font_size_default = 16 * (1 << CSS_RADIX_POINT),
+ .font_size_minimum = 6 * (1 << CSS_RADIX_POINT),
+ .device_dpi = 96 * (1 << CSS_RADIX_POINT),
+ .root_style = NULL, /* We don't have a root node yet. */
+ .pw = NULL, /* We're not implementing measure callback */
+ .measure = NULL, /* We're not implementing measure callback */
+};
+
/* Table of function pointers for the LibCSS Select API. */
static css_select_handler select_handler = {
CSS_SELECT_HANDLER_VERSION_1,
@@ -143,11 +152,19 @@ static css_select_handler select_handler = {
node_is_lang,
node_presentational_hint,
ua_default_for_property,
- compute_font_size,
set_libcss_node_data,
- get_libcss_node_data
+ get_libcss_node_data,
};
+/* LWC leak callback */
+void lwc_callback(lwc_string *str, void *pw)
+{
+ (void)(pw);
+
+ fprintf(stderr, "Leaked string: %.*s\n",
+ (int)lwc_string_length(str),
+ lwc_string_data(str));
+}
int main(int argc, char **argv)
{
@@ -237,6 +254,7 @@ int main(int argc, char **argv)
lwc_intern_string(element, strlen(element), &element_name);
code = css_select_style(select_ctx, element_name,
+ &unit_len_ctx,
&media, NULL,
&select_handler, 0,
&style);
@@ -267,6 +285,7 @@ int main(int argc, char **argv)
if (code != CSS_OK)
die("css_stylesheet_destroy", code);
+ lwc_iterate_strings(lwc_callback, NULL);
return 0;
}
@@ -662,68 +681,6 @@ css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint)
return CSS_OK;
}
-css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size)
-{
- static css_hint_length sizes[] = {
- { FLTTOFIX(6.75), CSS_UNIT_PT },
- { FLTTOFIX(7.50), CSS_UNIT_PT },
- { FLTTOFIX(9.75), CSS_UNIT_PT },
- { FLTTOFIX(12.0), CSS_UNIT_PT },
- { FLTTOFIX(13.5), CSS_UNIT_PT },
- { FLTTOFIX(18.0), CSS_UNIT_PT },
- { FLTTOFIX(24.0), CSS_UNIT_PT }
- };
- const css_hint_length *parent_size;
-
- UNUSED(pw);
-
- /* Grab parent size, defaulting to medium if none */
- if (parent == NULL) {
- parent_size = &sizes[CSS_FONT_SIZE_MEDIUM - 1];
- } else {
- assert(parent->status == CSS_FONT_SIZE_DIMENSION);
- assert(parent->data.length.unit != CSS_UNIT_EM);
- assert(parent->data.length.unit != CSS_UNIT_EX);
- parent_size = &parent->data.length;
- }
-
- assert(size->status != CSS_FONT_SIZE_INHERIT);
-
- if (size->status < CSS_FONT_SIZE_LARGER) {
- /* Keyword -- simple */
- size->data.length = sizes[size->status - 1];
- } else if (size->status == CSS_FONT_SIZE_LARGER) {
- /** \todo Step within table, if appropriate */
- size->data.length.value =
- FMUL(parent_size->value, FLTTOFIX(1.2));
- size->data.length.unit = parent_size->unit;
- } else if (size->status == CSS_FONT_SIZE_SMALLER) {
- /** \todo Step within table, if appropriate */
- size->data.length.value =
- FMUL(parent_size->value, FLTTOFIX(1.2));
- size->data.length.unit = parent_size->unit;
- } else if (size->data.length.unit == CSS_UNIT_EM ||
- size->data.length.unit == CSS_UNIT_EX) {
- size->data.length.value =
- FMUL(size->data.length.value, parent_size->value);
-
- if (size->data.length.unit == CSS_UNIT_EX) {
- size->data.length.value = FMUL(size->data.length.value,
- FLTTOFIX(0.6));
- }
-
- size->data.length.unit = parent_size->unit;
- } else if (size->data.length.unit == CSS_UNIT_PCT) {
- size->data.length.value = FDIV(FMUL(size->data.length.value,
- parent_size->value), FLTTOFIX(100));
- size->data.length.unit = parent_size->unit;
- }
-
- size->status = CSS_FONT_SIZE_DIMENSION;
-
- return CSS_OK;
-}
-
static css_error set_libcss_node_data(void *pw, void *n,
void *libcss_node_data)
{
diff --git a/include/libcss/computed.h b/include/libcss/computed.h
index f4b3e21..5d9cc7e 100644
--- a/include/libcss/computed.h
+++ b/include/libcss/computed.h
@@ -19,6 +19,7 @@ extern "C"
#include <libcss/functypes.h>
#include <libcss/properties.h>
#include <libcss/types.h>
+#include <libcss/unit.h>
struct css_hint;
struct css_select_handler;
@@ -81,10 +82,7 @@ css_error css_computed_style_destroy(css_computed_style *style);
css_error css_computed_style_compose(
const css_computed_style *restrict parent,
const css_computed_style *restrict child,
- css_error (*compute_font_size)(void *pw,
- const struct css_hint *parent,
- struct css_hint *size),
- void *pw,
+ const css_unit_ctx *unit_ctx,
css_computed_style **restrict result);
/******************************************************************************
@@ -340,6 +338,14 @@ uint8_t css_computed_opacity(
const css_computed_style *style,
css_fixed *opacity);
+uint8_t css_computed_fill_opacity(
+ const css_computed_style *style,
+ css_fixed *fill_opacity);
+
+uint8_t css_computed_stroke_opacity(
+ const css_computed_style *style,
+ css_fixed *stroke_opacity);
+
uint8_t css_computed_text_transform(
const css_computed_style *style);
diff --git a/include/libcss/fpmath.h b/include/libcss/fpmath.h
index bed5ee6..eec40b3 100644
--- a/include/libcss/fpmath.h
+++ b/include/libcss/fpmath.h
@@ -99,10 +99,12 @@ css_float_to_fixed(const float a) {
float xx = a * (float) (1 << CSS_RADIX_POINT);
if (xx < INT_MIN)
- xx = INT_MIN;
+ return INT_MIN;
- if (xx > INT_MAX)
- xx = INT_MAX;
+ /* Conversion from int to float changes value from
+ * 2147483647 to 2147483648, so we use >= instead of >. */
+ if (xx >= (float)INT_MAX)
+ return INT_MAX;
return (css_fixed) xx;
}
@@ -128,6 +130,8 @@ css_float_to_fixed(const float a) {
/* truncate a fixed point value */
#define TRUNCATEFIX(a) (a & ~((1 << CSS_RADIX_POINT)- 1 ))
+/* get fractional component of a fixed point value */
+#define FIXFRAC(a) (a & ((1 << CSS_RADIX_POINT)- 1 ))
/* Useful values */
#define F_PI_2 0x00000648 /* 1.5708 (PI/2) */
diff --git a/include/libcss/properties.h b/include/libcss/properties.h
index a5569d0..cb1f0ff 100644
--- a/include/libcss/properties.h
+++ b/include/libcss/properties.h
@@ -138,6 +138,8 @@ enum css_properties_e {
CSS_PROP_FLEX_WRAP = 0x079,
CSS_PROP_JUSTIFY_CONTENT = 0x07a,
CSS_PROP_ORDER = 0x07b,
+ CSS_PROP_FILL_OPACITY = 0x07c,
+ CSS_PROP_STROKE_OPACITY = 0x07d,
CSS_N_PROPERTIES
};
@@ -163,12 +165,12 @@ enum css_align_items_e {
};
enum css_align_self_e {
- CSS_ALIGN_SELF_INHERIT = 0x0,
- CSS_ALIGN_SELF_STRETCH = 0x1,
- CSS_ALIGN_SELF_FLEX_START = 0x2,
- CSS_ALIGN_SELF_FLEX_END = 0x3,
- CSS_ALIGN_SELF_CENTER = 0x4,
- CSS_ALIGN_SELF_BASELINE = 0x5,
+ CSS_ALIGN_SELF_INHERIT = CSS_ALIGN_ITEMS_INHERIT,
+ CSS_ALIGN_SELF_STRETCH = CSS_ALIGN_ITEMS_STRETCH,
+ CSS_ALIGN_SELF_FLEX_START = CSS_ALIGN_ITEMS_FLEX_START,
+ CSS_ALIGN_SELF_FLEX_END = CSS_ALIGN_ITEMS_FLEX_END,
+ CSS_ALIGN_SELF_CENTER = CSS_ALIGN_ITEMS_CENTER,
+ CSS_ALIGN_SELF_BASELINE = CSS_ALIGN_ITEMS_BASELINE,
CSS_ALIGN_SELF_AUTO = 0x6
};
@@ -440,7 +442,9 @@ enum css_display_e {
CSS_DISPLAY_TABLE_CAPTION = 0x0f,
CSS_DISPLAY_NONE = 0x10,
CSS_DISPLAY_FLEX = 0x11,
- CSS_DISPLAY_INLINE_FLEX = 0x12
+ CSS_DISPLAY_INLINE_FLEX = 0x12,
+ CSS_DISPLAY_GRID = 0x13,
+ CSS_DISPLAY_INLINE_GRID = 0x14
};
enum css_empty_cells_e {
@@ -449,6 +453,11 @@ enum css_empty_cells_e {
CSS_EMPTY_CELLS_HIDE = 0x2
};
+enum css_fill_opacity_e {
+ CSS_FILL_OPACITY_INHERIT = 0x0,
+ CSS_FILL_OPACITY_SET = 0x1
+};
+
enum css_flex_basis_e {
CSS_FLEX_BASIS_INHERIT = 0x0,
CSS_FLEX_BASIS_SET = 0x1,
@@ -638,7 +647,12 @@ enum css_list_style_type_e {
CSS_LIST_STYLE_TYPE_HIAGANA = 0x2c,
CSS_LIST_STYLE_TYPE_HIAGANA_IROHA = 0x2d,
CSS_LIST_STYLE_TYPE_KATAKANA = 0x2e,
- CSS_LIST_STYLE_TYPE_KATAKANA_IROHA = 0x2f
+ CSS_LIST_STYLE_TYPE_KATAKANA_IROHA = 0x2f,
+ CSS_LIST_STYLE_TYPE_JAPANESE_INFORMAL = 0x30,
+ CSS_LIST_STYLE_TYPE_JAPANESE_FORMAL = 0x31,
+ CSS_LIST_STYLE_TYPE_KOREAN_HANGUL_FORMAL = 0x32,
+ CSS_LIST_STYLE_TYPE_KOREAN_HANJA_INFORMAL = 0x33,
+ CSS_LIST_STYLE_TYPE_KOREAN_HANJA_FORMAL = 0x34
};
enum css_margin_e {
@@ -756,7 +770,8 @@ enum css_position_e {
CSS_POSITION_STATIC = 0x1,
CSS_POSITION_RELATIVE = 0x2,
CSS_POSITION_ABSOLUTE = 0x3,
- CSS_POSITION_FIXED = 0x4
+ CSS_POSITION_FIXED = 0x4,
+ CSS_POSITION_STICKY = 0x5
};
enum css_quotes_e {
@@ -772,6 +787,11 @@ enum css_right_e {
CSS_RIGHT_AUTO = 0x2
};
+enum css_stroke_opacity_e {
+ CSS_STROKE_OPACITY_INHERIT = 0x0,
+ CSS_STROKE_OPACITY_SET = 0x1
+};
+
enum css_table_layout_e {
CSS_TABLE_LAYOUT_INHERIT = 0x0,
CSS_TABLE_LAYOUT_AUTO = 0x1,
diff --git a/include/libcss/select.h b/include/libcss/select.h
index ca57456..25317e5 100644
--- a/include/libcss/select.h
+++ b/include/libcss/select.h
@@ -18,6 +18,7 @@ extern "C"
#include <libcss/hint.h>
#include <libcss/types.h>
#include <libcss/computed.h>
+#include <libcss/unit.h>
typedef enum css_pseudo_element {
CSS_PSEUDO_ELEMENT_NONE = 0,
@@ -123,9 +124,6 @@ typedef struct css_select_handler {
css_error (*ua_default_for_property)(void *pw, uint32_t property,
css_hint *hint);
- css_error (*compute_font_size)(void *pw, const css_hint *parent,
- css_hint *size);
-
/**
* Set libcss_node_data on a DOM node.
*
@@ -221,13 +219,16 @@ css_error css_select_default_style(css_select_ctx *ctx,
css_select_handler *handler, void *pw,
css_computed_style **style);
css_error css_select_style(css_select_ctx *ctx, void *node,
+ const css_unit_ctx *unit_ctx,
const css_media *media, const css_stylesheet *inline_style,
css_select_handler *handler, void *pw,
css_select_results **result);
css_error css_select_results_destroy(css_select_results *results);
css_error css_select_font_faces(css_select_ctx *ctx,
- const css_media *media, lwc_string *font_family,
+ const css_media *media,
+ const css_unit_ctx *unit_ctx,
+ lwc_string *font_family,
css_select_font_faces_results **result);
css_error css_select_font_faces_results_destroy(
css_select_font_faces_results *results);
diff --git a/include/libcss/types.h b/include/libcss/types.h
index d8ac494..3fb28d3 100644
--- a/include/libcss/types.h
+++ b/include/libcss/types.h
@@ -88,19 +88,16 @@ typedef enum css_unit {
CSS_UNIT_MM = 0x05,
CSS_UNIT_PT = 0x06,
CSS_UNIT_PC = 0x07,
- CSS_UNIT_CAP = 0x08,
- CSS_UNIT_CH = 0x09,
- CSS_UNIT_IC = 0x0a,
- CSS_UNIT_REM = 0x0b,
- CSS_UNIT_LH = 0x0c,
- CSS_UNIT_RLH = 0x0d,
- CSS_UNIT_VH = 0x0e,
- CSS_UNIT_VW = 0x0f,
- CSS_UNIT_VI = 0x10,
- CSS_UNIT_VB = 0x11,
- CSS_UNIT_VMIN = 0x12,
- CSS_UNIT_VMAX = 0x13,
- CSS_UNIT_Q = 0x14,
+ CSS_UNIT_CH = 0x08,
+ CSS_UNIT_REM = 0x09,
+ CSS_UNIT_LH = 0x0a,
+ CSS_UNIT_VH = 0x0b,
+ CSS_UNIT_VW = 0x0c,
+ CSS_UNIT_VI = 0x0d,
+ CSS_UNIT_VB = 0x0e,
+ CSS_UNIT_VMIN = 0x0f,
+ CSS_UNIT_VMAX = 0x10,
+ CSS_UNIT_Q = 0x11,
CSS_UNIT_PCT = 0x15, /* Percentage */
@@ -116,7 +113,7 @@ typedef enum css_unit {
} css_unit;
/**
- * Media orienations
+ * Media orientations
*/
typedef enum css_media_orientation {
CSS_MEDIA_ORIENTATION_PORTRAIT = 0,
@@ -226,6 +223,8 @@ typedef struct css_media {
css_fixed monochrome; /* monochrome bpp (0 for colour) */
css_fixed inverted_colors; /** boolean: {0|1} */
+ lwc_string *prefers_color_scheme; /* "light", "dark" */
+
/* Interaction media features */
css_media_pointer pointer;
css_media_pointer any_pointer;
@@ -237,10 +236,6 @@ typedef struct css_media {
/* Scripting media features */
css_media_scripting scripting;
-
- /* Client details for length conversion */
- css_fixed client_font_size; /* In pt */
- css_fixed client_line_height; /* In css pixels */
} css_media;
/**
diff --git a/include/libcss/unit.h b/include/libcss/unit.h
new file mode 100644
index 0000000..67194c1
--- /dev/null
+++ b/include/libcss/unit.h
@@ -0,0 +1,156 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
+ */
+
+#ifndef libcss_unit_h_
+#define libcss_unit_h_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libcss/types.h>
+
+/**
+ * Client callback for font measuring.
+ *
+ * \param[in] pw Client data.
+ * \param[in] style Style to measure font for, or NULL.
+ * \param[in] unit Either CSS_UNIT_EX, or CSS_UNIT_CH.
+ * \return length in CSS pixels.
+ */
+typedef css_fixed (*css_unit_len_measure)(
+ void *pw,
+ const css_computed_style *style,
+ const css_unit unit);
+
+/**
+ * LibCSS unit conversion context.
+ *
+ * The client callback is optional. It is used for measuring "ch"
+ * (glyph '0' advance) and "ex" (height of the letter 'x') units.
+ * If a NULL pointer is given, LibCSS will use a fixed scaling of
+ * the "em" unit.
+ */
+typedef struct css_unit_ctx {
+ /**
+ * Viewport width in CSS pixels.
+ * Used if unit is vh, vw, vi, vb, vmin, or vmax.
+ */
+ css_fixed viewport_width;
+ /**
+ * Viewport height in CSS pixels.
+ * Used if unit is vh, vw, vi, vb, vmin, or vmax.
+ */
+ css_fixed viewport_height;
+ /**
+ * Client default font size in CSS pixels.
+ */
+ css_fixed font_size_default;
+ /**
+ * Client minimum font size in CSS pixels. May be zero.
+ */
+ css_fixed font_size_minimum;
+ /**
+ * DPI of the device the style is selected for.
+ */
+ css_fixed device_dpi;
+ /**
+ * Computed style for the document root element, needed for rem units.
+ * May be NULL, in which case font_size_default is used instead, as
+ * would be the case if rem unit is used on the root element.
+ */
+ const css_computed_style *root_style;
+ /**
+ * Optional client private word for measure callback.
+ */
+ void *pw;
+ /**
+ * Optional client callback for font measuring.
+ */
+ const css_unit_len_measure measure;
+} css_unit_ctx;
+
+/**
+ * Convert css pixels to physical pixels.
+ *
+ * \param[in] css_pixels Length in css pixels.
+ * \param[in] device_dpi Device dots per inch.
+ * \return Length in device pixels.
+ */
+static inline css_fixed css_unit_css2device_px(
+ const css_fixed css_pixels,
+ const css_fixed device_dpi)
+{
+ return FDIV(FMUL(css_pixels, device_dpi), F_96);
+}
+
+/**
+ * Convert device pixels to css pixels.
+ *
+ * \param[in] device_pixels Length in physical pixels.
+ * \param[in] device_dpi Device dots per inch.
+ * \return Length in css pixels.
+ */
+static inline css_fixed css_unit_device2css_px(
+ const css_fixed device_pixels,
+ const css_fixed device_dpi)
+{
+ return FDIV(FMUL(device_pixels, F_96), device_dpi);
+}
+
+/**
+ * Convert a length to points (pt).
+ *
+ * \param[in] style Style to perform conversion for or NULL.
+ * \param[in] ctx Length unit conversion context.
+ * \param[in] length Length to convert.
+ * \param[in] unit Current unit of length.
+ * \return A length in points.
+ */
+css_fixed css_unit_font_size_len2pt(
+ const css_computed_style *style,
+ const css_unit_ctx *ctx,
+ const css_fixed length,
+ const css_unit unit);
+
+/**
+ * Convert a length to CSS pixels.
+ *
+ * \param[in] style Style to perform conversion for or NULL.
+ * \param[in] ctx Length unit conversion context.
+ * \param[in] length Length to convert.
+ * \param[in] unit Current unit of length.
+ * \return A length in CSS pixels.
+ */
+css_fixed css_unit_len2css_px(
+ const css_computed_style *style,
+ const css_unit_ctx *ctx,
+ const css_fixed length,
+ const css_unit unit);
+
+/**
+ * Convert a length to device pixels.
+ *
+ * \param[in] style Style to perform conversion for or NULL.
+ * \param[in] ctx Length unit conversion context.
+ * \param[in] length Length to convert.
+ * \param[in] unit Current unit of length.
+ * \return A length in device pixels.
+ */
+css_fixed css_unit_len2device_px(
+ const css_computed_style *style,
+ const css_unit_ctx *ctx,
+ const css_fixed length,
+ const css_unit unit);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index 7518281..ccfdcac 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -18,9 +18,20 @@ typedef uint32_t css_code_t;
typedef enum css_properties_e opcode_t;
+enum flag_value {
+ FLAG_VALUE__NONE = 0,
+ FLAG_VALUE_INHERIT = 1,
+ FLAG_VALUE_INITIAL = 2,
+ FLAG_VALUE_REVERT = 3,
+ FLAG_VALUE_UNSET = 4,
+};
+
enum flag {
- FLAG_IMPORTANT = (1<<0),
- FLAG_INHERIT = (1<<1)
+ FLAG_IMPORTANT = (1 << 0),
+ FLAG_INHERIT = (FLAG_VALUE_INHERIT << 1),
+ FLAG_INITIAL = (FLAG_VALUE_INITIAL << 1),
+ FLAG_REVERT = (FLAG_VALUE_REVERT << 1),
+ FLAG_UNSET = (FLAG_VALUE_UNSET << 1),
};
@@ -34,19 +45,16 @@ typedef enum unit {
UNIT_MM = (1u << 8) + 5,
UNIT_PT = (1u << 8) + 6,
UNIT_PC = (1u << 8) + 7,
- UNIT_CAP = (1u << 8) + 8,
- UNIT_CH = (1u << 8) + 9,
- UNIT_IC = (1u << 8) + 10,
- UNIT_REM = (1u << 8) + 11,
- UNIT_LH = (1u << 8) + 12,
- UNIT_RLH = (1u << 8) + 13,
- UNIT_VH = (1u << 8) + 14,
- UNIT_VW = (1u << 8) + 15,
- UNIT_VI = (1u << 8) + 16,
- UNIT_VB = (1u << 8) + 17,
- UNIT_VMIN = (1u << 8) + 18,
- UNIT_VMAX = (1u << 8) + 19,
- UNIT_Q = (1u << 8) + 20,
+ UNIT_CH = (1u << 8) + 8,
+ UNIT_REM = (1u << 8) + 9,
+ UNIT_LH = (1u << 8) + 10,
+ UNIT_VH = (1u << 8) + 11,
+ UNIT_VW = (1u << 8) + 12,
+ UNIT_VI = (1u << 8) + 13,
+ UNIT_VB = (1u << 8) + 14,
+ UNIT_VMIN = (1u << 8) + 15,
+ UNIT_VMAX = (1u << 8) + 16,
+ UNIT_Q = (1u << 8) + 17,
UNIT_PCT = (1 << 9),
@@ -98,12 +106,22 @@ static inline uint16_t getValue(css_code_t OPV)
static inline bool isImportant(css_code_t OPV)
{
- return getFlags(OPV) & 0x1;
+ return getFlags(OPV) & FLAG_IMPORTANT;
+}
+
+static inline enum flag_value getFlagValue(css_code_t OPV)
+{
+ return (getFlags(OPV) >> 1) & 0x7;
+}
+
+static inline bool hasFlagValue(css_code_t OPV)
+{
+ return getFlagValue(OPV) != FLAG_VALUE__NONE;
}
static inline bool isInherit(css_code_t OPV)
{
- return getFlags(OPV) & 0x2;
+ return getFlagValue(OPV) == FLAG_VALUE_INHERIT;
}
#endif
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index 1e561e5..7a1377b 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -29,11 +29,11 @@ enum op_align_items {
};
enum op_align_self {
- ALIGN_SELF_STRETCH = 0x0000,
- ALIGN_SELF_FLEX_START = 0x0001,
- ALIGN_SELF_FLEX_END = 0x0002,
- ALIGN_SELF_CENTER = 0x0003,
- ALIGN_SELF_BASELINE = 0x0004,
+ ALIGN_SELF_STRETCH = ALIGN_ITEMS_STRETCH,
+ ALIGN_SELF_FLEX_START = ALIGN_ITEMS_FLEX_START,
+ ALIGN_SELF_FLEX_END = ALIGN_ITEMS_FLEX_END,
+ ALIGN_SELF_CENTER = ALIGN_ITEMS_CENTER,
+ ALIGN_SELF_BASELINE = ALIGN_ITEMS_BASELINE,
ALIGN_SELF_AUTO = 0x0005
};
@@ -332,7 +332,9 @@ enum op_display {
DISPLAY_TABLE_CAPTION = 0x000e,
DISPLAY_NONE = 0x000f,
DISPLAY_FLEX = 0x0010,
- DISPLAY_INLINE_FLEX = 0x0011
+ DISPLAY_INLINE_FLEX = 0x0011,
+ DISPLAY_GRID = 0x0012,
+ DISPLAY_INLINE_GRID = 0x0013
};
enum op_elevation {
@@ -349,6 +351,11 @@ enum op_empty_cells {
EMPTY_CELLS_HIDE = 0x0001
};
+enum op_fill_opacity {
+ FILL_OPACITY_SET = 0x0080
+};
+
+
enum op_flex_basis {
FLEX_BASIS_AUTO = 0x0000,
FLEX_BASIS_CONTENT = 0x0001,
@@ -523,7 +530,12 @@ enum op_list_style_type {
LIST_STYLE_TYPE_HIAGANA = 0x002b,
LIST_STYLE_TYPE_HIAGANA_IROHA = 0x002c,
LIST_STYLE_TYPE_KATAKANA = 0x002d,
- LIST_STYLE_TYPE_KATAKANA_IROHA = 0x002e
+ LIST_STYLE_TYPE_KATAKANA_IROHA = 0x002e,
+ LIST_STYLE_TYPE_JAPANESE_INFORMAL = 0x002f,
+ LIST_STYLE_TYPE_JAPANESE_FORMAL = 0x0030,
+ LIST_STYLE_TYPE_KOREAN_HANGUL_FORMAL = 0x0031,
+ LIST_STYLE_TYPE_KOREAN_HANJA_INFORMAL = 0x0032,
+ LIST_STYLE_TYPE_KOREAN_HANJA_FORMAL = 0x0033
};
enum op_margin {
@@ -658,7 +670,8 @@ enum op_position {
POSITION_STATIC = 0x0000,
POSITION_RELATIVE = 0x0001,
POSITION_ABSOLUTE = 0x0002,
- POSITION_FIXED = 0x0003
+ POSITION_FIXED = 0x0003,
+ POSITION_STICKY = 0x0004
};
enum op_quotes {
@@ -713,6 +726,10 @@ enum op_stress {
STRESS_SET = 0x0080
};
+enum op_stroke_opacity {
+ STROKE_OPACITY_SET = 0x0080
+};
+
enum op_table_layout {
TABLE_LAYOUT_AUTO = 0x0000,
TABLE_LAYOUT_FIXED = 0x0001
diff --git a/src/parse/font_face.c b/src/parse/font_face.c
index f17d50e..055a118 100644
--- a/src/parse/font_face.c
+++ b/src/parse/font_face.c
@@ -41,7 +41,7 @@ static bool font_rule_font_family_reserved(css_language *c,
}
static css_error font_face_parse_font_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face *font_face)
{
css_error error;
@@ -60,7 +60,7 @@ static css_error font_face_parse_font_family(css_language *c,
}
static css_error font_face_src_parse_format(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face_format *format)
{
bool match;
@@ -120,7 +120,7 @@ static css_error font_face_src_parse_format(css_language *c,
}
static css_error font_face_src_parse_spec_or_name(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
lwc_string **location,
css_font_face_location_type *location_type,
css_font_face_format *format)
@@ -194,10 +194,10 @@ static css_error font_face_src_parse_spec_or_name(css_language *c,
}
static css_error font_face_parse_src(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face *font_face)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
css_font_face_src *srcs = NULL, *new_srcs = NULL;
@@ -258,10 +258,10 @@ cleanup:
}
static css_error font_face_parse_font_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face *font_face)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
enum css_font_style_e style = 0;
@@ -299,10 +299,10 @@ static css_error font_face_parse_font_style(css_language *c,
}
static css_error font_face_parse_font_weight(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face *font_face)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
enum css_font_weight_e weight = 0;
@@ -374,7 +374,7 @@ static css_error font_face_parse_font_weight(css_language *c,
*/
css_error css__parse_font_descriptor(css_language *c,
const css_token *descriptor, const parserutils_vector *vector,
- int *ctx, css_rule_font_face *rule)
+ int32_t *ctx, css_rule_font_face *rule)
{
css_font_face *font_face = rule->font_face;
css_error error;
diff --git a/src/parse/font_face.h b/src/parse/font_face.h
index 435380e..dc00ef1 100644
--- a/src/parse/font_face.h
+++ b/src/parse/font_face.h
@@ -17,6 +17,6 @@
css_error css__parse_font_descriptor(css_language *c,
const css_token *descriptor, const parserutils_vector *vector,
- int *ctx, struct css_rule_font_face *rule);
+ int32_t *ctx, struct css_rule_font_face *rule);
#endif
diff --git a/src/parse/important.c b/src/parse/important.c
index e0e8620..02aafc4 100644
--- a/src/parse/important.c
+++ b/src/parse/important.c
@@ -25,10 +25,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_important(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint8_t *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
bool match = false;
const css_token *token;
@@ -87,7 +87,7 @@ void css__make_style_important(css_style *style)
offset++;
/* Advance past any property-specific data */
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (op) {
case CSS_PROP_AZIMUTH:
if ((value & ~AZIMUTH_BEHIND) == AZIMUTH_ANGLE)
@@ -346,6 +346,16 @@ void css__make_style_important(css_style *style)
offset++; /* value */
break;
+ case CSS_PROP_FILL_OPACITY:
+ if (value == FILL_OPACITY_SET)
+ offset++; /* value */
+ break;
+
+ case CSS_PROP_STROKE_OPACITY:
+ if (value == STROKE_OPACITY_SET)
+ offset++; /* value */
+ break;
+
case CSS_PROP_ORDER:
if (value == ORDER_SET)
offset++; /* value */
diff --git a/src/parse/important.h b/src/parse/important.h
index ba5e118..e939c4b 100644
--- a/src/parse/important.h
+++ b/src/parse/important.h
@@ -12,7 +12,7 @@
#include "parse/language.h"
css_error css__parse_important(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint8_t *result);
void css__make_style_important(css_style *style);
diff --git a/src/parse/language.c b/src/parse/language.c
index c2d02d7..936ab3d 100644
--- a/src/parse/language.c
+++ b/src/parse/language.c
@@ -63,37 +63,37 @@ static css_error lookupNamespace(css_language *c,
/* Selector list parsing */
static css_error parseClass(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector_detail *specific);
static css_error parseAttrib(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector_detail *specific);
static css_error parseNth(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector_detail_value *value);
static css_error parsePseudo(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool in_not, css_selector_detail *specific);
static css_error parseSpecific(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool in_not, css_selector_detail *specific);
static css_error parseAppendSpecific(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **parent);
static css_error parseSelectorSpecifics(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **parent);
static css_error parseTypeSelector(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_qname *qname);
static css_error parseSimpleSelector(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **result);
static css_error parseCombinator(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_combinator *result);
static css_error parseSelector(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **result);
static css_error parseSelectorList(css_language *c,
const parserutils_vector *vector, css_rule *rule);
@@ -101,7 +101,7 @@ static css_error parseSelectorList(css_language *c,
/* Declaration parsing */
static css_error parseProperty(css_language *c,
const css_token *property, const parserutils_vector *vector,
- int *ctx, css_rule *rule);
+ int32_t *ctx, css_rule *rule);
/**
* Create a CSS language parser
@@ -790,7 +790,7 @@ css_error handleDeclaration(css_language *c, const parserutils_vector *vector)
{
css_error error;
const css_token *token, *ident;
- int ctx = 0;
+ int32_t ctx = 0;
context_entry *entry;
css_rule *rule;
@@ -945,7 +945,7 @@ css_error lookupNamespace(css_language *c, lwc_string *prefix, lwc_string **uri)
******************************************************************************/
css_error parseClass(css_language *c, const parserutils_vector *vector,
- int *ctx, css_selector_detail *specific)
+ int32_t *ctx, css_selector_detail *specific)
{
css_qname qname;
css_selector_detail_value detail_value;
@@ -976,7 +976,7 @@ css_error parseClass(css_language *c, const parserutils_vector *vector,
}
css_error parseAttrib(css_language *c, const parserutils_vector *vector,
- int *ctx, css_selector_detail *specific)
+ int32_t *ctx, css_selector_detail *specific)
{
css_qname qname;
css_selector_detail_value detail_value;
@@ -1078,7 +1078,7 @@ css_error parseAttrib(css_language *c, const parserutils_vector *vector,
}
css_error parseNth(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector_detail_value *value)
{
const css_token *token;
@@ -1279,7 +1279,7 @@ css_error parseNth(css_language *c,
}
css_error parsePseudo(css_language *c, const parserutils_vector *vector,
- int *ctx, bool in_not, css_selector_detail *specific)
+ int32_t *ctx, bool in_not, css_selector_detail *specific)
{
static const struct
{
@@ -1459,7 +1459,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector,
}
css_error parseSpecific(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool in_not, css_selector_detail *specific)
{
css_error error;
@@ -1514,7 +1514,7 @@ css_error parseSpecific(css_language *c,
}
css_error parseAppendSpecific(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **parent)
{
css_error error;
@@ -1529,7 +1529,7 @@ css_error parseAppendSpecific(css_language *c,
}
css_error parseSelectorSpecifics(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **parent)
{
css_error error;
@@ -1551,7 +1551,7 @@ css_error parseSelectorSpecifics(css_language *c,
}
css_error parseTypeSelector(css_language *c, const parserutils_vector *vector,
- int *ctx, css_qname *qname)
+ int32_t *ctx, css_qname *qname)
{
const css_token *token;
css_error error;
@@ -1612,10 +1612,10 @@ css_error parseTypeSelector(css_language *c, const parserutils_vector *vector,
}
css_error parseSimpleSelector(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
css_selector *selector;
@@ -1678,7 +1678,7 @@ css_error parseSimpleSelector(css_language *c,
}
css_error parseCombinator(css_language *c, const parserutils_vector *vector,
- int *ctx, css_combinator *result)
+ int32_t *ctx, css_combinator *result)
{
const css_token *token;
css_combinator comb = CSS_COMBINATOR_NONE;
@@ -1719,7 +1719,7 @@ css_error parseCombinator(css_language *c, const parserutils_vector *vector,
}
css_error parseSelector(css_language *c, const parserutils_vector *vector,
- int *ctx, css_selector **result)
+ int32_t *ctx, css_selector **result)
{
css_error error;
const css_token *token = NULL;
@@ -1785,7 +1785,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector,
css_error error;
const css_token *token = NULL;
css_selector *selector = NULL;
- int ctx = 0;
+ int32_t ctx = 0;
/* Strip any leading whitespace (can happen if in nested block) */
consumeWhitespace(vector, &ctx);
@@ -1843,7 +1843,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector,
******************************************************************************/
css_error parseProperty(css_language *c, const css_token *property,
- const parserutils_vector *vector, int *ctx, css_rule *rule)
+ const parserutils_vector *vector, int32_t *ctx, css_rule *rule)
{
css_error error;
css_prop_handler handler = NULL;
diff --git a/src/parse/language.h b/src/parse/language.h
index 2ab4987..81a096a 100644
--- a/src/parse/language.h
+++ b/src/parse/language.h
@@ -64,7 +64,7 @@ css_error css__language_destroy(css_language *language);
* \param vector The vector to consume from
* \param ctx The vector's context
*/
-static inline void consumeWhitespace(const parserutils_vector *vector, int *ctx)
+static inline void consumeWhitespace(const parserutils_vector *vector, int32_t *ctx)
{
const css_token *token = NULL;
diff --git a/src/parse/mq.c b/src/parse/mq.c
index b0e47c3..5031e34 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -79,11 +79,11 @@ void css__mq_query_destroy(css_mq_query *media)
}
static css_error mq_parse_condition(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool permit_or, css_mq_cond **cond);
static css_error mq_parse_ratio(
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
const css_token *numerator, css_fixed *ratio)
{
const css_token *token;
@@ -260,7 +260,7 @@ static css_error mq_parse_range__convert_to_level_4(
}
static css_error mq_parse_range(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
const css_token *name_or_value,
css_mq_feature **feature)
{
@@ -443,7 +443,7 @@ static css_error mq_parse_range(lwc_string **strings,
}
static css_error mq_parse_media_feature(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_feature **feature)
{
const css_token *name_or_value, *token;
@@ -565,7 +565,7 @@ static css_error mq_parse_media_feature(lwc_string **strings,
* CSS Syntax Module Level 3: 8.2
*/
static css_error mq_parse_consume_any_value(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool until, const char until_char)
{
const css_token *token;
@@ -627,7 +627,7 @@ static css_error mq_parse_consume_any_value(lwc_string **strings,
}
static css_error mq_parse_general_enclosed(lwc_string **strings,
- const parserutils_vector *vector, int *ctx)
+ const parserutils_vector *vector, int32_t *ctx)
{
const css_token *token;
css_error error;
@@ -671,7 +671,7 @@ static css_error mq_parse_general_enclosed(lwc_string **strings,
}
static css_error mq_parse_media_in_parens(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_cond_or_feature **cond_or_feature)
{
const css_token *token;
@@ -754,7 +754,7 @@ static css_error mq_parse_media_in_parens(lwc_string **strings,
}
static css_error mq_parse_condition(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool permit_or, css_mq_cond **cond)
{
const css_token *token;
@@ -882,63 +882,84 @@ static css_error mq_parse_condition(lwc_string **strings,
/**
* Parse a media query type.
*/
-static uint64_t mq_parse_type(lwc_string **strings, lwc_string *type)
+static css_error mq_parse_type(lwc_string **strings, lwc_string *type,
+ uint64_t *result)
{
bool match;
+ css_error error = CSS_OK;
if (type == NULL) {
- return CSS_MEDIA_ALL;
+ *result = CSS_MEDIA_ALL;
} else if (lwc_string_caseless_isequal(
type, strings[AURAL],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_AURAL;
+ *result = CSS_MEDIA_AURAL;
} else if (lwc_string_caseless_isequal(
type, strings[BRAILLE],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_BRAILLE;
+ *result = CSS_MEDIA_BRAILLE;
} else if (lwc_string_caseless_isequal(
type, strings[EMBOSSED],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_EMBOSSED;
+ *result = CSS_MEDIA_EMBOSSED;
} else if (lwc_string_caseless_isequal(
type, strings[HANDHELD],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_HANDHELD;
+ *result = CSS_MEDIA_HANDHELD;
} else if (lwc_string_caseless_isequal(
type, strings[PRINT],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_PRINT;
+ *result = CSS_MEDIA_PRINT;
} else if (lwc_string_caseless_isequal(
type, strings[PROJECTION],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_PROJECTION;
+ *result = CSS_MEDIA_PROJECTION;
} else if (lwc_string_caseless_isequal(
type, strings[SCREEN],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_SCREEN;
+ *result = CSS_MEDIA_SCREEN;
} else if (lwc_string_caseless_isequal(
type, strings[SPEECH],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_SPEECH;
+ *result = CSS_MEDIA_SPEECH;
} else if (lwc_string_caseless_isequal(
type, strings[TTY],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_TTY;
+ *result = CSS_MEDIA_TTY;
} else if (lwc_string_caseless_isequal(
type, strings[TV],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_TV;
+ *result = CSS_MEDIA_TV;
} else if (lwc_string_caseless_isequal(
type, strings[ALL],
&match) == lwc_error_ok && match) {
- return CSS_MEDIA_ALL;
+ *result = CSS_MEDIA_ALL;
+ } else if (lwc_string_caseless_isequal(
+ type, strings[NOT],
+ &match) == lwc_error_ok && match) {
+ error = CSS_INVALID;
+ } else if (lwc_string_caseless_isequal(
+ type, strings[AND],
+ &match) == lwc_error_ok && match) {
+ error = CSS_INVALID;
+ } else if (lwc_string_caseless_isequal(
+ type, strings[OR],
+ &match) == lwc_error_ok && match) {
+ error = CSS_INVALID;
+ } else if (lwc_string_caseless_isequal(
+ type, strings[ONLY],
+ &match) == lwc_error_ok && match) {
+ error = CSS_INVALID;
+ } else {
+ /* Unknown type: same as not matching */
+ *result = 0;
}
- return 0;
+ return error;
}
static css_error mq_parse_media_query(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_query **query)
{
const css_token *token;
@@ -963,7 +984,7 @@ static css_error mq_parse_media_query(lwc_string **strings,
lwc_string_caseless_isequal(token->idata,
strings[NOT], &match) == lwc_error_ok &&
match) {
- int old_ctx = *ctx;
+ int32_t old_ctx = *ctx;
parserutils_vector_iterate(vector, ctx);
consumeWhitespace(vector, ctx);
@@ -991,6 +1012,7 @@ static css_error mq_parse_media_query(lwc_string **strings,
return error;
}
+ result->type = CSS_MEDIA_ALL;
goto finished;
}
@@ -1016,7 +1038,11 @@ static css_error mq_parse_media_query(lwc_string **strings,
return CSS_INVALID;
}
- result->type = mq_parse_type(strings, token->idata);
+ error = mq_parse_type(strings, token->idata, &result->type);
+ if (error != CSS_OK) {
+ free(result);
+ return error;
+ }
consumeWhitespace(vector, ctx);
@@ -1041,10 +1067,6 @@ static css_error mq_parse_media_query(lwc_string **strings,
}
finished:
- if (result->type == 0) {
- result->type = CSS_MEDIA_ALL;
- }
-
*query = result;
return CSS_OK;
}
@@ -1078,7 +1100,7 @@ static css_error css__mq_parse__create_not_all(
}
css_error css__mq_parse_media_list(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_query **media)
{
css_mq_query *result = NULL, *last = NULL;
@@ -1140,7 +1162,7 @@ static css_error css_parse_media_query_handle_event(
const parserutils_vector *tokens,
void *pw)
{
- int idx = 0;
+ int32_t idx = 0;
css_error err;
css_mq_query *media;
const css_token *tok;
diff --git a/src/parse/mq.h b/src/parse/mq.h
index 7a51578..ec19419 100644
--- a/src/parse/mq.h
+++ b/src/parse/mq.h
@@ -88,7 +88,7 @@ css_error css_parse_media_query(lwc_string **strings,
css_mq_query **media_out);
css_error css__mq_parse_media_list(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_query **media);
void css__mq_query_destroy(css_mq_query *media);
diff --git a/src/parse/properties/Makefile b/src/parse/properties/Makefile
index 6461dda..df84d49 100644
--- a/src/parse/properties/Makefile
+++ b/src/parse/properties/Makefile
@@ -45,6 +45,7 @@ DIR_SOURCES := \
cue.c \
cursor.c \
elevation.c \
+ fill_opacity.c \
flex.c \
flex_flow.c \
font.c \
@@ -61,6 +62,7 @@ DIR_SOURCES := \
play_during.c \
properties.c \
quotes.c \
+ stroke_opacity.c \
text_decoration.c \
utils.c \
voice_family.c
diff --git a/src/parse/properties/azimuth.c b/src/parse/properties/azimuth.c
index f54189b..a9265d1 100644
--- a/src/parse/properties/azimuth.c
+++ b/src/parse/properties/azimuth.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_azimuth(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
@@ -53,11 +53,30 @@ css_error css__parse_azimuth(css_language *c,
}
if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT],
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
flags = FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
+ } else if (token->type == CSS_TOKEN_IDENT &&
(lwc_string_caseless_isequal(token->idata, c->strings[LEFTWARDS],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c
index 01b995e..20aeb30 100644
--- a/src/parse/properties/background.c
+++ b/src/parse/properties/background.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_background(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error = CSS_OK;
@@ -45,31 +45,38 @@ css_error css__parse_background(css_language *c,
css_style * image_style;
css_style * position_style;
css_style * repeat_style;
-
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_ATTACHMENT);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_ATTACHMENT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_IMAGE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_IMAGE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_POSITION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_POSITION);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_REPEAT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_REPEAT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/background_position.c b/src/parse/properties/background_position.c
index 6932c05..1d87e6a 100644
--- a/src/parse/properties/background_position.c
+++ b/src/parse/properties/background_position.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_background_position(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
@@ -54,6 +54,24 @@ css_error css__parse_background_position(css_language *c,
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
flags = FLAG_INHERIT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
} else {
int i;
diff --git a/src/parse/properties/border.c b/src/parse/properties/border.c
index 26cdbcd..be269ab 100644
--- a/src/parse/properties/border.c
+++ b/src/parse/properties/border.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_TOP);
diff --git a/src/parse/properties/border_color.c b/src/parse/properties/border_color.c
index 28d30b7..60b401e 100644
--- a/src/parse/properties/border_color.c
+++ b/src/parse/properties/border_color.c
@@ -28,15 +28,16 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
uint16_t side_val[4];
uint32_t side_color[4];
uint32_t side_count = 0;
+ enum flag_value flag_value;
css_error error;
/* Firstly, handle inherit */
@@ -44,20 +45,26 @@ css_error css__parse_border_color(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_COLOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_COLOR);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/border_spacing.c b/src/parse/properties/border_spacing.c
index 2322a5a..e00fb27 100644
--- a/src/parse/properties/border_spacing.c
+++ b/src/parse/properties/border_spacing.c
@@ -28,15 +28,15 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_spacing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
css_fixed length[2] = { 0 };
uint32_t unit[2] = { 0 };
- bool match;
+ enum flag_value flag_value;
/* length length? | IDENT(inherit) */
token = parserutils_vector_peek(vector, *ctx);
@@ -45,16 +45,13 @@ css_error css__parse_border_spacing(css_language *c,
return CSS_INVALID;
}
- if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
parserutils_vector_iterate(vector, ctx);
/* inherit */
- error = css__stylesheet_style_appendOPV(result,
- CSS_PROP_BORDER_SPACING,
- FLAG_INHERIT,
- 0);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_SPACING);
} else {
int num_lengths = 0;
diff --git a/src/parse/properties/border_style.c b/src/parse/properties/border_style.c
index a0d264d..4d54900 100644
--- a/src/parse/properties/border_style.c
+++ b/src/parse/properties/border_style.c
@@ -28,36 +28,43 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
uint16_t side_val[4];
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_STYLE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_STYLE);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/border_width.c b/src/parse/properties/border_width.c
index bc911c9..b11ca05 100644
--- a/src/parse/properties/border_width.c
+++ b/src/parse/properties/border_width.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
uint16_t side_val[4];
@@ -40,26 +40,33 @@ css_error css__parse_border_width(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_WIDTH);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_WIDTH);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/clip.c b/src/parse/properties/clip.c
index 7862d4a..4bf653d 100644
--- a/src/parse/properties/clip.c
+++ b/src/parse/properties/clip.c
@@ -28,15 +28,16 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_clip(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
int num_lengths = 0;
css_fixed length[4] = { 0 };
uint32_t unit[4] = { 0 };
+ enum flag_value flag_value;
bool match;
/* FUNCTION(rect) [ [ IDENT(auto) | length ] CHAR(,)? ]{3}
@@ -48,14 +49,12 @@ css_error css__parse_clip(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css__stylesheet_style_appendOPV(result,
- CSS_PROP_CLIP,
- FLAG_INHERIT,
- 0);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result,
+ flag_value, CSS_PROP_CLIP);
+
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(
token->idata, c->strings[AUTO],
diff --git a/src/parse/properties/column_rule.c b/src/parse/properties/column_rule.c
index ba57565..7bfcad5 100644
--- a/src/parse/properties/column_rule.c
+++ b/src/parse/properties/column_rule.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_column_rule(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
@@ -41,26 +41,28 @@ css_error css__parse_column_rule(css_language *c,
css_style *color_style;
css_style *style_style;
css_style *width_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_WIDTH);
-
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/columns.c b/src/parse/properties/columns.c
index b245740..277a305 100644
--- a/src/parse/properties/columns.c
+++ b/src/parse/properties/columns.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_columns(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error = CSS_OK;
@@ -39,19 +39,22 @@ css_error css__parse_columns(css_language *c,
bool count = true;
css_style *width_style;
css_style *count_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_COUNT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/content.c b/src/parse/properties/content.c
index 10f221f..b32de22 100644
--- a/src/parse/properties/content.c
+++ b/src/parse/properties/content.c
@@ -29,12 +29,13 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_content(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* IDENT(normal, none, inherit) | [ ... ]+ */
@@ -44,12 +45,11 @@ css_error css__parse_content(css_language *c,
return CSS_INVALID;
}
+ flag_value = get_css_flag_value(c, token);
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_CONTENT);
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_CONTENT);
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata,
c->strings[NORMAL],
diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c
index 24cc536..3e1d997 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -106,7 +106,7 @@ void output_header(FILE *outputf, const char *descriptor, struct keyval *parser_
" * If the input is invalid, then \\a *ctx remains unchanged.\n"
" */\n"
"css_error css__parse_%s(css_language *c,\n"
- " const parserutils_vector *vector, int *ctx,\n"
+ " const parserutils_vector *vector, int32_t *ctx,\n"
" css_style *result%s)\n"
"{\n",
descriptor,
@@ -120,7 +120,7 @@ void output_header(FILE *outputf, const char *descriptor, struct keyval *parser_
void output_token_type_check(FILE *outputf, bool do_token_check, struct keyval_list *IDENT, struct keyval_list *URI, struct keyval_list *NUMBER)
{
fprintf(outputf,
- " int orig_ctx = *ctx;\n"
+ " int32_t orig_ctx = *ctx;\n"
" css_error error;\n"
" const css_token *token;\n"
" bool match;\n\n"
@@ -169,18 +169,38 @@ void output_ident(FILE *outputf, bool only_ident, struct keyval *parseid, struct
"if (");
if (!only_ident) {
fprintf(outputf,
- "(token->type == CSS_TOKEN_IDENT) && ");
+ "(token->type == CSS_TOKEN_IDENT) &&\n\t\t\t");
}
fprintf(outputf,
- "(lwc_string_caseless_isequal(token->idata, c->strings[%s], &match) == lwc_error_ok && match)) {\n",
+ "(lwc_string_caseless_isequal(\n"
+ "\t\t\ttoken->idata, c->strings[%s],\n"
+ "\t\t\t&match) == lwc_error_ok && match)) {\n",
ckv->key);
if (strcmp(ckv->key,"INHERIT") == 0) {
fprintf(outputf,
- "\t\t\terror = css_stylesheet_style_inherit(result, %s);\n",
+ "\t\terror = css_stylesheet_style_inherit(result,\n"
+ "\t\t\t\t%s);\n\n",
+ parseid->val);
+ } else if (strcmp(ckv->key,"INITIAL") == 0) {
+ fprintf(outputf,
+ "\t\terror = css_stylesheet_style_initial(result,\n"
+ "\t\t\t\t%s);\n\n",
+ parseid->val);
+ } else if (strcmp(ckv->key,"REVERT") == 0) {
+ fprintf(outputf,
+ "\t\terror = css_stylesheet_style_revert(result,\n"
+ "\t\t\t\t%s);\n\n",
+ parseid->val);
+ } else if (strcmp(ckv->key,"UNSET") == 0) {
+ fprintf(outputf,
+ "\t\terror = css_stylesheet_style_unset(result,\n"
+ "\t\t\t\t%s);\n\n",
parseid->val);
} else {
fprintf(outputf,
- "\t\t\terror = css__stylesheet_style_appendOPV(result, %s, %s);\n",
+ "\t\terror = css__stylesheet_style_appendOPV(result,\n"
+ "\t\t\t\t%s,\n"
+ "\t\t\t\t%s);\n\n",
parseid->val,
ckv->val);
}
@@ -466,10 +486,22 @@ void output_wrap(FILE *outputf, struct keyval *parseid, struct keyval_list *WRAP
}
char str_INHERIT[] = "INHERIT";
+char str_INITIAL[] = "INITIAL";
+char str_REVERT[] = "REVERT";
+char str_UNSET[] = "UNSET";
struct keyval ident_inherit = {
.key = str_INHERIT,
};
+struct keyval ident_initial = {
+ .key = str_INITIAL,
+};
+struct keyval ident_unset = {
+ .key = str_UNSET,
+};
+struct keyval ident_revert = {
+ .key = str_REVERT,
+};
int main(int argc, char **argv)
{
@@ -554,6 +586,12 @@ int main(int argc, char **argv)
curlist = &base;
} else if (strcmp(rkv->val, str_INHERIT) == 0) {
IDENT.item[IDENT.count++] = &ident_inherit;
+ } else if (strcmp(rkv->val, str_INITIAL) == 0) {
+ IDENT.item[IDENT.count++] = &ident_initial;
+ } else if (strcmp(rkv->val, str_REVERT) == 0) {
+ IDENT.item[IDENT.count++] = &ident_revert;
+ } else if (strcmp(rkv->val, str_UNSET) == 0) {
+ IDENT.item[IDENT.count++] = &ident_unset;
}
} else if (strcmp(rkv->key, "IDENT_LIST") == 0) {
if (rkv->val[0] == '(') {
diff --git a/src/parse/properties/cue.c b/src/parse/properties/cue.c
index eef10d1..db64412 100644
--- a/src/parse/properties/cue.c
+++ b/src/parse/properties/cue.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_cue(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *first_token;
const css_token *token;
@@ -57,15 +57,23 @@ css_error css__parse_cue(css_language *c,
error = css__parse_cue_after(c, vector, ctx, result);
} else {
/* second token - might be useful */
- if (is_css_inherit(c, token)) {
- /* another inherit which is bogus */
+ enum flag_value flag_value;
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* another generic property reset value
+ * which is bogus */
error = CSS_INVALID;
} else {
error = css__parse_cue_after(c, vector, ctx, result);
if (error == CSS_OK) {
/* second token parsed */
- if (is_css_inherit(c, first_token)) {
- /* valid second token after inherit */
+ flag_value = get_css_flag_value(c, first_token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* valid second token after
+ * generic property reset value */
error = CSS_INVALID;
}
} else {
diff --git a/src/parse/properties/cursor.c b/src/parse/properties/cursor.c
index ad3ac47..b61d9a9 100644
--- a/src/parse/properties/cursor.c
+++ b/src/parse/properties/cursor.c
@@ -27,12 +27,13 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_cursor(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* [ (URI ',')* IDENT(auto, crosshair, default, pointer, move, e-resize,
@@ -48,11 +49,11 @@ css_error css__parse_cursor(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_CURSOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_CURSOR);
} else {
bool first = true;
diff --git a/src/parse/properties/elevation.c b/src/parse/properties/elevation.c
index fea35a3..b456799 100644
--- a/src/parse/properties/elevation.c
+++ b/src/parse/properties/elevation.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_elevation(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
@@ -55,6 +55,24 @@ css_error css__parse_elevation(css_language *c,
flags = FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_IDENT &&
(lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
token->idata, c->strings[BELOW],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/fill_opacity.c b/src/parse/properties/fill_opacity.c
new file mode 100644
index 0000000..caed86f
--- /dev/null
+++ b/src/parse/properties/fill_opacity.c
@@ -0,0 +1,82 @@
+/*
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ */
+
+#include <assert.h>
+#include <string.h>
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+#include "parse/properties/properties.h"
+#include "parse/properties/utils.h"
+
+/**
+ * Parse fill-opacity
+ *
+ * \param c Parsing context
+ * \param vector Vector of tokens to process
+ * \param ctx Pointer to vector iteration context
+ * \param result resulting style
+ * \return CSS_OK on success,
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
+ *
+ * Post condition: \a *ctx is updated with the next token to process
+ * If the input is invalid, then \a *ctx remains unchanged.
+ */
+css_error css__parse_fill_opacity(css_language *c,
+ const parserutils_vector *vector, int32_t *ctx,
+ css_style *result)
+{
+ int32_t orig_ctx = *ctx;
+ css_error error;
+ const css_token *token;
+ enum flag_value flag_value;
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FILL_OPACITY);
+
+ } else if (token->type == CSS_TOKEN_NUMBER) {
+ css_fixed num = 0;
+ size_t consumed = 0;
+
+ num = css__number_from_lwc_string(token->idata, false, &consumed);
+ /* Invalid if there are trailing characters */
+ if (consumed != lwc_string_length(token->idata)) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ /* Clamp to range [0,1] */
+ if (num < 0)
+ num = 0;
+ if (num > INTTOFIX(1))
+ num = INTTOFIX(1);
+
+ error = css__stylesheet_style_appendOPV(result, CSS_PROP_FILL_OPACITY, 0, FILL_OPACITY_SET);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
+
+ error = css__stylesheet_style_append(result, num);
+ } else {
+ error = CSS_INVALID;
+ }
+
+ if (error != CSS_OK)
+ *ctx = orig_ctx;
+
+ return error;
+}
+
diff --git a/src/parse/properties/flex.c b/src/parse/properties/flex.c
index 9e284d9..a29309b 100644
--- a/src/parse/properties/flex.c
+++ b/src/parse/properties/flex.c
@@ -29,10 +29,10 @@
*/
css_error css__parse_flex(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
@@ -44,29 +44,30 @@ css_error css__parse_flex(css_language *c,
css_style *basis_style;
bool short_auto = false;
bool short_none = false;
+ enum flag_value flag_value;
bool match;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
-
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_GROW);
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_SHRINK);
-
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_BASIS);
-
- if (error == CSS_OK)
+ if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
return error;
diff --git a/src/parse/properties/flex_flow.c b/src/parse/properties/flex_flow.c
index e2d0e0c..a5e2926 100644
--- a/src/parse/properties/flex_flow.c
+++ b/src/parse/properties/flex_flow.c
@@ -29,10 +29,10 @@
*/
css_error css__parse_flex_flow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
@@ -40,26 +40,28 @@ css_error css__parse_flex_flow(css_language *c,
bool wrap = true;
css_style *direction_style;
css_style *wrap_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
-
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_DIRECTION);
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_WRAP);
-
- if (error == CSS_OK)
+ if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
return error;
- }
+ }
/* allocate styles */
error = css__stylesheet_style_create(c->sheet, &direction_style);
diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 9903f75..16a6cc4 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -13,6 +13,42 @@
#include "parse/properties/properties.h"
#include "parse/properties/utils.h"
+/**
+ * Convert css_unit to a bytecode unit.
+ */
+static inline uint32_t css__to_parse_unit(css_unit u)
+{
+ switch (u) {
+ case CSS_UNIT_PX: return UNIT_PX;
+ case CSS_UNIT_EX: return UNIT_EX;
+ case CSS_UNIT_EM: return UNIT_EM;
+ case CSS_UNIT_IN: return UNIT_IN;
+ case CSS_UNIT_CM: return UNIT_CM;
+ case CSS_UNIT_MM: return UNIT_MM;
+ case CSS_UNIT_PT: return UNIT_PT;
+ case CSS_UNIT_PC: return UNIT_PC;
+ case CSS_UNIT_CH: return UNIT_CH;
+ case CSS_UNIT_REM: return UNIT_REM;
+ case CSS_UNIT_LH: return UNIT_LH;
+ case CSS_UNIT_VH: return UNIT_VH;
+ case CSS_UNIT_VW: return UNIT_VW;
+ case CSS_UNIT_VI: return UNIT_VI;
+ case CSS_UNIT_VB: return UNIT_VB;
+ case CSS_UNIT_VMIN: return UNIT_VMIN;
+ case CSS_UNIT_VMAX: return UNIT_VMAX;
+ case CSS_UNIT_Q: return UNIT_Q;
+ case CSS_UNIT_PCT: return UNIT_PCT;
+ case CSS_UNIT_DEG: return UNIT_DEG;
+ case CSS_UNIT_GRAD: return UNIT_GRAD;
+ case CSS_UNIT_RAD: return UNIT_RAD;
+ case CSS_UNIT_MS: return UNIT_MS;
+ case CSS_UNIT_S: return UNIT_S;
+ case CSS_UNIT_HZ: return UNIT_HZ;
+ case CSS_UNIT_KHZ: return UNIT_KHZ;
+ }
+
+ return 0;
+}
static css_error parse_system_font(css_language *c,
css_style *result, css_system_font *system_font)
@@ -124,7 +160,9 @@ static css_error parse_system_font(css_language *c,
if (error != CSS_OK)
return error;
- error = css__stylesheet_style_vappend(result, 2, system_font->size.size, system_font->size.unit);
+ error = css__stylesheet_style_vappend(result, 2,
+ system_font->size.size,
+ css__to_parse_unit(system_font->size.unit));
if (error != CSS_OK)
return error;
@@ -133,7 +171,9 @@ static css_error parse_system_font(css_language *c,
if (error != CSS_OK)
return error;
- error = css__stylesheet_style_vappend(result, 2, system_font->line_height.size, system_font->line_height.unit);
+ error = css__stylesheet_style_vappend(result, 2,
+ system_font->line_height.size,
+ css__to_parse_unit(system_font->line_height.unit));
if (error != CSS_OK)
return error;
@@ -184,12 +224,12 @@ static css_error parse_system_font(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_font(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
const css_token *token;
css_error error;
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
css_system_font system_font;
@@ -203,6 +243,7 @@ css_error css__parse_font(css_language *c,
css_style *size_style;
css_style *line_height_style;
css_style *family_style;
+ enum flag_value flag_value;
int svw;
/* Firstly, handle inherit */
@@ -210,28 +251,36 @@ css_error css__parse_font(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_STYLE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_VARIANT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_VARIANT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_WEIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_WEIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_SIZE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_SIZE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LINE_HEIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LINE_HEIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_FAMILY);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
@@ -247,6 +296,9 @@ css_error css__parse_font(css_language *c,
error = parse_system_font(c, result, &system_font);
+ lwc_string_unref(system_font.family);
+ system_font.family = NULL;
+
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/font_family.c b/src/parse/properties/font_family.c
index 23c080b..2f8782e 100644
--- a/src/parse/properties/font_family.c
+++ b/src/parse/properties/font_family.c
@@ -99,10 +99,10 @@ static css_code_t font_family_value(css_language *c, const css_token *token, boo
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_font_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
bool match;
@@ -127,7 +127,30 @@ css_error css__parse_font_family(css_language *c,
(lwc_string_caseless_isequal(
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY);
+ error = css_stylesheet_style_inherit(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_initial(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_revert(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_unset(result,
+ CSS_PROP_FONT_FAMILY);
+
} else {
*ctx = orig_ctx;
diff --git a/src/parse/properties/font_weight.c b/src/parse/properties/font_weight.c
index 8e57e5f..77ec9a1 100644
--- a/src/parse/properties/font_weight.c
+++ b/src/parse/properties/font_weight.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_font_weight(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
@@ -47,10 +47,29 @@ css_error css__parse_font_weight(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(
+ if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_INITIAL;
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_REVERT;
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_UNSET;
+
} else if (token->type == CSS_TOKEN_NUMBER) {
size_t consumed = 0;
css_fixed num = css__number_from_lwc_string(token->idata,
diff --git a/src/parse/properties/list_style.c b/src/parse/properties/list_style.c
index b2c8de3..1cb373a 100644
--- a/src/parse/properties/list_style.c
+++ b/src/parse/properties/list_style.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_list_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
@@ -41,23 +41,28 @@ css_error css__parse_list_style(css_language *c,
css_style *image_style;
css_style *position_style;
css_style *type_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_IMAGE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_IMAGE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_POSITION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_POSITION);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_TYPE);
-
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_TYPE);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/list_style_type.c b/src/parse/properties/list_style_type.c
index ccaa133..eb7f363 100644
--- a/src/parse/properties/list_style_type.c
+++ b/src/parse/properties/list_style_type.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_list_style_type(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *ident;
uint8_t flags = 0;
@@ -49,10 +49,26 @@ css_error css__parse_list_style_type(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(
+ if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
ident->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_INITIAL;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_REVERT;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_UNSET;
} else {
error = css__parse_list_style_type_value(c, ident, &value);
if (error != CSS_OK) {
diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c
index 7817d50..1ee56f7 100644
--- a/src/parse/properties/margin.c
+++ b/src/parse/properties/margin.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_margin(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
uint16_t side_val[4];
@@ -40,26 +40,33 @@ css_error css__parse_margin(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_TOP);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_TOP);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_RIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_RIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_BOTTOM);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_BOTTOM);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_LEFT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_LEFT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
@@ -70,7 +77,9 @@ css_error css__parse_margin(css_language *c,
do {
prev_ctx = *ctx;
- if ((token != NULL) && is_css_inherit(c, token)) {
+ flag_value = get_css_flag_value(c, token);
+
+ if ((token != NULL) && flag_value != FLAG_VALUE__NONE) {
*ctx = orig_ctx;
return CSS_INVALID;
}
diff --git a/src/parse/properties/opacity.c b/src/parse/properties/opacity.c
index e8b7c3e..22acd76 100644
--- a/src/parse/properties/opacity.c
+++ b/src/parse/properties/opacity.c
@@ -27,13 +27,13 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_opacity(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
- bool match;
+ enum flag_value flag_value;
token = parserutils_vector_iterate(vector, ctx);
if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) {
@@ -41,8 +41,12 @@ css_error css__parse_opacity(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_OPACITY);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OPACITY);
+
} else if (token->type == CSS_TOKEN_NUMBER) {
css_fixed num = 0;
size_t consumed = 0;
diff --git a/src/parse/properties/outline.c b/src/parse/properties/outline.c
index 4d4fbf0..ac91ffd 100644
--- a/src/parse/properties/outline.c
+++ b/src/parse/properties/outline.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_outline(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
@@ -41,23 +41,28 @@ css_error css__parse_outline(css_language *c,
css_style *color_style;
css_style *style_style;
css_style *width_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_COLOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_WIDTH);
-
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_WIDTH);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/overflow.c b/src/parse/properties/overflow.c
index ca133ed..dbb373a 100644
--- a/src/parse/properties/overflow.c
+++ b/src/parse/properties/overflow.c
@@ -28,12 +28,13 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_overflow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error1, error2 = CSS_OK;
const css_token *token;
+ enum flag_value flag_value;
bool match;
token = parserutils_vector_iterate(vector, ctx);
@@ -42,12 +43,12 @@ css_error css__parse_overflow(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT], &match) == lwc_error_ok &&
- match)) {
- error1 = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error1 = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_OVERFLOW_X);
- error2 = css_stylesheet_style_inherit(result,
+ error2 = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_OVERFLOW_Y);
} else if ((lwc_string_caseless_isequal(token->idata,
diff --git a/src/parse/properties/padding.c b/src/parse/properties/padding.c
index 7f5b9f6..a87ffa5 100644
--- a/src/parse/properties/padding.c
+++ b/src/parse/properties/padding.c
@@ -28,15 +28,16 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_padding(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_fixed side_length[4];
uint32_t side_unit[4];
uint32_t side_count = 0;
+ enum flag_value flag_value;
css_error error;
/* Firstly, handle inherit */
@@ -44,20 +45,26 @@ css_error css__parse_padding(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_TOP);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_TOP);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_RIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_RIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_BOTTOM);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_BOTTOM);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_LEFT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_LEFT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/pause.c b/src/parse/properties/pause.c
index e45a8f4..e558337 100644
--- a/src/parse/properties/pause.c
+++ b/src/parse/properties/pause.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_pause(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *first_token;
const css_token *token;
@@ -57,15 +57,23 @@ css_error css__parse_pause(css_language *c,
error = css__parse_pause_after(c, vector, ctx, result);
} else {
/* second token - might be useful */
- if (is_css_inherit(c, token)) {
- /* another bogus inherit */
+ enum flag_value flag_value;
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* another generic property reset value
+ * which is bogus */
error = CSS_INVALID;
} else {
error = css__parse_pause_after(c, vector, ctx, result);
if (error == CSS_OK) {
/* second token parsed */
- if (is_css_inherit(c, first_token)) {
- /* valid second token after inherit */
+ flag_value = get_css_flag_value(c, first_token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* valid second token after
+ * generic property reset value */
error = CSS_INVALID;
}
} else {
diff --git a/src/parse/properties/play_during.c b/src/parse/properties/play_during.c
index 109ae64..da7f236 100644
--- a/src/parse/properties/play_during.c
+++ b/src/parse/properties/play_during.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_play_during(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
@@ -54,14 +54,32 @@ css_error css__parse_play_during(css_language *c,
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_INITIAL;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_REVERT;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_UNSET;
+
} else if ((lwc_string_caseless_isequal(
token->idata, c->strings[NONE],
&match) == lwc_error_ok && match)) {
value = PLAY_DURING_NONE;
+
} else if ((lwc_string_caseless_isequal(
token->idata, c->strings[AUTO],
&match) == lwc_error_ok && match)) {
value = PLAY_DURING_AUTO;
+
} else {
*ctx = orig_ctx;
return CSS_INVALID;
diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c
index 06524da..2cc849c 100644
--- a/src/parse/properties/properties.c
+++ b/src/parse/properties/properties.c
@@ -74,6 +74,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
css__parse_display,
css__parse_elevation,
css__parse_empty_cells,
+ css__parse_fill_opacity,
css__parse_flex,
css__parse_flex_basis,
css__parse_flex_direction,
@@ -140,6 +141,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
css__parse_speak,
css__parse_speech_rate,
css__parse_stress,
+ css__parse_stroke_opacity,
css__parse_table_layout,
css__parse_text_align,
css__parse_text_decoration,
@@ -261,6 +263,8 @@ const uint32_t property_unit_mask[CSS_N_PROPERTIES] = {
[CSS_PROP_WORD_SPACING] = UNIT_MASK_WORD_SPACING,
[CSS_PROP_Z_INDEX] = UNIT_MASK_Z_INDEX,
[CSS_PROP_OPACITY] = UNIT_MASK_OPACITY,
+ [CSS_PROP_FILL_OPACITY] = UNIT_MASK_FILL_OPACITY,
+ [CSS_PROP_STROKE_OPACITY] = UNIT_MASK_STROKE_OPACITY,
[CSS_PROP_BREAK_AFTER] = UNIT_MASK_BREAK_AFTER,
[CSS_PROP_BREAK_BEFORE] = UNIT_MASK_BREAK_BEFORE,
[CSS_PROP_BREAK_INSIDE] = UNIT_MASK_BREAK_INSIDE,
diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen
index e729285..b0e797c 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -1,56 +1,56 @@
##Common templates
#
-#property:CSS_PROP_ENUM IDENT:( INHERIT: IDENT:)
-#property:CSS_PROP_ENUM IDENT:INHERIT NUMBER:( false: RANGE: NUMBER:)
-#property:CSS_PROP_ENUM IDENT:INHERIT LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
-#property:CSS_PROP_ENUM IDENT:( INHERIT: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false: RANGE: NUMBER:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
#property:CSS_PROP_ENUM WRAP:
-background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:)
+background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:)
-border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE IDENT:)
+border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: INITIAL: REVERT: UNSET: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE IDENT:)
-cue_after:CSS_PROP_CUE_AFTER IDENT:( INHERIT: NONE:0,CUE_AFTER_NONE IDENT:) URI:CUE_AFTER_URI
+cue_after:CSS_PROP_CUE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,CUE_AFTER_NONE IDENT:) URI:CUE_AFTER_URI
-cue_before:CSS_PROP_CUE_BEFORE IDENT:( INHERIT: NONE:0,CUE_BEFORE_NONE IDENT:) URI:CUE_BEFORE_URI
+cue_before:CSS_PROP_CUE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,CUE_BEFORE_NONE IDENT:) URI:CUE_BEFORE_URI
-direction:CSS_PROP_DIRECTION IDENT:( INHERIT: LTR:0,DIRECTION_LTR RTL:0,DIRECTION_RTL IDENT:)
+direction:CSS_PROP_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LTR:0,DIRECTION_LTR RTL:0,DIRECTION_RTL IDENT:)
-display:CSS_PROP_DISPLAY IDENT:( INHERIT: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE FLEX:0,DISPLAY_FLEX INLINE_FLEX:0,DISPLAY_INLINE_FLEX IDENT:)
+display:CSS_PROP_DISPLAY IDENT:( INHERIT: INITIAL: REVERT: UNSET: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE FLEX:0,DISPLAY_FLEX INLINE_FLEX:0,DISPLAY_INLINE_FLEX GRID:0,DISPLAY_GRID INLINE_GRID:0,DISPLAY_INLINE_GRID IDENT:)
-empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: SHOW:0,EMPTY_CELLS_SHOW HIDE:0,EMPTY_CELLS_HIDE IDENT:)
+empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: INITIAL: REVERT: UNSET: SHOW:0,EMPTY_CELLS_SHOW HIDE:0,EMPTY_CELLS_HIDE IDENT:)
-float:CSS_PROP_FLOAT IDENT:( INHERIT: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:)
+float:CSS_PROP_FLOAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:)
-font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:)
+font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: INITIAL: REVERT: UNSET: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:)
-font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:)
+font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:)
-font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:)
+font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:)
-height:CSS_PROP_HEIGHT IDENT:( INHERIT: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:)
+height:CSS_PROP_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:)
-letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:)
+letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:)
-line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:)
+line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:)
border_top:BORDER_SIDE_TOP WRAP:css__parse_border_side
border_bottom:BORDER_SIDE_BOTTOM WRAP:css__parse_border_side
border_left:BORDER_SIDE_LEFT WRAP:css__parse_border_side
border_right:BORDER_SIDE_RIGHT WRAP:css__parse_border_side
-max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:)
+max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:)
-max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:)
+max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:)
-min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:)
+min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:)
-min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:)
+min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:)
-color:CSS_PROP_COLOR IDENT:INHERIT COLOR:COLOR_SET
+color:CSS_PROP_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLOR_SET
#generic for padding_{top, bottom, left, right}.c
-padding_side:op GENERIC: IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:)
+padding_side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:)
padding_bottom:CSS_PROP_PADDING_BOTTOM WRAP:css__parse_padding_side
padding_left:CSS_PROP_PADDING_LEFT WRAP:css__parse_padding_side
@@ -59,7 +59,7 @@ padding_right:CSS_PROP_PADDING_RIGHT WRAP:css__parse_padding_side
#generic for margin_{top, bottom, left, right}.c
-margin_side:op GENERIC IDENT:( INHERIT: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:)
+margin_side:op GENERIC IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:)
margin_top:CSS_PROP_MARGIN_TOP WRAP:css__parse_margin_side
margin_bottom:CSS_PROP_MARGIN_BOTTOM WRAP:css__parse_margin_side
@@ -67,7 +67,7 @@ margin_left:CSS_PROP_MARGIN_LEFT WRAP:css__parse_margin_side
margin_right:CSS_PROP_MARGIN_RIGHT WRAP:css__parse_margin_side
#generic for {top, bottom, left, right}.c
-side:op GENERIC: IDENT:( INHERIT: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
+side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
top:CSS_PROP_TOP WRAP:css__parse_side
bottom:CSS_PROP_BOTTOM WRAP:css__parse_side
@@ -76,7 +76,7 @@ right:CSS_PROP_RIGHT WRAP:css__parse_side
#generic for border_{top, bottom, left, right}_width.c
-border_side_width:op GENERIC: IDENT:( INHERIT: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:)
+border_side_width:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:)
border_top_width:CSS_PROP_BORDER_TOP_WIDTH WRAP:css__parse_border_side_width
border_bottom_width:CSS_PROP_BORDER_BOTTOM_WIDTH WRAP:css__parse_border_side_width
@@ -85,7 +85,7 @@ border_right_width:CSS_PROP_BORDER_RIGHT_WIDTH WRAP:css__parse_border_side_width
#generic for border_{top, bottom, left, right}_style.c
-border_side_style:op GENERIC: IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
+border_side_style:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
border_top_style:CSS_PROP_BORDER_TOP_STYLE WRAP:css__parse_border_side_style
border_bottom_style:CSS_PROP_BORDER_BOTTOM_STYLE WRAP:css__parse_border_side_style
@@ -93,7 +93,7 @@ border_left_style:CSS_PROP_BORDER_LEFT_STYLE WRAP:css__parse_border_side_style
border_right_style:CSS_PROP_BORDER_RIGHT_STYLE WRAP:css__parse_border_side_style
#generic for border_{top, bottom, left, right}_color.c
-border_side_color:op GENERIC: IDENT:( INHERIT: IDENT:) COLOR:BORDER_COLOR_SET
+border_side_color:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:BORDER_COLOR_SET
border_top_color:CSS_PROP_BORDER_TOP_COLOR WRAP:css__parse_border_side_color
border_bottom_color:CSS_PROP_BORDER_BOTTOM_COLOR WRAP:css__parse_border_side_color
@@ -101,139 +101,139 @@ border_left_color:CSS_PROP_BORDER_LEFT_COLOR WRAP:css__parse_border_side_color
border_right_color:CSS_PROP_BORDER_RIGHT_COLOR WRAP:css__parse_border_side_color
-counter_increment:CSS_PROP_COUNTER_INCREMENT IDENT:( INHERIT: NONE:0,COUNTER_INCREMENT_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_INCREMENT_NAMED 1:COUNTER_INCREMENT_NONE IDENT_LIST:)
+counter_increment:CSS_PROP_COUNTER_INCREMENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COUNTER_INCREMENT_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_INCREMENT_NAMED 1:COUNTER_INCREMENT_NONE IDENT_LIST:)
-counter_reset:CSS_PROP_COUNTER_RESET IDENT:( INHERIT: NONE:0,COUNTER_RESET_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_RESET_NAMED 0:COUNTER_RESET_NONE IDENT_LIST:)
+counter_reset:CSS_PROP_COUNTER_RESET IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COUNTER_RESET_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_RESET_NAMED 0:COUNTER_RESET_NONE IDENT_LIST:)
-background_attachment:CSS_PROP_BACKGROUND_ATTACHMENT IDENT:( INHERIT: FIXED:0,BACKGROUND_ATTACHMENT_FIXED SCROLL:0,BACKGROUND_ATTACHMENT_SCROLL IDENT:)
+background_attachment:CSS_PROP_BACKGROUND_ATTACHMENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: FIXED:0,BACKGROUND_ATTACHMENT_FIXED SCROLL:0,BACKGROUND_ATTACHMENT_SCROLL IDENT:)
-background_color:CSS_PROP_BACKGROUND_COLOR IDENT:( INHERIT: IDENT:) COLOR:BACKGROUND_COLOR_SET
+background_color:CSS_PROP_BACKGROUND_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:BACKGROUND_COLOR_SET
-caption_side:CSS_PROP_CAPTION_SIDE IDENT:( INHERIT: TOP:0,CAPTION_SIDE_TOP BOTTOM:0,CAPTION_SIDE_BOTTOM IDENT:)
+caption_side:CSS_PROP_CAPTION_SIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: TOP:0,CAPTION_SIDE_TOP BOTTOM:0,CAPTION_SIDE_BOTTOM IDENT:)
-clear:CSS_PROP_CLEAR IDENT:( INHERIT: RIGHT:0,CLEAR_RIGHT LEFT:0,CLEAR_LEFT BOTH:0,CLEAR_BOTH NONE:0,CLEAR_NONE IDENT:)
+clear:CSS_PROP_CLEAR IDENT:( INHERIT: INITIAL: REVERT: UNSET: RIGHT:0,CLEAR_RIGHT LEFT:0,CLEAR_LEFT BOTH:0,CLEAR_BOTH NONE:0,CLEAR_NONE IDENT:)
-background_image:CSS_PROP_BACKGROUND_IMAGE IDENT:( INHERIT: NONE:0,BACKGROUND_IMAGE_NONE IDENT:) URI:BACKGROUND_IMAGE_URI
+background_image:CSS_PROP_BACKGROUND_IMAGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BACKGROUND_IMAGE_NONE IDENT:) URI:BACKGROUND_IMAGE_URI
-list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: NONE:0,LIST_STYLE_IMAGE_NONE IDENT:) URI:LIST_STYLE_IMAGE_URI
+list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,LIST_STYLE_IMAGE_NONE IDENT:) URI:LIST_STYLE_IMAGE_URI
-list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:)
+list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:)
-orphans:CSS_PROP_ORPHANS IDENT:INHERIT NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:)
+orphans:CSS_PROP_ORPHANS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:)
-outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET
+outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET
-outline_style:CSS_PROP_OUTLINE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
+outline_style:CSS_PROP_OUTLINE_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BORDER_STYLE_NONE DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
outline_width:CSS_PROP_OUTLINE_WIDTH WRAP:css__parse_border_side_width
-overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
+overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
-overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
+overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
-page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:)
+page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:)
-page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:)
+page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:)
-page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:)
+page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:)
-pause_after:CSS_PROP_PAUSE_AFTER IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:)
+pause_after:CSS_PROP_PAUSE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:)
-pause_before:CSS_PROP_PAUSE_BEFORE IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:)
+pause_before:CSS_PROP_PAUSE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:)
-pitch:CSS_PROP_PITCH IDENT:( INHERIT: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:)
+pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:)
-pitch_range:CSS_PROP_PITCH_RANGE IDENT:INHERIT NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:)
+pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:)
-position:CSS_PROP_POSITION IDENT:( INHERIT: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED IDENT:)
+position:CSS_PROP_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED STICKY:0,POSITION_STICKY IDENT:)
-richness:CSS_PROP_RICHNESS IDENT:INHERIT NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:)
+richness:CSS_PROP_RICHNESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:)
-speak:CSS_PROP_SPEAK IDENT:( INHERIT: NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:)
+speak:CSS_PROP_SPEAK IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:)
-speak_header:CSS_PROP_SPEAK_HEADER IDENT:( INHERIT: ONCE:0,SPEAK_HEADER_ONCE ALWAYS:0,SPEAK_HEADER_ALWAYS IDENT:)
+speak_header:CSS_PROP_SPEAK_HEADER IDENT:( INHERIT: INITIAL: REVERT: UNSET: ONCE:0,SPEAK_HEADER_ONCE ALWAYS:0,SPEAK_HEADER_ALWAYS IDENT:)
-speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: DIGITS:0,SPEAK_NUMERAL_DIGITS CONTINUOUS:0,SPEAK_NUMERAL_CONTINUOUS IDENT:)
+speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: INITIAL: REVERT: UNSET: DIGITS:0,SPEAK_NUMERAL_DIGITS CONTINUOUS:0,SPEAK_NUMERAL_CONTINUOUS IDENT:)
-speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:)
+speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: INITIAL: REVERT: UNSET: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:)
-speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:)
+speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:)
-stress:CSS_PROP_STRESS IDENT:INHERIT NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:)
+stress:CSS_PROP_STRESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:)
-table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:)
+table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:)
-text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:)
+text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:)
-text_indent:CSS_PROP_TEXT_INDENT IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:)
+text_indent:CSS_PROP_TEXT_INDENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:)
-text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:)
+text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: INITIAL: REVERT: UNSET: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:)
-unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:)
+unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:)
-vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:)
+vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:)
-visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:)
+visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:)
-volume:CSS_PROP_VOLUME IDENT:( INHERIT: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:)
+volume:CSS_PROP_VOLUME IDENT:( INHERIT: INITIAL: REVERT: UNSET: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:)
-white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:)
+white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:)
-widows:CSS_PROP_WIDOWS IDENT:INHERIT NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:)
+widows:CSS_PROP_WIDOWS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:)
-width:CSS_PROP_WIDTH IDENT:( INHERIT: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:)
+width:CSS_PROP_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:)
-word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:)
+word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:)
-z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:)
+z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:)
-break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:)
+break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:)
-break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,BREAK_BEFORE_AUTO ALWAYS:0,BREAK_BEFORE_ALWAYS AVOID:0,BREAK_BEFORE_AVOID LEFT:0,BREAK_BEFORE_LEFT RIGHT:0,BREAK_BEFORE_RIGHT PAGE:0,BREAK_BEFORE_PAGE COLUMN:0,BREAK_BEFORE_COLUMN AVOID_PAGE:0,BREAK_BEFORE_AVOID_PAGE AVOID_COLUMN:0,BREAK_BEFORE_AVOID_COLUMN IDENT:)
+break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_BEFORE_AUTO ALWAYS:0,BREAK_BEFORE_ALWAYS AVOID:0,BREAK_BEFORE_AVOID LEFT:0,BREAK_BEFORE_LEFT RIGHT:0,BREAK_BEFORE_RIGHT PAGE:0,BREAK_BEFORE_PAGE COLUMN:0,BREAK_BEFORE_COLUMN AVOID_PAGE:0,BREAK_BEFORE_AVOID_PAGE AVOID_COLUMN:0,BREAK_BEFORE_AVOID_COLUMN IDENT:)
-break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:)
+break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:)
-column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:)
+column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:)
-column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:)
+column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: INITIAL: REVERT: UNSET: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:)
-column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:)
+column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:)
-column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: IDENT:) COLOR:COLUMN_RULE_COLOR_SET
+column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLUMN_RULE_COLOR_SET
-column_rule_style:CSS_PROP_COLUMN_RULE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
+column_rule_style:CSS_PROP_COLUMN_RULE_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
column_rule_width:CSS_PROP_COLUMN_RULE_WIDTH WRAP:css__parse_border_side_width
-column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:)
+column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:)
-column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:)
+column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH 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:)
+writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: INITIAL: REVERT: UNSET: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:)
-box_sizing:CSS_PROP_BOX_SIZING IDENT:( INHERIT: CONTENT_BOX:0,BOX_SIZING_CONTENT_BOX BORDER_BOX:0,BOX_SIZING_BORDER_BOX IDENT:)
+box_sizing:CSS_PROP_BOX_SIZING IDENT:( INHERIT: INITIAL: REVERT: UNSET: CONTENT_BOX:0,BOX_SIZING_CONTENT_BOX BORDER_BOX:0,BOX_SIZING_BORDER_BOX IDENT:)
-align_content:CSS_PROP_ALIGN_CONTENT IDENT:( INHERIT: STRETCH:0,ALIGN_CONTENT_STRETCH FLEX_START:0,ALIGN_CONTENT_FLEX_START FLEX_END:0,ALIGN_CONTENT_FLEX_END CENTER:0,ALIGN_CONTENT_CENTER SPACE_BETWEEN:0,ALIGN_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,ALIGN_CONTENT_SPACE_AROUND SPACE_EVENLY:0,ALIGN_CONTENT_SPACE_EVENLY IDENT:)
+align_content:CSS_PROP_ALIGN_CONTENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_CONTENT_STRETCH FLEX_START:0,ALIGN_CONTENT_FLEX_START FLEX_END:0,ALIGN_CONTENT_FLEX_END CENTER:0,ALIGN_CONTENT_CENTER SPACE_BETWEEN:0,ALIGN_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,ALIGN_CONTENT_SPACE_AROUND SPACE_EVENLY:0,ALIGN_CONTENT_SPACE_EVENLY IDENT:)
-align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: STRETCH:0,ALIGN_ITEMS_STRETCH FLEX_START:0,ALIGN_ITEMS_FLEX_START FLEX_END:0,ALIGN_ITEMS_FLEX_END CENTER:0,ALIGN_ITEMS_CENTER BASELINE:0,ALIGN_ITEMS_BASELINE IDENT:)
+align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_ITEMS_STRETCH FLEX_START:0,ALIGN_ITEMS_FLEX_START FLEX_END:0,ALIGN_ITEMS_FLEX_END CENTER:0,ALIGN_ITEMS_CENTER BASELINE:0,ALIGN_ITEMS_BASELINE IDENT:)
-align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:)
+align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:)
-flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:)
+flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:)
-flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE IDENT:)
+flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: UNSET: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE IDENT:)
-flex_grow:CSS_PROP_FLEX_GROW IDENT:INHERIT NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:)
+flex_grow:CSS_PROP_FLEX_GROW IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:)
-flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:INHERIT NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
+flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
-flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: NOWRAP:0,FLEX_WRAP_NOWRAP WRAP_STRING:0,FLEX_WRAP_WRAP WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:)
+flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NOWRAP:0,FLEX_WRAP_NOWRAP WRAP_STRING:0,FLEX_WRAP_WRAP WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:)
-justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: FLEX_START:0,JUSTIFY_CONTENT_FLEX_START FLEX_END:0,JUSTIFY_CONTENT_FLEX_END CENTER:0,JUSTIFY_CONTENT_CENTER SPACE_BETWEEN:0,JUSTIFY_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,JUSTIFY_CONTENT_SPACE_AROUND SPACE_EVENLY:0,JUSTIFY_CONTENT_SPACE_EVENLY IDENT:)
+justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: FLEX_START:0,JUSTIFY_CONTENT_FLEX_START FLEX_END:0,JUSTIFY_CONTENT_FLEX_END CENTER:0,JUSTIFY_CONTENT_CENTER SPACE_BETWEEN:0,JUSTIFY_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,JUSTIFY_CONTENT_SPACE_AROUND SPACE_EVENLY:0,JUSTIFY_CONTENT_SPACE_EVENLY IDENT:)
-order:CSS_PROP_ORDER IDENT:INHERIT NUMBER:( true:ORDER_SET NUMBER:)
+order:CSS_PROP_ORDER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORDER_SET NUMBER:)
diff --git a/src/parse/properties/properties.h b/src/parse/properties/properties.h
index 1e7f821..17b7f41 100644
--- a/src/parse/properties/properties.h
+++ b/src/parse/properties/properties.h
@@ -17,445 +17,451 @@
* Type of property handler function
*/
typedef css_error (*css_prop_handler)(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
extern const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP];
css_error css__parse_align_content(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_align_items(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_align_self(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_azimuth(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_attachment(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_image(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_position(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_repeat(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_bottom(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_bottom_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_bottom_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_bottom_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_collapse(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_left(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_left_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_left_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_left_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_right(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_right_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_right_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_right_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_spacing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_top(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_top_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_top_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_top_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_bottom(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_box_sizing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_break_after(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_break_before(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_break_inside(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_caption_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_clear(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_clip(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_columns(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_count(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_fill(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_gap(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_rule(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_rule_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_rule_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_rule_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_span(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_content(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_counter_increment(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_counter_reset(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_cue(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_cue_after(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_cue_before(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_cursor(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_direction(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_display(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_elevation(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_empty_cells(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
+ css_style *result);
+css_error css__parse_fill_opacity(css_language *c,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_basis(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_direction(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_flow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_grow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_shrink(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_wrap(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_float(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_size(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_variant(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_weight(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_height(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_justify_content(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_left(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_letter_spacing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_line_height(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_list_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_list_style_image(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_list_style_position(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_list_style_type(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin_bottom(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin_left(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin_right(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin_top(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_max_height(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_max_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_min_height(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_min_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_opacity(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_order(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_orphans(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_outline(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_outline_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_outline_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_outline_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_overflow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_overflow_x(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_overflow_y(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding_bottom(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding_left(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding_right(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding_top(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_page_break_after(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_page_break_before(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_page_break_inside(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pause(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pause_after(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pause_before(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pitch_range(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pitch(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_play_during(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_position(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_quotes(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_richness(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_right(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speak_header(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speak_numeral(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speak_punctuation(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speak(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speech_rate(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_stress(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
+ css_style *result);
+css_error css__parse_stroke_opacity(css_language *c,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_table_layout(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_text_align(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_text_decoration(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_text_indent(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_text_transform(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_top(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_unicode_bidi(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_vertical_align(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_visibility(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_voice_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_volume(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_white_space(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_widows(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_word_spacing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_writing_mode(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_z_index(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
/** Mapping from property bytecode index to bytecode unit class mask. */
@@ -546,6 +552,8 @@ extern const uint32_t property_unit_mask[CSS_N_PROPERTIES];
#define UNIT_MASK_WORD_SPACING (UNIT_LENGTH)
#define UNIT_MASK_Z_INDEX (0)
#define UNIT_MASK_OPACITY (0)
+#define UNIT_MASK_FILL_OPACITY (0)
+#define UNIT_MASK_STROKE_OPACITY (0)
#define UNIT_MASK_BREAK_AFTER (0)
#define UNIT_MASK_BREAK_BEFORE (0)
#define UNIT_MASK_BREAK_INSIDE (0)
diff --git a/src/parse/properties/quotes.c b/src/parse/properties/quotes.c
index 9d3c4c9..f5360a4 100644
--- a/src/parse/properties/quotes.c
+++ b/src/parse/properties/quotes.c
@@ -28,12 +28,13 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_quotes(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* [ STRING STRING ]+ | IDENT(none,inherit) */
@@ -45,11 +46,12 @@ css_error css__parse_quotes(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_QUOTES);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_QUOTES);
+
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata,
c->strings[NONE],
diff --git a/src/parse/properties/stroke_opacity.c b/src/parse/properties/stroke_opacity.c
new file mode 100644
index 0000000..7c10998
--- /dev/null
+++ b/src/parse/properties/stroke_opacity.c
@@ -0,0 +1,82 @@
+/*
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ */
+
+#include <assert.h>
+#include <string.h>
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+#include "parse/properties/properties.h"
+#include "parse/properties/utils.h"
+
+/**
+ * Parse stroke-opacity
+ *
+ * \param c Parsing context
+ * \param vector Vector of tokens to process
+ * \param ctx Pointer to vector iteration context
+ * \param result resulting style
+ * \return CSS_OK on success,
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
+ *
+ * Post condition: \a *ctx is updated with the next token to process
+ * If the input is invalid, then \a *ctx remains unchanged.
+ */
+css_error css__parse_stroke_opacity(css_language *c,
+ const parserutils_vector *vector, int32_t *ctx,
+ css_style *result)
+{
+ int32_t orig_ctx = *ctx;
+ css_error error;
+ const css_token *token;
+ enum flag_value flag_value;
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_STROKE_OPACITY);
+
+ } else if (token->type == CSS_TOKEN_NUMBER) {
+ css_fixed num = 0;
+ size_t consumed = 0;
+
+ num = css__number_from_lwc_string(token->idata, false, &consumed);
+ /* Invalid if there are trailing characters */
+ if (consumed != lwc_string_length(token->idata)) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ /* Clamp to range [0,1] */
+ if (num < 0)
+ num = 0;
+ if (num > INTTOFIX(1))
+ num = INTTOFIX(1);
+
+ error = css__stylesheet_style_appendOPV(result, CSS_PROP_STROKE_OPACITY, 0, STROKE_OPACITY_SET);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
+
+ error = css__stylesheet_style_append(result, num);
+ } else {
+ error = CSS_INVALID;
+ }
+
+ if (error != CSS_OK)
+ *ctx = orig_ctx;
+
+ return error;
+}
+
diff --git a/src/parse/properties/text_decoration.c b/src/parse/properties/text_decoration.c
index a7bae24..4849a12 100644
--- a/src/parse/properties/text_decoration.c
+++ b/src/parse/properties/text_decoration.c
@@ -28,12 +28,13 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_text_decoration(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* IDENT([ underline || overline || line-through || blink ])
@@ -44,10 +45,14 @@ css_error css__parse_text_decoration(css_language *c,
return CSS_INVALID;
}
+ flag_value = get_css_flag_value(c, token);
+
if (lwc_string_caseless_isequal(token->idata,
c->strings[INHERIT],
&match) == lwc_error_ok && match) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_TEXT_DECORATION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_TEXT_DECORATION);
+
} else if (lwc_string_caseless_isequal(token->idata,
c->strings[NONE],
&match) == lwc_error_ok && match) {
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index c82c88f..e6ab872 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -34,7 +34,7 @@ css_error css__parse_list_style_type_value(css_language *c, const css_token *ide
* upper-latin, armenian, georgian, lower-alpha, upper-alpha,
* none)
*/
- #define MAP_ENTRIES 47
+ #define MAP_ENTRIES 52
bool match;
int midx;
const struct {
@@ -87,7 +87,12 @@ css_error css__parse_list_style_type_value(css_language *c, const css_token *ide
{ HIAGANA, LIST_STYLE_TYPE_HIAGANA },
{ HIAGANA_IROHA, LIST_STYLE_TYPE_HIAGANA_IROHA },
{ KATAKANA, LIST_STYLE_TYPE_KATAKANA },
- { KATAKANA_IROHA, LIST_STYLE_TYPE_KATAKANA_IROHA }
+ { KATAKANA_IROHA, LIST_STYLE_TYPE_KATAKANA_IROHA },
+ { JAPANESE_INFORMAL, LIST_STYLE_TYPE_JAPANESE_INFORMAL },
+ { JAPANESE_FORMAL, LIST_STYLE_TYPE_JAPANESE_FORMAL },
+ { KOREAN_HANGUL_FORMAL, LIST_STYLE_TYPE_KOREAN_HANGUL_FORMAL },
+ { KOREAN_HANJA_INFORMAL, LIST_STYLE_TYPE_KOREAN_HANJA_INFORMAL },
+ { KOREAN_HANJA_FORMAL, LIST_STYLE_TYPE_KOREAN_HANJA_FORMAL }
};
for (midx = 0; midx < MAP_ENTRIES; midx++) {
@@ -121,10 +126,10 @@ css_error css__parse_list_style_type_value(css_language *c, const css_token *ide
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum border_side_e side)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error = CSS_OK;
@@ -361,10 +366,10 @@ static void HSL_to_RGB(css_fixed hue, css_fixed sat, css_fixed lit, uint8_t *r,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_colour_specifier(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint16_t *value, uint32_t *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
const css_token *token;
bool match;
css_error error;
@@ -908,11 +913,11 @@ css_error css__parse_hash_colour(lwc_string *data, uint32_t *result)
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_unit_specifier(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint32_t default_unit,
css_fixed *length, uint32_t *unit)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
const css_token *token;
css_fixed num;
size_t consumed = 0;
@@ -933,7 +938,7 @@ css_error css__parse_unit_specifier(css_language *c,
if (token->type == CSS_TOKEN_DIMENSION) {
size_t len = lwc_string_length(token->idata);
const char *data = lwc_string_data(token->idata);
- css_unit temp_unit = CSS_UNIT_PX;
+ uint32_t temp_unit = CSS_UNIT_PX;
error = css__parse_unit_keyword(data + consumed, len - consumed,
&temp_unit);
@@ -942,7 +947,7 @@ css_error css__parse_unit_specifier(css_language *c,
return error;
}
- *unit = (uint32_t) temp_unit;
+ *unit = temp_unit;
} else if (token->type == CSS_TOKEN_NUMBER) {
/* Non-zero values are permitted in quirks mode */
if (num != 0) {
@@ -961,8 +966,8 @@ css_error css__parse_unit_specifier(css_language *c,
* dimensions separated from their units by whitespace
* (e.g. "0 px")
*/
- int temp_ctx = *ctx;
- css_unit temp_unit;
+ int32_t temp_ctx = *ctx;
+ uint32_t temp_unit;
consumeWhitespace(vector, &temp_ctx);
@@ -976,7 +981,7 @@ css_error css__parse_unit_specifier(css_language *c,
if (error == CSS_OK) {
c->sheet->quirks_used = true;
*ctx = temp_ctx;
- *unit = (uint32_t) temp_unit;
+ *unit = temp_unit;
}
}
}
@@ -1027,12 +1032,8 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit)
*unit = UNIT_DEG;
else if (strncasecmp(ptr, "rad", 3) == 0)
*unit = UNIT_RAD;
- else if (strncasecmp(ptr, "cap", 3) == 0)
- *unit = UNIT_CAP;
else if (strncasecmp(ptr, "rem", 3) == 0)
*unit = UNIT_REM;
- else if (strncasecmp(ptr, "rlh", 3) == 0)
- *unit = UNIT_RLH;
else if (strncasecmp(ptr, "dpi", 3) == 0)
*unit = UNIT_DPI;
else
@@ -1060,8 +1061,6 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit)
*unit = UNIT_PC;
else if (strncasecmp(ptr, "ch", 2) == 0)
*unit = UNIT_CH;
- else if (strncasecmp(ptr, "ic", 2) == 0)
- *unit = UNIT_IC;
else if (strncasecmp(ptr, "lh", 2) == 0)
*unit = UNIT_LH;
else if (strncasecmp(ptr, "vh", 2) == 0)
@@ -1104,7 +1103,7 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit)
* The resulting string's reference is passed to the caller
*/
css_error css__ident_list_or_string_to_string(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
lwc_string **result)
{
@@ -1142,11 +1141,11 @@ css_error css__ident_list_or_string_to_string(css_language *c,
* The resulting string's reference is passed to the caller
*/
css_error css__ident_list_to_string(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
lwc_string **result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
const css_token *token;
css_error error = CSS_OK;
parserutils_buffer *buffer;
@@ -1230,12 +1229,12 @@ cleanup:
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__comma_list_to_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
css_code_t (*get_value)(css_language *c, const css_token *token, bool first),
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx = orig_ctx;
const css_token *token;
bool first = true;
diff --git a/src/parse/properties/utils.h b/src/parse/properties/utils.h
index e4c97c7..aab14e8 100644
--- a/src/parse/properties/utils.h
+++ b/src/parse/properties/utils.h
@@ -19,6 +19,35 @@ static inline bool is_css_inherit(css_language *c, const css_token *token)
&match) == lwc_error_ok && match));
}
+static inline enum flag_value get_css_flag_value(
+ css_language *c,
+ const css_token *token)
+{
+ if (token->type == CSS_TOKEN_IDENT) {
+ bool match;
+
+ if (lwc_string_caseless_isequal(
+ token->idata, c->strings[INHERIT],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_INHERIT;
+ } else if (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_INITIAL;
+ } else if (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_REVERT;
+ } else if (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_UNSET;
+ }
+ }
+
+ return FLAG_VALUE__NONE;
+}
+
enum border_side_e { BORDER_SIDE_TOP = 0, BORDER_SIDE_RIGHT = 1, BORDER_SIDE_BOTTOM = 2, BORDER_SIDE_LEFT = 3 };
/**
@@ -37,7 +66,7 @@ enum border_side_e { BORDER_SIDE_TOP = 0, BORDER_SIDE_RIGHT = 1, BORDER_SIDE_BOT
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum border_side_e side);
/**
@@ -56,7 +85,7 @@ css_error css__parse_border_side(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
/**
@@ -75,7 +104,7 @@ css_error css__parse_border_side_color(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
@@ -95,7 +124,7 @@ css_error css__parse_border_side_style(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
@@ -115,7 +144,7 @@ css_error css__parse_border_side_width(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
@@ -134,7 +163,7 @@ css_error css__parse_side(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_margin_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
/**
@@ -152,7 +181,7 @@ css_error css__parse_margin_side(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_padding_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
@@ -165,7 +194,7 @@ css_error css__parse_list_style_type_value(css_language *c,
const css_token *token, uint16_t *value);
css_error css__parse_colour_specifier(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint16_t *value, uint32_t *result);
css_error css__parse_named_colour(css_language *c, lwc_string *data,
@@ -174,7 +203,7 @@ css_error css__parse_named_colour(css_language *c, lwc_string *data,
css_error css__parse_hash_colour(lwc_string *data, uint32_t *result);
css_error css__parse_unit_specifier(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint32_t default_unit,
css_fixed *length, uint32_t *unit);
@@ -182,17 +211,17 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len,
uint32_t *unit);
css_error css__ident_list_or_string_to_string(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
lwc_string **result);
css_error css__ident_list_to_string(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
lwc_string **result);
css_error css__comma_list_to_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
css_code_t (*get_value)(css_language *c,
const css_token *token,
diff --git a/src/parse/properties/voice_family.c b/src/parse/properties/voice_family.c
index 193cb6b..45d63f1 100644
--- a/src/parse/properties/voice_family.c
+++ b/src/parse/properties/voice_family.c
@@ -84,13 +84,13 @@ static css_code_t voice_family_value(css_language *c, const css_token *token, bo
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_voice_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
- bool match;
+ enum flag_value flag_value;
/* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit)
*
@@ -105,11 +105,12 @@ css_error css__parse_voice_family(css_language *c,
return CSS_INVALID;
}
- if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_VOICE_FAMILY);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_VOICE_FAMILY);
+
} else {
*ctx = orig_ctx;
diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c
index a2d9175..c57bc1b 100644
--- a/src/parse/propstrings.c
+++ b/src/parse/propstrings.c
@@ -148,6 +148,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("display"),
SMAP("elevation"),
SMAP("empty-cells"),
+ SMAP("fill-opacity"),
SMAP("flex"),
SMAP("flex-basis"),
SMAP("flex-direction"),
@@ -214,6 +215,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("speak"),
SMAP("speech-rate"),
SMAP("stress"),
+ SMAP("stroke-opacity"),
SMAP("table-layout"),
SMAP("text-align"),
SMAP("text-decoration"),
@@ -233,6 +235,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("z-index"),
SMAP("inherit"),
+ SMAP("unset"),
SMAP("important"),
SMAP("none"),
SMAP("both"),
@@ -345,6 +348,11 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("hiragana-iroha"),
SMAP("katakana"),
SMAP("katakana-iroha"),
+ SMAP("japanese-informal"),
+ SMAP("japanese-formal"),
+ SMAP("korean-hangul-formal"),
+ SMAP("korean-hanja-informal"),
+ SMAP("korean-hanja-formal"),
SMAP("invert"),
SMAP("visible"),
SMAP("always"),
@@ -448,6 +456,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("src"),
SMAP("local"),
SMAP("initial"),
+ SMAP("revert"),
SMAP("format"),
SMAP("woff"),
SMAP("truetype"),
@@ -479,6 +488,9 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("or"),
SMAP("only"),
SMAP("infinite"),
+ SMAP("grid"),
+ SMAP("inline-grid"),
+ SMAP("sticky"),
SMAP("aliceblue"),
SMAP("antiquewhite"),
diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h
index f011231..8491e72 100644
--- a/src/parse/propstrings.h
+++ b/src/parse/propstrings.h
@@ -51,27 +51,28 @@ enum {
COLUMN_COUNT, COLUMN_FILL, COLUMN_GAP, COLUMN_RULE, COLUMN_RULE_COLOR,
COLUMN_RULE_STYLE, COLUMN_RULE_WIDTH, COLUMN_SPAN, COLUMN_WIDTH,
CONTENT, COUNTER_INCREMENT, COUNTER_RESET, CUE, CUE_AFTER, CUE_BEFORE,
- CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, FLEX, FLEX_BASIS,
- FLEX_DIRECTION, FLEX_FLOW, FLEX_GROW, FLEX_SHRINK, FLEX_WRAP,
- LIBCSS_FLOAT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_VARIANT,
- FONT_WEIGHT, HEIGHT, JUSTIFY_CONTENT, LEFT, LETTER_SPACING, LINE_HEIGHT,
- LIST_STYLE, LIST_STYLE_IMAGE, LIST_STYLE_POSITION, LIST_STYLE_TYPE,
- MARGIN, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP,
- MAX_HEIGHT, MAX_WIDTH, MIN_HEIGHT, MIN_WIDTH, OPACITY, ORDER, ORPHANS,
- OUTLINE, OUTLINE_COLOR, OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW,
- OVERFLOW_X, OVERFLOW_Y, PADDING, PADDING_BOTTOM, PADDING_LEFT,
- PADDING_RIGHT, PADDING_TOP, PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE,
- PAGE_BREAK_INSIDE, PAUSE, PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH,
- PLAY_DURING, POSITION, QUOTES, RICHNESS, RIGHT, 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, WRITING_MODE, Z_INDEX,
+ CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, FILL_OPACITY, FLEX,
+ FLEX_BASIS, FLEX_DIRECTION, FLEX_FLOW, FLEX_GROW, FLEX_SHRINK,
+ FLEX_WRAP, LIBCSS_FLOAT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE,
+ FONT_VARIANT, FONT_WEIGHT, HEIGHT, JUSTIFY_CONTENT, LEFT,
+ LETTER_SPACING, LINE_HEIGHT, LIST_STYLE, LIST_STYLE_IMAGE,
+ LIST_STYLE_POSITION, LIST_STYLE_TYPE, MARGIN, MARGIN_BOTTOM,
+ MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP, MAX_HEIGHT, MAX_WIDTH,
+ MIN_HEIGHT, MIN_WIDTH, OPACITY, ORDER, ORPHANS, OUTLINE, OUTLINE_COLOR,
+ OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW, OVERFLOW_X, OVERFLOW_Y, PADDING,
+ PADDING_BOTTOM, PADDING_LEFT, PADDING_RIGHT, PADDING_TOP,
+ PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE, PAGE_BREAK_INSIDE, PAUSE,
+ PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH, PLAY_DURING, POSITION,
+ QUOTES, RICHNESS, RIGHT, SPEAK_HEADER, SPEAK_NUMERAL, SPEAK_PUNCTUATION,
+ SPEAK, SPEECH_RATE, STRESS, STROKE_OPACITY, 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, WRITING_MODE, Z_INDEX,
LAST_PROP = Z_INDEX,
/* Other keywords */
- INHERIT, IMPORTANT, NONE, BOTH, FIXED, SCROLL, TRANSPARENT,
+ INHERIT, UNSET, IMPORTANT, NONE, BOTH, FIXED, SCROLL, TRANSPARENT,
NO_REPEAT, REPEAT_X, REPEAT_Y, REPEAT, HIDDEN, DOTTED, DASHED,
SOLID, LIBCSS_DOUBLE, GROOVE, RIDGE, INSET, OUTSET, THIN, MEDIUM, THICK,
COLLAPSE, SEPARATE, AUTO, LTR, RTL, INLINE, BLOCK, LIST_ITEM, RUN_IN,
@@ -88,7 +89,8 @@ enum {
DEVANAGARI, GUJARATI, GURMUKHI, HEBREW, KANNADA, LAO, MALAYALAM,
MONGOLIAN, MYANMAR, ORIYA, PERSIAN, TAMIL, TELUGU, THAI, TIBETAN,
CJK_EARTHLY_BRANCH, CJK_HEAVENLY_STEM, HIAGANA, HIAGANA_IROHA,
- KATAKANA, KATAKANA_IROHA,
+ KATAKANA, KATAKANA_IROHA, JAPANESE_INFORMAL, JAPANESE_FORMAL,
+ KOREAN_HANGUL_FORMAL, KOREAN_HANJA_INFORMAL, KOREAN_HANJA_FORMAL,
INVERT, VISIBLE, ALWAYS, AVOID, X_LOW, LOW, HIGH, X_HIGH, LIBCSS_STATIC,
RELATIVE, ABSOLUTE, ONCE, DIGITS, CONTINUOUS, CODE, SPELL_OUT, X_SLOW,
SLOW, FAST, X_FAST, FASTER, SLOWER, CENTER, JUSTIFY, CAPITALIZE,
@@ -102,12 +104,13 @@ enum {
W_RESIZE, LIBCSS_TEXT, WAIT, HELP, PROGRESS, SERIF, SANS_SERIF, CURSIVE,
FANTASY, MONOSPACE, MALE, FEMALE, CHILD, MIX, UNDERLINE, OVERLINE,
LINE_THROUGH, BLINK, RGB, RGBA, HSL, HSLA, LIBCSS_LEFT, LIBCSS_CENTER,
- LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL,
+ LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL, REVERT,
FORMAT, WOFF, TRUETYPE, OPENTYPE, EMBEDDED_OPENTYPE, SVG, COLUMN,
AVOID_PAGE, AVOID_COLUMN, BALANCE, HORIZONTAL_TB, VERTICAL_RL,
VERTICAL_LR, CONTENT_BOX, BORDER_BOX, STRETCH, INLINE_FLEX, FLEX_START,
FLEX_END, SPACE_BETWEEN, SPACE_AROUND, SPACE_EVENLY, ROW, ROW_REVERSE,
COLUMN_REVERSE, WRAP_STRING, WRAP_REVERSE, AND, OR, ONLY, INFINITE,
+ GRID, INLINE_GRID, STICKY,
/* Named colours */
FIRST_COLOUR,
diff --git a/src/select/Makefile b/src/select/Makefile
index 8b47673..e237d46 100644
--- a/src/select/Makefile
+++ b/src/select/Makefile
@@ -1,7 +1,8 @@
# Sources
+.PHONY: select_generator
select_generator:
python3 src/select/select_generator.py
-DIR_SOURCES := arena.c computed.c dispatch.c hash.c select.c font_face.c format_list_style.c
+DIR_SOURCES := arena.c computed.c dispatch.c hash.c select.c strings.c font_face.c format_list_style.c unit.c
include $(NSBUILD)/Makefile.subdir
diff --git a/src/select/autogenerated_computed.h b/src/select/autogenerated_computed.h
index 7765f35..40005c1 100644
--- a/src/select/autogenerated_computed.h
+++ b/src/select/autogenerated_computed.h
@@ -52,6 +52,7 @@ struct css_computed_style_i {
* direction 2
* display 5
* empty_cells 2
+ * fill_opacity 1 4
* flex_basis 2 + 5 4
* flex_direction 3
* flex_grow 1 4
@@ -95,6 +96,7 @@ struct css_computed_style_i {
* page_break_inside 2
* position 3
* right 2 + 5 4
+ * stroke_opacity 1 4
* table_layout 2
* text_align 4
* text_decoration 5
@@ -140,66 +142,67 @@ struct css_computed_style_i {
* quotes 1 sizeof(ptr)
*
* --- --- ---
- * 462 bits 228 + 8sizeof(ptr) bytes
+ * 464 bits 236 + 8sizeof(ptr) bytes
* ===================
- * 286 + 8sizeof(ptr) bytes
+ * 294 + 8sizeof(ptr) bytes
*
* Bit allocations:
*
* 0 bbbbbbbboooooooorrrrrrrrdddddddd
- * border_left_width; border_top_width; border_bottom_width; border_right_width
+ * border_top_width; border_right_width; border_left_width; border_bottom_width
*
- * 1 vvvvvvvvvooooooooccccccccmmmmmmm
- * vertical_align; outline_width; column_rule_width; margin_top
+ * 1 fffffffffooooooooccccccccwwwwwww
+ * font_size; outline_width; column_rule_width; word_spacing
*
- * 2 ccccccccccccccccccccccccccpppppp
- * clip; padding_left
+ * 2 cccccccccccccccccccccccccctttttt
+ * clip; text_indent
*
- * 3 mmmmmmmrrrrrrrwwwwwwwttttttddddd
- * max_height; right; width; text_indent; display
+ * 3 cccccccooooooobbbbbbbppppppttttt
+ * column_width; column_gap; bottom; padding_top; text_decoration
*
- * 4 fffffffmmmmmmmcccccccllllllltttt
- * flex_basis; min_height; column_gap; left; text_align
+ * 4 wwwwwwwtttttttrrrrrrrmmmmmmmeeee
+ * width; top; right; min_width; text_align
*
- * 5 cccccccmmmmmmmlllllllwwwwwwwbbbb
- * column_width; margin_bottom; line_height; word_spacing; break_inside
+ * 5 mmmmmmmaaaaaaaxxxxxxxrrrrrrroooo
+ * min_height; max_width; max_height; margin_top; outline_style
*
- * 6 hhhhhhhlllllllmmmmmmmaaaaaaabbbb
- * height; letter_spacing; min_width; margin_right; border_bottom_style
+ * 6 mmmmmmmaaaaaaarrrrrrrlllllllffff
+ * margin_right; margin_left; margin_bottom; line_height; font_weight
*
- * 7 tttttttmmmmmmmbbbbbbbaaaaaaaoooo
- * top; margin_left; bottom; max_width; border_top_style
+ * 7 llllllleeeeeeehhhhhhhfffffffcccc
+ * letter_spacing; left; height; flex_basis; column_rule_style
*
- * 8 llllllppppppaaaaaaddddddtttttggg
- * list_style_type; padding_top; padding_right; padding_bottom;
- * text_decoration; page_break_after
+ * 8 ppppppaaaaaaddddddlllllliiiiiwww
+ * padding_right; padding_left; padding_bottom; list_style_type; display;
+ * white_space
*
- * 9 cccccbbbbooooffffrrrruuuullllnnn
- * cursor; break_before; border_left_style; font_weight; break_after;
- * outline_style; column_rule_style; font_family
+ * 9 cccccbbbbrrrreeeeooooddddllllttt
+ * cursor; break_inside; break_before; break_after; border_top_style;
+ * border_right_style; border_left_style; text_transform
*
- * 10 aaallliiipppbbccttoouuzzffeerrmm
- * align_content; align_items; align_self; position; border_bottom_color;
- * column_rule_color; table_layout; box_sizing; column_span; z_index;
- * flex_wrap; empty_cells; border_left_color; column_count
+ * 10 bbbaaallliiizzwwvvuuttppoossffnn
+ * background_repeat; align_self; align_items; align_content; z_index;
+ * writing_mode; visibility; unicode_bidi; table_layout; page_break_inside;
+ * outline_color; list_style_position; font_variant; font_style
*
- * 11 ffoobbppaannccrrddeeuulliittUUvv
- * float; font_variant; background_attachment; page_break_inside;
- * background_color; font_style; content; border_top_color; border_collapse;
- * border_right_color; outline_color; column_fill; list_style_position;
- * caption_side; unicode_bidi; visibility
+ * 11 fflleeddccoouummnnaabbrriittppBB
+ * float; flex_wrap; empty_cells; direction; content; column_span;
+ * column_rule_color; column_fill; column_count; caption_side; box_sizing;
+ * border_top_color; border_right_color; border_left_color; border_collapse;
+ * border_bottom_color
*
- * 12 bbbbbbbbbbbaaaaaaaaaaafffffffffl
- * border_spacing; background_position; font_size; flex_grow
+ * 12 bbbbbbbbbbbaaaaaaaaaaavvvvvvvvvw
+ * border_spacing; background_position; vertical_align; widows
*
- * 13 bbbboooaaawwwvvvtttcccpppjjjfffr
- * border_right_style; overflow_y; background_repeat; white_space; overflow_x;
- * text_transform; clear; page_break_before; justify_content; flex_direction;
- * order
+ * 13 bbbbpppaaagggooovvvjjjffflllcccs
+ * border_bottom_style; position; page_break_before; page_break_after;
+ * overflow_y; overflow_x; justify_content; font_family; flex_direction; clear;
+ * stroke_opacity
*
- * 14 wwddlicobfqupr..................
- * writing_mode; direction; list_style_image; widows; counter_reset; orphans;
- * background_image; flex_shrink; quotes; counter_increment; opacity; color
+ * 14 bbaaqorplfeicuCk................
+ * background_color; background_attachment; quotes; orphans; order; opacity;
+ * list_style_image; flex_shrink; flex_grow; fill_opacity; counter_reset;
+ * counter_increment; color; background_image
*/
uint32_t bits[15];
@@ -228,6 +231,7 @@ struct css_computed_style_i {
css_color column_rule_color;
css_fixed column_rule_width;
css_fixed column_width;
+ css_fixed fill_opacity;
css_fixed flex_basis;
css_fixed flex_grow;
css_fixed flex_shrink;
@@ -255,6 +259,7 @@ struct css_computed_style_i {
css_fixed padding_right;
css_fixed padding_top;
css_fixed right;
+ css_fixed stroke_opacity;
css_fixed text_indent;
css_fixed top;
css_fixed vertical_align;
@@ -262,7 +267,6 @@ struct css_computed_style_i {
css_fixed width;
css_fixed word_spacing;
int32_t z_index;
-
};
struct css_computed_style {
diff --git a/src/select/autogenerated_propget.h b/src/select/autogenerated_propget.h
index 39ce62a..d1f7ffb 100644
--- a/src/select/autogenerated_propget.h
+++ b/src/select/autogenerated_propget.h
@@ -7,8 +7,17 @@
#define ALIGN_CONTENT_INDEX 10
-#define ALIGN_CONTENT_SHIFT 29
-#define ALIGN_CONTENT_MASK 0xe0000000
+#define ALIGN_CONTENT_SHIFT 20
+#define ALIGN_CONTENT_MASK 0x700000
+static inline uint8_t get_align_content_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[ALIGN_CONTENT_INDEX];
+ bits &= ALIGN_CONTENT_MASK;
+ bits >>= ALIGN_CONTENT_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_align_content(const css_computed_style *style)
{
uint32_t bits = style->i.bits[ALIGN_CONTENT_INDEX];
@@ -24,8 +33,17 @@ static inline uint8_t get_align_content(const css_computed_style *style)
#undef ALIGN_CONTENT_MASK
#define ALIGN_ITEMS_INDEX 10
-#define ALIGN_ITEMS_SHIFT 26
-#define ALIGN_ITEMS_MASK 0x1c000000
+#define ALIGN_ITEMS_SHIFT 23
+#define ALIGN_ITEMS_MASK 0x3800000
+static inline uint8_t get_align_items_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[ALIGN_ITEMS_INDEX];
+ bits &= ALIGN_ITEMS_MASK;
+ bits >>= ALIGN_ITEMS_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_align_items(const css_computed_style *style)
{
uint32_t bits = style->i.bits[ALIGN_ITEMS_INDEX];
@@ -41,8 +59,17 @@ static inline uint8_t get_align_items(const css_computed_style *style)
#undef ALIGN_ITEMS_MASK
#define ALIGN_SELF_INDEX 10
-#define ALIGN_SELF_SHIFT 23
-#define ALIGN_SELF_MASK 0x3800000
+#define ALIGN_SELF_SHIFT 26
+#define ALIGN_SELF_MASK 0x1c000000
+static inline uint8_t get_align_self_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[ALIGN_SELF_INDEX];
+ bits &= ALIGN_SELF_MASK;
+ bits >>= ALIGN_SELF_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_align_self(const css_computed_style *style)
{
uint32_t bits = style->i.bits[ALIGN_SELF_INDEX];
@@ -57,9 +84,19 @@ static inline uint8_t get_align_self(const css_computed_style *style)
#undef ALIGN_SELF_SHIFT
#undef ALIGN_SELF_MASK
-#define BACKGROUND_ATTACHMENT_INDEX 11
-#define BACKGROUND_ATTACHMENT_SHIFT 26
-#define BACKGROUND_ATTACHMENT_MASK 0xc000000
+#define BACKGROUND_ATTACHMENT_INDEX 14
+#define BACKGROUND_ATTACHMENT_SHIFT 28
+#define BACKGROUND_ATTACHMENT_MASK 0x30000000
+static inline uint8_t get_background_attachment_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
+ bits &= BACKGROUND_ATTACHMENT_MASK;
+ bits >>= BACKGROUND_ATTACHMENT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_background_attachment(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
@@ -74,9 +111,18 @@ static inline uint8_t get_background_attachment(const css_computed_style *style)
#undef BACKGROUND_ATTACHMENT_SHIFT
#undef BACKGROUND_ATTACHMENT_MASK
-#define BACKGROUND_COLOR_INDEX 11
-#define BACKGROUND_COLOR_SHIFT 22
-#define BACKGROUND_COLOR_MASK 0xc00000
+#define BACKGROUND_COLOR_INDEX 14
+#define BACKGROUND_COLOR_SHIFT 30
+#define BACKGROUND_COLOR_MASK 0xc0000000
+static inline uint8_t get_background_color_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BACKGROUND_COLOR_INDEX];
+ bits &= BACKGROUND_COLOR_MASK;
+ bits >>= BACKGROUND_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_background_color(const css_computed_style *style,
css_color *color)
{
@@ -94,8 +140,17 @@ static inline uint8_t get_background_color(const css_computed_style *style,
#undef BACKGROUND_COLOR_MASK
#define BACKGROUND_IMAGE_INDEX 14
-#define BACKGROUND_IMAGE_SHIFT 23
-#define BACKGROUND_IMAGE_MASK 0x800000
+#define BACKGROUND_IMAGE_SHIFT 16
+#define BACKGROUND_IMAGE_MASK 0x10000
+static inline uint8_t get_background_image_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BACKGROUND_IMAGE_INDEX];
+ bits &= BACKGROUND_IMAGE_MASK;
+ bits >>= BACKGROUND_IMAGE_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_background_image(const css_computed_style *style,
lwc_string **string)
{
@@ -115,6 +170,16 @@ static inline uint8_t get_background_image(const css_computed_style *style,
#define BACKGROUND_POSITION_INDEX 12
#define BACKGROUND_POSITION_SHIFT 10
#define BACKGROUND_POSITION_MASK 0x1ffc00
+static inline uint8_t get_background_position_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BACKGROUND_POSITION_INDEX];
+ bits &= BACKGROUND_POSITION_MASK;
+ bits >>= BACKGROUND_POSITION_SHIFT;
+
+ /* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_background_position(const css_computed_style *style,
css_fixed *length_a, css_unit *unit_a, css_fixed *length_b,
css_unit *unit_b)
@@ -137,9 +202,19 @@ static inline uint8_t get_background_position(const css_computed_style *style,
#undef BACKGROUND_POSITION_SHIFT
#undef BACKGROUND_POSITION_MASK
-#define BACKGROUND_REPEAT_INDEX 13
-#define BACKGROUND_REPEAT_SHIFT 22
-#define BACKGROUND_REPEAT_MASK 0x1c00000
+#define BACKGROUND_REPEAT_INDEX 10
+#define BACKGROUND_REPEAT_SHIFT 29
+#define BACKGROUND_REPEAT_MASK 0xe0000000
+static inline uint8_t get_background_repeat_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BACKGROUND_REPEAT_INDEX];
+ bits &= BACKGROUND_REPEAT_MASK;
+ bits >>= BACKGROUND_REPEAT_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_background_repeat(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BACKGROUND_REPEAT_INDEX];
@@ -154,9 +229,19 @@ static inline uint8_t get_background_repeat(const css_computed_style *style)
#undef BACKGROUND_REPEAT_SHIFT
#undef BACKGROUND_REPEAT_MASK
-#define BORDER_BOTTOM_COLOR_INDEX 10
-#define BORDER_BOTTOM_COLOR_SHIFT 18
-#define BORDER_BOTTOM_COLOR_MASK 0xc0000
+#define BORDER_BOTTOM_COLOR_INDEX 11
+#define BORDER_BOTTOM_COLOR_SHIFT 0
+#define BORDER_BOTTOM_COLOR_MASK 0x3
+static inline uint8_t get_border_bottom_color_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
+ bits &= BORDER_BOTTOM_COLOR_MASK;
+ bits >>= BORDER_BOTTOM_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_bottom_color(const css_computed_style *style,
css_color *color)
{
@@ -173,9 +258,19 @@ static inline uint8_t get_border_bottom_color(const css_computed_style *style,
#undef BORDER_BOTTOM_COLOR_SHIFT
#undef BORDER_BOTTOM_COLOR_MASK
-#define BORDER_BOTTOM_STYLE_INDEX 6
-#define BORDER_BOTTOM_STYLE_SHIFT 0
-#define BORDER_BOTTOM_STYLE_MASK 0xf
+#define BORDER_BOTTOM_STYLE_INDEX 13
+#define BORDER_BOTTOM_STYLE_SHIFT 28
+#define BORDER_BOTTOM_STYLE_MASK 0xf0000000
+static inline uint8_t get_border_bottom_style_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
+ bits &= BORDER_BOTTOM_STYLE_MASK;
+ bits >>= BORDER_BOTTOM_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_border_bottom_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
@@ -191,8 +286,18 @@ static inline uint8_t get_border_bottom_style(const css_computed_style *style)
#undef BORDER_BOTTOM_STYLE_MASK
#define BORDER_BOTTOM_WIDTH_INDEX 0
-#define BORDER_BOTTOM_WIDTH_SHIFT 8
-#define BORDER_BOTTOM_WIDTH_MASK 0xff00
+#define BORDER_BOTTOM_WIDTH_SHIFT 0
+#define BORDER_BOTTOM_WIDTH_MASK 0xff
+static inline uint8_t get_border_bottom_width_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
+ bits &= BORDER_BOTTOM_WIDTH_MASK;
+ bits >>= BORDER_BOTTOM_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_border_bottom_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -213,8 +318,17 @@ static inline uint8_t get_border_bottom_width(const css_computed_style *style,
#undef BORDER_BOTTOM_WIDTH_MASK
#define BORDER_COLLAPSE_INDEX 11
-#define BORDER_COLLAPSE_SHIFT 14
-#define BORDER_COLLAPSE_MASK 0xc000
+#define BORDER_COLLAPSE_SHIFT 2
+#define BORDER_COLLAPSE_MASK 0xc
+static inline uint8_t get_border_collapse_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_COLLAPSE_INDEX];
+ bits &= BORDER_COLLAPSE_MASK;
+ bits >>= BORDER_COLLAPSE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_collapse(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_COLLAPSE_INDEX];
@@ -229,9 +343,19 @@ static inline uint8_t get_border_collapse(const css_computed_style *style)
#undef BORDER_COLLAPSE_SHIFT
#undef BORDER_COLLAPSE_MASK
-#define BORDER_LEFT_COLOR_INDEX 10
-#define BORDER_LEFT_COLOR_SHIFT 2
-#define BORDER_LEFT_COLOR_MASK 0xc
+#define BORDER_LEFT_COLOR_INDEX 11
+#define BORDER_LEFT_COLOR_SHIFT 4
+#define BORDER_LEFT_COLOR_MASK 0x30
+static inline uint8_t get_border_left_color_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_LEFT_COLOR_INDEX];
+ bits &= BORDER_LEFT_COLOR_MASK;
+ bits >>= BORDER_LEFT_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_left_color(const css_computed_style *style,
css_color *color)
{
@@ -249,8 +373,18 @@ static inline uint8_t get_border_left_color(const css_computed_style *style,
#undef BORDER_LEFT_COLOR_MASK
#define BORDER_LEFT_STYLE_INDEX 9
-#define BORDER_LEFT_STYLE_SHIFT 19
-#define BORDER_LEFT_STYLE_MASK 0x780000
+#define BORDER_LEFT_STYLE_SHIFT 3
+#define BORDER_LEFT_STYLE_MASK 0x78
+static inline uint8_t get_border_left_style_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_LEFT_STYLE_INDEX];
+ bits &= BORDER_LEFT_STYLE_MASK;
+ bits >>= BORDER_LEFT_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_border_left_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_LEFT_STYLE_INDEX];
@@ -266,8 +400,18 @@ static inline uint8_t get_border_left_style(const css_computed_style *style)
#undef BORDER_LEFT_STYLE_MASK
#define BORDER_LEFT_WIDTH_INDEX 0
-#define BORDER_LEFT_WIDTH_SHIFT 24
-#define BORDER_LEFT_WIDTH_MASK 0xff000000
+#define BORDER_LEFT_WIDTH_SHIFT 8
+#define BORDER_LEFT_WIDTH_MASK 0xff00
+static inline uint8_t get_border_left_width_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_LEFT_WIDTH_INDEX];
+ bits &= BORDER_LEFT_WIDTH_MASK;
+ bits >>= BORDER_LEFT_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_border_left_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -288,8 +432,18 @@ static inline uint8_t get_border_left_width(const css_computed_style *style,
#undef BORDER_LEFT_WIDTH_MASK
#define BORDER_RIGHT_COLOR_INDEX 11
-#define BORDER_RIGHT_COLOR_SHIFT 12
-#define BORDER_RIGHT_COLOR_MASK 0x3000
+#define BORDER_RIGHT_COLOR_SHIFT 6
+#define BORDER_RIGHT_COLOR_MASK 0xc0
+static inline uint8_t get_border_right_color_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_RIGHT_COLOR_INDEX];
+ bits &= BORDER_RIGHT_COLOR_MASK;
+ bits >>= BORDER_RIGHT_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_right_color(const css_computed_style *style,
css_color *color)
{
@@ -306,9 +460,19 @@ static inline uint8_t get_border_right_color(const css_computed_style *style,
#undef BORDER_RIGHT_COLOR_SHIFT
#undef BORDER_RIGHT_COLOR_MASK
-#define BORDER_RIGHT_STYLE_INDEX 13
-#define BORDER_RIGHT_STYLE_SHIFT 28
-#define BORDER_RIGHT_STYLE_MASK 0xf0000000
+#define BORDER_RIGHT_STYLE_INDEX 9
+#define BORDER_RIGHT_STYLE_SHIFT 7
+#define BORDER_RIGHT_STYLE_MASK 0x780
+static inline uint8_t get_border_right_style_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_RIGHT_STYLE_INDEX];
+ bits &= BORDER_RIGHT_STYLE_MASK;
+ bits >>= BORDER_RIGHT_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_border_right_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_RIGHT_STYLE_INDEX];
@@ -324,8 +488,18 @@ static inline uint8_t get_border_right_style(const css_computed_style *style)
#undef BORDER_RIGHT_STYLE_MASK
#define BORDER_RIGHT_WIDTH_INDEX 0
-#define BORDER_RIGHT_WIDTH_SHIFT 0
-#define BORDER_RIGHT_WIDTH_MASK 0xff
+#define BORDER_RIGHT_WIDTH_SHIFT 16
+#define BORDER_RIGHT_WIDTH_MASK 0xff0000
+static inline uint8_t get_border_right_width_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
+ bits &= BORDER_RIGHT_WIDTH_MASK;
+ bits >>= BORDER_RIGHT_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_border_right_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -348,6 +522,15 @@ static inline uint8_t get_border_right_width(const css_computed_style *style,
#define BORDER_SPACING_INDEX 12
#define BORDER_SPACING_SHIFT 21
#define BORDER_SPACING_MASK 0xffe00000
+static inline uint8_t get_border_spacing_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_SPACING_INDEX];
+ bits &= BORDER_SPACING_MASK;
+ bits >>= BORDER_SPACING_SHIFT;
+
+ /* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_border_spacing(const css_computed_style *style,
css_fixed *length_a, css_unit *unit_a, css_fixed *length_b,
css_unit *unit_b)
@@ -371,8 +554,17 @@ static inline uint8_t get_border_spacing(const css_computed_style *style,
#undef BORDER_SPACING_MASK
#define BORDER_TOP_COLOR_INDEX 11
-#define BORDER_TOP_COLOR_SHIFT 16
-#define BORDER_TOP_COLOR_MASK 0x30000
+#define BORDER_TOP_COLOR_SHIFT 8
+#define BORDER_TOP_COLOR_MASK 0x300
+static inline uint8_t get_border_top_color_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_TOP_COLOR_INDEX];
+ bits &= BORDER_TOP_COLOR_MASK;
+ bits >>= BORDER_TOP_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_top_color(const css_computed_style *style,
css_color *color)
{
@@ -389,9 +581,18 @@ static inline uint8_t get_border_top_color(const css_computed_style *style,
#undef BORDER_TOP_COLOR_SHIFT
#undef BORDER_TOP_COLOR_MASK
-#define BORDER_TOP_STYLE_INDEX 7
-#define BORDER_TOP_STYLE_SHIFT 0
-#define BORDER_TOP_STYLE_MASK 0xf
+#define BORDER_TOP_STYLE_INDEX 9
+#define BORDER_TOP_STYLE_SHIFT 11
+#define BORDER_TOP_STYLE_MASK 0x7800
+static inline uint8_t get_border_top_style_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_TOP_STYLE_INDEX];
+ bits &= BORDER_TOP_STYLE_MASK;
+ bits >>= BORDER_TOP_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_border_top_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_TOP_STYLE_INDEX];
@@ -407,8 +608,17 @@ static inline uint8_t get_border_top_style(const css_computed_style *style)
#undef BORDER_TOP_STYLE_MASK
#define BORDER_TOP_WIDTH_INDEX 0
-#define BORDER_TOP_WIDTH_SHIFT 16
-#define BORDER_TOP_WIDTH_MASK 0xff0000
+#define BORDER_TOP_WIDTH_SHIFT 24
+#define BORDER_TOP_WIDTH_MASK 0xff000000
+static inline uint8_t get_border_top_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_TOP_WIDTH_INDEX];
+ bits &= BORDER_TOP_WIDTH_MASK;
+ bits >>= BORDER_TOP_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_border_top_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -428,42 +638,49 @@ static inline uint8_t get_border_top_width(const css_computed_style *style,
#undef BORDER_TOP_WIDTH_SHIFT
#undef BORDER_TOP_WIDTH_MASK
-#define BOTTOM_INDEX 7
+#define BOTTOM_INDEX 3
#define BOTTOM_SHIFT 11
#define BOTTOM_MASK 0x3f800
-static inline uint8_t get_bottom(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
+static inline uint8_t get_bottom_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BOTTOM_INDEX];
bits &= BOTTOM_MASK;
bits >>= BOTTOM_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_BOTTOM_SET) {
- *length = style->i.bottom;
- *unit = bits >> 2;
- }
-
+
+ /* 7bits: uuuuutt : unit | type */
return (bits & 0x3);
}
-static inline uint8_t get_bottom_bits(
- const css_computed_style *style)
+static inline uint8_t get_bottom(const css_computed_style *style, css_fixed
+ *length, css_unit *unit)
{
uint32_t bits = style->i.bits[BOTTOM_INDEX];
bits &= BOTTOM_MASK;
bits >>= BOTTOM_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
+
+ /* 7bits: uuuuutt : unit | type */
+ if ((bits & 0x3) == CSS_BOTTOM_SET) {
+ *length = style->i.bottom;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
}
#undef BOTTOM_INDEX
#undef BOTTOM_SHIFT
#undef BOTTOM_MASK
-#define BOX_SIZING_INDEX 10
-#define BOX_SIZING_SHIFT 12
-#define BOX_SIZING_MASK 0x3000
+#define BOX_SIZING_INDEX 11
+#define BOX_SIZING_SHIFT 10
+#define BOX_SIZING_MASK 0xc00
+static inline uint8_t get_box_sizing_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BOX_SIZING_INDEX];
+ bits &= BOX_SIZING_MASK;
+ bits >>= BOX_SIZING_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_box_sizing(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BOX_SIZING_INDEX];
@@ -479,8 +696,17 @@ static inline uint8_t get_box_sizing(const css_computed_style *style)
#undef BOX_SIZING_MASK
#define BREAK_AFTER_INDEX 9
-#define BREAK_AFTER_SHIFT 11
-#define BREAK_AFTER_MASK 0x7800
+#define BREAK_AFTER_SHIFT 15
+#define BREAK_AFTER_MASK 0x78000
+static inline uint8_t get_break_after_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BREAK_AFTER_INDEX];
+ bits &= BREAK_AFTER_MASK;
+ bits >>= BREAK_AFTER_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_break_after(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BREAK_AFTER_INDEX];
@@ -496,8 +722,17 @@ static inline uint8_t get_break_after(const css_computed_style *style)
#undef BREAK_AFTER_MASK
#define BREAK_BEFORE_INDEX 9
-#define BREAK_BEFORE_SHIFT 23
-#define BREAK_BEFORE_MASK 0x7800000
+#define BREAK_BEFORE_SHIFT 19
+#define BREAK_BEFORE_MASK 0x780000
+static inline uint8_t get_break_before_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BREAK_BEFORE_INDEX];
+ bits &= BREAK_BEFORE_MASK;
+ bits >>= BREAK_BEFORE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_break_before(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BREAK_BEFORE_INDEX];
@@ -512,9 +747,18 @@ static inline uint8_t get_break_before(const css_computed_style *style)
#undef BREAK_BEFORE_SHIFT
#undef BREAK_BEFORE_MASK
-#define BREAK_INSIDE_INDEX 5
-#define BREAK_INSIDE_SHIFT 0
-#define BREAK_INSIDE_MASK 0xf
+#define BREAK_INSIDE_INDEX 9
+#define BREAK_INSIDE_SHIFT 23
+#define BREAK_INSIDE_MASK 0x7800000
+static inline uint8_t get_break_inside_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BREAK_INSIDE_INDEX];
+ bits &= BREAK_INSIDE_MASK;
+ bits >>= BREAK_INSIDE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_break_inside(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BREAK_INSIDE_INDEX];
@@ -530,8 +774,17 @@ static inline uint8_t get_break_inside(const css_computed_style *style)
#undef BREAK_INSIDE_MASK
#define CAPTION_SIDE_INDEX 11
-#define CAPTION_SIDE_SHIFT 4
-#define CAPTION_SIDE_MASK 0x30
+#define CAPTION_SIDE_SHIFT 12
+#define CAPTION_SIDE_MASK 0x3000
+static inline uint8_t get_caption_side_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CAPTION_SIDE_INDEX];
+ bits &= CAPTION_SIDE_MASK;
+ bits >>= CAPTION_SIDE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_caption_side(const css_computed_style *style)
{
uint32_t bits = style->i.bits[CAPTION_SIDE_INDEX];
@@ -547,8 +800,17 @@ static inline uint8_t get_caption_side(const css_computed_style *style)
#undef CAPTION_SIDE_MASK
#define CLEAR_INDEX 13
-#define CLEAR_SHIFT 10
-#define CLEAR_MASK 0x1c00
+#define CLEAR_SHIFT 1
+#define CLEAR_MASK 0xe
+static inline uint8_t get_clear_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CLEAR_INDEX];
+ bits &= CLEAR_MASK;
+ bits >>= CLEAR_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_clear(const css_computed_style *style)
{
uint32_t bits = style->i.bits[CLEAR_INDEX];
@@ -566,6 +828,16 @@ static inline uint8_t get_clear(const css_computed_style *style)
#define CLIP_INDEX 2
#define CLIP_SHIFT 6
#define CLIP_MASK 0xffffffc0
+static inline uint8_t get_clip_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CLIP_INDEX];
+ bits &= CLIP_MASK;
+ bits >>= CLIP_SHIFT;
+
+ /* 26bits: aaaaabbbbbcccccdddddtttttt : unit_a | unit_b | unit_c |
+ unit_d | type */
+ return (bits & 0x3f);
+}
static inline uint8_t get_clip(
const css_computed_style *style,
css_computed_clip_rect *rect)
@@ -606,8 +878,17 @@ static inline uint8_t get_clip(
#undef CLIP_MASK
#define COLOR_INDEX 14
-#define COLOR_SHIFT 18
-#define COLOR_MASK 0x40000
+#define COLOR_SHIFT 17
+#define COLOR_MASK 0x20000
+static inline uint8_t get_color_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLOR_INDEX];
+ bits &= COLOR_MASK;
+ bits >>= COLOR_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_color(const css_computed_style *style, css_color
*color)
{
@@ -624,9 +905,18 @@ static inline uint8_t get_color(const css_computed_style *style, css_color
#undef COLOR_SHIFT
#undef COLOR_MASK
-#define COLUMN_COUNT_INDEX 10
-#define COLUMN_COUNT_SHIFT 0
-#define COLUMN_COUNT_MASK 0x3
+#define COLUMN_COUNT_INDEX 11
+#define COLUMN_COUNT_SHIFT 14
+#define COLUMN_COUNT_MASK 0xc000
+static inline uint8_t get_column_count_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_COUNT_INDEX];
+ bits &= COLUMN_COUNT_MASK;
+ bits >>= COLUMN_COUNT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_count(const css_computed_style *style, int32_t
*integer)
{
@@ -644,8 +934,17 @@ static inline uint8_t get_column_count(const css_computed_style *style, int32_t
#undef COLUMN_COUNT_MASK
#define COLUMN_FILL_INDEX 11
-#define COLUMN_FILL_SHIFT 8
-#define COLUMN_FILL_MASK 0x300
+#define COLUMN_FILL_SHIFT 16
+#define COLUMN_FILL_MASK 0x30000
+static inline uint8_t get_column_fill_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_FILL_INDEX];
+ bits &= COLUMN_FILL_MASK;
+ bits >>= COLUMN_FILL_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_fill(const css_computed_style *style)
{
uint32_t bits = style->i.bits[COLUMN_FILL_INDEX];
@@ -660,9 +959,18 @@ static inline uint8_t get_column_fill(const css_computed_style *style)
#undef COLUMN_FILL_SHIFT
#undef COLUMN_FILL_MASK
-#define COLUMN_GAP_INDEX 4
-#define COLUMN_GAP_SHIFT 11
-#define COLUMN_GAP_MASK 0x3f800
+#define COLUMN_GAP_INDEX 3
+#define COLUMN_GAP_SHIFT 18
+#define COLUMN_GAP_MASK 0x1fc0000
+static inline uint8_t get_column_gap_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_GAP_INDEX];
+ bits &= COLUMN_GAP_MASK;
+ bits >>= COLUMN_GAP_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_gap(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -682,9 +990,19 @@ static inline uint8_t get_column_gap(const css_computed_style *style, css_fixed
#undef COLUMN_GAP_SHIFT
#undef COLUMN_GAP_MASK
-#define COLUMN_RULE_COLOR_INDEX 10
-#define COLUMN_RULE_COLOR_SHIFT 16
-#define COLUMN_RULE_COLOR_MASK 0x30000
+#define COLUMN_RULE_COLOR_INDEX 11
+#define COLUMN_RULE_COLOR_SHIFT 18
+#define COLUMN_RULE_COLOR_MASK 0xc0000
+static inline uint8_t get_column_rule_color_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_RULE_COLOR_INDEX];
+ bits &= COLUMN_RULE_COLOR_MASK;
+ bits >>= COLUMN_RULE_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_rule_color(const css_computed_style *style,
css_color *color)
{
@@ -701,9 +1019,19 @@ static inline uint8_t get_column_rule_color(const css_computed_style *style,
#undef COLUMN_RULE_COLOR_SHIFT
#undef COLUMN_RULE_COLOR_MASK
-#define COLUMN_RULE_STYLE_INDEX 9
-#define COLUMN_RULE_STYLE_SHIFT 3
-#define COLUMN_RULE_STYLE_MASK 0x78
+#define COLUMN_RULE_STYLE_INDEX 7
+#define COLUMN_RULE_STYLE_SHIFT 0
+#define COLUMN_RULE_STYLE_MASK 0xf
+static inline uint8_t get_column_rule_style_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_RULE_STYLE_INDEX];
+ bits &= COLUMN_RULE_STYLE_MASK;
+ bits >>= COLUMN_RULE_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_column_rule_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[COLUMN_RULE_STYLE_INDEX];
@@ -721,6 +1049,16 @@ static inline uint8_t get_column_rule_style(const css_computed_style *style)
#define COLUMN_RULE_WIDTH_INDEX 1
#define COLUMN_RULE_WIDTH_SHIFT 7
#define COLUMN_RULE_WIDTH_MASK 0x7f80
+static inline uint8_t get_column_rule_width_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_RULE_WIDTH_INDEX];
+ bits &= COLUMN_RULE_WIDTH_MASK;
+ bits >>= COLUMN_RULE_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_column_rule_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -740,9 +1078,18 @@ static inline uint8_t get_column_rule_width(const css_computed_style *style,
#undef COLUMN_RULE_WIDTH_SHIFT
#undef COLUMN_RULE_WIDTH_MASK
-#define COLUMN_SPAN_INDEX 10
-#define COLUMN_SPAN_SHIFT 10
-#define COLUMN_SPAN_MASK 0xc00
+#define COLUMN_SPAN_INDEX 11
+#define COLUMN_SPAN_SHIFT 20
+#define COLUMN_SPAN_MASK 0x300000
+static inline uint8_t get_column_span_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_SPAN_INDEX];
+ bits &= COLUMN_SPAN_MASK;
+ bits >>= COLUMN_SPAN_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_span(const css_computed_style *style)
{
uint32_t bits = style->i.bits[COLUMN_SPAN_INDEX];
@@ -757,9 +1104,18 @@ static inline uint8_t get_column_span(const css_computed_style *style)
#undef COLUMN_SPAN_SHIFT
#undef COLUMN_SPAN_MASK
-#define COLUMN_WIDTH_INDEX 5
+#define COLUMN_WIDTH_INDEX 3
#define COLUMN_WIDTH_SHIFT 25
#define COLUMN_WIDTH_MASK 0xfe000000
+static inline uint8_t get_column_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_WIDTH_INDEX];
+ bits &= COLUMN_WIDTH_MASK;
+ bits >>= COLUMN_WIDTH_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -780,8 +1136,17 @@ static inline uint8_t get_column_width(const css_computed_style *style,
#undef COLUMN_WIDTH_MASK
#define CONTENT_INDEX 11
-#define CONTENT_SHIFT 18
-#define CONTENT_MASK 0xc0000
+#define CONTENT_SHIFT 22
+#define CONTENT_MASK 0xc00000
+static inline uint8_t get_content_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CONTENT_INDEX];
+ bits &= CONTENT_MASK;
+ bits >>= CONTENT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_content(const css_computed_style *style, const
css_computed_content_item **content_item)
{
@@ -801,8 +1166,18 @@ static inline uint8_t get_content(const css_computed_style *style, const
#undef CONTENT_MASK
#define COUNTER_INCREMENT_INDEX 14
-#define COUNTER_INCREMENT_SHIFT 20
-#define COUNTER_INCREMENT_MASK 0x100000
+#define COUNTER_INCREMENT_SHIFT 18
+#define COUNTER_INCREMENT_MASK 0x40000
+static inline uint8_t get_counter_increment_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[COUNTER_INCREMENT_INDEX];
+ bits &= COUNTER_INCREMENT_MASK;
+ bits >>= COUNTER_INCREMENT_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_counter_increment(const css_computed_style *style,
const css_computed_counter **counter_arr)
{
@@ -820,8 +1195,17 @@ static inline uint8_t get_counter_increment(const css_computed_style *style,
#undef COUNTER_INCREMENT_MASK
#define COUNTER_RESET_INDEX 14
-#define COUNTER_RESET_SHIFT 25
-#define COUNTER_RESET_MASK 0x2000000
+#define COUNTER_RESET_SHIFT 19
+#define COUNTER_RESET_MASK 0x80000
+static inline uint8_t get_counter_reset_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COUNTER_RESET_INDEX];
+ bits &= COUNTER_RESET_MASK;
+ bits >>= COUNTER_RESET_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_counter_reset(const css_computed_style *style, const
css_computed_counter **counter_arr)
{
@@ -841,6 +1225,15 @@ static inline uint8_t get_counter_reset(const css_computed_style *style, const
#define CURSOR_INDEX 9
#define CURSOR_SHIFT 27
#define CURSOR_MASK 0xf8000000
+static inline uint8_t get_cursor_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CURSOR_INDEX];
+ bits &= CURSOR_MASK;
+ bits >>= CURSOR_SHIFT;
+
+ /* 5bits: ttttt : type */
+ return (bits & 0x1f);
+}
static inline uint8_t get_cursor(const css_computed_style *style, lwc_string
***string_arr)
{
@@ -857,9 +1250,18 @@ static inline uint8_t get_cursor(const css_computed_style *style, lwc_string
#undef CURSOR_SHIFT
#undef CURSOR_MASK
-#define DIRECTION_INDEX 14
-#define DIRECTION_SHIFT 28
-#define DIRECTION_MASK 0x30000000
+#define DIRECTION_INDEX 11
+#define DIRECTION_SHIFT 24
+#define DIRECTION_MASK 0x3000000
+static inline uint8_t get_direction_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[DIRECTION_INDEX];
+ bits &= DIRECTION_MASK;
+ bits >>= DIRECTION_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_direction(const css_computed_style *style)
{
uint32_t bits = style->i.bits[DIRECTION_INDEX];
@@ -874,9 +1276,18 @@ static inline uint8_t get_direction(const css_computed_style *style)
#undef DIRECTION_SHIFT
#undef DIRECTION_MASK
-#define DISPLAY_INDEX 3
-#define DISPLAY_SHIFT 0
-#define DISPLAY_MASK 0x1f
+#define DISPLAY_INDEX 8
+#define DISPLAY_SHIFT 3
+#define DISPLAY_MASK 0xf8
+static inline uint8_t get_display_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[DISPLAY_INDEX];
+ bits &= DISPLAY_MASK;
+ bits >>= DISPLAY_SHIFT;
+
+ /* 5bits: ttttt : type */
+ return (bits & 0x1f);
+}
static inline uint8_t get_display(const css_computed_style *style)
{
uint32_t bits = style->i.bits[DISPLAY_INDEX];
@@ -891,9 +1302,18 @@ static inline uint8_t get_display(const css_computed_style *style)
#undef DISPLAY_SHIFT
#undef DISPLAY_MASK
-#define EMPTY_CELLS_INDEX 10
-#define EMPTY_CELLS_SHIFT 4
-#define EMPTY_CELLS_MASK 0x30
+#define EMPTY_CELLS_INDEX 11
+#define EMPTY_CELLS_SHIFT 26
+#define EMPTY_CELLS_MASK 0xc000000
+static inline uint8_t get_empty_cells_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[EMPTY_CELLS_INDEX];
+ bits &= EMPTY_CELLS_MASK;
+ bits >>= EMPTY_CELLS_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_empty_cells(const css_computed_style *style)
{
uint32_t bits = style->i.bits[EMPTY_CELLS_INDEX];
@@ -908,9 +1328,48 @@ static inline uint8_t get_empty_cells(const css_computed_style *style)
#undef EMPTY_CELLS_SHIFT
#undef EMPTY_CELLS_MASK
-#define FLEX_BASIS_INDEX 4
-#define FLEX_BASIS_SHIFT 25
-#define FLEX_BASIS_MASK 0xfe000000
+#define FILL_OPACITY_INDEX 14
+#define FILL_OPACITY_SHIFT 20
+#define FILL_OPACITY_MASK 0x100000
+static inline uint8_t get_fill_opacity_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FILL_OPACITY_INDEX];
+ bits &= FILL_OPACITY_MASK;
+ bits >>= FILL_OPACITY_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
+static inline uint8_t get_fill_opacity(const css_computed_style *style,
+ css_fixed *fixed)
+{
+ uint32_t bits = style->i.bits[FILL_OPACITY_INDEX];
+ bits &= FILL_OPACITY_MASK;
+ bits >>= FILL_OPACITY_SHIFT;
+
+ /* 1bit: t : type */
+ if ((bits & 0x1) == CSS_FILL_OPACITY_SET) {
+ *fixed = style->i.fill_opacity;
+ }
+
+ return (bits & 0x1);
+}
+#undef FILL_OPACITY_INDEX
+#undef FILL_OPACITY_SHIFT
+#undef FILL_OPACITY_MASK
+
+#define FLEX_BASIS_INDEX 7
+#define FLEX_BASIS_SHIFT 4
+#define FLEX_BASIS_MASK 0x7f0
+static inline uint8_t get_flex_basis_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLEX_BASIS_INDEX];
+ bits &= FLEX_BASIS_MASK;
+ bits >>= FLEX_BASIS_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_flex_basis(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -931,8 +1390,17 @@ static inline uint8_t get_flex_basis(const css_computed_style *style, css_fixed
#undef FLEX_BASIS_MASK
#define FLEX_DIRECTION_INDEX 13
-#define FLEX_DIRECTION_SHIFT 1
-#define FLEX_DIRECTION_MASK 0xe
+#define FLEX_DIRECTION_SHIFT 4
+#define FLEX_DIRECTION_MASK 0x70
+static inline uint8_t get_flex_direction_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLEX_DIRECTION_INDEX];
+ bits &= FLEX_DIRECTION_MASK;
+ bits >>= FLEX_DIRECTION_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_flex_direction(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FLEX_DIRECTION_INDEX];
@@ -947,9 +1415,18 @@ static inline uint8_t get_flex_direction(const css_computed_style *style)
#undef FLEX_DIRECTION_SHIFT
#undef FLEX_DIRECTION_MASK
-#define FLEX_GROW_INDEX 12
-#define FLEX_GROW_SHIFT 0
-#define FLEX_GROW_MASK 0x1
+#define FLEX_GROW_INDEX 14
+#define FLEX_GROW_SHIFT 21
+#define FLEX_GROW_MASK 0x200000
+static inline uint8_t get_flex_grow_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLEX_GROW_INDEX];
+ bits &= FLEX_GROW_MASK;
+ bits >>= FLEX_GROW_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_flex_grow(const css_computed_style *style, css_fixed
*fixed)
{
@@ -971,6 +1448,15 @@ static inline uint8_t get_flex_grow(const css_computed_style *style, css_fixed
#define FLEX_SHRINK_INDEX 14
#define FLEX_SHRINK_SHIFT 22
#define FLEX_SHRINK_MASK 0x400000
+static inline uint8_t get_flex_shrink_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLEX_SHRINK_INDEX];
+ bits &= FLEX_SHRINK_MASK;
+ bits >>= FLEX_SHRINK_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_flex_shrink(const css_computed_style *style,
css_fixed *fixed)
{
@@ -989,9 +1475,18 @@ static inline uint8_t get_flex_shrink(const css_computed_style *style,
#undef FLEX_SHRINK_SHIFT
#undef FLEX_SHRINK_MASK
-#define FLEX_WRAP_INDEX 10
-#define FLEX_WRAP_SHIFT 6
-#define FLEX_WRAP_MASK 0xc0
+#define FLEX_WRAP_INDEX 11
+#define FLEX_WRAP_SHIFT 28
+#define FLEX_WRAP_MASK 0x30000000
+static inline uint8_t get_flex_wrap_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLEX_WRAP_INDEX];
+ bits &= FLEX_WRAP_MASK;
+ bits >>= FLEX_WRAP_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_flex_wrap(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FLEX_WRAP_INDEX];
@@ -1009,6 +1504,15 @@ static inline uint8_t get_flex_wrap(const css_computed_style *style)
#define FLOAT_INDEX 11
#define FLOAT_SHIFT 30
#define FLOAT_MASK 0xc0000000
+static inline uint8_t get_float_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLOAT_INDEX];
+ bits &= FLOAT_MASK;
+ bits >>= FLOAT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_float(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FLOAT_INDEX];
@@ -1023,9 +1527,18 @@ static inline uint8_t get_float(const css_computed_style *style)
#undef FLOAT_SHIFT
#undef FLOAT_MASK
-#define FONT_FAMILY_INDEX 9
-#define FONT_FAMILY_SHIFT 0
-#define FONT_FAMILY_MASK 0x7
+#define FONT_FAMILY_INDEX 13
+#define FONT_FAMILY_SHIFT 7
+#define FONT_FAMILY_MASK 0x380
+static inline uint8_t get_font_family_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_FAMILY_INDEX];
+ bits &= FONT_FAMILY_MASK;
+ bits >>= FONT_FAMILY_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_font_family(const css_computed_style *style,
lwc_string ***string_arr)
{
@@ -1042,9 +1555,18 @@ static inline uint8_t get_font_family(const css_computed_style *style,
#undef FONT_FAMILY_SHIFT
#undef FONT_FAMILY_MASK
-#define FONT_SIZE_INDEX 12
-#define FONT_SIZE_SHIFT 1
-#define FONT_SIZE_MASK 0x3fe
+#define FONT_SIZE_INDEX 1
+#define FONT_SIZE_SHIFT 23
+#define FONT_SIZE_MASK 0xff800000
+static inline uint8_t get_font_size_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_SIZE_INDEX];
+ bits &= FONT_SIZE_MASK;
+ bits >>= FONT_SIZE_SHIFT;
+
+ /* 9bits: uuuuutttt : unit | type */
+ return (bits & 0xf);
+}
static inline uint8_t get_font_size(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1064,9 +1586,18 @@ static inline uint8_t get_font_size(const css_computed_style *style, css_fixed
#undef FONT_SIZE_SHIFT
#undef FONT_SIZE_MASK
-#define FONT_STYLE_INDEX 11
-#define FONT_STYLE_SHIFT 20
-#define FONT_STYLE_MASK 0x300000
+#define FONT_STYLE_INDEX 10
+#define FONT_STYLE_SHIFT 0
+#define FONT_STYLE_MASK 0x3
+static inline uint8_t get_font_style_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_STYLE_INDEX];
+ bits &= FONT_STYLE_MASK;
+ bits >>= FONT_STYLE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_font_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FONT_STYLE_INDEX];
@@ -1081,9 +1612,18 @@ static inline uint8_t get_font_style(const css_computed_style *style)
#undef FONT_STYLE_SHIFT
#undef FONT_STYLE_MASK
-#define FONT_VARIANT_INDEX 11
-#define FONT_VARIANT_SHIFT 28
-#define FONT_VARIANT_MASK 0x30000000
+#define FONT_VARIANT_INDEX 10
+#define FONT_VARIANT_SHIFT 2
+#define FONT_VARIANT_MASK 0xc
+static inline uint8_t get_font_variant_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_VARIANT_INDEX];
+ bits &= FONT_VARIANT_MASK;
+ bits >>= FONT_VARIANT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_font_variant(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FONT_VARIANT_INDEX];
@@ -1098,9 +1638,18 @@ static inline uint8_t get_font_variant(const css_computed_style *style)
#undef FONT_VARIANT_SHIFT
#undef FONT_VARIANT_MASK
-#define FONT_WEIGHT_INDEX 9
-#define FONT_WEIGHT_SHIFT 15
-#define FONT_WEIGHT_MASK 0x78000
+#define FONT_WEIGHT_INDEX 6
+#define FONT_WEIGHT_SHIFT 0
+#define FONT_WEIGHT_MASK 0xf
+static inline uint8_t get_font_weight_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_WEIGHT_INDEX];
+ bits &= FONT_WEIGHT_MASK;
+ bits >>= FONT_WEIGHT_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_font_weight(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FONT_WEIGHT_INDEX];
@@ -1115,9 +1664,18 @@ static inline uint8_t get_font_weight(const css_computed_style *style)
#undef FONT_WEIGHT_SHIFT
#undef FONT_WEIGHT_MASK
-#define HEIGHT_INDEX 6
-#define HEIGHT_SHIFT 25
-#define HEIGHT_MASK 0xfe000000
+#define HEIGHT_INDEX 7
+#define HEIGHT_SHIFT 11
+#define HEIGHT_MASK 0x3f800
+static inline uint8_t get_height_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[HEIGHT_INDEX];
+ bits &= HEIGHT_MASK;
+ bits >>= HEIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_height(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1138,8 +1696,17 @@ static inline uint8_t get_height(const css_computed_style *style, css_fixed
#undef HEIGHT_MASK
#define JUSTIFY_CONTENT_INDEX 13
-#define JUSTIFY_CONTENT_SHIFT 4
-#define JUSTIFY_CONTENT_MASK 0x70
+#define JUSTIFY_CONTENT_SHIFT 10
+#define JUSTIFY_CONTENT_MASK 0x1c00
+static inline uint8_t get_justify_content_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[JUSTIFY_CONTENT_INDEX];
+ bits &= JUSTIFY_CONTENT_MASK;
+ bits >>= JUSTIFY_CONTENT_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_justify_content(const css_computed_style *style)
{
uint32_t bits = style->i.bits[JUSTIFY_CONTENT_INDEX];
@@ -1154,42 +1721,49 @@ static inline uint8_t get_justify_content(const css_computed_style *style)
#undef JUSTIFY_CONTENT_SHIFT
#undef JUSTIFY_CONTENT_MASK
-#define LEFT_INDEX 4
-#define LEFT_SHIFT 4
-#define LEFT_MASK 0x7f0
-static inline uint8_t get_left(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
+#define LEFT_INDEX 7
+#define LEFT_SHIFT 18
+#define LEFT_MASK 0x1fc0000
+static inline uint8_t get_left_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[LEFT_INDEX];
bits &= LEFT_MASK;
bits >>= LEFT_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_LEFT_SET) {
- *length = style->i.left;
- *unit = bits >> 2;
- }
-
+
+ /* 7bits: uuuuutt : unit | type */
return (bits & 0x3);
}
-static inline uint8_t get_left_bits(
- const css_computed_style *style)
+static inline uint8_t get_left(const css_computed_style *style, css_fixed
+ *length, css_unit *unit)
{
uint32_t bits = style->i.bits[LEFT_INDEX];
bits &= LEFT_MASK;
bits >>= LEFT_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
+
+ /* 7bits: uuuuutt : unit | type */
+ if ((bits & 0x3) == CSS_LEFT_SET) {
+ *length = style->i.left;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
}
#undef LEFT_INDEX
#undef LEFT_SHIFT
#undef LEFT_MASK
-#define LETTER_SPACING_INDEX 6
-#define LETTER_SPACING_SHIFT 18
-#define LETTER_SPACING_MASK 0x1fc0000
+#define LETTER_SPACING_INDEX 7
+#define LETTER_SPACING_SHIFT 25
+#define LETTER_SPACING_MASK 0xfe000000
+static inline uint8_t get_letter_spacing_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[LETTER_SPACING_INDEX];
+ bits &= LETTER_SPACING_MASK;
+ bits >>= LETTER_SPACING_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_letter_spacing(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1209,9 +1783,18 @@ static inline uint8_t get_letter_spacing(const css_computed_style *style,
#undef LETTER_SPACING_SHIFT
#undef LETTER_SPACING_MASK
-#define LINE_HEIGHT_INDEX 5
-#define LINE_HEIGHT_SHIFT 11
-#define LINE_HEIGHT_MASK 0x3f800
+#define LINE_HEIGHT_INDEX 6
+#define LINE_HEIGHT_SHIFT 4
+#define LINE_HEIGHT_MASK 0x7f0
+static inline uint8_t get_line_height_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[LINE_HEIGHT_INDEX];
+ bits &= LINE_HEIGHT_MASK;
+ bits >>= LINE_HEIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_line_height(
const css_computed_style *style,
css_fixed *length, css_unit *unit)
@@ -1237,8 +1820,17 @@ static inline uint8_t get_line_height(
#undef LINE_HEIGHT_MASK
#define LIST_STYLE_IMAGE_INDEX 14
-#define LIST_STYLE_IMAGE_SHIFT 27
-#define LIST_STYLE_IMAGE_MASK 0x8000000
+#define LIST_STYLE_IMAGE_SHIFT 23
+#define LIST_STYLE_IMAGE_MASK 0x800000
+static inline uint8_t get_list_style_image_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[LIST_STYLE_IMAGE_INDEX];
+ bits &= LIST_STYLE_IMAGE_MASK;
+ bits >>= LIST_STYLE_IMAGE_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_list_style_image(const css_computed_style *style,
lwc_string **string)
{
@@ -1255,9 +1847,19 @@ static inline uint8_t get_list_style_image(const css_computed_style *style,
#undef LIST_STYLE_IMAGE_SHIFT
#undef LIST_STYLE_IMAGE_MASK
-#define LIST_STYLE_POSITION_INDEX 11
-#define LIST_STYLE_POSITION_SHIFT 6
-#define LIST_STYLE_POSITION_MASK 0xc0
+#define LIST_STYLE_POSITION_INDEX 10
+#define LIST_STYLE_POSITION_SHIFT 4
+#define LIST_STYLE_POSITION_MASK 0x30
+static inline uint8_t get_list_style_position_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[LIST_STYLE_POSITION_INDEX];
+ bits &= LIST_STYLE_POSITION_MASK;
+ bits >>= LIST_STYLE_POSITION_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_list_style_position(const css_computed_style *style)
{
uint32_t bits = style->i.bits[LIST_STYLE_POSITION_INDEX];
@@ -1273,8 +1875,17 @@ static inline uint8_t get_list_style_position(const css_computed_style *style)
#undef LIST_STYLE_POSITION_MASK
#define LIST_STYLE_TYPE_INDEX 8
-#define LIST_STYLE_TYPE_SHIFT 26
-#define LIST_STYLE_TYPE_MASK 0xfc000000
+#define LIST_STYLE_TYPE_SHIFT 8
+#define LIST_STYLE_TYPE_MASK 0x3f00
+static inline uint8_t get_list_style_type_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[LIST_STYLE_TYPE_INDEX];
+ bits &= LIST_STYLE_TYPE_MASK;
+ bits >>= LIST_STYLE_TYPE_SHIFT;
+
+ /* 6bits: tttttt : type */
+ return (bits & 0x3f);
+}
static inline uint8_t get_list_style_type(const css_computed_style *style)
{
uint32_t bits = style->i.bits[LIST_STYLE_TYPE_INDEX];
@@ -1289,9 +1900,18 @@ static inline uint8_t get_list_style_type(const css_computed_style *style)
#undef LIST_STYLE_TYPE_SHIFT
#undef LIST_STYLE_TYPE_MASK
-#define MARGIN_BOTTOM_INDEX 5
-#define MARGIN_BOTTOM_SHIFT 18
-#define MARGIN_BOTTOM_MASK 0x1fc0000
+#define MARGIN_BOTTOM_INDEX 6
+#define MARGIN_BOTTOM_SHIFT 11
+#define MARGIN_BOTTOM_MASK 0x3f800
+static inline uint8_t get_margin_bottom_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MARGIN_BOTTOM_INDEX];
+ bits &= MARGIN_BOTTOM_MASK;
+ bits >>= MARGIN_BOTTOM_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_margin_bottom(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1311,9 +1931,18 @@ static inline uint8_t get_margin_bottom(const css_computed_style *style,
#undef MARGIN_BOTTOM_SHIFT
#undef MARGIN_BOTTOM_MASK
-#define MARGIN_LEFT_INDEX 7
+#define MARGIN_LEFT_INDEX 6
#define MARGIN_LEFT_SHIFT 18
#define MARGIN_LEFT_MASK 0x1fc0000
+static inline uint8_t get_margin_left_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MARGIN_LEFT_INDEX];
+ bits &= MARGIN_LEFT_MASK;
+ bits >>= MARGIN_LEFT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_margin_left(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1334,8 +1963,17 @@ static inline uint8_t get_margin_left(const css_computed_style *style,
#undef MARGIN_LEFT_MASK
#define MARGIN_RIGHT_INDEX 6
-#define MARGIN_RIGHT_SHIFT 4
-#define MARGIN_RIGHT_MASK 0x7f0
+#define MARGIN_RIGHT_SHIFT 25
+#define MARGIN_RIGHT_MASK 0xfe000000
+static inline uint8_t get_margin_right_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MARGIN_RIGHT_INDEX];
+ bits &= MARGIN_RIGHT_MASK;
+ bits >>= MARGIN_RIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_margin_right(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1355,9 +1993,18 @@ static inline uint8_t get_margin_right(const css_computed_style *style,
#undef MARGIN_RIGHT_SHIFT
#undef MARGIN_RIGHT_MASK
-#define MARGIN_TOP_INDEX 1
-#define MARGIN_TOP_SHIFT 0
-#define MARGIN_TOP_MASK 0x7f
+#define MARGIN_TOP_INDEX 5
+#define MARGIN_TOP_SHIFT 4
+#define MARGIN_TOP_MASK 0x7f0
+static inline uint8_t get_margin_top_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MARGIN_TOP_INDEX];
+ bits &= MARGIN_TOP_MASK;
+ bits >>= MARGIN_TOP_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_margin_top(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1377,9 +2024,18 @@ static inline uint8_t get_margin_top(const css_computed_style *style, css_fixed
#undef MARGIN_TOP_SHIFT
#undef MARGIN_TOP_MASK
-#define MAX_HEIGHT_INDEX 3
-#define MAX_HEIGHT_SHIFT 25
-#define MAX_HEIGHT_MASK 0xfe000000
+#define MAX_HEIGHT_INDEX 5
+#define MAX_HEIGHT_SHIFT 11
+#define MAX_HEIGHT_MASK 0x3f800
+static inline uint8_t get_max_height_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MAX_HEIGHT_INDEX];
+ bits &= MAX_HEIGHT_MASK;
+ bits >>= MAX_HEIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_max_height(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1399,9 +2055,18 @@ static inline uint8_t get_max_height(const css_computed_style *style, css_fixed
#undef MAX_HEIGHT_SHIFT
#undef MAX_HEIGHT_MASK
-#define MAX_WIDTH_INDEX 7
-#define MAX_WIDTH_SHIFT 4
-#define MAX_WIDTH_MASK 0x7f0
+#define MAX_WIDTH_INDEX 5
+#define MAX_WIDTH_SHIFT 18
+#define MAX_WIDTH_MASK 0x1fc0000
+static inline uint8_t get_max_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MAX_WIDTH_INDEX];
+ bits &= MAX_WIDTH_MASK;
+ bits >>= MAX_WIDTH_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_max_width(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1421,9 +2086,18 @@ static inline uint8_t get_max_width(const css_computed_style *style, css_fixed
#undef MAX_WIDTH_SHIFT
#undef MAX_WIDTH_MASK
-#define MIN_HEIGHT_INDEX 4
-#define MIN_HEIGHT_SHIFT 18
-#define MIN_HEIGHT_MASK 0x1fc0000
+#define MIN_HEIGHT_INDEX 5
+#define MIN_HEIGHT_SHIFT 25
+#define MIN_HEIGHT_MASK 0xfe000000
+static inline uint8_t get_min_height_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MIN_HEIGHT_INDEX];
+ bits &= MIN_HEIGHT_MASK;
+ bits >>= MIN_HEIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_min_height(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1443,9 +2117,18 @@ static inline uint8_t get_min_height(const css_computed_style *style, css_fixed
#undef MIN_HEIGHT_SHIFT
#undef MIN_HEIGHT_MASK
-#define MIN_WIDTH_INDEX 6
-#define MIN_WIDTH_SHIFT 11
-#define MIN_WIDTH_MASK 0x3f800
+#define MIN_WIDTH_INDEX 4
+#define MIN_WIDTH_SHIFT 4
+#define MIN_WIDTH_MASK 0x7f0
+static inline uint8_t get_min_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MIN_WIDTH_INDEX];
+ bits &= MIN_WIDTH_MASK;
+ bits >>= MIN_WIDTH_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_min_width(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1466,8 +2149,17 @@ static inline uint8_t get_min_width(const css_computed_style *style, css_fixed
#undef MIN_WIDTH_MASK
#define OPACITY_INDEX 14
-#define OPACITY_SHIFT 19
-#define OPACITY_MASK 0x80000
+#define OPACITY_SHIFT 24
+#define OPACITY_MASK 0x1000000
+static inline uint8_t get_opacity_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OPACITY_INDEX];
+ bits &= OPACITY_MASK;
+ bits >>= OPACITY_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_opacity(const css_computed_style *style, css_fixed
*fixed)
{
@@ -1486,9 +2178,18 @@ static inline uint8_t get_opacity(const css_computed_style *style, css_fixed
#undef OPACITY_SHIFT
#undef OPACITY_MASK
-#define ORDER_INDEX 13
-#define ORDER_SHIFT 0
-#define ORDER_MASK 0x1
+#define ORDER_INDEX 14
+#define ORDER_SHIFT 25
+#define ORDER_MASK 0x2000000
+static inline uint8_t get_order_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[ORDER_INDEX];
+ bits &= ORDER_MASK;
+ bits >>= ORDER_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_order(const css_computed_style *style, int32_t
*integer)
{
@@ -1508,8 +2209,17 @@ static inline uint8_t get_order(const css_computed_style *style, int32_t
#undef ORDER_MASK
#define ORPHANS_INDEX 14
-#define ORPHANS_SHIFT 24
-#define ORPHANS_MASK 0x1000000
+#define ORPHANS_SHIFT 26
+#define ORPHANS_MASK 0x4000000
+static inline uint8_t get_orphans_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[ORPHANS_INDEX];
+ bits &= ORPHANS_MASK;
+ bits >>= ORPHANS_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_orphans(const css_computed_style *style, int32_t
*integer)
{
@@ -1526,9 +2236,18 @@ static inline uint8_t get_orphans(const css_computed_style *style, int32_t
#undef ORPHANS_SHIFT
#undef ORPHANS_MASK
-#define OUTLINE_COLOR_INDEX 11
-#define OUTLINE_COLOR_SHIFT 10
-#define OUTLINE_COLOR_MASK 0xc00
+#define OUTLINE_COLOR_INDEX 10
+#define OUTLINE_COLOR_SHIFT 6
+#define OUTLINE_COLOR_MASK 0xc0
+static inline uint8_t get_outline_color_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OUTLINE_COLOR_INDEX];
+ bits &= OUTLINE_COLOR_MASK;
+ bits >>= OUTLINE_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_outline_color(const css_computed_style *style,
css_color *color)
{
@@ -1547,9 +2266,18 @@ static inline uint8_t get_outline_color(const css_computed_style *style,
#undef OUTLINE_COLOR_SHIFT
#undef OUTLINE_COLOR_MASK
-#define OUTLINE_STYLE_INDEX 9
-#define OUTLINE_STYLE_SHIFT 7
-#define OUTLINE_STYLE_MASK 0x780
+#define OUTLINE_STYLE_INDEX 5
+#define OUTLINE_STYLE_SHIFT 0
+#define OUTLINE_STYLE_MASK 0xf
+static inline uint8_t get_outline_style_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OUTLINE_STYLE_INDEX];
+ bits &= OUTLINE_STYLE_MASK;
+ bits >>= OUTLINE_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_outline_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[OUTLINE_STYLE_INDEX];
@@ -1567,6 +2295,15 @@ static inline uint8_t get_outline_style(const css_computed_style *style)
#define OUTLINE_WIDTH_INDEX 1
#define OUTLINE_WIDTH_SHIFT 15
#define OUTLINE_WIDTH_MASK 0x7f8000
+static inline uint8_t get_outline_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OUTLINE_WIDTH_INDEX];
+ bits &= OUTLINE_WIDTH_MASK;
+ bits >>= OUTLINE_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_outline_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1587,8 +2324,17 @@ static inline uint8_t get_outline_width(const css_computed_style *style,
#undef OUTLINE_WIDTH_MASK
#define OVERFLOW_X_INDEX 13
-#define OVERFLOW_X_SHIFT 16
-#define OVERFLOW_X_MASK 0x70000
+#define OVERFLOW_X_SHIFT 13
+#define OVERFLOW_X_MASK 0xe000
+static inline uint8_t get_overflow_x_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OVERFLOW_X_INDEX];
+ bits &= OVERFLOW_X_MASK;
+ bits >>= OVERFLOW_X_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_overflow_x(const css_computed_style *style)
{
uint32_t bits = style->i.bits[OVERFLOW_X_INDEX];
@@ -1604,8 +2350,17 @@ static inline uint8_t get_overflow_x(const css_computed_style *style)
#undef OVERFLOW_X_MASK
#define OVERFLOW_Y_INDEX 13
-#define OVERFLOW_Y_SHIFT 25
-#define OVERFLOW_Y_MASK 0xe000000
+#define OVERFLOW_Y_SHIFT 16
+#define OVERFLOW_Y_MASK 0x70000
+static inline uint8_t get_overflow_y_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OVERFLOW_Y_INDEX];
+ bits &= OVERFLOW_Y_MASK;
+ bits >>= OVERFLOW_Y_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_overflow_y(const css_computed_style *style)
{
uint32_t bits = style->i.bits[OVERFLOW_Y_INDEX];
@@ -1621,8 +2376,17 @@ static inline uint8_t get_overflow_y(const css_computed_style *style)
#undef OVERFLOW_Y_MASK
#define PADDING_BOTTOM_INDEX 8
-#define PADDING_BOTTOM_SHIFT 8
-#define PADDING_BOTTOM_MASK 0x3f00
+#define PADDING_BOTTOM_SHIFT 14
+#define PADDING_BOTTOM_MASK 0xfc000
+static inline uint8_t get_padding_bottom_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PADDING_BOTTOM_INDEX];
+ bits &= PADDING_BOTTOM_MASK;
+ bits >>= PADDING_BOTTOM_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_padding_bottom(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1642,9 +2406,18 @@ static inline uint8_t get_padding_bottom(const css_computed_style *style,
#undef PADDING_BOTTOM_SHIFT
#undef PADDING_BOTTOM_MASK
-#define PADDING_LEFT_INDEX 2
-#define PADDING_LEFT_SHIFT 0
-#define PADDING_LEFT_MASK 0x3f
+#define PADDING_LEFT_INDEX 8
+#define PADDING_LEFT_SHIFT 20
+#define PADDING_LEFT_MASK 0x3f00000
+static inline uint8_t get_padding_left_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PADDING_LEFT_INDEX];
+ bits &= PADDING_LEFT_MASK;
+ bits >>= PADDING_LEFT_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_padding_left(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1665,8 +2438,17 @@ static inline uint8_t get_padding_left(const css_computed_style *style,
#undef PADDING_LEFT_MASK
#define PADDING_RIGHT_INDEX 8
-#define PADDING_RIGHT_SHIFT 14
-#define PADDING_RIGHT_MASK 0xfc000
+#define PADDING_RIGHT_SHIFT 26
+#define PADDING_RIGHT_MASK 0xfc000000
+static inline uint8_t get_padding_right_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PADDING_RIGHT_INDEX];
+ bits &= PADDING_RIGHT_MASK;
+ bits >>= PADDING_RIGHT_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_padding_right(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1686,9 +2468,18 @@ static inline uint8_t get_padding_right(const css_computed_style *style,
#undef PADDING_RIGHT_SHIFT
#undef PADDING_RIGHT_MASK
-#define PADDING_TOP_INDEX 8
-#define PADDING_TOP_SHIFT 20
-#define PADDING_TOP_MASK 0x3f00000
+#define PADDING_TOP_INDEX 3
+#define PADDING_TOP_SHIFT 5
+#define PADDING_TOP_MASK 0x7e0
+static inline uint8_t get_padding_top_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PADDING_TOP_INDEX];
+ bits &= PADDING_TOP_MASK;
+ bits >>= PADDING_TOP_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_padding_top(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1708,9 +2499,18 @@ static inline uint8_t get_padding_top(const css_computed_style *style,
#undef PADDING_TOP_SHIFT
#undef PADDING_TOP_MASK
-#define PAGE_BREAK_AFTER_INDEX 8
-#define PAGE_BREAK_AFTER_SHIFT 0
-#define PAGE_BREAK_AFTER_MASK 0x7
+#define PAGE_BREAK_AFTER_INDEX 13
+#define PAGE_BREAK_AFTER_SHIFT 19
+#define PAGE_BREAK_AFTER_MASK 0x380000
+static inline uint8_t get_page_break_after_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PAGE_BREAK_AFTER_INDEX];
+ bits &= PAGE_BREAK_AFTER_MASK;
+ bits >>= PAGE_BREAK_AFTER_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_page_break_after(const css_computed_style *style)
{
uint32_t bits = style->i.bits[PAGE_BREAK_AFTER_INDEX];
@@ -1726,8 +2526,18 @@ static inline uint8_t get_page_break_after(const css_computed_style *style)
#undef PAGE_BREAK_AFTER_MASK
#define PAGE_BREAK_BEFORE_INDEX 13
-#define PAGE_BREAK_BEFORE_SHIFT 7
-#define PAGE_BREAK_BEFORE_MASK 0x380
+#define PAGE_BREAK_BEFORE_SHIFT 22
+#define PAGE_BREAK_BEFORE_MASK 0x1c00000
+static inline uint8_t get_page_break_before_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[PAGE_BREAK_BEFORE_INDEX];
+ bits &= PAGE_BREAK_BEFORE_MASK;
+ bits >>= PAGE_BREAK_BEFORE_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_page_break_before(const css_computed_style *style)
{
uint32_t bits = style->i.bits[PAGE_BREAK_BEFORE_INDEX];
@@ -1742,9 +2552,19 @@ static inline uint8_t get_page_break_before(const css_computed_style *style)
#undef PAGE_BREAK_BEFORE_SHIFT
#undef PAGE_BREAK_BEFORE_MASK
-#define PAGE_BREAK_INSIDE_INDEX 11
-#define PAGE_BREAK_INSIDE_SHIFT 24
-#define PAGE_BREAK_INSIDE_MASK 0x3000000
+#define PAGE_BREAK_INSIDE_INDEX 10
+#define PAGE_BREAK_INSIDE_SHIFT 8
+#define PAGE_BREAK_INSIDE_MASK 0x300
+static inline uint8_t get_page_break_inside_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[PAGE_BREAK_INSIDE_INDEX];
+ bits &= PAGE_BREAK_INSIDE_MASK;
+ bits >>= PAGE_BREAK_INSIDE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_page_break_inside(const css_computed_style *style)
{
uint32_t bits = style->i.bits[PAGE_BREAK_INSIDE_INDEX];
@@ -1759,9 +2579,18 @@ static inline uint8_t get_page_break_inside(const css_computed_style *style)
#undef PAGE_BREAK_INSIDE_SHIFT
#undef PAGE_BREAK_INSIDE_MASK
-#define POSITION_INDEX 10
-#define POSITION_SHIFT 20
-#define POSITION_MASK 0x700000
+#define POSITION_INDEX 13
+#define POSITION_SHIFT 25
+#define POSITION_MASK 0xe000000
+static inline uint8_t get_position_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[POSITION_INDEX];
+ bits &= POSITION_MASK;
+ bits >>= POSITION_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_position(const css_computed_style *style)
{
uint32_t bits = style->i.bits[POSITION_INDEX];
@@ -1777,8 +2606,17 @@ static inline uint8_t get_position(const css_computed_style *style)
#undef POSITION_MASK
#define QUOTES_INDEX 14
-#define QUOTES_SHIFT 21
-#define QUOTES_MASK 0x200000
+#define QUOTES_SHIFT 27
+#define QUOTES_MASK 0x8000000
+static inline uint8_t get_quotes_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[QUOTES_INDEX];
+ bits &= QUOTES_MASK;
+ bits >>= QUOTES_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_quotes(const css_computed_style *style, lwc_string
***string_arr)
{
@@ -1795,42 +2633,79 @@ static inline uint8_t get_quotes(const css_computed_style *style, lwc_string
#undef QUOTES_SHIFT
#undef QUOTES_MASK
-#define RIGHT_INDEX 3
-#define RIGHT_SHIFT 18
-#define RIGHT_MASK 0x1fc0000
-static inline uint8_t get_right(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
+#define RIGHT_INDEX 4
+#define RIGHT_SHIFT 11
+#define RIGHT_MASK 0x3f800
+static inline uint8_t get_right_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[RIGHT_INDEX];
bits &= RIGHT_MASK;
bits >>= RIGHT_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_RIGHT_SET) {
- *length = style->i.right;
- *unit = bits >> 2;
- }
-
+
+ /* 7bits: uuuuutt : unit | type */
return (bits & 0x3);
}
-static inline uint8_t get_right_bits(
- const css_computed_style *style)
+static inline uint8_t get_right(const css_computed_style *style, css_fixed
+ *length, css_unit *unit)
{
uint32_t bits = style->i.bits[RIGHT_INDEX];
bits &= RIGHT_MASK;
bits >>= RIGHT_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
+
+ /* 7bits: uuuuutt : unit | type */
+ if ((bits & 0x3) == CSS_RIGHT_SET) {
+ *length = style->i.right;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
}
#undef RIGHT_INDEX
#undef RIGHT_SHIFT
#undef RIGHT_MASK
+#define STROKE_OPACITY_INDEX 13
+#define STROKE_OPACITY_SHIFT 0
+#define STROKE_OPACITY_MASK 0x1
+static inline uint8_t get_stroke_opacity_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[STROKE_OPACITY_INDEX];
+ bits &= STROKE_OPACITY_MASK;
+ bits >>= STROKE_OPACITY_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
+static inline uint8_t get_stroke_opacity(const css_computed_style *style,
+ css_fixed *fixed)
+{
+ uint32_t bits = style->i.bits[STROKE_OPACITY_INDEX];
+ bits &= STROKE_OPACITY_MASK;
+ bits >>= STROKE_OPACITY_SHIFT;
+
+ /* 1bit: t : type */
+ if ((bits & 0x1) == CSS_STROKE_OPACITY_SET) {
+ *fixed = style->i.stroke_opacity;
+ }
+
+ return (bits & 0x1);
+}
+#undef STROKE_OPACITY_INDEX
+#undef STROKE_OPACITY_SHIFT
+#undef STROKE_OPACITY_MASK
+
#define TABLE_LAYOUT_INDEX 10
-#define TABLE_LAYOUT_SHIFT 14
-#define TABLE_LAYOUT_MASK 0xc000
+#define TABLE_LAYOUT_SHIFT 10
+#define TABLE_LAYOUT_MASK 0xc00
+static inline uint8_t get_table_layout_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TABLE_LAYOUT_INDEX];
+ bits &= TABLE_LAYOUT_MASK;
+ bits >>= TABLE_LAYOUT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_table_layout(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TABLE_LAYOUT_INDEX];
@@ -1848,6 +2723,15 @@ static inline uint8_t get_table_layout(const css_computed_style *style)
#define TEXT_ALIGN_INDEX 4
#define TEXT_ALIGN_SHIFT 0
#define TEXT_ALIGN_MASK 0xf
+static inline uint8_t get_text_align_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TEXT_ALIGN_INDEX];
+ bits &= TEXT_ALIGN_MASK;
+ bits >>= TEXT_ALIGN_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_text_align(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TEXT_ALIGN_INDEX];
@@ -1862,9 +2746,18 @@ static inline uint8_t get_text_align(const css_computed_style *style)
#undef TEXT_ALIGN_SHIFT
#undef TEXT_ALIGN_MASK
-#define TEXT_DECORATION_INDEX 8
-#define TEXT_DECORATION_SHIFT 3
-#define TEXT_DECORATION_MASK 0xf8
+#define TEXT_DECORATION_INDEX 3
+#define TEXT_DECORATION_SHIFT 0
+#define TEXT_DECORATION_MASK 0x1f
+static inline uint8_t get_text_decoration_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TEXT_DECORATION_INDEX];
+ bits &= TEXT_DECORATION_MASK;
+ bits >>= TEXT_DECORATION_SHIFT;
+
+ /* 5bits: ttttt : type */
+ return (bits & 0x1f);
+}
static inline uint8_t get_text_decoration(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TEXT_DECORATION_INDEX];
@@ -1879,9 +2772,18 @@ static inline uint8_t get_text_decoration(const css_computed_style *style)
#undef TEXT_DECORATION_SHIFT
#undef TEXT_DECORATION_MASK
-#define TEXT_INDENT_INDEX 3
-#define TEXT_INDENT_SHIFT 5
-#define TEXT_INDENT_MASK 0x7e0
+#define TEXT_INDENT_INDEX 2
+#define TEXT_INDENT_SHIFT 0
+#define TEXT_INDENT_MASK 0x3f
+static inline uint8_t get_text_indent_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TEXT_INDENT_INDEX];
+ bits &= TEXT_INDENT_MASK;
+ bits >>= TEXT_INDENT_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_text_indent(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1901,9 +2803,18 @@ static inline uint8_t get_text_indent(const css_computed_style *style,
#undef TEXT_INDENT_SHIFT
#undef TEXT_INDENT_MASK
-#define TEXT_TRANSFORM_INDEX 13
-#define TEXT_TRANSFORM_SHIFT 13
-#define TEXT_TRANSFORM_MASK 0xe000
+#define TEXT_TRANSFORM_INDEX 9
+#define TEXT_TRANSFORM_SHIFT 0
+#define TEXT_TRANSFORM_MASK 0x7
+static inline uint8_t get_text_transform_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TEXT_TRANSFORM_INDEX];
+ bits &= TEXT_TRANSFORM_MASK;
+ bits >>= TEXT_TRANSFORM_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_text_transform(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TEXT_TRANSFORM_INDEX];
@@ -1918,42 +2829,49 @@ static inline uint8_t get_text_transform(const css_computed_style *style)
#undef TEXT_TRANSFORM_SHIFT
#undef TEXT_TRANSFORM_MASK
-#define TOP_INDEX 7
-#define TOP_SHIFT 25
-#define TOP_MASK 0xfe000000
-static inline uint8_t get_top(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
+#define TOP_INDEX 4
+#define TOP_SHIFT 18
+#define TOP_MASK 0x1fc0000
+static inline uint8_t get_top_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TOP_INDEX];
bits &= TOP_MASK;
bits >>= TOP_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_TOP_SET) {
- *length = style->i.top;
- *unit = bits >> 2;
- }
-
+
+ /* 7bits: uuuuutt : unit | type */
return (bits & 0x3);
}
-static inline uint8_t get_top_bits(
- const css_computed_style *style)
+static inline uint8_t get_top(const css_computed_style *style, css_fixed
+ *length, css_unit *unit)
{
uint32_t bits = style->i.bits[TOP_INDEX];
bits &= TOP_MASK;
bits >>= TOP_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
+
+ /* 7bits: uuuuutt : unit | type */
+ if ((bits & 0x3) == CSS_TOP_SET) {
+ *length = style->i.top;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
}
#undef TOP_INDEX
#undef TOP_SHIFT
#undef TOP_MASK
-#define UNICODE_BIDI_INDEX 11
-#define UNICODE_BIDI_SHIFT 2
-#define UNICODE_BIDI_MASK 0xc
+#define UNICODE_BIDI_INDEX 10
+#define UNICODE_BIDI_SHIFT 12
+#define UNICODE_BIDI_MASK 0x3000
+static inline uint8_t get_unicode_bidi_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[UNICODE_BIDI_INDEX];
+ bits &= UNICODE_BIDI_MASK;
+ bits >>= UNICODE_BIDI_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_unicode_bidi(const css_computed_style *style)
{
uint32_t bits = style->i.bits[UNICODE_BIDI_INDEX];
@@ -1968,9 +2886,18 @@ static inline uint8_t get_unicode_bidi(const css_computed_style *style)
#undef UNICODE_BIDI_SHIFT
#undef UNICODE_BIDI_MASK
-#define VERTICAL_ALIGN_INDEX 1
-#define VERTICAL_ALIGN_SHIFT 23
-#define VERTICAL_ALIGN_MASK 0xff800000
+#define VERTICAL_ALIGN_INDEX 12
+#define VERTICAL_ALIGN_SHIFT 1
+#define VERTICAL_ALIGN_MASK 0x3fe
+static inline uint8_t get_vertical_align_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[VERTICAL_ALIGN_INDEX];
+ bits &= VERTICAL_ALIGN_MASK;
+ bits >>= VERTICAL_ALIGN_SHIFT;
+
+ /* 9bits: uuuuutttt : unit | type */
+ return (bits & 0xf);
+}
static inline uint8_t get_vertical_align(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1990,9 +2917,18 @@ static inline uint8_t get_vertical_align(const css_computed_style *style,
#undef VERTICAL_ALIGN_SHIFT
#undef VERTICAL_ALIGN_MASK
-#define VISIBILITY_INDEX 11
-#define VISIBILITY_SHIFT 0
-#define VISIBILITY_MASK 0x3
+#define VISIBILITY_INDEX 10
+#define VISIBILITY_SHIFT 14
+#define VISIBILITY_MASK 0xc000
+static inline uint8_t get_visibility_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[VISIBILITY_INDEX];
+ bits &= VISIBILITY_MASK;
+ bits >>= VISIBILITY_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_visibility(const css_computed_style *style)
{
uint32_t bits = style->i.bits[VISIBILITY_INDEX];
@@ -2007,9 +2943,18 @@ static inline uint8_t get_visibility(const css_computed_style *style)
#undef VISIBILITY_SHIFT
#undef VISIBILITY_MASK
-#define WHITE_SPACE_INDEX 13
-#define WHITE_SPACE_SHIFT 19
-#define WHITE_SPACE_MASK 0x380000
+#define WHITE_SPACE_INDEX 8
+#define WHITE_SPACE_SHIFT 0
+#define WHITE_SPACE_MASK 0x7
+static inline uint8_t get_white_space_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WHITE_SPACE_INDEX];
+ bits &= WHITE_SPACE_MASK;
+ bits >>= WHITE_SPACE_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_white_space(const css_computed_style *style)
{
uint32_t bits = style->i.bits[WHITE_SPACE_INDEX];
@@ -2024,9 +2969,18 @@ static inline uint8_t get_white_space(const css_computed_style *style)
#undef WHITE_SPACE_SHIFT
#undef WHITE_SPACE_MASK
-#define WIDOWS_INDEX 14
-#define WIDOWS_SHIFT 26
-#define WIDOWS_MASK 0x4000000
+#define WIDOWS_INDEX 12
+#define WIDOWS_SHIFT 0
+#define WIDOWS_MASK 0x1
+static inline uint8_t get_widows_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WIDOWS_INDEX];
+ bits &= WIDOWS_MASK;
+ bits >>= WIDOWS_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_widows(const css_computed_style *style, int32_t
*integer)
{
@@ -2043,9 +2997,18 @@ static inline uint8_t get_widows(const css_computed_style *style, int32_t
#undef WIDOWS_SHIFT
#undef WIDOWS_MASK
-#define WIDTH_INDEX 3
-#define WIDTH_SHIFT 11
-#define WIDTH_MASK 0x3f800
+#define WIDTH_INDEX 4
+#define WIDTH_SHIFT 25
+#define WIDTH_MASK 0xfe000000
+static inline uint8_t get_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WIDTH_INDEX];
+ bits &= WIDTH_MASK;
+ bits >>= WIDTH_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_width(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -2065,9 +3028,18 @@ static inline uint8_t get_width(const css_computed_style *style, css_fixed
#undef WIDTH_SHIFT
#undef WIDTH_MASK
-#define WORD_SPACING_INDEX 5
-#define WORD_SPACING_SHIFT 4
-#define WORD_SPACING_MASK 0x7f0
+#define WORD_SPACING_INDEX 1
+#define WORD_SPACING_SHIFT 0
+#define WORD_SPACING_MASK 0x7f
+static inline uint8_t get_word_spacing_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WORD_SPACING_INDEX];
+ bits &= WORD_SPACING_MASK;
+ bits >>= WORD_SPACING_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_word_spacing(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -2087,9 +3059,18 @@ static inline uint8_t get_word_spacing(const css_computed_style *style,
#undef WORD_SPACING_SHIFT
#undef WORD_SPACING_MASK
-#define WRITING_MODE_INDEX 14
-#define WRITING_MODE_SHIFT 30
-#define WRITING_MODE_MASK 0xc0000000
+#define WRITING_MODE_INDEX 10
+#define WRITING_MODE_SHIFT 16
+#define WRITING_MODE_MASK 0x30000
+static inline uint8_t get_writing_mode_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WRITING_MODE_INDEX];
+ bits &= WRITING_MODE_MASK;
+ bits >>= WRITING_MODE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_writing_mode(const css_computed_style *style)
{
uint32_t bits = style->i.bits[WRITING_MODE_INDEX];
@@ -2105,8 +3086,17 @@ static inline uint8_t get_writing_mode(const css_computed_style *style)
#undef WRITING_MODE_MASK
#define Z_INDEX_INDEX 10
-#define Z_INDEX_SHIFT 8
-#define Z_INDEX_MASK 0x300
+#define Z_INDEX_SHIFT 18
+#define Z_INDEX_MASK 0xc0000
+static inline uint8_t get_z_index_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[Z_INDEX_INDEX];
+ bits &= Z_INDEX_MASK;
+ bits >>= Z_INDEX_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_z_index(const css_computed_style *style, int32_t
*integer)
{
diff --git a/src/select/autogenerated_propset.h b/src/select/autogenerated_propset.h
index 56ff7c6..198bc1e 100644
--- a/src/select/autogenerated_propset.h
+++ b/src/select/autogenerated_propset.h
@@ -9,15 +9,13 @@
* in which case it is 'inherit'. */
#define ALIGN_CONTENT_INDEX 10
-#define ALIGN_CONTENT_SHIFT 29
-#define ALIGN_CONTENT_MASK 0xe0000000
+#define ALIGN_CONTENT_SHIFT 20
+#define ALIGN_CONTENT_MASK 0x700000
static inline css_error set_align_content(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ALIGN_CONTENT_INDEX];
+ uint32_t *bits = &style->i.bits[ALIGN_CONTENT_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~ALIGN_CONTENT_MASK) | (((uint32_t)type & 0x7) <<
@@ -30,14 +28,12 @@ static inline css_error set_align_content(css_computed_style *style, uint8_t
#undef ALIGN_CONTENT_MASK
#define ALIGN_ITEMS_INDEX 10
-#define ALIGN_ITEMS_SHIFT 26
-#define ALIGN_ITEMS_MASK 0x1c000000
+#define ALIGN_ITEMS_SHIFT 23
+#define ALIGN_ITEMS_MASK 0x3800000
static inline css_error set_align_items(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ALIGN_ITEMS_INDEX];
+ uint32_t *bits = &style->i.bits[ALIGN_ITEMS_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~ALIGN_ITEMS_MASK) | (((uint32_t)type & 0x7) <<
@@ -50,14 +46,12 @@ static inline css_error set_align_items(css_computed_style *style, uint8_t type)
#undef ALIGN_ITEMS_MASK
#define ALIGN_SELF_INDEX 10
-#define ALIGN_SELF_SHIFT 23
-#define ALIGN_SELF_MASK 0x3800000
+#define ALIGN_SELF_SHIFT 26
+#define ALIGN_SELF_MASK 0x1c000000
static inline css_error set_align_self(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ALIGN_SELF_INDEX];
+ uint32_t *bits = &style->i.bits[ALIGN_SELF_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~ALIGN_SELF_MASK) | (((uint32_t)type & 0x7) <<
@@ -69,16 +63,14 @@ static inline css_error set_align_self(css_computed_style *style, uint8_t type)
#undef ALIGN_SELF_SHIFT
#undef ALIGN_SELF_MASK
-#define BACKGROUND_ATTACHMENT_INDEX 11
-#define BACKGROUND_ATTACHMENT_SHIFT 26
-#define BACKGROUND_ATTACHMENT_MASK 0xc000000
+#define BACKGROUND_ATTACHMENT_INDEX 14
+#define BACKGROUND_ATTACHMENT_SHIFT 28
+#define BACKGROUND_ATTACHMENT_MASK 0x30000000
static inline css_error set_background_attachment(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BACKGROUND_ATTACHMENT_MASK) | (((uint32_t)type & 0x3)
@@ -90,16 +82,14 @@ static inline css_error set_background_attachment(css_computed_style *style,
#undef BACKGROUND_ATTACHMENT_SHIFT
#undef BACKGROUND_ATTACHMENT_MASK
-#define BACKGROUND_COLOR_INDEX 11
-#define BACKGROUND_COLOR_SHIFT 22
-#define BACKGROUND_COLOR_MASK 0xc00000
+#define BACKGROUND_COLOR_INDEX 14
+#define BACKGROUND_COLOR_SHIFT 30
+#define BACKGROUND_COLOR_MASK 0xc0000000
static inline css_error set_background_color(css_computed_style *style, uint8_t
type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BACKGROUND_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -114,15 +104,13 @@ static inline css_error set_background_color(css_computed_style *style, uint8_t
#undef BACKGROUND_COLOR_MASK
#define BACKGROUND_IMAGE_INDEX 14
-#define BACKGROUND_IMAGE_SHIFT 23
-#define BACKGROUND_IMAGE_MASK 0x800000
+#define BACKGROUND_IMAGE_SHIFT 16
+#define BACKGROUND_IMAGE_MASK 0x10000
static inline css_error set_background_image(css_computed_style *style, uint8_t
type, lwc_string *string)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_IMAGE_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_IMAGE_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~BACKGROUND_IMAGE_MASK) | (((uint32_t)type & 0x1) <<
@@ -153,9 +141,7 @@ static inline css_error set_background_position(css_computed_style *style,
uint8_t type, css_fixed length_a, css_unit unit_a, css_fixed
length_b, css_unit unit_b)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_POSITION_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_POSITION_INDEX];
/* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
*bits = (*bits & ~BACKGROUND_POSITION_MASK) | ((((uint32_t)type & 0x1)
@@ -172,16 +158,14 @@ static inline css_error set_background_position(css_computed_style *style,
#undef BACKGROUND_POSITION_SHIFT
#undef BACKGROUND_POSITION_MASK
-#define BACKGROUND_REPEAT_INDEX 13
-#define BACKGROUND_REPEAT_SHIFT 22
-#define BACKGROUND_REPEAT_MASK 0x1c00000
+#define BACKGROUND_REPEAT_INDEX 10
+#define BACKGROUND_REPEAT_SHIFT 29
+#define BACKGROUND_REPEAT_MASK 0xe0000000
static inline css_error set_background_repeat(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_REPEAT_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_REPEAT_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~BACKGROUND_REPEAT_MASK) | (((uint32_t)type & 0x7) <<
@@ -193,16 +177,14 @@ static inline css_error set_background_repeat(css_computed_style *style,
#undef BACKGROUND_REPEAT_SHIFT
#undef BACKGROUND_REPEAT_MASK
-#define BORDER_BOTTOM_COLOR_INDEX 10
-#define BORDER_BOTTOM_COLOR_SHIFT 18
-#define BORDER_BOTTOM_COLOR_MASK 0xc0000
+#define BORDER_BOTTOM_COLOR_INDEX 11
+#define BORDER_BOTTOM_COLOR_SHIFT 0
+#define BORDER_BOTTOM_COLOR_MASK 0x3
static inline css_error set_border_bottom_color(css_computed_style *style,
uint8_t type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_BOTTOM_COLOR_MASK) | (((uint32_t)type & 0x3)
@@ -216,16 +198,14 @@ static inline css_error set_border_bottom_color(css_computed_style *style,
#undef BORDER_BOTTOM_COLOR_SHIFT
#undef BORDER_BOTTOM_COLOR_MASK
-#define BORDER_BOTTOM_STYLE_INDEX 6
-#define BORDER_BOTTOM_STYLE_SHIFT 0
-#define BORDER_BOTTOM_STYLE_MASK 0xf
+#define BORDER_BOTTOM_STYLE_INDEX 13
+#define BORDER_BOTTOM_STYLE_SHIFT 28
+#define BORDER_BOTTOM_STYLE_MASK 0xf0000000
static inline css_error set_border_bottom_style(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BORDER_BOTTOM_STYLE_MASK) | (((uint32_t)type & 0xf)
@@ -238,15 +218,13 @@ static inline css_error set_border_bottom_style(css_computed_style *style,
#undef BORDER_BOTTOM_STYLE_MASK
#define BORDER_BOTTOM_WIDTH_INDEX 0
-#define BORDER_BOTTOM_WIDTH_SHIFT 8
-#define BORDER_BOTTOM_WIDTH_MASK 0xff00
+#define BORDER_BOTTOM_WIDTH_SHIFT 0
+#define BORDER_BOTTOM_WIDTH_MASK 0xff
static inline css_error set_border_bottom_width(css_computed_style *style,
uint8_t type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~BORDER_BOTTOM_WIDTH_MASK) | ((((uint32_t)type & 0x7)
@@ -261,15 +239,13 @@ static inline css_error set_border_bottom_width(css_computed_style *style,
#undef BORDER_BOTTOM_WIDTH_MASK
#define BORDER_COLLAPSE_INDEX 11
-#define BORDER_COLLAPSE_SHIFT 14
-#define BORDER_COLLAPSE_MASK 0xc000
+#define BORDER_COLLAPSE_SHIFT 2
+#define BORDER_COLLAPSE_MASK 0xc
static inline css_error set_border_collapse(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_COLLAPSE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_COLLAPSE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_COLLAPSE_MASK) | (((uint32_t)type & 0x3) <<
@@ -281,16 +257,14 @@ static inline css_error set_border_collapse(css_computed_style *style, uint8_t
#undef BORDER_COLLAPSE_SHIFT
#undef BORDER_COLLAPSE_MASK
-#define BORDER_LEFT_COLOR_INDEX 10
-#define BORDER_LEFT_COLOR_SHIFT 2
-#define BORDER_LEFT_COLOR_MASK 0xc
+#define BORDER_LEFT_COLOR_INDEX 11
+#define BORDER_LEFT_COLOR_SHIFT 4
+#define BORDER_LEFT_COLOR_MASK 0x30
static inline css_error set_border_left_color(css_computed_style *style,
uint8_t type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_LEFT_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -305,15 +279,13 @@ static inline css_error set_border_left_color(css_computed_style *style,
#undef BORDER_LEFT_COLOR_MASK
#define BORDER_LEFT_STYLE_INDEX 9
-#define BORDER_LEFT_STYLE_SHIFT 19
-#define BORDER_LEFT_STYLE_MASK 0x780000
+#define BORDER_LEFT_STYLE_SHIFT 3
+#define BORDER_LEFT_STYLE_MASK 0x78
static inline css_error set_border_left_style(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BORDER_LEFT_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -326,15 +298,13 @@ static inline css_error set_border_left_style(css_computed_style *style,
#undef BORDER_LEFT_STYLE_MASK
#define BORDER_LEFT_WIDTH_INDEX 0
-#define BORDER_LEFT_WIDTH_SHIFT 24
-#define BORDER_LEFT_WIDTH_MASK 0xff000000
+#define BORDER_LEFT_WIDTH_SHIFT 8
+#define BORDER_LEFT_WIDTH_MASK 0xff00
static inline css_error set_border_left_width(css_computed_style *style,
uint8_t type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~BORDER_LEFT_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -349,15 +319,13 @@ static inline css_error set_border_left_width(css_computed_style *style,
#undef BORDER_LEFT_WIDTH_MASK
#define BORDER_RIGHT_COLOR_INDEX 11
-#define BORDER_RIGHT_COLOR_SHIFT 12
-#define BORDER_RIGHT_COLOR_MASK 0x3000
+#define BORDER_RIGHT_COLOR_SHIFT 6
+#define BORDER_RIGHT_COLOR_MASK 0xc0
static inline css_error set_border_right_color(css_computed_style *style,
uint8_t type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_RIGHT_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -371,16 +339,14 @@ static inline css_error set_border_right_color(css_computed_style *style,
#undef BORDER_RIGHT_COLOR_SHIFT
#undef BORDER_RIGHT_COLOR_MASK
-#define BORDER_RIGHT_STYLE_INDEX 13
-#define BORDER_RIGHT_STYLE_SHIFT 28
-#define BORDER_RIGHT_STYLE_MASK 0xf0000000
+#define BORDER_RIGHT_STYLE_INDEX 9
+#define BORDER_RIGHT_STYLE_SHIFT 7
+#define BORDER_RIGHT_STYLE_MASK 0x780
static inline css_error set_border_right_style(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BORDER_RIGHT_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -393,15 +359,13 @@ static inline css_error set_border_right_style(css_computed_style *style,
#undef BORDER_RIGHT_STYLE_MASK
#define BORDER_RIGHT_WIDTH_INDEX 0
-#define BORDER_RIGHT_WIDTH_SHIFT 0
-#define BORDER_RIGHT_WIDTH_MASK 0xff
+#define BORDER_RIGHT_WIDTH_SHIFT 16
+#define BORDER_RIGHT_WIDTH_MASK 0xff0000
static inline css_error set_border_right_width(css_computed_style *style,
uint8_t type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~BORDER_RIGHT_WIDTH_MASK) | ((((uint32_t)type & 0x7) |
@@ -423,9 +387,7 @@ static inline css_error set_border_spacing(css_computed_style *style, uint8_t
type, css_fixed length_a, css_unit unit_a, css_fixed length_b,
css_unit unit_b)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_SPACING_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_SPACING_INDEX];
/* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
*bits = (*bits & ~BORDER_SPACING_MASK) | ((((uint32_t)type & 0x1) | (
@@ -442,15 +404,13 @@ static inline css_error set_border_spacing(css_computed_style *style, uint8_t
#undef BORDER_SPACING_MASK
#define BORDER_TOP_COLOR_INDEX 11
-#define BORDER_TOP_COLOR_SHIFT 16
-#define BORDER_TOP_COLOR_MASK 0x30000
+#define BORDER_TOP_COLOR_SHIFT 8
+#define BORDER_TOP_COLOR_MASK 0x300
static inline css_error set_border_top_color(css_computed_style *style, uint8_t
type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_TOP_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_TOP_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_TOP_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -464,16 +424,14 @@ static inline css_error set_border_top_color(css_computed_style *style, uint8_t
#undef BORDER_TOP_COLOR_SHIFT
#undef BORDER_TOP_COLOR_MASK
-#define BORDER_TOP_STYLE_INDEX 7
-#define BORDER_TOP_STYLE_SHIFT 0
-#define BORDER_TOP_STYLE_MASK 0xf
+#define BORDER_TOP_STYLE_INDEX 9
+#define BORDER_TOP_STYLE_SHIFT 11
+#define BORDER_TOP_STYLE_MASK 0x7800
static inline css_error set_border_top_style(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_TOP_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_TOP_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BORDER_TOP_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -486,15 +444,13 @@ static inline css_error set_border_top_style(css_computed_style *style, uint8_t
#undef BORDER_TOP_STYLE_MASK
#define BORDER_TOP_WIDTH_INDEX 0
-#define BORDER_TOP_WIDTH_SHIFT 16
-#define BORDER_TOP_WIDTH_MASK 0xff0000
+#define BORDER_TOP_WIDTH_SHIFT 24
+#define BORDER_TOP_WIDTH_MASK 0xff000000
static inline css_error set_border_top_width(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~BORDER_TOP_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -508,16 +464,14 @@ static inline css_error set_border_top_width(css_computed_style *style, uint8_t
#undef BORDER_TOP_WIDTH_SHIFT
#undef BORDER_TOP_WIDTH_MASK
-#define BOTTOM_INDEX 7
+#define BOTTOM_INDEX 3
#define BOTTOM_SHIFT 11
#define BOTTOM_MASK 0x3f800
static inline css_error set_bottom(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BOTTOM_INDEX];
+ uint32_t *bits = &style->i.bits[BOTTOM_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~BOTTOM_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -531,15 +485,13 @@ static inline css_error set_bottom(css_computed_style *style, uint8_t type,
#undef BOTTOM_SHIFT
#undef BOTTOM_MASK
-#define BOX_SIZING_INDEX 10
-#define BOX_SIZING_SHIFT 12
-#define BOX_SIZING_MASK 0x3000
+#define BOX_SIZING_INDEX 11
+#define BOX_SIZING_SHIFT 10
+#define BOX_SIZING_MASK 0xc00
static inline css_error set_box_sizing(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BOX_SIZING_INDEX];
+ uint32_t *bits = &style->i.bits[BOX_SIZING_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BOX_SIZING_MASK) | (((uint32_t)type & 0x3) <<
@@ -552,14 +504,12 @@ static inline css_error set_box_sizing(css_computed_style *style, uint8_t type)
#undef BOX_SIZING_MASK
#define BREAK_AFTER_INDEX 9
-#define BREAK_AFTER_SHIFT 11
-#define BREAK_AFTER_MASK 0x7800
+#define BREAK_AFTER_SHIFT 15
+#define BREAK_AFTER_MASK 0x78000
static inline css_error set_break_after(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BREAK_AFTER_INDEX];
+ uint32_t *bits = &style->i.bits[BREAK_AFTER_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BREAK_AFTER_MASK) | (((uint32_t)type & 0xf) <<
@@ -572,15 +522,13 @@ static inline css_error set_break_after(css_computed_style *style, uint8_t type)
#undef BREAK_AFTER_MASK
#define BREAK_BEFORE_INDEX 9
-#define BREAK_BEFORE_SHIFT 23
-#define BREAK_BEFORE_MASK 0x7800000
+#define BREAK_BEFORE_SHIFT 19
+#define BREAK_BEFORE_MASK 0x780000
static inline css_error set_break_before(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BREAK_BEFORE_INDEX];
+ uint32_t *bits = &style->i.bits[BREAK_BEFORE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BREAK_BEFORE_MASK) | (((uint32_t)type & 0xf) <<
@@ -592,16 +540,14 @@ static inline css_error set_break_before(css_computed_style *style, uint8_t
#undef BREAK_BEFORE_SHIFT
#undef BREAK_BEFORE_MASK
-#define BREAK_INSIDE_INDEX 5
-#define BREAK_INSIDE_SHIFT 0
-#define BREAK_INSIDE_MASK 0xf
+#define BREAK_INSIDE_INDEX 9
+#define BREAK_INSIDE_SHIFT 23
+#define BREAK_INSIDE_MASK 0x7800000
static inline css_error set_break_inside(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BREAK_INSIDE_INDEX];
+ uint32_t *bits = &style->i.bits[BREAK_INSIDE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BREAK_INSIDE_MASK) | (((uint32_t)type & 0xf) <<
@@ -614,15 +560,13 @@ static inline css_error set_break_inside(css_computed_style *style, uint8_t
#undef BREAK_INSIDE_MASK
#define CAPTION_SIDE_INDEX 11
-#define CAPTION_SIDE_SHIFT 4
-#define CAPTION_SIDE_MASK 0x30
+#define CAPTION_SIDE_SHIFT 12
+#define CAPTION_SIDE_MASK 0x3000
static inline css_error set_caption_side(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[CAPTION_SIDE_INDEX];
+ uint32_t *bits = &style->i.bits[CAPTION_SIDE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~CAPTION_SIDE_MASK) | (((uint32_t)type & 0x3) <<
@@ -635,14 +579,12 @@ static inline css_error set_caption_side(css_computed_style *style, uint8_t
#undef CAPTION_SIDE_MASK
#define CLEAR_INDEX 13
-#define CLEAR_SHIFT 10
-#define CLEAR_MASK 0x1c00
+#define CLEAR_SHIFT 1
+#define CLEAR_MASK 0xe
static inline css_error set_clear(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[CLEAR_INDEX];
+ uint32_t *bits = &style->i.bits[CLEAR_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~CLEAR_MASK) | (((uint32_t)type & 0x7) << CLEAR_SHIFT);
@@ -697,15 +639,13 @@ static inline css_error set_clip(
#undef CLIP_MASK
#define COLOR_INDEX 14
-#define COLOR_SHIFT 18
-#define COLOR_MASK 0x40000
+#define COLOR_SHIFT 17
+#define COLOR_MASK 0x20000
static inline css_error set_color(css_computed_style *style, uint8_t type,
css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[COLOR_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~COLOR_MASK) | (((uint32_t)type & 0x1) << COLOR_SHIFT);
@@ -718,16 +658,14 @@ static inline css_error set_color(css_computed_style *style, uint8_t type,
#undef COLOR_SHIFT
#undef COLOR_MASK
-#define COLUMN_COUNT_INDEX 10
-#define COLUMN_COUNT_SHIFT 0
-#define COLUMN_COUNT_MASK 0x3
+#define COLUMN_COUNT_INDEX 11
+#define COLUMN_COUNT_SHIFT 14
+#define COLUMN_COUNT_MASK 0xc000
static inline css_error set_column_count(css_computed_style *style, uint8_t
type, int32_t integer)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_COUNT_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_COUNT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~COLUMN_COUNT_MASK) | (((uint32_t)type & 0x3) <<
@@ -742,14 +680,12 @@ static inline css_error set_column_count(css_computed_style *style, uint8_t
#undef COLUMN_COUNT_MASK
#define COLUMN_FILL_INDEX 11
-#define COLUMN_FILL_SHIFT 8
-#define COLUMN_FILL_MASK 0x300
+#define COLUMN_FILL_SHIFT 16
+#define COLUMN_FILL_MASK 0x30000
static inline css_error set_column_fill(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_FILL_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_FILL_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~COLUMN_FILL_MASK) | (((uint32_t)type & 0x3) <<
@@ -761,16 +697,14 @@ static inline css_error set_column_fill(css_computed_style *style, uint8_t type)
#undef COLUMN_FILL_SHIFT
#undef COLUMN_FILL_MASK
-#define COLUMN_GAP_INDEX 4
-#define COLUMN_GAP_SHIFT 11
-#define COLUMN_GAP_MASK 0x3f800
+#define COLUMN_GAP_INDEX 3
+#define COLUMN_GAP_SHIFT 18
+#define COLUMN_GAP_MASK 0x1fc0000
static inline css_error set_column_gap(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_GAP_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_GAP_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~COLUMN_GAP_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -784,16 +718,14 @@ static inline css_error set_column_gap(css_computed_style *style, uint8_t type,
#undef COLUMN_GAP_SHIFT
#undef COLUMN_GAP_MASK
-#define COLUMN_RULE_COLOR_INDEX 10
-#define COLUMN_RULE_COLOR_SHIFT 16
-#define COLUMN_RULE_COLOR_MASK 0x30000
+#define COLUMN_RULE_COLOR_INDEX 11
+#define COLUMN_RULE_COLOR_SHIFT 18
+#define COLUMN_RULE_COLOR_MASK 0xc0000
static inline css_error set_column_rule_color(css_computed_style *style,
uint8_t type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_RULE_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_RULE_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~COLUMN_RULE_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -807,16 +739,14 @@ static inline css_error set_column_rule_color(css_computed_style *style,
#undef COLUMN_RULE_COLOR_SHIFT
#undef COLUMN_RULE_COLOR_MASK
-#define COLUMN_RULE_STYLE_INDEX 9
-#define COLUMN_RULE_STYLE_SHIFT 3
-#define COLUMN_RULE_STYLE_MASK 0x78
+#define COLUMN_RULE_STYLE_INDEX 7
+#define COLUMN_RULE_STYLE_SHIFT 0
+#define COLUMN_RULE_STYLE_MASK 0xf
static inline css_error set_column_rule_style(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_RULE_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_RULE_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~COLUMN_RULE_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -835,9 +765,7 @@ static inline css_error set_column_rule_style(css_computed_style *style,
static inline css_error set_column_rule_width(css_computed_style *style,
uint8_t type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_RULE_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_RULE_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -851,15 +779,13 @@ static inline css_error set_column_rule_width(css_computed_style *style,
#undef COLUMN_RULE_WIDTH_SHIFT
#undef COLUMN_RULE_WIDTH_MASK
-#define COLUMN_SPAN_INDEX 10
-#define COLUMN_SPAN_SHIFT 10
-#define COLUMN_SPAN_MASK 0xc00
+#define COLUMN_SPAN_INDEX 11
+#define COLUMN_SPAN_SHIFT 20
+#define COLUMN_SPAN_MASK 0x300000
static inline css_error set_column_span(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_SPAN_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_SPAN_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~COLUMN_SPAN_MASK) | (((uint32_t)type & 0x3) <<
@@ -871,16 +797,14 @@ static inline css_error set_column_span(css_computed_style *style, uint8_t type)
#undef COLUMN_SPAN_SHIFT
#undef COLUMN_SPAN_MASK
-#define COLUMN_WIDTH_INDEX 5
+#define COLUMN_WIDTH_INDEX 3
#define COLUMN_WIDTH_SHIFT 25
#define COLUMN_WIDTH_MASK 0xfe000000
static inline css_error set_column_width(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_WIDTH_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~COLUMN_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -895,8 +819,8 @@ static inline css_error set_column_width(css_computed_style *style, uint8_t
#undef COLUMN_WIDTH_MASK
#define CONTENT_INDEX 11
-#define CONTENT_SHIFT 18
-#define CONTENT_MASK 0xc0000
+#define CONTENT_SHIFT 22
+#define CONTENT_MASK 0xc00000
static inline css_error set_content(
css_computed_style *style, uint8_t type,
css_computed_content_item *content)
@@ -978,15 +902,13 @@ static inline css_error set_content(
#undef CONTENT_MASK
#define COUNTER_INCREMENT_INDEX 14
-#define COUNTER_INCREMENT_SHIFT 20
-#define COUNTER_INCREMENT_MASK 0x100000
+#define COUNTER_INCREMENT_SHIFT 18
+#define COUNTER_INCREMENT_MASK 0x40000
static inline css_error set_counter_increment(css_computed_style *style,
uint8_t type, css_computed_counter *counter_arr)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COUNTER_INCREMENT_INDEX];
+ uint32_t *bits = &style->i.bits[COUNTER_INCREMENT_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~COUNTER_INCREMENT_MASK) | (((uint32_t)type & 0x1) <<
@@ -1016,15 +938,13 @@ static inline css_error set_counter_increment(css_computed_style *style,
#undef COUNTER_INCREMENT_MASK
#define COUNTER_RESET_INDEX 14
-#define COUNTER_RESET_SHIFT 25
-#define COUNTER_RESET_MASK 0x2000000
+#define COUNTER_RESET_SHIFT 19
+#define COUNTER_RESET_MASK 0x80000
static inline css_error set_counter_reset(css_computed_style *style, uint8_t
type, css_computed_counter *counter_arr)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COUNTER_RESET_INDEX];
+ uint32_t *bits = &style->i.bits[COUNTER_RESET_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~COUNTER_RESET_MASK) | (((uint32_t)type & 0x1) <<
@@ -1060,9 +980,7 @@ static inline css_error set_counter_reset(css_computed_style *style, uint8_t
static inline css_error set_cursor(css_computed_style *style, uint8_t type,
lwc_string **string_arr)
{
- uint32_t *bits;
-
- bits = &style->i.bits[CURSOR_INDEX];
+ uint32_t *bits = &style->i.bits[CURSOR_INDEX];
/* 5bits: ttttt : type */
*bits = (*bits & ~CURSOR_MASK) | (((uint32_t)type & 0x1f) <<
@@ -1091,15 +1009,13 @@ static inline css_error set_cursor(css_computed_style *style, uint8_t type,
#undef CURSOR_SHIFT
#undef CURSOR_MASK
-#define DIRECTION_INDEX 14
-#define DIRECTION_SHIFT 28
-#define DIRECTION_MASK 0x30000000
+#define DIRECTION_INDEX 11
+#define DIRECTION_SHIFT 24
+#define DIRECTION_MASK 0x3000000
static inline css_error set_direction(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[DIRECTION_INDEX];
+ uint32_t *bits = &style->i.bits[DIRECTION_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~DIRECTION_MASK) | (((uint32_t)type & 0x3) <<
@@ -1111,15 +1027,13 @@ static inline css_error set_direction(css_computed_style *style, uint8_t type)
#undef DIRECTION_SHIFT
#undef DIRECTION_MASK
-#define DISPLAY_INDEX 3
-#define DISPLAY_SHIFT 0
-#define DISPLAY_MASK 0x1f
+#define DISPLAY_INDEX 8
+#define DISPLAY_SHIFT 3
+#define DISPLAY_MASK 0xf8
static inline css_error set_display(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[DISPLAY_INDEX];
+ uint32_t *bits = &style->i.bits[DISPLAY_INDEX];
/* 5bits: ttttt : type */
*bits = (*bits & ~DISPLAY_MASK) | (((uint32_t)type & 0x1f) <<
@@ -1131,15 +1045,13 @@ static inline css_error set_display(css_computed_style *style, uint8_t type)
#undef DISPLAY_SHIFT
#undef DISPLAY_MASK
-#define EMPTY_CELLS_INDEX 10
-#define EMPTY_CELLS_SHIFT 4
-#define EMPTY_CELLS_MASK 0x30
+#define EMPTY_CELLS_INDEX 11
+#define EMPTY_CELLS_SHIFT 26
+#define EMPTY_CELLS_MASK 0xc000000
static inline css_error set_empty_cells(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[EMPTY_CELLS_INDEX];
+ uint32_t *bits = &style->i.bits[EMPTY_CELLS_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~EMPTY_CELLS_MASK) | (((uint32_t)type & 0x3) <<
@@ -1151,16 +1063,35 @@ static inline css_error set_empty_cells(css_computed_style *style, uint8_t type)
#undef EMPTY_CELLS_SHIFT
#undef EMPTY_CELLS_MASK
-#define FLEX_BASIS_INDEX 4
-#define FLEX_BASIS_SHIFT 25
-#define FLEX_BASIS_MASK 0xfe000000
+#define FILL_OPACITY_INDEX 14
+#define FILL_OPACITY_SHIFT 20
+#define FILL_OPACITY_MASK 0x100000
+
+static inline css_error set_fill_opacity(css_computed_style *style, uint8_t
+ type, css_fixed fixed)
+{
+ uint32_t *bits = &style->i.bits[FILL_OPACITY_INDEX];
+
+ /* 1bit: t : type */
+ *bits = (*bits & ~FILL_OPACITY_MASK) | (((uint32_t)type & 0x1) <<
+ FILL_OPACITY_SHIFT);
+
+ style->i.fill_opacity = fixed;
+
+ return CSS_OK;
+}
+#undef FILL_OPACITY_INDEX
+#undef FILL_OPACITY_SHIFT
+#undef FILL_OPACITY_MASK
+
+#define FLEX_BASIS_INDEX 7
+#define FLEX_BASIS_SHIFT 4
+#define FLEX_BASIS_MASK 0x7f0
static inline css_error set_flex_basis(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_BASIS_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_BASIS_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~FLEX_BASIS_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1175,15 +1106,13 @@ static inline css_error set_flex_basis(css_computed_style *style, uint8_t type,
#undef FLEX_BASIS_MASK
#define FLEX_DIRECTION_INDEX 13
-#define FLEX_DIRECTION_SHIFT 1
-#define FLEX_DIRECTION_MASK 0xe
+#define FLEX_DIRECTION_SHIFT 4
+#define FLEX_DIRECTION_MASK 0x70
static inline css_error set_flex_direction(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_DIRECTION_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_DIRECTION_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~FLEX_DIRECTION_MASK) | (((uint32_t)type & 0x7) <<
@@ -1195,16 +1124,14 @@ static inline css_error set_flex_direction(css_computed_style *style, uint8_t
#undef FLEX_DIRECTION_SHIFT
#undef FLEX_DIRECTION_MASK
-#define FLEX_GROW_INDEX 12
-#define FLEX_GROW_SHIFT 0
-#define FLEX_GROW_MASK 0x1
+#define FLEX_GROW_INDEX 14
+#define FLEX_GROW_SHIFT 21
+#define FLEX_GROW_MASK 0x200000
static inline css_error set_flex_grow(css_computed_style *style, uint8_t type,
css_fixed fixed)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_GROW_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_GROW_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~FLEX_GROW_MASK) | (((uint32_t)type & 0x1) <<
@@ -1225,9 +1152,7 @@ static inline css_error set_flex_grow(css_computed_style *style, uint8_t type,
static inline css_error set_flex_shrink(css_computed_style *style, uint8_t
type, css_fixed fixed)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_SHRINK_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_SHRINK_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~FLEX_SHRINK_MASK) | (((uint32_t)type & 0x1) <<
@@ -1241,15 +1166,13 @@ static inline css_error set_flex_shrink(css_computed_style *style, uint8_t
#undef FLEX_SHRINK_SHIFT
#undef FLEX_SHRINK_MASK
-#define FLEX_WRAP_INDEX 10
-#define FLEX_WRAP_SHIFT 6
-#define FLEX_WRAP_MASK 0xc0
+#define FLEX_WRAP_INDEX 11
+#define FLEX_WRAP_SHIFT 28
+#define FLEX_WRAP_MASK 0x30000000
static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_WRAP_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_WRAP_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~FLEX_WRAP_MASK) | (((uint32_t)type & 0x3) <<
@@ -1267,9 +1190,7 @@ static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type)
static inline css_error set_float(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLOAT_INDEX];
+ uint32_t *bits = &style->i.bits[FLOAT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~FLOAT_MASK) | (((uint32_t)type & 0x3) << FLOAT_SHIFT);
@@ -1280,16 +1201,14 @@ static inline css_error set_float(css_computed_style *style, uint8_t type)
#undef FLOAT_SHIFT
#undef FLOAT_MASK
-#define FONT_FAMILY_INDEX 9
-#define FONT_FAMILY_SHIFT 0
-#define FONT_FAMILY_MASK 0x7
+#define FONT_FAMILY_INDEX 13
+#define FONT_FAMILY_SHIFT 7
+#define FONT_FAMILY_MASK 0x380
static inline css_error set_font_family(css_computed_style *style, uint8_t
type, lwc_string **string_arr)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_FAMILY_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_FAMILY_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~FONT_FAMILY_MASK) | (((uint32_t)type & 0x7) <<
@@ -1318,16 +1237,14 @@ static inline css_error set_font_family(css_computed_style *style, uint8_t
#undef FONT_FAMILY_SHIFT
#undef FONT_FAMILY_MASK
-#define FONT_SIZE_INDEX 12
-#define FONT_SIZE_SHIFT 1
-#define FONT_SIZE_MASK 0x3fe
+#define FONT_SIZE_INDEX 1
+#define FONT_SIZE_SHIFT 23
+#define FONT_SIZE_MASK 0xff800000
static inline css_error set_font_size(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_SIZE_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_SIZE_INDEX];
/* 9bits: uuuuutttt : unit | type */
*bits = (*bits & ~FONT_SIZE_MASK) | ((((uint32_t)type & 0xf) | (unit <<
@@ -1341,15 +1258,13 @@ static inline css_error set_font_size(css_computed_style *style, uint8_t type,
#undef FONT_SIZE_SHIFT
#undef FONT_SIZE_MASK
-#define FONT_STYLE_INDEX 11
-#define FONT_STYLE_SHIFT 20
-#define FONT_STYLE_MASK 0x300000
+#define FONT_STYLE_INDEX 10
+#define FONT_STYLE_SHIFT 0
+#define FONT_STYLE_MASK 0x3
static inline css_error set_font_style(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_STYLE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~FONT_STYLE_MASK) | (((uint32_t)type & 0x3) <<
@@ -1361,16 +1276,14 @@ static inline css_error set_font_style(css_computed_style *style, uint8_t type)
#undef FONT_STYLE_SHIFT
#undef FONT_STYLE_MASK
-#define FONT_VARIANT_INDEX 11
-#define FONT_VARIANT_SHIFT 28
-#define FONT_VARIANT_MASK 0x30000000
+#define FONT_VARIANT_INDEX 10
+#define FONT_VARIANT_SHIFT 2
+#define FONT_VARIANT_MASK 0xc
static inline css_error set_font_variant(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_VARIANT_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_VARIANT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~FONT_VARIANT_MASK) | (((uint32_t)type & 0x3) <<
@@ -1382,15 +1295,13 @@ static inline css_error set_font_variant(css_computed_style *style, uint8_t
#undef FONT_VARIANT_SHIFT
#undef FONT_VARIANT_MASK
-#define FONT_WEIGHT_INDEX 9
-#define FONT_WEIGHT_SHIFT 15
-#define FONT_WEIGHT_MASK 0x78000
+#define FONT_WEIGHT_INDEX 6
+#define FONT_WEIGHT_SHIFT 0
+#define FONT_WEIGHT_MASK 0xf
static inline css_error set_font_weight(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_WEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_WEIGHT_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~FONT_WEIGHT_MASK) | (((uint32_t)type & 0xf) <<
@@ -1402,16 +1313,14 @@ static inline css_error set_font_weight(css_computed_style *style, uint8_t type)
#undef FONT_WEIGHT_SHIFT
#undef FONT_WEIGHT_MASK
-#define HEIGHT_INDEX 6
-#define HEIGHT_SHIFT 25
-#define HEIGHT_MASK 0xfe000000
+#define HEIGHT_INDEX 7
+#define HEIGHT_SHIFT 11
+#define HEIGHT_MASK 0x3f800
static inline css_error set_height(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[HEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[HEIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -1426,15 +1335,13 @@ static inline css_error set_height(css_computed_style *style, uint8_t type,
#undef HEIGHT_MASK
#define JUSTIFY_CONTENT_INDEX 13
-#define JUSTIFY_CONTENT_SHIFT 4
-#define JUSTIFY_CONTENT_MASK 0x70
+#define JUSTIFY_CONTENT_SHIFT 10
+#define JUSTIFY_CONTENT_MASK 0x1c00
static inline css_error set_justify_content(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[JUSTIFY_CONTENT_INDEX];
+ uint32_t *bits = &style->i.bits[JUSTIFY_CONTENT_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~JUSTIFY_CONTENT_MASK) | (((uint32_t)type & 0x7) <<
@@ -1446,16 +1353,14 @@ static inline css_error set_justify_content(css_computed_style *style, uint8_t
#undef JUSTIFY_CONTENT_SHIFT
#undef JUSTIFY_CONTENT_MASK
-#define LEFT_INDEX 4
-#define LEFT_SHIFT 4
-#define LEFT_MASK 0x7f0
+#define LEFT_INDEX 7
+#define LEFT_SHIFT 18
+#define LEFT_MASK 0x1fc0000
static inline css_error set_left(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LEFT_INDEX];
+ uint32_t *bits = &style->i.bits[LEFT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~LEFT_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -1469,16 +1374,14 @@ static inline css_error set_left(css_computed_style *style, uint8_t type,
#undef LEFT_SHIFT
#undef LEFT_MASK
-#define LETTER_SPACING_INDEX 6
-#define LETTER_SPACING_SHIFT 18
-#define LETTER_SPACING_MASK 0x1fc0000
+#define LETTER_SPACING_INDEX 7
+#define LETTER_SPACING_SHIFT 25
+#define LETTER_SPACING_MASK 0xfe000000
static inline css_error set_letter_spacing(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LETTER_SPACING_INDEX];
+ uint32_t *bits = &style->i.bits[LETTER_SPACING_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~LETTER_SPACING_MASK) | ((((uint32_t)type & 0x3) | (
@@ -1492,16 +1395,14 @@ static inline css_error set_letter_spacing(css_computed_style *style, uint8_t
#undef LETTER_SPACING_SHIFT
#undef LETTER_SPACING_MASK
-#define LINE_HEIGHT_INDEX 5
-#define LINE_HEIGHT_SHIFT 11
-#define LINE_HEIGHT_MASK 0x3f800
+#define LINE_HEIGHT_INDEX 6
+#define LINE_HEIGHT_SHIFT 4
+#define LINE_HEIGHT_MASK 0x7f0
static inline css_error set_line_height(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LINE_HEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[LINE_HEIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~LINE_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1516,15 +1417,13 @@ static inline css_error set_line_height(css_computed_style *style, uint8_t
#undef LINE_HEIGHT_MASK
#define LIST_STYLE_IMAGE_INDEX 14
-#define LIST_STYLE_IMAGE_SHIFT 27
-#define LIST_STYLE_IMAGE_MASK 0x8000000
+#define LIST_STYLE_IMAGE_SHIFT 23
+#define LIST_STYLE_IMAGE_MASK 0x800000
static inline css_error set_list_style_image(css_computed_style *style, uint8_t
type, lwc_string *string)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX];
+ uint32_t *bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~LIST_STYLE_IMAGE_MASK) | (((uint32_t)type & 0x1) <<
@@ -1547,16 +1446,14 @@ static inline css_error set_list_style_image(css_computed_style *style, uint8_t
#undef LIST_STYLE_IMAGE_SHIFT
#undef LIST_STYLE_IMAGE_MASK
-#define LIST_STYLE_POSITION_INDEX 11
-#define LIST_STYLE_POSITION_SHIFT 6
-#define LIST_STYLE_POSITION_MASK 0xc0
+#define LIST_STYLE_POSITION_INDEX 10
+#define LIST_STYLE_POSITION_SHIFT 4
+#define LIST_STYLE_POSITION_MASK 0x30
static inline css_error set_list_style_position(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LIST_STYLE_POSITION_INDEX];
+ uint32_t *bits = &style->i.bits[LIST_STYLE_POSITION_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~LIST_STYLE_POSITION_MASK) | (((uint32_t)type & 0x3)
@@ -1569,15 +1466,13 @@ static inline css_error set_list_style_position(css_computed_style *style,
#undef LIST_STYLE_POSITION_MASK
#define LIST_STYLE_TYPE_INDEX 8
-#define LIST_STYLE_TYPE_SHIFT 26
-#define LIST_STYLE_TYPE_MASK 0xfc000000
+#define LIST_STYLE_TYPE_SHIFT 8
+#define LIST_STYLE_TYPE_MASK 0x3f00
static inline css_error set_list_style_type(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LIST_STYLE_TYPE_INDEX];
+ uint32_t *bits = &style->i.bits[LIST_STYLE_TYPE_INDEX];
/* 6bits: tttttt : type */
*bits = (*bits & ~LIST_STYLE_TYPE_MASK) | (((uint32_t)type & 0x3f) <<
@@ -1589,16 +1484,14 @@ static inline css_error set_list_style_type(css_computed_style *style, uint8_t
#undef LIST_STYLE_TYPE_SHIFT
#undef LIST_STYLE_TYPE_MASK
-#define MARGIN_BOTTOM_INDEX 5
-#define MARGIN_BOTTOM_SHIFT 18
-#define MARGIN_BOTTOM_MASK 0x1fc0000
+#define MARGIN_BOTTOM_INDEX 6
+#define MARGIN_BOTTOM_SHIFT 11
+#define MARGIN_BOTTOM_MASK 0x3f800
static inline css_error set_margin_bottom(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MARGIN_BOTTOM_INDEX];
+ uint32_t *bits = &style->i.bits[MARGIN_BOTTOM_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MARGIN_BOTTOM_MASK) | ((((uint32_t)type & 0x3) | (
@@ -1612,16 +1505,14 @@ static inline css_error set_margin_bottom(css_computed_style *style, uint8_t
#undef MARGIN_BOTTOM_SHIFT
#undef MARGIN_BOTTOM_MASK
-#define MARGIN_LEFT_INDEX 7
+#define MARGIN_LEFT_INDEX 6
#define MARGIN_LEFT_SHIFT 18
#define MARGIN_LEFT_MASK 0x1fc0000
static inline css_error set_margin_left(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MARGIN_LEFT_INDEX];
+ uint32_t *bits = &style->i.bits[MARGIN_LEFT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MARGIN_LEFT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1636,15 +1527,13 @@ static inline css_error set_margin_left(css_computed_style *style, uint8_t
#undef MARGIN_LEFT_MASK
#define MARGIN_RIGHT_INDEX 6
-#define MARGIN_RIGHT_SHIFT 4
-#define MARGIN_RIGHT_MASK 0x7f0
+#define MARGIN_RIGHT_SHIFT 25
+#define MARGIN_RIGHT_MASK 0xfe000000
static inline css_error set_margin_right(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MARGIN_RIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[MARGIN_RIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MARGIN_RIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1658,16 +1547,14 @@ static inline css_error set_margin_right(css_computed_style *style, uint8_t
#undef MARGIN_RIGHT_SHIFT
#undef MARGIN_RIGHT_MASK
-#define MARGIN_TOP_INDEX 1
-#define MARGIN_TOP_SHIFT 0
-#define MARGIN_TOP_MASK 0x7f
+#define MARGIN_TOP_INDEX 5
+#define MARGIN_TOP_SHIFT 4
+#define MARGIN_TOP_MASK 0x7f0
static inline css_error set_margin_top(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MARGIN_TOP_INDEX];
+ uint32_t *bits = &style->i.bits[MARGIN_TOP_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MARGIN_TOP_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1681,16 +1568,14 @@ static inline css_error set_margin_top(css_computed_style *style, uint8_t type,
#undef MARGIN_TOP_SHIFT
#undef MARGIN_TOP_MASK
-#define MAX_HEIGHT_INDEX 3
-#define MAX_HEIGHT_SHIFT 25
-#define MAX_HEIGHT_MASK 0xfe000000
+#define MAX_HEIGHT_INDEX 5
+#define MAX_HEIGHT_SHIFT 11
+#define MAX_HEIGHT_MASK 0x3f800
static inline css_error set_max_height(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MAX_HEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[MAX_HEIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MAX_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1704,16 +1589,14 @@ static inline css_error set_max_height(css_computed_style *style, uint8_t type,
#undef MAX_HEIGHT_SHIFT
#undef MAX_HEIGHT_MASK
-#define MAX_WIDTH_INDEX 7
-#define MAX_WIDTH_SHIFT 4
-#define MAX_WIDTH_MASK 0x7f0
+#define MAX_WIDTH_INDEX 5
+#define MAX_WIDTH_SHIFT 18
+#define MAX_WIDTH_MASK 0x1fc0000
static inline css_error set_max_width(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MAX_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[MAX_WIDTH_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MAX_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -1727,16 +1610,14 @@ static inline css_error set_max_width(css_computed_style *style, uint8_t type,
#undef MAX_WIDTH_SHIFT
#undef MAX_WIDTH_MASK
-#define MIN_HEIGHT_INDEX 4
-#define MIN_HEIGHT_SHIFT 18
-#define MIN_HEIGHT_MASK 0x1fc0000
+#define MIN_HEIGHT_INDEX 5
+#define MIN_HEIGHT_SHIFT 25
+#define MIN_HEIGHT_MASK 0xfe000000
static inline css_error set_min_height(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MIN_HEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[MIN_HEIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MIN_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1750,16 +1631,14 @@ static inline css_error set_min_height(css_computed_style *style, uint8_t type,
#undef MIN_HEIGHT_SHIFT
#undef MIN_HEIGHT_MASK
-#define MIN_WIDTH_INDEX 6
-#define MIN_WIDTH_SHIFT 11
-#define MIN_WIDTH_MASK 0x3f800
+#define MIN_WIDTH_INDEX 4
+#define MIN_WIDTH_SHIFT 4
+#define MIN_WIDTH_MASK 0x7f0
static inline css_error set_min_width(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MIN_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[MIN_WIDTH_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MIN_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -1774,15 +1653,13 @@ static inline css_error set_min_width(css_computed_style *style, uint8_t type,
#undef MIN_WIDTH_MASK
#define OPACITY_INDEX 14
-#define OPACITY_SHIFT 19
-#define OPACITY_MASK 0x80000
+#define OPACITY_SHIFT 24
+#define OPACITY_MASK 0x1000000
static inline css_error set_opacity(css_computed_style *style, uint8_t type,
css_fixed fixed)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OPACITY_INDEX];
+ uint32_t *bits = &style->i.bits[OPACITY_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~OPACITY_MASK) | (((uint32_t)type & 0x1) <<
@@ -1796,16 +1673,14 @@ static inline css_error set_opacity(css_computed_style *style, uint8_t type,
#undef OPACITY_SHIFT
#undef OPACITY_MASK
-#define ORDER_INDEX 13
-#define ORDER_SHIFT 0
-#define ORDER_MASK 0x1
+#define ORDER_INDEX 14
+#define ORDER_SHIFT 25
+#define ORDER_MASK 0x2000000
static inline css_error set_order(css_computed_style *style, uint8_t type,
int32_t integer)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ORDER_INDEX];
+ uint32_t *bits = &style->i.bits[ORDER_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~ORDER_MASK) | (((uint32_t)type & 0x1) << ORDER_SHIFT);
@@ -1819,15 +1694,13 @@ static inline css_error set_order(css_computed_style *style, uint8_t type,
#undef ORDER_MASK
#define ORPHANS_INDEX 14
-#define ORPHANS_SHIFT 24
-#define ORPHANS_MASK 0x1000000
+#define ORPHANS_SHIFT 26
+#define ORPHANS_MASK 0x4000000
static inline css_error set_orphans(css_computed_style *style, uint8_t type,
int32_t integer)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ORPHANS_INDEX];
+ uint32_t *bits = &style->i.bits[ORPHANS_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~ORPHANS_MASK) | (((uint32_t)type & 0x1) <<
@@ -1841,16 +1714,14 @@ static inline css_error set_orphans(css_computed_style *style, uint8_t type,
#undef ORPHANS_SHIFT
#undef ORPHANS_MASK
-#define OUTLINE_COLOR_INDEX 11
-#define OUTLINE_COLOR_SHIFT 10
-#define OUTLINE_COLOR_MASK 0xc00
+#define OUTLINE_COLOR_INDEX 10
+#define OUTLINE_COLOR_SHIFT 6
+#define OUTLINE_COLOR_MASK 0xc0
static inline css_error set_outline_color(css_computed_style *style, uint8_t
type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OUTLINE_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[OUTLINE_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~OUTLINE_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -1864,16 +1735,14 @@ static inline css_error set_outline_color(css_computed_style *style, uint8_t
#undef OUTLINE_COLOR_SHIFT
#undef OUTLINE_COLOR_MASK
-#define OUTLINE_STYLE_INDEX 9
-#define OUTLINE_STYLE_SHIFT 7
-#define OUTLINE_STYLE_MASK 0x780
+#define OUTLINE_STYLE_INDEX 5
+#define OUTLINE_STYLE_SHIFT 0
+#define OUTLINE_STYLE_MASK 0xf
static inline css_error set_outline_style(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OUTLINE_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[OUTLINE_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~OUTLINE_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -1892,9 +1761,7 @@ static inline css_error set_outline_style(css_computed_style *style, uint8_t
static inline css_error set_outline_width(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OUTLINE_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[OUTLINE_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~OUTLINE_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -1909,14 +1776,12 @@ static inline css_error set_outline_width(css_computed_style *style, uint8_t
#undef OUTLINE_WIDTH_MASK
#define OVERFLOW_X_INDEX 13
-#define OVERFLOW_X_SHIFT 16
-#define OVERFLOW_X_MASK 0x70000
+#define OVERFLOW_X_SHIFT 13
+#define OVERFLOW_X_MASK 0xe000
static inline css_error set_overflow_x(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OVERFLOW_X_INDEX];
+ uint32_t *bits = &style->i.bits[OVERFLOW_X_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~OVERFLOW_X_MASK) | (((uint32_t)type & 0x7) <<
@@ -1929,14 +1794,12 @@ static inline css_error set_overflow_x(css_computed_style *style, uint8_t type)
#undef OVERFLOW_X_MASK
#define OVERFLOW_Y_INDEX 13
-#define OVERFLOW_Y_SHIFT 25
-#define OVERFLOW_Y_MASK 0xe000000
+#define OVERFLOW_Y_SHIFT 16
+#define OVERFLOW_Y_MASK 0x70000
static inline css_error set_overflow_y(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OVERFLOW_Y_INDEX];
+ uint32_t *bits = &style->i.bits[OVERFLOW_Y_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~OVERFLOW_Y_MASK) | (((uint32_t)type & 0x7) <<
@@ -1949,15 +1812,13 @@ static inline css_error set_overflow_y(css_computed_style *style, uint8_t type)
#undef OVERFLOW_Y_MASK
#define PADDING_BOTTOM_INDEX 8
-#define PADDING_BOTTOM_SHIFT 8
-#define PADDING_BOTTOM_MASK 0x3f00
+#define PADDING_BOTTOM_SHIFT 14
+#define PADDING_BOTTOM_MASK 0xfc000
static inline css_error set_padding_bottom(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PADDING_BOTTOM_INDEX];
+ uint32_t *bits = &style->i.bits[PADDING_BOTTOM_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~PADDING_BOTTOM_MASK) | ((((uint32_t)type & 0x1) | (
@@ -1971,16 +1832,14 @@ static inline css_error set_padding_bottom(css_computed_style *style, uint8_t
#undef PADDING_BOTTOM_SHIFT
#undef PADDING_BOTTOM_MASK
-#define PADDING_LEFT_INDEX 2
-#define PADDING_LEFT_SHIFT 0
-#define PADDING_LEFT_MASK 0x3f
+#define PADDING_LEFT_INDEX 8
+#define PADDING_LEFT_SHIFT 20
+#define PADDING_LEFT_MASK 0x3f00000
static inline css_error set_padding_left(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PADDING_LEFT_INDEX];
+ uint32_t *bits = &style->i.bits[PADDING_LEFT_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~PADDING_LEFT_MASK) | ((((uint32_t)type & 0x1) | (unit
@@ -1995,15 +1854,13 @@ static inline css_error set_padding_left(css_computed_style *style, uint8_t
#undef PADDING_LEFT_MASK
#define PADDING_RIGHT_INDEX 8
-#define PADDING_RIGHT_SHIFT 14
-#define PADDING_RIGHT_MASK 0xfc000
+#define PADDING_RIGHT_SHIFT 26
+#define PADDING_RIGHT_MASK 0xfc000000
static inline css_error set_padding_right(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PADDING_RIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[PADDING_RIGHT_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~PADDING_RIGHT_MASK) | ((((uint32_t)type & 0x1) | (
@@ -2017,16 +1874,14 @@ static inline css_error set_padding_right(css_computed_style *style, uint8_t
#undef PADDING_RIGHT_SHIFT
#undef PADDING_RIGHT_MASK
-#define PADDING_TOP_INDEX 8
-#define PADDING_TOP_SHIFT 20
-#define PADDING_TOP_MASK 0x3f00000
+#define PADDING_TOP_INDEX 3
+#define PADDING_TOP_SHIFT 5
+#define PADDING_TOP_MASK 0x7e0
static inline css_error set_padding_top(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PADDING_TOP_INDEX];
+ uint32_t *bits = &style->i.bits[PADDING_TOP_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~PADDING_TOP_MASK) | ((((uint32_t)type & 0x1) | (unit
@@ -2040,16 +1895,14 @@ static inline css_error set_padding_top(css_computed_style *style, uint8_t
#undef PADDING_TOP_SHIFT
#undef PADDING_TOP_MASK
-#define PAGE_BREAK_AFTER_INDEX 8
-#define PAGE_BREAK_AFTER_SHIFT 0
-#define PAGE_BREAK_AFTER_MASK 0x7
+#define PAGE_BREAK_AFTER_INDEX 13
+#define PAGE_BREAK_AFTER_SHIFT 19
+#define PAGE_BREAK_AFTER_MASK 0x380000
static inline css_error set_page_break_after(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PAGE_BREAK_AFTER_INDEX];
+ uint32_t *bits = &style->i.bits[PAGE_BREAK_AFTER_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~PAGE_BREAK_AFTER_MASK) | (((uint32_t)type & 0x7) <<
@@ -2062,15 +1915,13 @@ static inline css_error set_page_break_after(css_computed_style *style, uint8_t
#undef PAGE_BREAK_AFTER_MASK
#define PAGE_BREAK_BEFORE_INDEX 13
-#define PAGE_BREAK_BEFORE_SHIFT 7
-#define PAGE_BREAK_BEFORE_MASK 0x380
+#define PAGE_BREAK_BEFORE_SHIFT 22
+#define PAGE_BREAK_BEFORE_MASK 0x1c00000
static inline css_error set_page_break_before(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PAGE_BREAK_BEFORE_INDEX];
+ uint32_t *bits = &style->i.bits[PAGE_BREAK_BEFORE_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~PAGE_BREAK_BEFORE_MASK) | (((uint32_t)type & 0x7) <<
@@ -2082,16 +1933,14 @@ static inline css_error set_page_break_before(css_computed_style *style,
#undef PAGE_BREAK_BEFORE_SHIFT
#undef PAGE_BREAK_BEFORE_MASK
-#define PAGE_BREAK_INSIDE_INDEX 11
-#define PAGE_BREAK_INSIDE_SHIFT 24
-#define PAGE_BREAK_INSIDE_MASK 0x3000000
+#define PAGE_BREAK_INSIDE_INDEX 10
+#define PAGE_BREAK_INSIDE_SHIFT 8
+#define PAGE_BREAK_INSIDE_MASK 0x300
static inline css_error set_page_break_inside(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PAGE_BREAK_INSIDE_INDEX];
+ uint32_t *bits = &style->i.bits[PAGE_BREAK_INSIDE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~PAGE_BREAK_INSIDE_MASK) | (((uint32_t)type & 0x3) <<
@@ -2103,15 +1952,13 @@ static inline css_error set_page_break_inside(css_computed_style *style,
#undef PAGE_BREAK_INSIDE_SHIFT
#undef PAGE_BREAK_INSIDE_MASK
-#define POSITION_INDEX 10
-#define POSITION_SHIFT 20
-#define POSITION_MASK 0x700000
+#define POSITION_INDEX 13
+#define POSITION_SHIFT 25
+#define POSITION_MASK 0xe000000
static inline css_error set_position(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[POSITION_INDEX];
+ uint32_t *bits = &style->i.bits[POSITION_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~POSITION_MASK) | (((uint32_t)type & 0x7) <<
@@ -2124,15 +1971,13 @@ static inline css_error set_position(css_computed_style *style, uint8_t type)
#undef POSITION_MASK
#define QUOTES_INDEX 14
-#define QUOTES_SHIFT 21
-#define QUOTES_MASK 0x200000
+#define QUOTES_SHIFT 27
+#define QUOTES_MASK 0x8000000
static inline css_error set_quotes(css_computed_style *style, uint8_t type,
lwc_string **string_arr)
{
- uint32_t *bits;
-
- bits = &style->i.bits[QUOTES_INDEX];
+ uint32_t *bits = &style->i.bits[QUOTES_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~QUOTES_MASK) | (((uint32_t)type & 0x1) <<
@@ -2161,16 +2006,14 @@ static inline css_error set_quotes(css_computed_style *style, uint8_t type,
#undef QUOTES_SHIFT
#undef QUOTES_MASK
-#define RIGHT_INDEX 3
-#define RIGHT_SHIFT 18
-#define RIGHT_MASK 0x1fc0000
+#define RIGHT_INDEX 4
+#define RIGHT_SHIFT 11
+#define RIGHT_MASK 0x3f800
static inline css_error set_right(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[RIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[RIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~RIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -2184,16 +2027,35 @@ static inline css_error set_right(css_computed_style *style, uint8_t type,
#undef RIGHT_SHIFT
#undef RIGHT_MASK
+#define STROKE_OPACITY_INDEX 13
+#define STROKE_OPACITY_SHIFT 0
+#define STROKE_OPACITY_MASK 0x1
+
+static inline css_error set_stroke_opacity(css_computed_style *style, uint8_t
+ type, css_fixed fixed)
+{
+ uint32_t *bits = &style->i.bits[STROKE_OPACITY_INDEX];
+
+ /* 1bit: t : type */
+ *bits = (*bits & ~STROKE_OPACITY_MASK) | (((uint32_t)type & 0x1) <<
+ STROKE_OPACITY_SHIFT);
+
+ style->i.stroke_opacity = fixed;
+
+ return CSS_OK;
+}
+#undef STROKE_OPACITY_INDEX
+#undef STROKE_OPACITY_SHIFT
+#undef STROKE_OPACITY_MASK
+
#define TABLE_LAYOUT_INDEX 10
-#define TABLE_LAYOUT_SHIFT 14
-#define TABLE_LAYOUT_MASK 0xc000
+#define TABLE_LAYOUT_SHIFT 10
+#define TABLE_LAYOUT_MASK 0xc00
static inline css_error set_table_layout(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TABLE_LAYOUT_INDEX];
+ uint32_t *bits = &style->i.bits[TABLE_LAYOUT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~TABLE_LAYOUT_MASK) | (((uint32_t)type & 0x3) <<
@@ -2211,9 +2073,7 @@ static inline css_error set_table_layout(css_computed_style *style, uint8_t
static inline css_error set_text_align(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TEXT_ALIGN_INDEX];
+ uint32_t *bits = &style->i.bits[TEXT_ALIGN_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~TEXT_ALIGN_MASK) | (((uint32_t)type & 0xf) <<
@@ -2225,16 +2085,14 @@ static inline css_error set_text_align(css_computed_style *style, uint8_t type)
#undef TEXT_ALIGN_SHIFT
#undef TEXT_ALIGN_MASK
-#define TEXT_DECORATION_INDEX 8
-#define TEXT_DECORATION_SHIFT 3
-#define TEXT_DECORATION_MASK 0xf8
+#define TEXT_DECORATION_INDEX 3
+#define TEXT_DECORATION_SHIFT 0
+#define TEXT_DECORATION_MASK 0x1f
static inline css_error set_text_decoration(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TEXT_DECORATION_INDEX];
+ uint32_t *bits = &style->i.bits[TEXT_DECORATION_INDEX];
/* 5bits: ttttt : type */
*bits = (*bits & ~TEXT_DECORATION_MASK) | (((uint32_t)type & 0x1f) <<
@@ -2246,16 +2104,14 @@ static inline css_error set_text_decoration(css_computed_style *style, uint8_t
#undef TEXT_DECORATION_SHIFT
#undef TEXT_DECORATION_MASK
-#define TEXT_INDENT_INDEX 3
-#define TEXT_INDENT_SHIFT 5
-#define TEXT_INDENT_MASK 0x7e0
+#define TEXT_INDENT_INDEX 2
+#define TEXT_INDENT_SHIFT 0
+#define TEXT_INDENT_MASK 0x3f
static inline css_error set_text_indent(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TEXT_INDENT_INDEX];
+ uint32_t *bits = &style->i.bits[TEXT_INDENT_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~TEXT_INDENT_MASK) | ((((uint32_t)type & 0x1) | (unit
@@ -2269,16 +2125,14 @@ static inline css_error set_text_indent(css_computed_style *style, uint8_t
#undef TEXT_INDENT_SHIFT
#undef TEXT_INDENT_MASK
-#define TEXT_TRANSFORM_INDEX 13
-#define TEXT_TRANSFORM_SHIFT 13
-#define TEXT_TRANSFORM_MASK 0xe000
+#define TEXT_TRANSFORM_INDEX 9
+#define TEXT_TRANSFORM_SHIFT 0
+#define TEXT_TRANSFORM_MASK 0x7
static inline css_error set_text_transform(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TEXT_TRANSFORM_INDEX];
+ uint32_t *bits = &style->i.bits[TEXT_TRANSFORM_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~TEXT_TRANSFORM_MASK) | (((uint32_t)type & 0x7) <<
@@ -2290,16 +2144,14 @@ static inline css_error set_text_transform(css_computed_style *style, uint8_t
#undef TEXT_TRANSFORM_SHIFT
#undef TEXT_TRANSFORM_MASK
-#define TOP_INDEX 7
-#define TOP_SHIFT 25
-#define TOP_MASK 0xfe000000
+#define TOP_INDEX 4
+#define TOP_SHIFT 18
+#define TOP_MASK 0x1fc0000
static inline css_error set_top(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TOP_INDEX];
+ uint32_t *bits = &style->i.bits[TOP_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~TOP_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -2313,16 +2165,14 @@ static inline css_error set_top(css_computed_style *style, uint8_t type,
#undef TOP_SHIFT
#undef TOP_MASK
-#define UNICODE_BIDI_INDEX 11
-#define UNICODE_BIDI_SHIFT 2
-#define UNICODE_BIDI_MASK 0xc
+#define UNICODE_BIDI_INDEX 10
+#define UNICODE_BIDI_SHIFT 12
+#define UNICODE_BIDI_MASK 0x3000
static inline css_error set_unicode_bidi(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[UNICODE_BIDI_INDEX];
+ uint32_t *bits = &style->i.bits[UNICODE_BIDI_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~UNICODE_BIDI_MASK) | (((uint32_t)type & 0x3) <<
@@ -2334,16 +2184,14 @@ static inline css_error set_unicode_bidi(css_computed_style *style, uint8_t
#undef UNICODE_BIDI_SHIFT
#undef UNICODE_BIDI_MASK
-#define VERTICAL_ALIGN_INDEX 1
-#define VERTICAL_ALIGN_SHIFT 23
-#define VERTICAL_ALIGN_MASK 0xff800000
+#define VERTICAL_ALIGN_INDEX 12
+#define VERTICAL_ALIGN_SHIFT 1
+#define VERTICAL_ALIGN_MASK 0x3fe
static inline css_error set_vertical_align(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[VERTICAL_ALIGN_INDEX];
+ uint32_t *bits = &style->i.bits[VERTICAL_ALIGN_INDEX];
/* 9bits: uuuuutttt : unit | type */
*bits = (*bits & ~VERTICAL_ALIGN_MASK) | ((((uint32_t)type & 0xf) | (
@@ -2357,15 +2205,13 @@ static inline css_error set_vertical_align(css_computed_style *style, uint8_t
#undef VERTICAL_ALIGN_SHIFT
#undef VERTICAL_ALIGN_MASK
-#define VISIBILITY_INDEX 11
-#define VISIBILITY_SHIFT 0
-#define VISIBILITY_MASK 0x3
+#define VISIBILITY_INDEX 10
+#define VISIBILITY_SHIFT 14
+#define VISIBILITY_MASK 0xc000
static inline css_error set_visibility(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[VISIBILITY_INDEX];
+ uint32_t *bits = &style->i.bits[VISIBILITY_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~VISIBILITY_MASK) | (((uint32_t)type & 0x3) <<
@@ -2377,15 +2223,13 @@ static inline css_error set_visibility(css_computed_style *style, uint8_t type)
#undef VISIBILITY_SHIFT
#undef VISIBILITY_MASK
-#define WHITE_SPACE_INDEX 13
-#define WHITE_SPACE_SHIFT 19
-#define WHITE_SPACE_MASK 0x380000
+#define WHITE_SPACE_INDEX 8
+#define WHITE_SPACE_SHIFT 0
+#define WHITE_SPACE_MASK 0x7
static inline css_error set_white_space(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[WHITE_SPACE_INDEX];
+ uint32_t *bits = &style->i.bits[WHITE_SPACE_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~WHITE_SPACE_MASK) | (((uint32_t)type & 0x7) <<
@@ -2397,16 +2241,14 @@ static inline css_error set_white_space(css_computed_style *style, uint8_t type)
#undef WHITE_SPACE_SHIFT
#undef WHITE_SPACE_MASK
-#define WIDOWS_INDEX 14
-#define WIDOWS_SHIFT 26
-#define WIDOWS_MASK 0x4000000
+#define WIDOWS_INDEX 12
+#define WIDOWS_SHIFT 0
+#define WIDOWS_MASK 0x1
static inline css_error set_widows(css_computed_style *style, uint8_t type,
int32_t integer)
{
- uint32_t *bits;
-
- bits = &style->i.bits[WIDOWS_INDEX];
+ uint32_t *bits = &style->i.bits[WIDOWS_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~WIDOWS_MASK) | (((uint32_t)type & 0x1) <<
@@ -2420,16 +2262,14 @@ static inline css_error set_widows(css_computed_style *style, uint8_t type,
#undef WIDOWS_SHIFT
#undef WIDOWS_MASK
-#define WIDTH_INDEX 3
-#define WIDTH_SHIFT 11
-#define WIDTH_MASK 0x3f800
+#define WIDTH_INDEX 4
+#define WIDTH_SHIFT 25
+#define WIDTH_MASK 0xfe000000
static inline css_error set_width(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[WIDTH_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -2443,16 +2283,14 @@ static inline css_error set_width(css_computed_style *style, uint8_t type,
#undef WIDTH_SHIFT
#undef WIDTH_MASK
-#define WORD_SPACING_INDEX 5
-#define WORD_SPACING_SHIFT 4
-#define WORD_SPACING_MASK 0x7f0
+#define WORD_SPACING_INDEX 1
+#define WORD_SPACING_SHIFT 0
+#define WORD_SPACING_MASK 0x7f
static inline css_error set_word_spacing(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[WORD_SPACING_INDEX];
+ uint32_t *bits = &style->i.bits[WORD_SPACING_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~WORD_SPACING_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -2466,16 +2304,14 @@ static inline css_error set_word_spacing(css_computed_style *style, uint8_t
#undef WORD_SPACING_SHIFT
#undef WORD_SPACING_MASK
-#define WRITING_MODE_INDEX 14
-#define WRITING_MODE_SHIFT 30
-#define WRITING_MODE_MASK 0xc0000000
+#define WRITING_MODE_INDEX 10
+#define WRITING_MODE_SHIFT 16
+#define WRITING_MODE_MASK 0x30000
static inline css_error set_writing_mode(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[WRITING_MODE_INDEX];
+ uint32_t *bits = &style->i.bits[WRITING_MODE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~WRITING_MODE_MASK) | (((uint32_t)type & 0x3) <<
@@ -2488,15 +2324,13 @@ static inline css_error set_writing_mode(css_computed_style *style, uint8_t
#undef WRITING_MODE_MASK
#define Z_INDEX_INDEX 10
-#define Z_INDEX_SHIFT 8
-#define Z_INDEX_MASK 0x300
+#define Z_INDEX_SHIFT 18
+#define Z_INDEX_MASK 0xc0000
static inline css_error set_z_index(css_computed_style *style, uint8_t type,
int32_t integer)
{
- uint32_t *bits;
-
- bits = &style->i.bits[Z_INDEX_INDEX];
+ uint32_t *bits = &style->i.bits[Z_INDEX_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~Z_INDEX_MASK) | (((uint32_t)type & 0x3) <<
diff --git a/src/select/bloom.h b/src/select/bloom.h
index 11628ab..dda4cca 100644
--- a/src/select/bloom.h
+++ b/src/select/bloom.h
@@ -9,22 +9,30 @@
* Bloom filter for CSS style selection optimisation.
*
* Attempting to match CSS rules by querying the client about DOM nodes via
- * the selection callbacks is slow. To avoid this, clients may pass a node
- * bloom filter to css_get_style. This bloom filter has bits set according
- * to the node's ancestor element names, class names and id names.
+ * the selection callbacks is slow. To avoid the slow matching of CSS rule
+ * selector chains, we build up two bloom filters. One describing the rule
+ * selector chain, and one describing the node we are selecting for in
+ * css_get_style.
+ *
+ * These bloom filters have bits set according to the node's ancestor element
+ * names, class names and id names.
*
* Generate the bloom filter by adding calling css_bloom_add_hash() on each
* ancestor element name, class name and id name for the node.
*
- * Use the insesnsitive hash value:
+ * Use the insensitive hash value:
*
* lwc_err = lwc_string_caseless_hash_value(str, &hash);
+ *
+ * We avoid matching most selector chains by checking whether the rule bloom
+ * is a subset of the node bloom.
*/
#ifndef libcss_bloom_h_
#define libcss_bloom_h_
#include <stdint.h>
+#include <string.h>
/* Size of bloom filter as multiple of 32 bits.
* Has to be 4, 8, or 16.
@@ -88,7 +96,8 @@ static inline bool css_bloom_has_hash(const css_bloom bloom[CSS_BLOOM_SIZE],
* \param b superset bloom
* \return true iff 'a' is subset of 'b'
*/
-static inline bool css_bloom_in_bloom(const css_bloom a[CSS_BLOOM_SIZE],
+static inline bool css_bloom_in_bloom(
+ const css_bloom a[CSS_BLOOM_SIZE],
const css_bloom b[CSS_BLOOM_SIZE])
{
if ((a[0] & b[0]) != a[0])
@@ -132,13 +141,14 @@ static inline bool css_bloom_in_bloom(const css_bloom a[CSS_BLOOM_SIZE],
/**
- * Merge bloom 'a' into bloom 'b'.
+ * Merge bloom \ref a into bloom \ref b.
*
* \param a bloom to insert
* \param b target bloom
*/
-static inline void css_bloom_merge(const css_bloom a[CSS_BLOOM_SIZE],
- css_bloom b[CSS_BLOOM_SIZE])
+static inline void css_bloom_merge(
+ const css_bloom a[restrict CSS_BLOOM_SIZE],
+ css_bloom b[restrict CSS_BLOOM_SIZE])
{
b[0] |= a[0];
b[1] |= a[1];
@@ -170,27 +180,7 @@ static inline void css_bloom_merge(const css_bloom a[CSS_BLOOM_SIZE],
*/
static inline void css_bloom_init(css_bloom bloom[CSS_BLOOM_SIZE])
{
- bloom[0] = 0;
- bloom[1] = 0;
- bloom[2] = 0;
- bloom[3] = 0;
-#if (CSS_BLOOM_SIZE > 4)
- bloom[4] = 0;
- bloom[5] = 0;
- bloom[6] = 0;
- bloom[7] = 0;
-#endif
-#if (CSS_BLOOM_SIZE > 8)
- bloom[8] = 0;
- bloom[9] = 0;
- bloom[10] = 0;
- bloom[11] = 0;
- bloom[12] = 0;
- bloom[13] = 0;
- bloom[14] = 0;
- bloom[15] = 0;
-#endif
+ memset(bloom, 0, sizeof(*bloom) * CSS_BLOOM_SIZE);
}
#endif
-
diff --git a/src/select/computed.c b/src/select/computed.c
index a1b345b..78f3b80 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -12,6 +12,7 @@
#include "select/dispatch.h"
#include "select/propget.h"
#include "select/propset.h"
+#include "select/unit.h"
#include "utils/utils.h"
static css_error compute_absolute_color(css_computed_style *style,
@@ -232,6 +233,37 @@ css_error css__computed_style_initialise(css_computed_style *style,
}
/**
+ * Clone a computed style
+ *
+ * \param orig Style to copy
+ * \param clone_out Returns cloned style on success
+ * \return CSS_OK on success.
+ */
+css_error css__computed_style_clone(
+ const css_computed_style *orig,
+ css_computed_style **clone_out)
+{
+ css_error error;
+ css_computed_style *clone;
+
+ error = css__computed_style_create(&clone);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ for (size_t i = 0; i < CSS_N_PROPERTIES; i++) {
+ error = prop_dispatch[i].copy(orig, clone);
+ if (error != CSS_OK) {
+ css_computed_style_destroy(clone);
+ return error;
+ }
+ }
+
+ *clone_out = clone;
+ return CSS_OK;
+}
+
+/**
* Compose two computed styles
*
* \param parent Parent style
@@ -247,9 +279,7 @@ css_error css__computed_style_initialise(css_computed_style *style,
css_error css_computed_style_compose(
const css_computed_style *restrict parent,
const css_computed_style *restrict child,
- css_error (*compute_font_size)(void *pw,
- const css_hint *parent, css_hint *size),
- void *pw,
+ const css_unit_ctx *unit_ctx,
css_computed_style **restrict result)
{
css_computed_style *composed;
@@ -275,8 +305,7 @@ css_error css_computed_style_compose(
}
/* Finally, compute absolute values for everything */
- error = css__compute_absolute_values(parent, composed,
- compute_font_size, pw);
+ error = css__compute_absolute_values(parent, composed, unit_ctx);
if (error != CSS_OK) {
return error;
}
@@ -781,6 +810,18 @@ uint8_t css_computed_opacity(const css_computed_style *style,
return get_opacity(style, opacity);
}
+uint8_t css_computed_fill_opacity(const css_computed_style *style,
+ css_fixed *fill_opacity)
+{
+ return get_fill_opacity(style, fill_opacity);
+}
+
+uint8_t css_computed_stroke_opacity(const css_computed_style *style,
+ css_fixed *stroke_opacity)
+{
+ return get_stroke_opacity(style, stroke_opacity);
+}
+
uint8_t css_computed_text_transform(const css_computed_style *style)
{
return get_text_transform(style);
@@ -897,6 +938,8 @@ uint8_t css_computed_display(const css_computed_style *style,
return CSS_DISPLAY_TABLE;
} else if (display == CSS_DISPLAY_INLINE_FLEX) {
return CSS_DISPLAY_FLEX;
+ } else if (display == CSS_DISPLAY_INLINE_GRID) {
+ return CSS_DISPLAY_GRID;
} else if (display == CSS_DISPLAY_INLINE ||
display == CSS_DISPLAY_RUN_IN ||
display == CSS_DISPLAY_TABLE_ROW_GROUP ||
@@ -1087,31 +1130,36 @@ uint8_t css_computed_order(const css_computed_style *style,
*
* \param parent Parent style, or NULL for tree root
* \param style Computed style to process
- * \param compute_font_size Callback to calculate an absolute font-size
- * \param pw Private word for callback
+ * \param unit_ctx Client length conversion context.
* \return CSS_OK on success.
*/
css_error css__compute_absolute_values(const css_computed_style *parent,
css_computed_style *style,
- css_error (*compute_font_size)(void *pw,
- const css_hint *parent, css_hint *size),
- void *pw)
+ const css_unit_ctx *unit_ctx)
{
+ css_hint_length *ref_length = NULL;
css_hint psize, size, ex_size;
css_error error;
- /* Ensure font-size is absolute */
+ /* Get reference font-size for relative sizes. */
if (parent != NULL) {
psize.status = get_font_size(parent,
&psize.data.length.value,
&psize.data.length.unit);
+ if (psize.status != CSS_FONT_SIZE_DIMENSION) {
+ return CSS_BADPARM;
+ }
+ ref_length = &psize.data.length;
}
size.status = get_font_size(style,
&size.data.length.value,
&size.data.length.unit);
- error = compute_font_size(pw, parent != NULL ? &psize : NULL, &size);
+ error = css_unit_compute_absolute_font_size(ref_length,
+ unit_ctx->root_style,
+ unit_ctx->font_size_default,
+ &size);
if (error != CSS_OK)
return error;
@@ -1125,7 +1173,12 @@ css_error css__compute_absolute_values(const css_computed_style *parent,
ex_size.status = CSS_FONT_SIZE_DIMENSION;
ex_size.data.length.value = INTTOFIX(1);
ex_size.data.length.unit = CSS_UNIT_EX;
- error = compute_font_size(pw, &size, &ex_size);
+
+ error = css_unit_compute_absolute_font_size(
+ &size.data.length,
+ unit_ctx->root_style,
+ unit_ctx->font_size_default,
+ &ex_size);
if (error != CSS_OK)
return error;
diff --git a/src/select/computed.h b/src/select/computed.h
index c926cec..a1e4eed 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -10,6 +10,8 @@
#include <libcss/computed.h>
#include <libcss/hint.h>
+#include <libcss/unit.h>
+
#include "autogenerated_computed.h"
/**
@@ -33,10 +35,12 @@ css_error css__computed_style_create(css_computed_style **result);
css_error css__computed_style_initialise(css_computed_style *style,
struct css_select_handler *handler, void *pw);
+css_error css__computed_style_clone(
+ const css_computed_style *orig,
+ css_computed_style **clone_out);
+
css_error css__compute_absolute_values(const css_computed_style *parent,
css_computed_style *style,
- css_error (*compute_font_size)(void *pw,
- const css_hint *parent, css_hint *size),
- void *pw);
+ const css_unit_ctx *unit_ctx);
#endif
diff --git a/src/select/dispatch.c b/src/select/dispatch.c
index 30bba25..cee9335 100644
--- a/src/select/dispatch.c
+++ b/src/select/dispatch.c
@@ -15,6 +15,7 @@
css__cascade_##pname, \
css__set_##pname##_from_hint, \
css__initial_##pname, \
+ css__copy_##pname, \
css__compose_##pname
struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
@@ -513,5 +514,13 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
{
PROPERTY_FUNCS(order),
0,
+ },
+ {
+ PROPERTY_FUNCS(fill_opacity),
+ 1,
+ },
+ {
+ PROPERTY_FUNCS(stroke_opacity),
+ 1,
}
};
diff --git a/src/select/dispatch.h b/src/select/dispatch.h
index e3f93a3..8ddf4f9 100644
--- a/src/select/dispatch.h
+++ b/src/select/dispatch.h
@@ -23,6 +23,8 @@ extern struct prop_table {
css_error (*set_from_hint)(const css_hint *hint,
css_computed_style *style);
css_error (*initial)(css_select_state *state);
+ css_error (*copy)(const css_computed_style *from,
+ css_computed_style *to);
css_error (*compose)(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result);
diff --git a/src/select/format_list_style.c b/src/select/format_list_style.c
index 9cc5de7..0e3a39e 100644
--- a/src/select/format_list_style.c
+++ b/src/select/format_list_style.c
@@ -8,7 +8,7 @@
#include "select/propget.h"
#include "utils/utils.h"
-#define SYMBOL_SIZE 5
+#define SYMBOL_SIZE 8
typedef char symbol_t[SYMBOL_SIZE];
/**
@@ -330,6 +330,9 @@ calc_additive_system(int value,
/* iterate over the available weights */
for (widx = 0; widx < cstyle->items; widx++) {
+ if (cstyle->weights[widx] == 0) {
+ break;
+ }
times = value / cstyle->weights[widx];
if (times > 0) {
for (idx = 0;idx < times;idx++) {
@@ -975,6 +978,106 @@ static struct list_counter_style lcs_katakana_iroha = {
.suffix = "、",
};
+/**
+ * weights suitable for the five complex addative styles
+ */
+static const int complex_counter_weights[] = {
+ 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000,
+ 900, 800, 700, 600, 500, 400, 300, 200, 100,
+ 90, 80, 70, 60, 50, 40, 30, 20, 10,
+ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+};
+static const symbol_t japanese_informal_symbols[] = {
+ "九千", "八千", "七千", "六千", "五千", "四千", "三千", "二千", "千",
+ "九百", "八百", "七百", "六百", "五百", "四百", "三百", "二百", "百",
+ "九十", "八十", "七十", "六十", "五十", "四十", "三十", "二十", "十",
+ "九", "八", "七", "六", "五", "四", "三", "二", "一", "〇",
+};
+static const struct list_counter_style lcs_japanese_informal = {
+ .name = "japanese-informal",
+ .system = calc_additive_system,
+ .fallback = &lcs_cjk_decimal,
+ .symbols = japanese_informal_symbols,
+ .weights = complex_counter_weights,
+ .items = (sizeof(japanese_informal_symbols) / SYMBOL_SIZE),
+ .range = { .start = -9999, .end = 9999 },
+ .negative = { .pre = "マイナス" },
+ .suffix = "\xE3\x80\x81",
+};
+
+static const symbol_t japanese_formal_symbols[] = {
+ "九阡", "八阡", "七阡", "六阡", "伍阡", "四阡", "参阡", "弐阡", "壱阡",
+ "九百", "八百", "七百", "六百", "伍百", "四百", "参百", "弐百", "壱百",
+ "九拾", "八拾", "七拾", "六拾", "伍拾", "四拾", "参拾", "弐拾", "壱拾",
+ "九", "八", "七", "六", "伍", "四", "参", "弐", "壱", "零",
+};
+static const struct list_counter_style lcs_japanese_formal = {
+ .name = "japanese-formal",
+ .system = calc_additive_system,
+ .fallback = &lcs_cjk_decimal,
+ .symbols = japanese_formal_symbols,
+ .weights = complex_counter_weights,
+ .items = (sizeof(japanese_formal_symbols) / SYMBOL_SIZE),
+ .range = { .start = -9999, .end = 9999 },
+ .negative = { .pre = "マイナス" },
+ .suffix = "\xE3\x80\x81",
+};
+
+static const symbol_t korean_hangul_formal_symbols[] = {
+ "구천", "팔천", "칠천", "육천", "오천", "사천", "삼천", "이천", "일천",
+ "구백", "팔백", "칠백", "육백", "오백", "사백", "삼백", "이백", "일백",
+ "구십", "팔십", "칠십", "육십", "오십", "사십", "삼십", "이십", "일십",
+ "구", "팔", "칠", "육", "오", "사", "삼", "이", "일", "영"
+};
+static const struct list_counter_style lcs_korean_hangul_formal = {
+ .name = "korean-hangul-formal",
+ .system = calc_additive_system,
+ .fallback = &lcs_cjk_decimal,
+ .symbols = korean_hangul_formal_symbols,
+ .weights = complex_counter_weights,
+ .items = (sizeof(korean_hangul_formal_symbols) / SYMBOL_SIZE),
+ .range = { .start = -9999, .end = 9999 },
+ .negative = { .pre = "\xEB\xA7\x88\xEC\x9D\xB4\xEB\x84\x88\xEC\x8A\xA4 " },
+ .suffix = ", ",
+};
+
+static const symbol_t korean_hanja_informal_symbols[] = {
+ "九千", "八千", "七千", "六千", "五千", "四千", "三千", "二千", "千",
+ "九百", "八百", "七百", "六百", "五百", "四百", "三百", "二百", "百",
+ "九十", "八十", "七十", "六十", "五十", "四十", "三十", "二十", "十",
+ "九", "八", "七", "六", "五", "四", "三", "二", "一", "零"
+};
+static const struct list_counter_style lcs_korean_hanja_informal = {
+ .name = "korean-hanja-informal",
+ .system = calc_additive_system,
+ .fallback = &lcs_cjk_decimal,
+ .symbols = korean_hanja_informal_symbols,
+ .weights = complex_counter_weights,
+ .items = (sizeof(korean_hanja_informal_symbols) / SYMBOL_SIZE),
+ .range = { .start = -9999, .end = 9999 },
+ .negative = { .pre = "\xEB\xA7\x88\xEC\x9D\xB4\xEB\x84\x88\xEC\x8A\xA4 " },
+ .suffix = ", ",
+};
+
+static const symbol_t korean_hanja_formal_symbols[] = {
+ "九仟", "八仟", "七仟", "六仟", "五仟", "四仟", "參仟", "貳仟", "壹仟",
+ "九百", "八百", "七百", "六百", "五百", "四百", "參百", "貳百", "壹百",
+ "九拾", "八拾", "七拾", "六拾", "五拾", "四拾", "參拾", "貳拾", "壹拾",
+ "九", "八", "七", "六", "五", "四", "參", "貳", "壹", "零"
+};
+static const struct list_counter_style lcs_korean_hanja_formal = {
+ .name = "korean-hanja-formal",
+ .system = calc_additive_system,
+ .fallback = &lcs_cjk_decimal,
+ .symbols = korean_hanja_formal_symbols,
+ .weights = complex_counter_weights,
+ .items = (sizeof(korean_hanja_formal_symbols) / SYMBOL_SIZE),
+ .range = { .start = -9999, .end = 9999 },
+ .negative = { .pre = "\xEB\xA7\x88\xEC\x9D\xB4\xEB\x84\x88\xEC\x8A\xA4 " },
+ .suffix = ", ",
+};
+
+
static const struct list_counter_style *
counter_style_from_computed_style(const css_computed_style *style)
@@ -1070,6 +1173,16 @@ counter_style_from_computed_style(const css_computed_style *style)
return &lcs_katakana;
case CSS_LIST_STYLE_TYPE_KATAKANA_IROHA:
return &lcs_katakana_iroha;
+ case CSS_LIST_STYLE_TYPE_JAPANESE_INFORMAL:
+ return &lcs_japanese_informal;
+ case CSS_LIST_STYLE_TYPE_JAPANESE_FORMAL:
+ return &lcs_japanese_formal;
+ case CSS_LIST_STYLE_TYPE_KOREAN_HANGUL_FORMAL:
+ return &lcs_korean_hangul_formal;
+ case CSS_LIST_STYLE_TYPE_KOREAN_HANJA_INFORMAL:
+ return &lcs_korean_hanja_informal;
+ case CSS_LIST_STYLE_TYPE_KOREAN_HANJA_FORMAL:
+ return &lcs_korean_hanja_formal;
}
return NULL;
}
diff --git a/src/select/hash.c b/src/select/hash.c
index 4b11702..12e82aa 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -8,6 +8,8 @@
#include <stdio.h>
#include <string.h>
+#include <libcss/hint.h>
+
#include "stylesheet.h"
#include "select/hash.h"
#include "select/mq.h"
@@ -368,7 +370,8 @@ css_error css__selector_hash_find(css_selector_hash *hash,
head->sel_chain_bloom,
req->node_bloom) &&
mq_rule_good_for_media(head->sel->rule,
- req->media)) {
+ req->unit_ctx, req->media,
+ req->str)) {
/* Found a match */
break;
}
@@ -444,10 +447,12 @@ css_error css__selector_hash_find_by_class(css_selector_hash *hash,
_chain_good_for_element_name(
head->sel,
&(req->qname),
- req->uni) &&
+ req->str->universal) &&
mq_rule_good_for_media(
head->sel->rule,
- req->media)) {
+ req->unit_ctx,
+ req->media,
+ req->str)) {
/* Found a match */
break;
}
@@ -524,10 +529,12 @@ css_error css__selector_hash_find_by_id(css_selector_hash *hash,
_chain_good_for_element_name(
head->sel,
&req->qname,
- req->uni) &&
+ req->str->universal) &&
mq_rule_good_for_media(
head->sel->rule,
- req->media)) {
+ req->unit_ctx,
+ req->media,
+ req->str)) {
/* Found a match */
break;
}
@@ -577,7 +584,8 @@ css_error css__selector_hash_find_universal(css_selector_hash *hash,
head->sel_chain_bloom,
req->node_bloom) &&
mq_rule_good_for_media(head->sel->rule,
- req->media)) {
+ req->unit_ctx, req->media,
+ req->str)) {
/* Found a match */
break;
}
@@ -757,7 +765,7 @@ static void print_chain_bloom_details(css_bloom bloom[CSS_BLOOM_SIZE])
{
printf("Chain bloom:\t");
int total = 0, i;
- int set[4];
+ int set[CSS_BLOOM_SIZE];
for (i = 0; i < CSS_BLOOM_SIZE; i++) {
set[i] = bits_set(bloom[i]);
total += set[i];
@@ -920,7 +928,8 @@ css_error _iterate_elements(
head->sel_chain_bloom,
req->node_bloom) &&
mq_rule_good_for_media(head->sel->rule,
- req->media)) {
+ req->unit_ctx, req->media,
+ req->str)) {
/* Found a match */
break;
}
@@ -977,10 +986,12 @@ css_error _iterate_classes(
_chain_good_for_element_name(
head->sel,
&(req->qname),
- req->uni) &&
+ req->str->universal) &&
mq_rule_good_for_media(
head->sel->rule,
- req->media)) {
+ req->unit_ctx,
+ req->media,
+ req->str)) {
/* Found a match */
break;
}
@@ -1038,10 +1049,12 @@ css_error _iterate_ids(
_chain_good_for_element_name(
head->sel,
&req->qname,
- req->uni) &&
+ req->str->universal) &&
mq_rule_good_for_media(
head->sel->rule,
- req->media)) {
+ req->unit_ctx,
+ req->media,
+ req->str)) {
/* Found a match */
break;
}
@@ -1084,7 +1097,8 @@ css_error _iterate_universal(
head->sel_chain_bloom,
req->node_bloom) &&
mq_rule_good_for_media(head->sel->rule,
- req->media)) {
+ req->unit_ctx, req->media,
+ req->str)) {
/* Found a match */
break;
}
diff --git a/src/select/hash.h b/src/select/hash.h
index aecf15a..5f48a38 100644
--- a/src/select/hash.h
+++ b/src/select/hash.h
@@ -10,10 +10,12 @@
#include <libwapcaplet/libwapcaplet.h>
+#include <libcss/unit.h>
#include <libcss/errors.h>
#include <libcss/functypes.h>
#include "select/bloom.h"
+#include "select/strings.h"
/* Ugh. We need this to avoid circular includes. Happy! */
struct css_selector;
@@ -24,8 +26,9 @@ struct css_hash_selection_requirments {
css_qname qname; /* Element name, or universal "*" */
lwc_string *class; /* Name of class, or NULL */
lwc_string *id; /* Name of id, or NULL */
- lwc_string *uni; /* Universal element string "*" */
+ const css_select_strings *str; /* Selection strings */
const css_media *media; /* Media spec we're selecting for */
+ const css_unit_ctx *unit_ctx; /* Document unit conversion context. */
const css_bloom *node_bloom; /* Node's bloom filter */
};
diff --git a/src/select/helpers.h b/src/select/helpers.h
index ba2e3be..19ff7de 100644
--- a/src/select/helpers.h
+++ b/src/select/helpers.h
@@ -22,12 +22,9 @@ static inline css_unit css__to_css_unit(uint32_t u)
case UNIT_MM: return CSS_UNIT_MM;
case UNIT_PT: return CSS_UNIT_PT;
case UNIT_PC: return CSS_UNIT_PC;
- case UNIT_CAP: return CSS_UNIT_CAP;
case UNIT_CH: return CSS_UNIT_CH;
- case UNIT_IC: return CSS_UNIT_IC;
case UNIT_REM: return CSS_UNIT_REM;
case UNIT_LH: return CSS_UNIT_LH;
- case UNIT_RLH: return CSS_UNIT_RLH;
case UNIT_VH: return CSS_UNIT_VH;
case UNIT_VW: return CSS_UNIT_VW;
case UNIT_VI: return CSS_UNIT_VI;
diff --git a/src/select/mq.h b/src/select/mq.h
index 79303e9..89da2c5 100644
--- a/src/select/mq.h
+++ b/src/select/mq.h
@@ -10,113 +10,14 @@
#define css_select_mq_h_
#include "select/helpers.h"
-
-static inline css_fixed css_len2px(
- css_fixed length,
- css_unit unit,
- const css_media *media)
-{
- css_fixed px_per_unit;
-
- switch (unit) {
- case CSS_UNIT_VI:
- /* TODO: Assumes writing mode. */
- unit = CSS_UNIT_VW;
- break;
- case CSS_UNIT_VB:
- /* TODO: Assumes writing mode. */
- unit = CSS_UNIT_VH;
- break;
- case CSS_UNIT_VMIN:
- unit = (media->height < media->width) ?
- CSS_UNIT_VH : CSS_UNIT_VW;
- break;
- case CSS_UNIT_VMAX:
- unit = (media->width > media->height) ?
- CSS_UNIT_VH : CSS_UNIT_VW;
- break;
- default:
- break;
- }
-
- switch (unit) {
- case CSS_UNIT_EM:
- case CSS_UNIT_EX:
- case CSS_UNIT_CAP:
- case CSS_UNIT_CH:
- case CSS_UNIT_IC:
- {
- px_per_unit = FDIV(FMUL(media->client_font_size, F_96), F_72);
-
- /* TODO: Handling these as fixed ratios of CSS_UNIT_EM. */
- switch (unit) {
- case CSS_UNIT_EX:
- px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.6));
- break;
- case CSS_UNIT_CAP:
- px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.9));
- break;
- case CSS_UNIT_CH:
- px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.4));
- break;
- case CSS_UNIT_IC:
- px_per_unit = FMUL(px_per_unit, FLTTOFIX(1.1));
- break;
- default:
- break;
- }
- }
- break;
- case CSS_UNIT_PX:
- return length;
- case CSS_UNIT_IN:
- px_per_unit = F_96;
- break;
- case CSS_UNIT_CM:
- px_per_unit = FDIV(F_96, FLTTOFIX(2.54));
- break;
- case CSS_UNIT_MM:
- px_per_unit = FDIV(F_96, FLTTOFIX(25.4));
- break;
- case CSS_UNIT_Q:
- px_per_unit = FDIV(F_96, FLTTOFIX(101.6));
- break;
- case CSS_UNIT_PT:
- px_per_unit = FDIV(F_96, F_72);
- break;
- case CSS_UNIT_PC:
- px_per_unit = FDIV(F_96, INTTOFIX(6));
- break;
- case CSS_UNIT_REM:
- px_per_unit = FDIV(FMUL(media->client_font_size, F_96), F_72);
- break;
- case CSS_UNIT_RLH:
- px_per_unit = media->client_line_height;
- break;
- case CSS_UNIT_VH:
- px_per_unit = FDIV(media->height, F_100);
- break;
- case CSS_UNIT_VW:
- px_per_unit = FDIV(media->width, F_100);
- break;
- default:
- px_per_unit = 0;
- break;
- }
-
- /* Ensure we round px_per_unit to the nearest whole number of pixels:
- * the use of FIXTOINT() below will truncate. */
- px_per_unit += F_0_5;
-
- /* Calculate total number of pixels */
- return FMUL(length, TRUNCATEFIX(px_per_unit));
-}
+#include "select/strings.h"
+#include "select/unit.h"
static inline bool mq_match_feature_range_length_op1(
css_mq_feature_op op,
const css_mq_value *value,
const css_fixed client_len,
- const css_media *media)
+ const css_unit_ctx *unit_ctx)
{
css_fixed v;
@@ -125,9 +26,9 @@ static inline bool mq_match_feature_range_length_op1(
}
if (value->data.dim.unit != UNIT_PX) {
- v = css_len2px(value->data.dim.len,
- css__to_css_unit(value->data.dim.unit),
- media);
+ v = css_unit_len2px_mq(unit_ctx,
+ value->data.dim.len,
+ css__to_css_unit(value->data.dim.unit));
} else {
v = value->data.dim.len;
}
@@ -148,7 +49,7 @@ static inline bool mq_match_feature_range_length_op2(
css_mq_feature_op op,
const css_mq_value *value,
const css_fixed client_len,
- const css_media *media)
+ const css_unit_ctx *unit_ctx)
{
css_fixed v;
@@ -160,9 +61,9 @@ static inline bool mq_match_feature_range_length_op2(
}
if (value->data.dim.unit != UNIT_PX) {
- v = css_len2px(value->data.dim.len,
- css__to_css_unit(value->data.dim.unit),
- media);
+ v = css_unit_len2px_mq(unit_ctx,
+ value->data.dim.len,
+ css__to_css_unit(value->data.dim.unit));
} else {
v = value->data.dim.len;
}
@@ -178,34 +79,79 @@ static inline bool mq_match_feature_range_length_op2(
}
}
+static inline bool mq_match_feature_eq_ident_op1(
+ css_mq_feature_op op,
+ const css_mq_value *value,
+ const lwc_string *client_value)
+{
+ bool is_match;
+
+ if (value->type != CSS_MQ_VALUE_TYPE_IDENT) {
+ return false;
+ }
+
+ if (value->data.ident == NULL || client_value == NULL) {
+ return false;
+ }
+
+ switch (op) {
+ case CSS_MQ_FEATURE_OP_EQ:
+ return (lwc_string_isequal(value->data.ident,
+ client_value, &is_match) == lwc_error_ok) &&
+ is_match;
+ default:
+ return false;
+ }
+}
+
/**
* Match media query features.
*
- * \param[in] feat Condition to match.
- * \param[in] media Current media spec, to check against feat.
+ * \param[in] feat Condition to match.
+ * \param[in] unit_ctx Current unit conversion context.
+ * \param[in] media Current media spec, to check against feat.
* \return true if condition matches, otherwise false.
*/
static inline bool mq_match_feature(
const css_mq_feature *feat,
- const css_media *media)
+ const css_unit_ctx *unit_ctx,
+ const css_media *media,
+ const css_select_strings *str)
{
+ bool match;
+
/* TODO: Use interned string for comparison. */
- if (strcmp(lwc_string_data(feat->name), "width") == 0) {
+ if (lwc_string_isequal(feat->name,
+ str->width, &match) == lwc_error_ok &&
+ match == true) {
if (!mq_match_feature_range_length_op1(feat->op, &feat->value,
- media->width, media)) {
+ media->width, unit_ctx)) {
return false;
}
return mq_match_feature_range_length_op2(feat->op2,
- &feat->value2, media->width, media);
+ &feat->value2, media->width, unit_ctx);
- } else if (strcmp(lwc_string_data(feat->name), "height") == 0) {
+ } else if (lwc_string_isequal(feat->name,
+ str->height, &match) == lwc_error_ok &&
+ match == true) {
if (!mq_match_feature_range_length_op1(feat->op, &feat->value,
- media->height, media)) {
+ media->height, unit_ctx)) {
return false;
}
return mq_match_feature_range_length_op2(feat->op2,
- &feat->value2, media->height, media);
+ &feat->value2, media->height, unit_ctx);
+
+ } else if (lwc_string_isequal(feat->name,
+ str->prefers_color_scheme, &match) == lwc_error_ok &&
+ match == true) {
+ if (mq_match_feature_eq_ident_op1(feat->op, &feat->value,
+ media->prefers_color_scheme) ||
+ feat->op == CSS_MQ_FEATURE_OP_BOOL) {
+ return true;
+ }
+
+ return false;
}
/* TODO: Look at other feature names. */
@@ -216,13 +162,16 @@ static inline bool mq_match_feature(
/**
* Match media query conditions.
*
- * \param[in] cond Condition to match.
- * \param[in] media Current media spec, to check against cond.
+ * \param[in] cond Condition to match.
+ * \param[in] unit_ctx Current unit conversion context.
+ * \param[in] media Current media spec, to check against cond.
* \return true if condition matches, otherwise false.
*/
static inline bool mq_match_condition(
const css_mq_cond *cond,
- const css_media *media)
+ const css_unit_ctx *unit_ctx,
+ const css_media *media,
+ const css_select_strings *str)
{
bool matched = !cond->op;
@@ -230,11 +179,13 @@ static inline bool mq_match_condition(
bool part_matched;
if (cond->parts[i]->type == CSS_MQ_FEATURE) {
part_matched = mq_match_feature(
- cond->parts[i]->data.feat, media);
+ cond->parts[i]->data.feat,
+ unit_ctx, media, str);
} else {
assert(cond->parts[i]->type == CSS_MQ_COND);
part_matched = mq_match_condition(
- cond->parts[i]->data.cond, media);
+ cond->parts[i]->data.cond,
+ unit_ctx, media, str);
}
if (cond->op) {
@@ -261,19 +212,23 @@ static inline bool mq_match_condition(
* If anything in the list matches, the list matches. If none match
* it doesn't match.
*
- * \param[in] m Media query list.
- * \param[in] media Current media spec, to check against m.
+ * \param[in] m Media query list.
+ * \param[in] unit_ctx Current unit conversion context.
+ * \param[in] media Current media spec, to check against m.
* \return true if media query list matches media
*/
static inline bool mq__list_match(
const css_mq_query *m,
- const css_media *media)
+ const css_unit_ctx *unit_ctx,
+ const css_media *media,
+ const css_select_strings *str)
{
for (; m != NULL; m = m->next) {
/* Check type */
if (!!(m->type & media->type) != m->negate_type) {
if (m->cond == NULL ||
- mq_match_condition(m->cond, media)) {
+ mq_match_condition(m->cond,
+ unit_ctx, media, str)) {
/* We have a match, no need to look further. */
return true;
}
@@ -286,11 +241,16 @@ static inline bool mq__list_match(
/**
* Test whether the rule applies for current media.
*
- * \param rule Rule to test
- * \param media Current media spec
+ * \param rule Rule to test
+ * \param unit_ctx Current unit conversion context.
+ * \param media Current media spec
* \return true iff chain's rule applies for media
*/
-static inline bool mq_rule_good_for_media(const css_rule *rule, const css_media *media)
+static inline bool mq_rule_good_for_media(
+ const css_rule *rule,
+ const css_unit_ctx *unit_ctx,
+ const css_media *media,
+ const css_select_strings *str)
{
bool applies = true;
const css_rule *ancestor = rule;
@@ -299,7 +259,8 @@ static inline bool mq_rule_good_for_media(const css_rule *rule, const css_media
const css_rule_media *m = (const css_rule_media *) ancestor;
if (ancestor->type == CSS_RULE_MEDIA) {
- applies = mq__list_match(m->media, media);
+ applies = mq__list_match(m->media,
+ unit_ctx, media, str);
if (applies == false) {
break;
}
diff --git a/src/select/overrides.py b/src/select/overrides.py
index b4d349a..869d6ec 100644
--- a/src/select/overrides.py
+++ b/src/select/overrides.py
@@ -183,35 +183,3 @@ static inline css_error set_content(
return CSS_OK;
}'''
-
-get_side = '''\
-static inline uint8_t get_{0}(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{{
- uint32_t bits = style->i.bits[{1}_INDEX];
- bits &= {1}_MASK;
- bits >>= {1}_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_{1}_SET) {{
- *length = style->i.{0};
- *unit = bits >> 2;
- }}
-
- return (bits & 0x3);
-}}
-static inline uint8_t get_{0}_bits(
- const css_computed_style *style)
-{{
- uint32_t bits = style->i.bits[{1}_INDEX];
- bits &= {1}_MASK;
- bits >>= {1}_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
-}}'''
-overrides['get']['top'] = get_side.format('top', 'TOP')
-overrides['get']['right'] = get_side.format('right', 'RIGHT')
-overrides['get']['bottom'] = get_side.format('bottom', 'BOTTOM')
-overrides['get']['left'] = get_side.format('left', 'LEFT')
diff --git a/src/select/properties/Makefile b/src/select/properties/Makefile
index 6c6cf84..eee6cc3 100644
--- a/src/select/properties/Makefile
+++ b/src/select/properties/Makefile
@@ -50,6 +50,7 @@ direction.c \
display.c \
elevation.c \
empty_cells.c \
+fill_opacity.c \
flex_basis.c \
flex_direction.c \
flex_grow.c \
@@ -107,6 +108,7 @@ speak_header.c \
speak_numeral.c \
speak_punctuation.c \
stress.c \
+stroke_opacity.c \
table_layout.c \
text_align.c \
text_decoration.c \
diff --git a/src/select/properties/align_content.c b/src/select/properties/align_content.c
index f43cd8e..d432879 100644
--- a/src/select/properties/align_content.c
+++ b/src/select/properties/align_content.c
@@ -21,7 +21,7 @@ css_error css__cascade_align_content(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ALIGN_CONTENT_STRETCH:
value = CSS_ALIGN_CONTENT_STRETCH;
@@ -48,7 +48,7 @@ css_error css__cascade_align_content(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_align_content(state->computed, value);
}
@@ -66,16 +66,25 @@ css_error css__initial_align_content(css_select_state *state)
return set_align_content(state->computed, CSS_ALIGN_CONTENT_STRETCH);
}
+css_error css__copy_align_content(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_align_content(to, get_align_content(from));
+}
+
css_error css__compose_align_content(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_align_content(child);
- if (type == CSS_ALIGN_CONTENT_INHERIT) {
- type = get_align_content(parent);
- }
-
- return set_align_content(result, type);
+ return css__copy_align_content(
+ type == CSS_ALIGN_CONTENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/align_items.c b/src/select/properties/align_items.c
index ad69c81..52ca094 100644
--- a/src/select/properties/align_items.c
+++ b/src/select/properties/align_items.c
@@ -21,7 +21,7 @@ css_error css__cascade_align_items(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ALIGN_ITEMS_STRETCH:
value = CSS_ALIGN_ITEMS_STRETCH;
@@ -42,7 +42,7 @@ css_error css__cascade_align_items(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_align_items(state->computed, value);
}
@@ -60,16 +60,25 @@ css_error css__initial_align_items(css_select_state *state)
return set_align_items(state->computed, CSS_ALIGN_ITEMS_STRETCH);
}
+css_error css__copy_align_items(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_align_items(to, get_align_items(from));
+}
+
css_error css__compose_align_items(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_align_items(child);
- if (type == CSS_ALIGN_ITEMS_INHERIT) {
- type = get_align_items(parent);
- }
-
- return set_align_items(result, type);
+ return css__copy_align_items(
+ type == CSS_ALIGN_ITEMS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/align_self.c b/src/select/properties/align_self.c
index e8e469e..abdb3fe 100644
--- a/src/select/properties/align_self.c
+++ b/src/select/properties/align_self.c
@@ -21,7 +21,7 @@ css_error css__cascade_align_self(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ALIGN_SELF_STRETCH:
value = CSS_ALIGN_SELF_STRETCH;
@@ -45,7 +45,7 @@ css_error css__cascade_align_self(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_align_self(state->computed, value);
}
@@ -63,16 +63,25 @@ css_error css__initial_align_self(css_select_state *state)
return set_align_self(state->computed, CSS_ALIGN_SELF_AUTO);
}
+css_error css__copy_align_self(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_align_self(to, get_align_self(from));
+}
+
css_error css__compose_align_self(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_align_self(child);
- if (type == CSS_ALIGN_SELF_INHERIT) {
- type = get_align_self(parent);
- }
-
- return set_align_self(result, type);
+ return css__copy_align_self(
+ type == CSS_ALIGN_SELF_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/azimuth.c b/src/select/properties/azimuth.c
index d52110f..bbbb48d 100644
--- a/src/select/properties/azimuth.c
+++ b/src/select/properties/azimuth.c
@@ -18,7 +18,7 @@ css_error css__cascade_azimuth(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_DEG;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv) & ~AZIMUTH_BEHIND) {
case AZIMUTH_ANGLE:
val = *((css_fixed *) style->bytecode);
@@ -47,7 +47,7 @@ css_error css__cascade_azimuth(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo set computed azimuth */
}
@@ -70,6 +70,16 @@ css_error css__initial_azimuth(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_azimuth(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_azimuth(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/background_attachment.c b/src/select/properties/background_attachment.c
index 834c830..49194cc 100644
--- a/src/select/properties/background_attachment.c
+++ b/src/select/properties/background_attachment.c
@@ -21,7 +21,7 @@ css_error css__cascade_background_attachment(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_ATTACHMENT_FIXED:
value = CSS_BACKGROUND_ATTACHMENT_FIXED;
@@ -33,7 +33,7 @@ css_error css__cascade_background_attachment(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_background_attachment(state->computed, value);
}
@@ -52,16 +52,25 @@ css_error css__initial_background_attachment(css_select_state *state)
CSS_BACKGROUND_ATTACHMENT_SCROLL);
}
+css_error css__copy_background_attachment(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_attachment(to, get_background_attachment(from));
+}
+
css_error css__compose_background_attachment(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_background_attachment(child);
- if (type == CSS_BACKGROUND_ATTACHMENT_INHERIT) {
- type = get_background_attachment(parent);
- }
-
- return set_background_attachment(result, type);
+ return css__copy_background_attachment(
+ type == CSS_BACKGROUND_ATTACHMENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_color.c b/src/select/properties/background_color.c
index bb90604..1ab61e6 100644
--- a/src/select/properties/background_color.c
+++ b/src/select/properties/background_color.c
@@ -32,6 +32,20 @@ css_error css__initial_background_color(css_select_state *state)
CSS_BACKGROUND_COLOR_COLOR, 0);
}
+css_error css__copy_background_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_background_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_color(to, type, color);
+}
+
css_error css__compose_background_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -39,10 +53,8 @@ css_error css__compose_background_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_background_color(child, &color);
- if (type == CSS_BACKGROUND_COLOR_INHERIT) {
- type = get_background_color(parent, &color);
- }
-
- return set_background_color(result, type, color);
+ return css__copy_background_color(
+ type == CSS_BACKGROUND_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_image.c b/src/select/properties/background_image.c
index 96f7409..68b1e0f 100644
--- a/src/select/properties/background_image.c
+++ b/src/select/properties/background_image.c
@@ -39,6 +39,20 @@ css_error css__initial_background_image(css_select_state *state)
CSS_BACKGROUND_IMAGE_NONE, NULL);
}
+css_error css__copy_background_image(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ lwc_string *url;
+ uint8_t type = get_background_image(from, &url);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_image(to, type, url);
+}
+
css_error css__compose_background_image(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -46,10 +60,8 @@ css_error css__compose_background_image(const css_computed_style *parent,
lwc_string *url;
uint8_t type = get_background_image(child, &url);
- if (type == CSS_BACKGROUND_IMAGE_INHERIT) {
- type = get_background_image(parent, &url);
- }
-
- return set_background_image(result, type, url);
+ return css__copy_background_image(
+ type == CSS_BACKGROUND_IMAGE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_position.c b/src/select/properties/background_position.c
index d925b9c..f3fe47c 100644
--- a/src/select/properties/background_position.c
+++ b/src/select/properties/background_position.c
@@ -23,7 +23,7 @@ css_error css__cascade_background_position(uint32_t opv, css_style *style,
uint32_t hunit = UNIT_PX;
uint32_t vunit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_BACKGROUND_POSITION_SET;
switch (getValue(opv) & 0xf0) {
@@ -73,7 +73,7 @@ css_error css__cascade_background_position(uint32_t opv, css_style *style,
vunit = css__to_css_unit(vunit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_background_position(state->computed, value,
hlength, hunit, vlength, vunit);
}
@@ -96,6 +96,22 @@ css_error css__initial_background_position(css_select_state *state)
0, CSS_UNIT_PCT, 0, CSS_UNIT_PCT);
}
+css_error css__copy_background_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed hlength = 0, vlength = 0;
+ css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX;
+ uint8_t type = get_background_position(from, &hlength, &hunit,
+ &vlength, &vunit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_position(to, type, hlength, hunit, vlength, vunit);
+}
+
css_error css__compose_background_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -105,12 +121,8 @@ css_error css__compose_background_position(const css_computed_style *parent,
uint8_t type = get_background_position(child, &hlength, &hunit,
&vlength, &vunit);
- if (type == CSS_BACKGROUND_POSITION_INHERIT) {
- type = get_background_position(parent,
- &hlength, &hunit, &vlength, &vunit);
- }
-
- return set_background_position(result, type, hlength, hunit,
- vlength, vunit);
+ return css__copy_background_position(
+ type == CSS_BACKGROUND_POSITION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_repeat.c b/src/select/properties/background_repeat.c
index 3881573..7104bfb 100644
--- a/src/select/properties/background_repeat.c
+++ b/src/select/properties/background_repeat.c
@@ -21,7 +21,7 @@ css_error css__cascade_background_repeat(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_REPEAT_NO_REPEAT:
value = CSS_BACKGROUND_REPEAT_NO_REPEAT;
@@ -39,7 +39,7 @@ css_error css__cascade_background_repeat(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_background_repeat(state->computed, value);
}
@@ -58,16 +58,25 @@ css_error css__initial_background_repeat(css_select_state *state)
CSS_BACKGROUND_REPEAT_REPEAT);
}
+css_error css__copy_background_repeat(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_repeat(to, get_background_repeat(from));
+}
+
css_error css__compose_background_repeat(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_background_repeat(child);
- if (type == CSS_BACKGROUND_REPEAT_INHERIT) {
- type = get_background_repeat(parent);
- }
-
- return set_background_repeat(result, type);
+ return css__copy_background_repeat(
+ type == CSS_BACKGROUND_REPEAT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_bottom_color.c b/src/select/properties/border_bottom_color.c
index bdbecb7..1996d71 100644
--- a/src/select/properties/border_bottom_color.c
+++ b/src/select/properties/border_bottom_color.c
@@ -33,6 +33,20 @@ css_error css__initial_border_bottom_color(css_select_state *state)
CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_bottom_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_bottom_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_bottom_color(to, type, color);
+}
+
css_error css__compose_border_bottom_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +54,8 @@ css_error css__compose_border_bottom_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_bottom_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_bottom_color(parent, &color);
- }
-
- return set_border_bottom_color(result, type, color);
+ return css__copy_border_bottom_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_bottom_style.c b/src/select/properties/border_bottom_style.c
index b5caccb..3451c65 100644
--- a/src/select/properties/border_bottom_style.c
+++ b/src/select/properties/border_bottom_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_bottom_style(css_select_state *state)
return set_border_bottom_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_bottom_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_bottom_style(to, get_border_bottom_style(from));
+}
+
css_error css__compose_border_bottom_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_bottom_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_bottom_style(parent);
- }
-
- return set_border_bottom_style(result, type);
+ return css__copy_border_bottom_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_bottom_width.c b/src/select/properties/border_bottom_width.c
index b071fba..19f4304 100644
--- a/src/select/properties/border_bottom_width.c
+++ b/src/select/properties/border_bottom_width.c
@@ -14,16 +14,16 @@
#include "select/properties/properties.h"
#include "select/properties/helpers.h"
-css_error css__cascade_border_bottom_width(uint32_t opv, css_style *style,
+css_error css__cascade_border_bottom_width(uint32_t opv, css_style *width,
css_select_state *state)
{
- return css__cascade_border_width(opv, style, state, set_border_bottom_width);
+ return css__cascade_border_width(opv, width, state, set_border_bottom_width);
}
css_error css__set_border_bottom_width_from_hint(const css_hint *hint,
- css_computed_style *style)
+ css_computed_style *width)
{
- return set_border_bottom_width(style, hint->status,
+ return set_border_bottom_width(width, hint->status,
hint->data.length.value, hint->data.length.unit);
}
@@ -33,6 +33,21 @@ css_error css__initial_border_bottom_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_bottom_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_bottom_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_bottom_width(to, type, length, unit);
+}
+
css_error css__compose_border_bottom_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_bottom_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_bottom_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_bottom_width(parent, &length, &unit);
- }
-
- return set_border_bottom_width(result, type, length, unit);
+ return css__copy_border_bottom_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_collapse.c b/src/select/properties/border_collapse.c
index 1363c7c..8868e6b 100644
--- a/src/select/properties/border_collapse.c
+++ b/src/select/properties/border_collapse.c
@@ -21,7 +21,7 @@ css_error css__cascade_border_collapse(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BORDER_COLLAPSE_SEPARATE:
value = CSS_BORDER_COLLAPSE_SEPARATE;
@@ -33,7 +33,7 @@ css_error css__cascade_border_collapse(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_border_collapse(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_border_collapse(css_select_state *state)
return set_border_collapse(state->computed, CSS_BORDER_COLLAPSE_SEPARATE);
}
+css_error css__copy_border_collapse(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_collapse(to, get_border_collapse(from));
+}
+
css_error css__compose_border_collapse(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_collapse(child);
- if (type == CSS_BORDER_COLLAPSE_INHERIT) {
- type = get_border_collapse(parent);
- }
-
- return set_border_collapse(result, type);
+ return css__copy_border_collapse(
+ type == CSS_BORDER_COLLAPSE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_left_color.c b/src/select/properties/border_left_color.c
index 2880751..60b81ae 100644
--- a/src/select/properties/border_left_color.c
+++ b/src/select/properties/border_left_color.c
@@ -33,6 +33,20 @@ css_error css__initial_border_left_color(css_select_state *state)
CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_left_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_left_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_left_color(to, type, color);
+}
+
css_error css__compose_border_left_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +54,8 @@ css_error css__compose_border_left_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_left_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_left_color(parent, &color);
- }
-
- return set_border_left_color(result, type, color);
+ return css__copy_border_left_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_left_style.c b/src/select/properties/border_left_style.c
index e6472b3..99b5494 100644
--- a/src/select/properties/border_left_style.c
+++ b/src/select/properties/border_left_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_left_style(css_select_state *state)
return set_border_left_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_left_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_left_style(to, get_border_left_style(from));
+}
+
css_error css__compose_border_left_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_left_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_left_style(parent);
- }
-
- return set_border_left_style(result, type);
+ return css__copy_border_left_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_left_width.c b/src/select/properties/border_left_width.c
index 1278fa9..e1fc822 100644
--- a/src/select/properties/border_left_width.c
+++ b/src/select/properties/border_left_width.c
@@ -33,6 +33,21 @@ css_error css__initial_border_left_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_left_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_left_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_left_width(to, type, length, unit);
+}
+
css_error css__compose_border_left_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_left_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_left_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_left_width(parent, &length, &unit);
- }
-
- return set_border_left_width(result, type, length, unit);
+ return css__copy_border_left_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_right_color.c b/src/select/properties/border_right_color.c
index b8563e6..815ca9c 100644
--- a/src/select/properties/border_right_color.c
+++ b/src/select/properties/border_right_color.c
@@ -33,6 +33,20 @@ css_error css__initial_border_right_color(css_select_state *state)
CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_right_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_right_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_right_color(to, type, color);
+}
+
css_error css__compose_border_right_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +54,8 @@ css_error css__compose_border_right_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_right_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_right_color(parent, &color);
- }
-
- return set_border_right_color(result, type, color);
+ return css__copy_border_right_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_right_style.c b/src/select/properties/border_right_style.c
index d75a99e..d14fbfb 100644
--- a/src/select/properties/border_right_style.c
+++ b/src/select/properties/border_right_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_right_style(css_select_state *state)
return set_border_right_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_right_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_right_style(to, get_border_right_style(from));
+}
+
css_error css__compose_border_right_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_right_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_right_style(parent);
- }
-
- return set_border_right_style(result, type);
+ return css__copy_border_right_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_right_width.c b/src/select/properties/border_right_width.c
index 18cacd2..93e8f19 100644
--- a/src/select/properties/border_right_width.c
+++ b/src/select/properties/border_right_width.c
@@ -33,6 +33,21 @@ css_error css__initial_border_right_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_right_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_right_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_right_width(to, type, length, unit);
+}
+
css_error css__compose_border_right_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_right_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_right_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_right_width(parent, &length, &unit);
- }
-
- return set_border_right_width(result, type, length, unit);
+ return css__copy_border_right_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_spacing.c b/src/select/properties/border_spacing.c
index 0077aac..1f70aff 100644
--- a/src/select/properties/border_spacing.c
+++ b/src/select/properties/border_spacing.c
@@ -23,7 +23,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style,
uint32_t hunit = UNIT_PX;
uint32_t vunit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_BORDER_SPACING_SET;
hlength = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(hlength));
@@ -40,7 +40,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style,
vunit = css__to_css_unit(vunit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_border_spacing(state->computed, value,
hlength, hunit, vlength, vunit);
}
@@ -62,6 +62,22 @@ css_error css__initial_border_spacing(css_select_state *state)
0, CSS_UNIT_PX, 0, CSS_UNIT_PX);
}
+css_error css__copy_border_spacing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed hlength = 0, vlength = 0;
+ css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX;
+ uint8_t type = get_border_spacing(from, &hlength, &hunit,
+ &vlength, &vunit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_spacing(to, type, hlength, hunit, vlength, vunit);
+}
+
css_error css__compose_border_spacing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -71,10 +87,7 @@ css_error css__compose_border_spacing(const css_computed_style *parent,
uint8_t type = get_border_spacing(child, &hlength, &hunit,
&vlength, &vunit);
- if (type == CSS_BORDER_SPACING_INHERIT) {
- type = get_border_spacing(parent,
- &hlength, &hunit, &vlength, &vunit);
- }
-
- return set_border_spacing(result, type, hlength, hunit, vlength, vunit);
+ return css__copy_border_spacing(
+ type == CSS_BORDER_SPACING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_top_color.c b/src/select/properties/border_top_color.c
index fd2ced4..ee3feb1 100644
--- a/src/select/properties/border_top_color.c
+++ b/src/select/properties/border_top_color.c
@@ -31,6 +31,20 @@ css_error css__initial_border_top_color(css_select_state *state)
return set_border_top_color(state->computed, CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_top_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_top_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_top_color(to, type, color);
+}
+
css_error css__compose_border_top_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_border_top_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_top_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_top_color(parent, &color);
- }
-
- return set_border_top_color(result, type, color);
+ return css__copy_border_top_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_top_style.c b/src/select/properties/border_top_style.c
index 48d6b6d..1d2dc91 100644
--- a/src/select/properties/border_top_style.c
+++ b/src/select/properties/border_top_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_top_style(css_select_state *state)
return set_border_top_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_top_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_top_style(to, get_border_top_style(from));
+}
+
css_error css__compose_border_top_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_top_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_top_style(parent);
- }
-
- return set_border_top_style(result, type);
+ return css__copy_border_top_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_top_width.c b/src/select/properties/border_top_width.c
index c0fb7da..18e60cb 100644
--- a/src/select/properties/border_top_width.c
+++ b/src/select/properties/border_top_width.c
@@ -33,6 +33,21 @@ css_error css__initial_border_top_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_top_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_top_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_top_width(to, type, length, unit);
+}
+
css_error css__compose_border_top_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_top_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_top_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_top_width(parent, &length, &unit);
- }
-
- return set_border_top_width(result, type, length, unit);
+ return css__copy_border_top_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/bottom.c b/src/select/properties/bottom.c
index 82754f1..fd65ed3 100644
--- a/src/select/properties/bottom.c
+++ b/src/select/properties/bottom.c
@@ -32,6 +32,21 @@ css_error css__initial_bottom(css_select_state *state)
return set_bottom(state->computed, CSS_BOTTOM_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_bottom(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_bottom(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_bottom(to, type, length, unit);
+}
+
css_error css__compose_bottom(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_bottom(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_bottom(child, &length, &unit);
- if (type == CSS_BOTTOM_INHERIT) {
- type = get_bottom(parent, &length, &unit);
- }
-
- return set_bottom(result, type, length, unit);
+ return css__copy_bottom(
+ type == CSS_BOTTOM_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/box_sizing.c b/src/select/properties/box_sizing.c
index 2d19c95..471f8a7 100644
--- a/src/select/properties/box_sizing.c
+++ b/src/select/properties/box_sizing.c
@@ -21,7 +21,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BOX_SIZING_CONTENT_BOX:
value = CSS_BOX_SIZING_CONTENT_BOX;
@@ -33,7 +33,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_box_sizing(state->computed, value);
}
@@ -51,17 +51,25 @@ css_error css__initial_box_sizing(css_select_state *state)
return set_box_sizing(state->computed, CSS_BOX_SIZING_CONTENT_BOX);
}
-css_error css__compose_box_sizing(
- const css_computed_style *parent,
+css_error css__copy_box_sizing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_box_sizing(to, get_box_sizing(from));
+}
+
+css_error css__compose_box_sizing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_box_sizing(child);
- if (type == CSS_BOX_SIZING_INHERIT) {
- type = get_box_sizing(parent);
- }
-
- return set_box_sizing(result, type);
+ return css__copy_box_sizing(
+ type == CSS_BOX_SIZING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/break_after.c b/src/select/properties/break_after.c
index 1f253aa..cb382e0 100644
--- a/src/select/properties/break_after.c
+++ b/src/select/properties/break_after.c
@@ -32,16 +32,25 @@ css_error css__initial_break_after(css_select_state *state)
return set_break_after(state->computed, CSS_BREAK_AFTER_AUTO);
}
+css_error css__copy_break_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_break_after(to, get_break_after(from));
+}
+
css_error css__compose_break_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_break_after(child);
- if (type == CSS_BREAK_AFTER_INHERIT) {
- type = get_break_after(parent);
- }
-
- return set_break_after(result, type);
+ return css__copy_break_after(
+ type == CSS_BREAK_AFTER_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/break_before.c b/src/select/properties/break_before.c
index 3dcda76..91b0612 100644
--- a/src/select/properties/break_before.c
+++ b/src/select/properties/break_before.c
@@ -32,16 +32,25 @@ css_error css__initial_break_before(css_select_state *state)
return set_break_before(state->computed, CSS_BREAK_BEFORE_AUTO);
}
+css_error css__copy_break_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_break_before(to, get_break_before(from));
+}
+
css_error css__compose_break_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_break_before(child);
- if (type == CSS_BREAK_BEFORE_INHERIT) {
- type = get_break_before(parent);
- }
-
- return set_break_before(result, type);
+ return css__copy_break_before(
+ type == CSS_BREAK_BEFORE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/break_inside.c b/src/select/properties/break_inside.c
index fdc44c1..d5b8aef 100644
--- a/src/select/properties/break_inside.c
+++ b/src/select/properties/break_inside.c
@@ -21,7 +21,7 @@ css_error css__cascade_break_inside(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BREAK_INSIDE_AUTO:
value = CSS_BREAK_INSIDE_AUTO;
@@ -39,7 +39,7 @@ css_error css__cascade_break_inside(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_break_inside(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_break_inside(css_select_state *state)
return set_break_inside(state->computed, CSS_BREAK_INSIDE_AUTO);
}
+css_error css__copy_break_inside(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_break_inside(to, get_break_inside(from));
+}
+
css_error css__compose_break_inside(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_break_inside(child);
- if (type == CSS_BREAK_INSIDE_INHERIT) {
- type = get_break_inside(parent);
- }
-
- return set_break_inside(result, type);
+ return css__copy_break_inside(
+ type == CSS_BREAK_INSIDE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/caption_side.c b/src/select/properties/caption_side.c
index ecccc1d..f0e7693 100644
--- a/src/select/properties/caption_side.c
+++ b/src/select/properties/caption_side.c
@@ -21,7 +21,7 @@ css_error css__cascade_caption_side(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case CAPTION_SIDE_TOP:
value = CSS_CAPTION_SIDE_TOP;
@@ -33,7 +33,7 @@ css_error css__cascade_caption_side(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_caption_side(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_caption_side(css_select_state *state)
return set_caption_side(state->computed, CSS_CAPTION_SIDE_TOP);
}
+css_error css__copy_caption_side(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_caption_side(to, get_caption_side(from));
+}
+
css_error css__compose_caption_side(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_caption_side(child);
- if (type == CSS_CAPTION_SIDE_INHERIT) {
- type = get_caption_side(parent);
- }
-
- return set_caption_side(result, type);
+ return css__copy_caption_side(
+ type == CSS_CAPTION_SIDE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/clear.c b/src/select/properties/clear.c
index bbb2673..1fbc48e 100644
--- a/src/select/properties/clear.c
+++ b/src/select/properties/clear.c
@@ -21,7 +21,7 @@ css_error css__cascade_clear(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case CLEAR_NONE:
value = CSS_CLEAR_NONE;
@@ -39,7 +39,7 @@ css_error css__cascade_clear(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_clear(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_clear(css_select_state *state)
return set_clear(state->computed, CSS_CLEAR_NONE);
}
+css_error css__copy_clear(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_clear(to, get_clear(from));
+}
+
css_error css__compose_clear(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_clear(child);
- if (type == CSS_CLEAR_INHERIT) {
- type = get_clear(parent);
- }
-
- return set_clear(result, type);
+ return css__copy_clear(
+ type == CSS_CLEAR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/clip.c b/src/select/properties/clip.c
index 2785afb..c0b9c2b 100644
--- a/src/select/properties/clip.c
+++ b/src/select/properties/clip.c
@@ -22,7 +22,7 @@ css_error css__cascade_clip(uint32_t opv, css_style *style,
CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX,
false, false, false, false };
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv) & CLIP_SHAPE_MASK) {
case CLIP_SHAPE_RECT:
if (getValue(opv) & CLIP_RECT_TOP_AUTO) {
@@ -71,7 +71,7 @@ css_error css__cascade_clip(uint32_t opv, css_style *style,
rect.lunit = css__to_css_unit(rect.lunit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_clip(state->computed, value, &rect);
}
@@ -93,6 +93,22 @@ css_error css__initial_clip(css_select_state *state)
return set_clip(state->computed, CSS_CLIP_AUTO, &rect);
}
+css_error css__copy_clip(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_computed_clip_rect rect = { 0, 0, 0, 0,
+ CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX,
+ false, false, false, false };
+ uint8_t type = get_clip(from, &rect);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_clip(to, type, &rect);
+}
+
css_error css__compose_clip(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -102,9 +118,7 @@ css_error css__compose_clip(const css_computed_style *parent,
false, false, false, false };
uint8_t type = get_clip(child, &rect);
- if (type == CSS_CLIP_INHERIT) {
- type = get_clip(parent, &rect);
- }
-
- return set_clip(result, type, &rect);
+ return css__copy_clip(
+ type == CSS_CLIP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/color.c b/src/select/properties/color.c
index 806f2cc..6424436 100644
--- a/src/select/properties/color.c
+++ b/src/select/properties/color.c
@@ -17,11 +17,11 @@
css_error css__cascade_color(uint32_t opv, css_style *style,
css_select_state *state)
{
- bool inherit = isInherit(opv);
+ enum flag_value flag_value = getFlagValue(opv);
uint16_t value = CSS_COLOR_INHERIT;
css_color color = 0;
- if (inherit == false) {
+ if (flag_value == FLAG_VALUE__NONE) {
switch (getValue(opv)) {
case COLOR_TRANSPARENT:
value = CSS_COLOR_COLOR;
@@ -29,7 +29,7 @@ css_error css__cascade_color(uint32_t opv, css_style *style,
case COLOR_CURRENT_COLOR:
/* color: currentColor always computes to inherit */
value = CSS_COLOR_INHERIT;
- inherit = true;
+ flag_value = FLAG_VALUE_INHERIT;
break;
case COLOR_SET:
value = CSS_COLOR_COLOR;
@@ -40,7 +40,7 @@ css_error css__cascade_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- inherit)) {
+ flag_value)) {
return set_color(state->computed, value, color);
}
@@ -66,6 +66,20 @@ css_error css__initial_color(css_select_state *state)
return css__set_color_from_hint(&hint, state->computed);
}
+css_error css__copy_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_color(to, type, color);
+}
+
css_error css__compose_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -73,10 +87,8 @@ css_error css__compose_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_color(child, &color);
- if (type == CSS_COLOR_INHERIT) {
- type = get_color(parent, &color);
- }
-
- return set_color(result, type, color);
+ return css__copy_color(
+ type == CSS_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c
index efd1243..4adadd6 100644
--- a/src/select/properties/column_count.c
+++ b/src/select/properties/column_count.c
@@ -20,7 +20,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style,
uint16_t value = CSS_COLUMN_COUNT_INHERIT;
css_fixed count = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COLUMN_COUNT_SET:
value = CSS_COLUMN_COUNT_SET;
@@ -34,7 +34,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_column_count(state->computed, value, count);
}
@@ -52,6 +52,20 @@ css_error css__initial_column_count(css_select_state *state)
return set_column_count(state->computed, CSS_COLUMN_COUNT_AUTO, 0);
}
+css_error css__copy_column_count(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_column_count(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_count(to, type, count);
+}
+
css_error css__compose_column_count(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -59,9 +73,7 @@ css_error css__compose_column_count(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_column_count(child, &count);
- if (type == CSS_COLUMN_COUNT_INHERIT) {
- type = get_column_count(parent, &count);
- }
-
- return set_column_count(result, type, count);
+ return css__copy_column_count(
+ type == CSS_COLUMN_COUNT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_fill.c b/src/select/properties/column_fill.c
index 31f19f0..f49946c 100644
--- a/src/select/properties/column_fill.c
+++ b/src/select/properties/column_fill.c
@@ -21,7 +21,7 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COLUMN_FILL_BALANCE:
value = CSS_COLUMN_FILL_BALANCE;
@@ -33,7 +33,7 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_column_fill(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_column_fill(css_select_state *state)
return set_column_fill(state->computed, CSS_COLUMN_FILL_BALANCE);
}
+css_error css__copy_column_fill(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_fill(to, get_column_fill(from));
+}
+
css_error css__compose_column_fill(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_column_fill(child);
- if (type == CSS_COLUMN_FILL_INHERIT) {
- type = get_column_fill(parent);
- }
-
- return set_column_fill(result, type);
+ return css__copy_column_fill(
+ type == CSS_COLUMN_FILL_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_gap.c b/src/select/properties/column_gap.c
index 087eb0f..5776dc9 100644
--- a/src/select/properties/column_gap.c
+++ b/src/select/properties/column_gap.c
@@ -33,6 +33,21 @@ css_error css__initial_column_gap(css_select_state *state)
INTTOFIX(1), CSS_UNIT_EM);
}
+css_error css__copy_column_gap(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = INTTOFIX(1);
+ css_unit unit = CSS_UNIT_EM;
+ uint8_t type = get_column_gap(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_gap(to, type, length, unit);
+}
+
css_error css__compose_column_gap(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,9 +56,7 @@ css_error css__compose_column_gap(const css_computed_style *parent,
css_unit unit = CSS_UNIT_EM;
uint8_t type = get_column_gap(child, &length, &unit);
- if (type == CSS_COLUMN_GAP_INHERIT) {
- type = get_column_gap(parent, &length, &unit);
- }
-
- return set_column_gap(result, type, length, unit);
+ return css__copy_column_gap(
+ type == CSS_COLUMN_GAP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_rule_color.c b/src/select/properties/column_rule_color.c
index f54c2ab..0b7ec9d 100644
--- a/src/select/properties/column_rule_color.c
+++ b/src/select/properties/column_rule_color.c
@@ -17,17 +17,18 @@
css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
css_select_state *state)
{
- bool inherit = isInherit(opv);
+ enum flag_value flag_value = getFlagValue(opv);
uint16_t value = CSS_COLUMN_RULE_COLOR_INHERIT;
css_color color = 0;
- if (isInherit(opv) == false) {
+ if (flag_value == FLAG_VALUE__NONE) {
switch (getValue(opv)) {
case COLUMN_RULE_COLOR_TRANSPARENT:
value = CSS_COLUMN_RULE_COLOR_COLOR;
break;
case COLUMN_RULE_COLOR_CURRENT_COLOR:
value = CSS_COLUMN_RULE_COLOR_CURRENT_COLOR;
+ flag_value = FLAG_VALUE_INHERIT;
break;
case COLUMN_RULE_COLOR_SET:
value = CSS_COLUMN_RULE_COLOR_COLOR;
@@ -38,7 +39,7 @@ css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- inherit)) {
+ flag_value)) {
return set_column_rule_color(state->computed, value, color);
}
@@ -57,6 +58,20 @@ css_error css__initial_column_rule_color(css_select_state *state)
CSS_COLUMN_RULE_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_column_rule_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_column_rule_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_rule_color(to, type, color);
+}
+
css_error css__compose_column_rule_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -64,10 +79,8 @@ css_error css__compose_column_rule_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_column_rule_color(child, &color);
- if (type == CSS_COLUMN_RULE_COLOR_INHERIT) {
- type = get_column_rule_color(parent, &color);
- }
-
- return set_column_rule_color(result, type, color);
+ return css__copy_column_rule_color(
+ type == CSS_COLUMN_RULE_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_rule_style.c b/src/select/properties/column_rule_style.c
index 1d9a41e..be9579c 100644
--- a/src/select/properties/column_rule_style.c
+++ b/src/select/properties/column_rule_style.c
@@ -33,16 +33,25 @@ css_error css__initial_column_rule_style(css_select_state *state)
CSS_COLUMN_RULE_STYLE_NONE);
}
+css_error css__copy_column_rule_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_rule_style(to, get_column_rule_style(from));
+}
+
css_error css__compose_column_rule_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_column_rule_style(child);
- if (type == CSS_COLUMN_RULE_STYLE_INHERIT) {
- type = get_column_rule_style(parent);
- }
-
- return set_column_rule_style(result, type);
+ return css__copy_column_rule_style(
+ type == CSS_COLUMN_RULE_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_rule_width.c b/src/select/properties/column_rule_width.c
index 3ca9367..c18f26c 100644
--- a/src/select/properties/column_rule_width.c
+++ b/src/select/properties/column_rule_width.c
@@ -34,6 +34,21 @@ css_error css__initial_column_rule_width(css_select_state *state)
CSS_COLUMN_RULE_WIDTH_MEDIUM, 0, CSS_UNIT_PX);
}
+css_error css__copy_column_rule_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_column_rule_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_rule_width(to, type, length, unit);
+}
+
css_error css__compose_column_rule_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -42,10 +57,8 @@ css_error css__compose_column_rule_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_column_rule_width(child, &length, &unit);
- if (type == CSS_COLUMN_RULE_WIDTH_INHERIT) {
- type = get_column_rule_width(parent, &length, &unit);
- }
-
- return set_column_rule_width(result, type, length, unit);
+ return css__copy_column_rule_width(
+ type == CSS_COLUMN_RULE_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_span.c b/src/select/properties/column_span.c
index 2c870d3..340150f 100644
--- a/src/select/properties/column_span.c
+++ b/src/select/properties/column_span.c
@@ -21,7 +21,7 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COLUMN_SPAN_NONE:
value = CSS_COLUMN_SPAN_NONE;
@@ -33,7 +33,7 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_column_span(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_column_span(css_select_state *state)
return set_column_span(state->computed, CSS_COLUMN_SPAN_NONE);
}
+css_error css__copy_column_span(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_span(to, get_column_span(from));
+}
+
css_error css__compose_column_span(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_column_span(child);
- if (type == CSS_COLUMN_SPAN_INHERIT) {
- type = get_column_span(parent);
- }
-
- return set_column_span(result, type);
+ return css__copy_column_span(
+ type == CSS_COLUMN_SPAN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_width.c b/src/select/properties/column_width.c
index e739ade..d88d022 100644
--- a/src/select/properties/column_width.c
+++ b/src/select/properties/column_width.c
@@ -33,17 +33,30 @@ css_error css__initial_column_width(css_select_state *state)
INTTOFIX(1), CSS_UNIT_EM);
}
+css_error css__copy_column_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_column_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_width(to, type, length, unit);
+}
+
css_error css__compose_column_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- css_fixed length = INTTOFIX(1);
- css_unit unit = CSS_UNIT_EM;
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
uint8_t type = get_column_width(child, &length, &unit);
- if (type == CSS_COLUMN_WIDTH_INHERIT) {
- type = get_column_width(parent, &length, &unit);
- }
-
- return set_column_width(result, type, length, unit);
+ return css__copy_column_width(
+ type == CSS_COLUMN_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/content.c b/src/select/properties/content.c
index f75743d..32af49f 100644
--- a/src/select/properties/content.c
+++ b/src/select/properties/content.c
@@ -21,7 +21,7 @@ css_error css__cascade_content(uint32_t opv, css_style *style,
css_computed_content_item *content = NULL;
uint32_t n_contents = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
if (v == CONTENT_NORMAL) {
@@ -140,7 +140,7 @@ css_error css__cascade_content(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_content(state->computed, value, content);
@@ -199,39 +199,40 @@ css_error css__initial_content(css_select_state *state)
return set_content(state->computed, CSS_CONTENT_NORMAL, NULL);
}
-css_error css__compose_content(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_content(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
css_computed_content_item *copy = NULL;
const css_computed_content_item *items = NULL;
- uint8_t type = get_content(child, &items);
+ uint8_t type = get_content(from, &items);
- if (type == CSS_CONTENT_INHERIT) {
- type = get_content(parent, &items);
+ if (from == to) {
+ return CSS_OK;
}
- if (type == CSS_CONTENT_SET) {
- size_t n_items = 0;
- const css_computed_content_item *i;
-
- for (i = items; i->type != CSS_COMPUTED_CONTENT_NONE;
- i++)
- n_items++;
-
- copy = malloc((n_items + 1) *
- sizeof(css_computed_content_item));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_content_item));
+ error = css__copy_computed_content_item_array(false, items, &copy);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_content(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_content(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_content(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ const css_computed_content_item *items = NULL;
+ uint8_t type = get_content(child, &items);
+
+ return css__copy_content(
+ type == CSS_CONTENT_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/counter_increment.c b/src/select/properties/counter_increment.c
index 1b75c25..2638838 100644
--- a/src/select/properties/counter_increment.c
+++ b/src/select/properties/counter_increment.c
@@ -48,38 +48,40 @@ css_error css__initial_counter_increment(css_select_state *state)
CSS_COUNTER_INCREMENT_NONE, NULL);
}
-css_error css__compose_counter_increment(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_counter_increment(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
css_computed_counter *copy = NULL;
- const css_computed_counter *items = NULL;
- uint8_t type = get_counter_increment(child, &items);
+ const css_computed_counter *counter_increment = NULL;
+ uint8_t type = get_counter_increment(from, &counter_increment);
- if (type == CSS_COUNTER_INCREMENT_INHERIT) {
- type = get_counter_increment(parent, &items);
+ if (from == to) {
+ return CSS_OK;
}
- if (type == CSS_COUNTER_INCREMENT_NAMED && items != NULL) {
- size_t n_items = 0;
- const css_computed_counter *i;
-
- for (i = items; i->name != NULL; i++)
- n_items++;
-
- copy = malloc((n_items + 1) *
- sizeof(css_computed_counter));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_counter));
+ error = css__copy_computed_counter_array(false, counter_increment, &copy);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_counter_increment(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_counter_increment(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_counter_increment(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ const css_computed_counter *counter_increment = NULL;
+ uint8_t type = get_counter_increment(child, &counter_increment);
+
+ return css__copy_counter_increment(
+ type == CSS_COUNTER_INCREMENT_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/counter_reset.c b/src/select/properties/counter_reset.c
index e4ec8bf..fcb39a3 100644
--- a/src/select/properties/counter_reset.c
+++ b/src/select/properties/counter_reset.c
@@ -47,38 +47,40 @@ css_error css__initial_counter_reset(css_select_state *state)
return set_counter_reset(state->computed, CSS_COUNTER_RESET_NONE, NULL);
}
-css_error css__compose_counter_reset(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_counter_reset(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
css_computed_counter *copy = NULL;
- const css_computed_counter *items = NULL;
- uint8_t type = get_counter_reset(child, &items);
+ const css_computed_counter *counter_reset = NULL;
+ uint8_t type = get_counter_reset(from, &counter_reset);
- if (type == CSS_COUNTER_RESET_INHERIT) {
- type = get_counter_reset(parent, &items);
+ if (from == to) {
+ return CSS_OK;
}
- if (type == CSS_COUNTER_RESET_NAMED && items != NULL) {
- size_t n_items = 0;
- const css_computed_counter *i;
-
- for (i = items; i->name != NULL; i++)
- n_items++;
-
- copy = malloc((n_items + 1) *
- sizeof(css_computed_counter));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_counter));
+ error = css__copy_computed_counter_array(false, counter_reset, &copy);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_counter_reset(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_counter_reset(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_counter_reset(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ const css_computed_counter *counter_reset = NULL;
+ uint8_t type = get_counter_reset(child, &counter_reset);
+
+ return css__copy_counter_reset(
+ type == CSS_COUNTER_RESET_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/cue_after.c b/src/select/properties/cue_after.c
index e1c09e8..67a2c73 100644
--- a/src/select/properties/cue_after.c
+++ b/src/select/properties/cue_after.c
@@ -37,6 +37,16 @@ css_error css__initial_cue_after(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_cue_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_cue_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/cue_before.c b/src/select/properties/cue_before.c
index d562b3b..7c24822 100644
--- a/src/select/properties/cue_before.c
+++ b/src/select/properties/cue_before.c
@@ -37,6 +37,16 @@ css_error css__initial_cue_before(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_cue_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_cue_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/cursor.c b/src/select/properties/cursor.c
index c5e50c6..09955c6 100644
--- a/src/select/properties/cursor.c
+++ b/src/select/properties/cursor.c
@@ -21,7 +21,7 @@ css_error css__cascade_cursor(uint32_t opv, css_style *style,
lwc_string **uris = NULL;
uint32_t n_uris = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
while (v == CURSOR_URI) {
@@ -124,7 +124,7 @@ css_error css__cascade_cursor(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_cursor(state->computed, value, uris);
@@ -164,38 +164,40 @@ css_error css__initial_cursor(css_select_state *state)
return set_cursor(state->computed, CSS_CURSOR_AUTO, NULL);
}
-css_error css__compose_cursor(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_cursor(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
lwc_string **copy = NULL;
- lwc_string **urls = NULL;
- uint8_t type = get_cursor(child, &urls);
+ lwc_string **cursor = NULL;
+ uint8_t type = get_cursor(from, &cursor);
- if (type == CSS_CURSOR_INHERIT) {
- type = get_cursor(parent, &urls);
+ if (from == to) {
+ return CSS_OK;
}
- if (urls != NULL) {
- lwc_string **i;
- size_t n_urls = 0;
-
- for (i = urls; (*i) != NULL; i++)
- n_urls++;
-
- copy = malloc((n_urls + 1) *
- sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, urls, (n_urls + 1) *
- sizeof(lwc_string *));
+ error = css__copy_lwc_string_array(false, cursor, &copy);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_cursor(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_cursor(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_cursor(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ lwc_string **cursor = NULL;
+ uint8_t type = get_cursor(child, &cursor);
+
+ return css__copy_cursor(
+ type == CSS_CURSOR_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/direction.c b/src/select/properties/direction.c
index f4a5c46..32bd31e 100644
--- a/src/select/properties/direction.c
+++ b/src/select/properties/direction.c
@@ -21,7 +21,7 @@ css_error css__cascade_direction(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case DIRECTION_LTR:
value = CSS_DIRECTION_LTR;
@@ -33,7 +33,7 @@ css_error css__cascade_direction(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_direction(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_direction(css_select_state *state)
return set_direction(state->computed, CSS_DIRECTION_LTR);
}
+css_error css__copy_direction(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_direction(to, get_direction(from));
+}
+
css_error css__compose_direction(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_direction(child);
- if (type == CSS_DIRECTION_INHERIT) {
- type = get_direction(parent);
- }
-
- return set_direction(result, type);
+ return css__copy_direction(
+ type == CSS_DIRECTION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/display.c b/src/select/properties/display.c
index 510d24a..5455d20 100644
--- a/src/select/properties/display.c
+++ b/src/select/properties/display.c
@@ -21,7 +21,7 @@ css_error css__cascade_display(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case DISPLAY_INLINE:
value = CSS_DISPLAY_INLINE;
@@ -77,11 +77,17 @@ css_error css__cascade_display(uint32_t opv, css_style *style,
case DISPLAY_INLINE_FLEX:
value = CSS_DISPLAY_INLINE_FLEX;
break;
+ case DISPLAY_GRID:
+ value = CSS_DISPLAY_GRID;
+ break;
+ case DISPLAY_INLINE_GRID:
+ value = CSS_DISPLAY_INLINE_GRID;
+ break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_display(state->computed, value);
}
@@ -99,16 +105,25 @@ css_error css__initial_display(css_select_state *state)
return set_display(state->computed, CSS_DISPLAY_INLINE);
}
+css_error css__copy_display(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_display(to, get_display(from));
+}
+
css_error css__compose_display(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_display(child);
- if (type == CSS_DISPLAY_INHERIT) {
- type = get_display(parent);
- }
-
- return set_display(result, type);
+ return css__copy_display(
+ type == CSS_DISPLAY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/elevation.c b/src/select/properties/elevation.c
index ee7d036..1368ef8 100644
--- a/src/select/properties/elevation.c
+++ b/src/select/properties/elevation.c
@@ -20,7 +20,7 @@ css_error css__cascade_elevation(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_DEG;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ELEVATION_ANGLE:
val = *((css_fixed *) style->bytecode);
@@ -42,7 +42,7 @@ css_error css__cascade_elevation(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo set computed elevation */
}
@@ -65,6 +65,16 @@ css_error css__initial_elevation(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_elevation(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_elevation(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/empty_cells.c b/src/select/properties/empty_cells.c
index fecdbdc..559fbde 100644
--- a/src/select/properties/empty_cells.c
+++ b/src/select/properties/empty_cells.c
@@ -21,7 +21,7 @@ css_error css__cascade_empty_cells(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case EMPTY_CELLS_SHOW:
value = CSS_EMPTY_CELLS_SHOW;
@@ -33,7 +33,7 @@ css_error css__cascade_empty_cells(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_empty_cells(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_empty_cells(css_select_state *state)
return set_empty_cells(state->computed, CSS_EMPTY_CELLS_SHOW);
}
+css_error css__copy_empty_cells(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_empty_cells(to, get_empty_cells(from));
+}
+
css_error css__compose_empty_cells(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_empty_cells(child);
- if (type == CSS_EMPTY_CELLS_INHERIT) {
- type = get_empty_cells(parent);
- }
-
- return set_empty_cells(result, type);
+ return css__copy_empty_cells(
+ type == CSS_EMPTY_CELLS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/fill_opacity.c b/src/select/properties/fill_opacity.c
new file mode 100644
index 0000000..af0b52b
--- /dev/null
+++ b/src/select/properties/fill_opacity.c
@@ -0,0 +1,73 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ */
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+#include "select/propset.h"
+#include "select/propget.h"
+#include "utils/utils.h"
+
+#include "select/properties/properties.h"
+#include "select/properties/helpers.h"
+
+css_error css__cascade_fill_opacity(uint32_t opv, css_style *style,
+ css_select_state *state)
+{
+ uint16_t value = CSS_FILL_OPACITY_INHERIT;
+ css_fixed fill_opacity = 0;
+
+ if (hasFlagValue(opv) == false) {
+ value = CSS_FILL_OPACITY_SET;
+
+ fill_opacity = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(fill_opacity));
+ }
+
+ if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
+ getFlagValue(opv))) {
+ return set_fill_opacity(state->computed, value, fill_opacity);
+ }
+
+ return CSS_OK;
+}
+
+css_error css__set_fill_opacity_from_hint(const css_hint *hint,
+ css_computed_style *style)
+{
+ return set_fill_opacity(style, hint->status, hint->data.fixed);
+}
+
+css_error css__initial_fill_opacity(css_select_state *state)
+{
+ return set_fill_opacity(state->computed, CSS_FILL_OPACITY_SET, INTTOFIX(1));
+}
+
+css_error css__copy_fill_opacity(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed fill_opacity = 0;
+ uint8_t type = get_fill_opacity(from, &fill_opacity);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_fill_opacity(to, type, fill_opacity);
+}
+
+css_error css__compose_fill_opacity(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ css_fixed fill_opacity = 0;
+ uint8_t type = get_fill_opacity(child, &fill_opacity);
+
+ return css__copy_fill_opacity(
+ type == CSS_FILL_OPACITY_INHERIT ? parent : child,
+ result);
+}
+
diff --git a/src/select/properties/flex_basis.c b/src/select/properties/flex_basis.c
index 1a92a6b..a3141bc 100644
--- a/src/select/properties/flex_basis.c
+++ b/src/select/properties/flex_basis.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_basis(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_BASIS_AUTO:
value = CSS_FLEX_BASIS_AUTO;
@@ -42,7 +42,7 @@ css_error css__cascade_flex_basis(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_basis(state->computed, value, length, unit);
}
@@ -62,6 +62,21 @@ css_error css__initial_flex_basis(css_select_state *state)
CSS_UNIT_PX);
}
+css_error css__copy_flex_basis(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_flex_basis(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_basis(to, type, length, unit);
+}
+
css_error css__compose_flex_basis(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -70,10 +85,8 @@ css_error css__compose_flex_basis(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_flex_basis(child, &length, &unit);
- if (type == CSS_FLEX_BASIS_INHERIT) {
- type = get_flex_basis(parent, &length, &unit);
- }
-
- return set_flex_basis(result, type, length, unit);
+ return css__copy_flex_basis(
+ type == CSS_FLEX_BASIS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_direction.c b/src/select/properties/flex_direction.c
index 79703be..1d979be 100644
--- a/src/select/properties/flex_direction.c
+++ b/src/select/properties/flex_direction.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_DIRECTION_ROW:
value = CSS_FLEX_DIRECTION_ROW;
@@ -39,7 +39,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_direction(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_flex_direction(css_select_state *state)
return set_flex_direction(state->computed, CSS_FLEX_DIRECTION_ROW);
}
+css_error css__copy_flex_direction(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_direction(to, get_flex_direction(from));
+}
+
css_error css__compose_flex_direction(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_flex_direction(child);
- if (type == CSS_FLEX_DIRECTION_INHERIT) {
- type = get_flex_direction(parent);
- }
-
- return set_flex_direction(result, type);
+ return css__copy_flex_direction(
+ type == CSS_FLEX_DIRECTION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_grow.c b/src/select/properties/flex_grow.c
index 7f37cfe..4650cef 100644
--- a/src/select/properties/flex_grow.c
+++ b/src/select/properties/flex_grow.c
@@ -20,7 +20,7 @@ css_error css__cascade_flex_grow(uint32_t opv, css_style *style,
uint16_t value = CSS_FLEX_GROW_INHERIT;
css_fixed flex_grow = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_FLEX_GROW_SET;
flex_grow = *((css_fixed *) style->bytecode);
@@ -28,7 +28,7 @@ css_error css__cascade_flex_grow(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_grow(state->computed, value, flex_grow);
}
@@ -46,6 +46,20 @@ css_error css__initial_flex_grow(css_select_state *state)
return set_flex_grow(state->computed, CSS_FLEX_GROW_SET, INTTOFIX(0));
}
+css_error css__copy_flex_grow(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed flex_grow = 0;
+ uint8_t type = get_flex_grow(from, &flex_grow);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_grow(to, type, flex_grow);
+}
+
css_error css__compose_flex_grow(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_flex_grow(const css_computed_style *parent,
css_fixed flex_grow = 0;
uint8_t type = get_flex_grow(child, &flex_grow);
- if (type == CSS_FLEX_GROW_INHERIT) {
- type = get_flex_grow(parent, &flex_grow);
- }
-
- return set_flex_grow(result, type, flex_grow);
+ return css__copy_flex_grow(
+ type == CSS_FLEX_GROW_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_shrink.c b/src/select/properties/flex_shrink.c
index d1acd2a..9b39ed0 100644
--- a/src/select/properties/flex_shrink.c
+++ b/src/select/properties/flex_shrink.c
@@ -20,7 +20,7 @@ css_error css__cascade_flex_shrink(uint32_t opv, css_style *style,
uint16_t value = CSS_FLEX_SHRINK_INHERIT;
css_fixed flex_shrink = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_FLEX_SHRINK_SET;
flex_shrink = *((css_fixed *) style->bytecode);
@@ -28,7 +28,7 @@ css_error css__cascade_flex_shrink(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_shrink(state->computed, value, flex_shrink);
}
@@ -46,6 +46,20 @@ css_error css__initial_flex_shrink(css_select_state *state)
return set_flex_shrink(state->computed, CSS_FLEX_SHRINK_SET, INTTOFIX(1));
}
+css_error css__copy_flex_shrink(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed flex_shrink = 0;
+ uint8_t type = get_flex_shrink(from, &flex_shrink);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_shrink(to, type, flex_shrink);
+}
+
css_error css__compose_flex_shrink(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_flex_shrink(const css_computed_style *parent,
css_fixed flex_shrink = 0;
uint8_t type = get_flex_shrink(child, &flex_shrink);
- if (type == CSS_FLEX_SHRINK_INHERIT) {
- type = get_flex_shrink(parent, &flex_shrink);
- }
-
- return set_flex_shrink(result, type, flex_shrink);
+ return css__copy_flex_shrink(
+ type == CSS_FLEX_SHRINK_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_wrap.c b/src/select/properties/flex_wrap.c
index 688a9b6..3ca9b74 100644
--- a/src/select/properties/flex_wrap.c
+++ b/src/select/properties/flex_wrap.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_wrap(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_WRAP_NOWRAP:
value = CSS_FLEX_WRAP_NOWRAP;
@@ -36,7 +36,7 @@ css_error css__cascade_flex_wrap(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_wrap(state->computed, value);
}
@@ -54,16 +54,27 @@ css_error css__initial_flex_wrap(css_select_state *state)
return set_flex_wrap(state->computed, CSS_FLEX_WRAP_NOWRAP);
}
+css_error css__copy_flex_wrap(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ uint8_t type = get_flex_wrap(from);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_wrap(to, type);
+}
+
css_error css__compose_flex_wrap(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_flex_wrap(child);
- if (type == CSS_FLEX_WRAP_INHERIT) {
- type = get_flex_wrap(parent);
- }
-
- return set_flex_wrap(result, type);
+ return css__copy_flex_wrap(
+ type == CSS_FLEX_WRAP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/float.c b/src/select/properties/float.c
index c3ba909..6d009bb 100644
--- a/src/select/properties/float.c
+++ b/src/select/properties/float.c
@@ -21,7 +21,7 @@ css_error css__cascade_float(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLOAT_LEFT:
value = CSS_FLOAT_LEFT;
@@ -36,7 +36,7 @@ css_error css__cascade_float(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_float(state->computed, value);
}
@@ -54,16 +54,25 @@ css_error css__initial_float(css_select_state *state)
return set_float(state->computed, CSS_FLOAT_NONE);
}
+css_error css__copy_float(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_float(to, get_float(from));
+}
+
css_error css__compose_float(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_float(child);
- if (type == CSS_FLOAT_INHERIT) {
- type = get_float(parent);
- }
-
- return set_float(result, type);
+ return css__copy_float(
+ type == CSS_FLOAT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_family.c b/src/select/properties/font_family.c
index f853fcc..b0183e2 100644
--- a/src/select/properties/font_family.c
+++ b/src/select/properties/font_family.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_family(uint32_t opv, css_style *style,
lwc_string **fonts = NULL;
uint32_t n_fonts = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
while (v != FONT_FAMILY_END) {
@@ -134,7 +134,7 @@ css_error css__cascade_font_family(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_font_family(state->computed, value, fonts);
@@ -182,42 +182,41 @@ css_error css__initial_font_family(css_select_state *state)
return css__set_font_family_from_hint(&hint, state->computed);
}
-css_error css__compose_font_family(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_font_family(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
- lwc_string **names = NULL;
- uint8_t type = get_font_family(child, &names);
-
- if (type == CSS_FONT_FAMILY_INHERIT || result != child) {
- size_t n_names = 0;
- lwc_string **copy = NULL;
-
- if (type == CSS_FONT_FAMILY_INHERIT)
- type = get_font_family(parent, &names);
+ lwc_string **copy = NULL;
+ lwc_string **font_family = NULL;
+ uint8_t type = get_font_family(from, &font_family);
- if (names != NULL) {
- lwc_string **i;
-
- for (i = names; (*i) != NULL; i++)
- n_names++;
+ if (from == to) {
+ return CSS_OK;
+ }
- copy = malloc((n_names + 1) * sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
+ error = css__copy_lwc_string_array(false, font_family, &copy);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
+ }
- memcpy(copy, names, (n_names + 1) *
- sizeof(lwc_string *));
- }
+ error = set_font_family(to, type, copy);
+ if (error != CSS_OK) {
+ free(copy);
+ }
- error = set_font_family(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ return error;
+}
- return error;
- }
+css_error css__compose_font_family(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ lwc_string **font_family = NULL;
+ uint8_t type = get_font_family(child, &font_family);
- return CSS_OK;
+ return css__copy_font_family(
+ type == CSS_FONT_FAMILY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_size.c b/src/select/properties/font_size.c
index a0269be..3ee9ce0 100644
--- a/src/select/properties/font_size.c
+++ b/src/select/properties/font_size.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style,
css_fixed size = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_SIZE_DIMENSION:
value = CSS_FONT_SIZE_DIMENSION;
@@ -65,7 +65,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_size(state->computed, value, size, unit);
}
@@ -85,6 +85,21 @@ css_error css__initial_font_size(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_font_size(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed size = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_font_size(from, &size, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_size(to, type, size, unit);
+}
+
css_error css__compose_font_size(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -93,10 +108,8 @@ css_error css__compose_font_size(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_font_size(child, &size, &unit);
- if (type == CSS_FONT_SIZE_INHERIT) {
- type = get_font_size(parent, &size, &unit);
- }
-
- return set_font_size(result, type, size, unit);
+ return css__copy_font_size(
+ type == CSS_FONT_SIZE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_style.c b/src/select/properties/font_style.c
index 0ba1fdd..fe605b8 100644
--- a/src/select/properties/font_style.c
+++ b/src/select/properties/font_style.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_STYLE_NORMAL:
value = CSS_FONT_STYLE_NORMAL;
@@ -36,7 +36,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_style(state->computed, value);
}
@@ -54,16 +54,25 @@ css_error css__initial_font_style(css_select_state *state)
return set_font_style(state->computed, CSS_FONT_STYLE_NORMAL);
}
+css_error css__copy_font_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_style(to, get_font_style(from));
+}
+
css_error css__compose_font_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_style(child);
- if (type == CSS_FONT_STYLE_INHERIT) {
- type= get_font_style(parent);
- }
-
- return set_font_style(result, type);
+ return css__copy_font_style(
+ type == CSS_FONT_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_variant.c b/src/select/properties/font_variant.c
index a9b6e56..9668fc3 100644
--- a/src/select/properties/font_variant.c
+++ b/src/select/properties/font_variant.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_variant(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_VARIANT_NORMAL:
value = CSS_FONT_VARIANT_NORMAL;
@@ -33,7 +33,7 @@ css_error css__cascade_font_variant(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_variant(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_font_variant(css_select_state *state)
return set_font_variant(state->computed, CSS_FONT_VARIANT_NORMAL);
}
+css_error css__copy_font_variant(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_variant(to, get_font_variant(from));
+}
+
css_error css__compose_font_variant(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_variant(child);
- if (type == CSS_FONT_VARIANT_INHERIT) {
- type = get_font_variant(parent);
- }
-
- return set_font_variant(result, type);
+ return css__copy_font_variant(
+ type == CSS_FONT_VARIANT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_weight.c b/src/select/properties/font_weight.c
index c0c2f2b..da918a1 100644
--- a/src/select/properties/font_weight.c
+++ b/src/select/properties/font_weight.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_weight(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_WEIGHT_NORMAL:
value = CSS_FONT_WEIGHT_NORMAL;
@@ -66,7 +66,7 @@ css_error css__cascade_font_weight(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_weight(state->computed, value);
}
@@ -84,16 +84,25 @@ css_error css__initial_font_weight(css_select_state *state)
return set_font_weight(state->computed, CSS_FONT_WEIGHT_NORMAL);
}
+css_error css__copy_font_weight(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_weight(to, get_font_weight(from));
+}
+
css_error css__compose_font_weight(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_weight(child);
- if (type == CSS_FONT_WEIGHT_INHERIT) {
- type = get_font_weight(parent);
- }
-
- return set_font_weight(result, type);
+ return css__copy_font_weight(
+ type == CSS_FONT_WEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/height.c b/src/select/properties/height.c
index 1d74c4a..d449e72 100644
--- a/src/select/properties/height.c
+++ b/src/select/properties/height.c
@@ -32,6 +32,21 @@ css_error css__initial_height(css_select_state *state)
return set_height(state->computed, CSS_HEIGHT_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_height(to, type, length, unit);
+}
+
css_error css__compose_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_height(child, &length, &unit);
- if (type == CSS_HEIGHT_INHERIT) {
- type = get_height(parent, &length, &unit);
- }
-
- return set_height(result, type, length, unit);
+ return css__copy_height(
+ type == CSS_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/helpers.c b/src/select/properties/helpers.c
index 40936dd..10ff228 100644
--- a/src/select/properties/helpers.c
+++ b/src/select/properties/helpers.c
@@ -33,7 +33,7 @@ css_error css__cascade_bg_border_color(uint32_t opv, css_style *style,
assert(CSS_BACKGROUND_COLOR_CURRENT_COLOR ==
(enum css_background_color_e)CSS_BORDER_COLOR_CURRENT_COLOR);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_COLOR_TRANSPARENT:
value = CSS_BACKGROUND_COLOR_COLOR;
@@ -50,7 +50,7 @@ css_error css__cascade_bg_border_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, color);
}
@@ -65,7 +65,7 @@ css_error css__cascade_uri_none(uint32_t opv, css_style *style,
uint16_t value = CSS_BACKGROUND_IMAGE_INHERIT;
lwc_string *uri = NULL;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_IMAGE_NONE:
value = CSS_BACKGROUND_IMAGE_NONE;
@@ -80,7 +80,7 @@ css_error css__cascade_uri_none(uint32_t opv, css_style *style,
/** \todo lose fun != NULL once all properties have set routines */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value, uri);
}
@@ -95,7 +95,7 @@ css_error css__cascade_border_style(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BORDER_STYLE_NONE:
value = CSS_BORDER_STYLE_NONE;
@@ -131,7 +131,7 @@ css_error css__cascade_border_style(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value);
}
@@ -147,7 +147,7 @@ css_error css__cascade_border_width(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BORDER_WIDTH_SET:
value = CSS_BORDER_WIDTH_WIDTH;
@@ -171,7 +171,7 @@ css_error css__cascade_border_width(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -187,7 +187,7 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BOTTOM_SET:
value = CSS_BOTTOM_SET;
@@ -205,7 +205,7 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -221,7 +221,7 @@ css_error css__cascade_length_normal(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LETTER_SPACING_SET:
value = CSS_LETTER_SPACING_SET;
@@ -239,7 +239,7 @@ css_error css__cascade_length_normal(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -255,7 +255,7 @@ css_error css__cascade_length_none(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case MAX_HEIGHT_SET:
value = CSS_MAX_HEIGHT_SET;
@@ -273,7 +273,7 @@ css_error css__cascade_length_none(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -289,7 +289,7 @@ css_error css__cascade_length(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_MIN_HEIGHT_SET;
length = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(length));
@@ -301,7 +301,7 @@ css_error css__cascade_length(uint32_t opv, css_style *style,
/** \todo lose fun != NULL once all properties have set routines */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -317,7 +317,7 @@ css_error css__cascade_number(uint32_t opv, css_style *style,
/** \todo values */
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = 0;
length = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(length));
@@ -325,7 +325,7 @@ css_error css__cascade_number(uint32_t opv, css_style *style,
/** \todo lose fun != NULL once all properties have set routines */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value, length);
}
@@ -340,7 +340,7 @@ css_error css__cascade_page_break_after_before_inside(uint32_t opv,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case PAGE_BREAK_AFTER_AUTO:
value = CSS_PAGE_BREAK_AFTER_AUTO;
@@ -362,7 +362,7 @@ css_error css__cascade_page_break_after_before_inside(uint32_t opv,
/** \todo lose fun != NULL */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value);
}
@@ -377,7 +377,7 @@ css_error css__cascade_break_after_before_inside(uint32_t opv,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BREAK_AFTER_AUTO:
value = CSS_BREAK_AFTER_AUTO;
@@ -411,7 +411,7 @@ css_error css__cascade_break_after_before_inside(uint32_t opv,
/** \todo lose fun != NULL */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value);
}
@@ -427,7 +427,7 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
css_computed_counter *counters = NULL;
uint32_t n_counters = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COUNTER_INCREMENT_NAMED:
{
@@ -490,7 +490,7 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = fun(state->computed, value, counters);
diff --git a/src/select/properties/helpers.h b/src/select/properties/helpers.h
index 60e5b4c..16c5d7a 100644
--- a/src/select/properties/helpers.h
+++ b/src/select/properties/helpers.h
@@ -59,4 +59,137 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
css_error (*fun)(css_computed_style *, uint8_t,
css_computed_counter *));
+/** Copy NULL terminated array of lwc_string pointers. */
+static inline css_error css__copy_lwc_string_array(
+ bool ref,
+ lwc_string *const*orig,
+ lwc_string ***copy_out)
+{
+ size_t count = 0;
+ lwc_string **copy = NULL;
+
+ if (orig != NULL) {
+ for (lwc_string *const*i = orig; (*i) != NULL; i++) {
+ count++;
+ }
+
+ copy = malloc((count + 1) * sizeof(*copy));
+ if (copy == NULL) {
+ return CSS_NOMEM;
+ }
+
+ if (ref) {
+ for (size_t i = 0; i < count; i++) {
+ copy[i] = lwc_string_ref(orig[i]);
+ }
+ copy[count] = NULL;
+ } else {
+ memcpy(copy, orig, (count + 1) * sizeof(*copy));
+ }
+ }
+
+ *copy_out = copy;
+ return CSS_OK;
+}
+
+/** Copy NULL-name terminated array of css_computed_counter items. */
+static inline css_error css__copy_computed_counter_array(
+ bool ref,
+ const css_computed_counter *orig,
+ css_computed_counter **copy_out)
+{
+ size_t count = 0;
+ css_computed_counter *copy = NULL;
+
+ if (orig != NULL) {
+ for (const css_computed_counter *i = orig;
+ i->name != NULL; i++) {
+ count++;
+ }
+
+ copy = malloc((count + 1) * sizeof(*copy));
+ if (copy == NULL) {
+ return CSS_NOMEM;
+ }
+
+ if (ref) {
+ for (size_t i = 0; i < count; i++) {
+ copy[i].name = lwc_string_ref(orig[i].name);
+ copy[i].value = orig[i].value;
+ }
+ copy[count].name = NULL;
+ copy[count].value = 0;
+ } else {
+ memcpy(copy, orig, (count + 1) * sizeof(*copy));
+ }
+ }
+
+ *copy_out = copy;
+ return CSS_OK;
+}
+
+/** Copy type:none terminated array of css_computed_content_item items. */
+static inline css_error css__copy_computed_content_item_array(
+ bool ref,
+ const css_computed_content_item *orig,
+ css_computed_content_item **copy_out)
+{
+ size_t count = 0;
+ css_computed_content_item *copy = NULL;
+
+ if (orig != NULL) {
+ for (const css_computed_content_item *i = orig;
+ i->type != CSS_COMPUTED_CONTENT_NONE; i++) {
+ count++;
+ }
+
+ copy = malloc((count + 1) * sizeof(*copy));
+ if (copy == NULL) {
+ return CSS_NOMEM;
+ }
+
+ if (ref) {
+ for (size_t i = 0; i < count; i++) {
+ switch (orig[i].type) {
+ case CSS_COMPUTED_CONTENT_STRING:
+ copy[i].data.string = lwc_string_ref(
+ orig[i].data.string);
+ break;
+ case CSS_COMPUTED_CONTENT_URI:
+ copy[i].data.uri = lwc_string_ref(
+ orig[i].data.uri);
+ break;
+ case CSS_COMPUTED_CONTENT_ATTR:
+ copy[i].data.attr = lwc_string_ref(
+ orig[i].data.attr);
+ break;
+ case CSS_COMPUTED_CONTENT_COUNTER:
+ copy[i].data.counter.name = lwc_string_ref(
+ orig[i].data.counter.name);
+ copy[i].data.counter.style =
+ orig[i].data.counter.style;
+ break;
+ case CSS_COMPUTED_CONTENT_COUNTERS:
+ copy[i].data.counters.name = lwc_string_ref(
+ orig[i].data.counters.name);
+ copy[i].data.counters.sep = lwc_string_ref(
+ orig[i].data.counters.sep);
+ copy[i].data.counters.style =
+ orig[i].data.counters.style;
+ break;
+ default:
+ break;
+ }
+ copy[i].type = orig[i].type;
+ }
+ copy[count].type = CSS_COMPUTED_CONTENT_NONE;
+ } else {
+ memcpy(copy, orig, (count + 1) * sizeof(*copy));
+ }
+ }
+
+ *copy_out = copy;
+ return CSS_OK;
+}
+
#endif
diff --git a/src/select/properties/justify_content.c b/src/select/properties/justify_content.c
index 2e17ca5..385bab7 100644
--- a/src/select/properties/justify_content.c
+++ b/src/select/properties/justify_content.c
@@ -21,7 +21,7 @@ css_error css__cascade_justify_content(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case JUSTIFY_CONTENT_FLEX_START:
value = CSS_JUSTIFY_CONTENT_FLEX_START;
@@ -45,7 +45,7 @@ css_error css__cascade_justify_content(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_justify_content(state->computed, value);
}
@@ -64,16 +64,25 @@ css_error css__initial_justify_content(css_select_state *state)
CSS_JUSTIFY_CONTENT_FLEX_START);
}
+css_error css__copy_justify_content(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_justify_content(to, get_justify_content(from));
+}
+
css_error css__compose_justify_content(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_justify_content(child);
- if (type == CSS_JUSTIFY_CONTENT_INHERIT) {
- type = get_justify_content(parent);
- }
-
- return set_justify_content(result, type);
+ return css__copy_justify_content(
+ type == CSS_JUSTIFY_CONTENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/left.c b/src/select/properties/left.c
index 4baa324..ca8c844 100644
--- a/src/select/properties/left.c
+++ b/src/select/properties/left.c
@@ -32,6 +32,21 @@ css_error css__initial_left(css_select_state *state)
return set_left(state->computed, CSS_LEFT_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_left(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_left(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_left(to, type, length, unit);
+}
+
css_error css__compose_left(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_left(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_left(child, &length, &unit);
- if (type == CSS_LEFT_INHERIT) {
- type = get_left(parent, &length, &unit);
- }
-
- return set_left(result, type, length, unit);
+ return css__copy_left(
+ type == CSS_LEFT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/letter_spacing.c b/src/select/properties/letter_spacing.c
index 27ea04b..9c8e50c 100644
--- a/src/select/properties/letter_spacing.c
+++ b/src/select/properties/letter_spacing.c
@@ -33,6 +33,21 @@ css_error css__initial_letter_spacing(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_letter_spacing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_letter_spacing(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_letter_spacing(to, type, length, unit);
+}
+
css_error css__compose_letter_spacing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,9 +56,7 @@ css_error css__compose_letter_spacing(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_letter_spacing(child, &length, &unit);
- if (type == CSS_LETTER_SPACING_INHERIT) {
- type = get_letter_spacing(parent, &length, &unit);
- }
-
- return set_letter_spacing(result, type, length, unit);
+ return css__copy_letter_spacing(
+ type == CSS_LETTER_SPACING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/line_height.c b/src/select/properties/line_height.c
index 091a575..7300b5d 100644
--- a/src/select/properties/line_height.c
+++ b/src/select/properties/line_height.c
@@ -21,7 +21,7 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LINE_HEIGHT_NUMBER:
value = CSS_LINE_HEIGHT_NUMBER;
@@ -44,7 +44,7 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_line_height(state->computed, value, val, unit);
}
@@ -64,6 +64,21 @@ css_error css__initial_line_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_line_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_line_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_line_height(to, type, length, unit);
+}
+
css_error css__compose_line_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -72,10 +87,8 @@ css_error css__compose_line_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_line_height(child, &length, &unit);
- if (type == CSS_LINE_HEIGHT_INHERIT) {
- type = get_line_height(parent, &length, &unit);
- }
-
- return set_line_height(result, type, length, unit);
+ return css__copy_line_height(
+ type == CSS_LINE_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/list_style_image.c b/src/select/properties/list_style_image.c
index cc77eb4..7a41c3a 100644
--- a/src/select/properties/list_style_image.c
+++ b/src/select/properties/list_style_image.c
@@ -39,6 +39,20 @@ css_error css__initial_list_style_image(css_select_state *state)
CSS_LIST_STYLE_IMAGE_NONE, NULL);
}
+css_error css__copy_list_style_image(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ lwc_string *url;
+ uint8_t type = get_list_style_image(from, &url);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_list_style_image(to, type, url);
+}
+
css_error css__compose_list_style_image(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -46,10 +60,8 @@ css_error css__compose_list_style_image(const css_computed_style *parent,
lwc_string *url;
uint8_t type = get_list_style_image(child, &url);
- if (type == CSS_LIST_STYLE_IMAGE_INHERIT) {
- type = get_list_style_image(parent, &url);
- }
-
- return set_list_style_image(result, type, url);
+ return css__copy_list_style_image(
+ type == CSS_LIST_STYLE_IMAGE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/list_style_position.c b/src/select/properties/list_style_position.c
index 02d7651..ca46850 100644
--- a/src/select/properties/list_style_position.c
+++ b/src/select/properties/list_style_position.c
@@ -21,7 +21,7 @@ css_error css__cascade_list_style_position(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LIST_STYLE_POSITION_INSIDE:
value = CSS_LIST_STYLE_POSITION_INSIDE;
@@ -33,7 +33,7 @@ css_error css__cascade_list_style_position(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_list_style_position(state->computed, value);
}
@@ -52,16 +52,25 @@ css_error css__initial_list_style_position(css_select_state *state)
CSS_LIST_STYLE_POSITION_OUTSIDE);
}
+css_error css__copy_list_style_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_list_style_position(to, get_list_style_position(from));
+}
+
css_error css__compose_list_style_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_list_style_position(child);
- if (type == CSS_LIST_STYLE_POSITION_INHERIT) {
- type = get_list_style_position(parent);
- }
-
- return set_list_style_position(result, type);
+ return css__copy_list_style_position(
+ type == CSS_LIST_STYLE_POSITION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/list_style_type.c b/src/select/properties/list_style_type.c
index 7560c3b..9d809e6 100644
--- a/src/select/properties/list_style_type.c
+++ b/src/select/properties/list_style_type.c
@@ -21,7 +21,7 @@ css_error css__cascade_list_style_type(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LIST_STYLE_TYPE_DISC:
value = CSS_LIST_STYLE_TYPE_DISC;
@@ -164,11 +164,26 @@ css_error css__cascade_list_style_type(uint32_t opv, css_style *style,
case LIST_STYLE_TYPE_KATAKANA_IROHA:
value = CSS_LIST_STYLE_TYPE_KATAKANA_IROHA;
break;
+ case LIST_STYLE_TYPE_JAPANESE_INFORMAL:
+ value = CSS_LIST_STYLE_TYPE_JAPANESE_INFORMAL;
+ break;
+ case LIST_STYLE_TYPE_JAPANESE_FORMAL:
+ value = CSS_LIST_STYLE_TYPE_JAPANESE_FORMAL;
+ break;
+ case LIST_STYLE_TYPE_KOREAN_HANGUL_FORMAL:
+ value = CSS_LIST_STYLE_TYPE_KOREAN_HANGUL_FORMAL;
+ break;
+ case LIST_STYLE_TYPE_KOREAN_HANJA_INFORMAL:
+ value = CSS_LIST_STYLE_TYPE_KOREAN_HANJA_INFORMAL;
+ break;
+ case LIST_STYLE_TYPE_KOREAN_HANJA_FORMAL:
+ value = CSS_LIST_STYLE_TYPE_KOREAN_HANJA_FORMAL;
+ break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_list_style_type(state->computed, value);
}
@@ -186,15 +201,24 @@ css_error css__initial_list_style_type(css_select_state *state)
return set_list_style_type(state->computed, CSS_LIST_STYLE_TYPE_DISC);
}
+css_error css__copy_list_style_type(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_list_style_type(to, get_list_style_type(from));
+}
+
css_error css__compose_list_style_type(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_list_style_type(child);
- if (type == CSS_LIST_STYLE_TYPE_INHERIT) {
- type = get_list_style_type(parent);
- }
-
- return set_list_style_type(result, type);
+ return css__copy_list_style_type(
+ type == CSS_LIST_STYLE_TYPE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_bottom.c b/src/select/properties/margin_bottom.c
index 3b1d8a1..a0ffd89 100644
--- a/src/select/properties/margin_bottom.c
+++ b/src/select/properties/margin_bottom.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_bottom(css_select_state *state)
return set_margin_bottom(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_bottom(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_bottom(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_bottom(to, type, length, unit);
+}
+
css_error css__compose_margin_bottom(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_bottom(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_bottom(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_bottom(parent, &length, &unit);
- }
-
- return set_margin_bottom(result, type, length, unit);
+ return css__copy_margin_bottom(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_left.c b/src/select/properties/margin_left.c
index 240285a..b163fba 100644
--- a/src/select/properties/margin_left.c
+++ b/src/select/properties/margin_left.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_left(css_select_state *state)
return set_margin_left(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_left(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_left(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_left(to, type, length, unit);
+}
+
css_error css__compose_margin_left(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_left(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_left(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_left(parent, &length, &unit);
- }
-
- return set_margin_left(result, type, length, unit);
+ return css__copy_margin_left(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_right.c b/src/select/properties/margin_right.c
index 737fbee..2c15b54 100644
--- a/src/select/properties/margin_right.c
+++ b/src/select/properties/margin_right.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_right(css_select_state *state)
return set_margin_right(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_right(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_right(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_right(to, type, length, unit);
+}
+
css_error css__compose_margin_right(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_right(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_right(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_right(parent, &length, &unit);
- }
-
- return set_margin_right(result, type, length, unit);
+ return css__copy_margin_right(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_top.c b/src/select/properties/margin_top.c
index 5563a48..1df811d 100644
--- a/src/select/properties/margin_top.c
+++ b/src/select/properties/margin_top.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_top(css_select_state *state)
return set_margin_top(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_top(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_top(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_top(to, type, length, unit);
+}
+
css_error css__compose_margin_top(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_top(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_top(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_top(parent, &length, &unit);
- }
-
- return set_margin_top(result, type, length, unit);
+ return css__copy_margin_top(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/max_height.c b/src/select/properties/max_height.c
index e03c8da..1dcf09d 100644
--- a/src/select/properties/max_height.c
+++ b/src/select/properties/max_height.c
@@ -33,6 +33,21 @@ css_error css__initial_max_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_max_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_max_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_max_height(to, type, length, unit);
+}
+
css_error css__compose_max_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_max_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_max_height(child, &length, &unit);
- if (type == CSS_MAX_HEIGHT_INHERIT) {
- type = get_max_height(parent, &length, &unit);
- }
-
- return set_max_height(result, type, length, unit);
+ return css__copy_max_height(
+ type == CSS_MAX_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/max_width.c b/src/select/properties/max_width.c
index ec98712..11d8ade 100644
--- a/src/select/properties/max_width.c
+++ b/src/select/properties/max_width.c
@@ -32,6 +32,21 @@ css_error css__initial_max_width(css_select_state *state)
return set_max_width(state->computed, CSS_MAX_WIDTH_NONE, 0, CSS_UNIT_PX);
}
+css_error css__copy_max_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_max_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_max_width(to, type, length, unit);
+}
+
css_error css__compose_max_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_max_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_max_width(child, &length, &unit);
- if (type == CSS_MAX_WIDTH_INHERIT) {
- type = get_max_width(parent, &length, &unit);
- }
-
- return set_max_width(result, type, length, unit);
+ return css__copy_max_width(
+ type == CSS_MAX_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/min_height.c b/src/select/properties/min_height.c
index a5389ce..d05655c 100644
--- a/src/select/properties/min_height.c
+++ b/src/select/properties/min_height.c
@@ -33,6 +33,21 @@ css_error css__initial_min_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_min_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_min_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_min_height(to, type, length, unit);
+}
+
css_error css__compose_min_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_min_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_min_height(child, &length, &unit);
- if (type == CSS_MIN_HEIGHT_INHERIT) {
- type = get_min_height(parent, &length, &unit);
- }
-
- return set_min_height(result, type, length, unit);
+ return css__copy_min_height(
+ type == CSS_MIN_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/min_width.c b/src/select/properties/min_width.c
index 8460e01..af709d3 100644
--- a/src/select/properties/min_width.c
+++ b/src/select/properties/min_width.c
@@ -33,6 +33,21 @@ css_error css__initial_min_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_min_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_min_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_min_width(to, type, length, unit);
+}
+
css_error css__compose_min_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_min_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_min_width(child, &length, &unit);
- if (type == CSS_MIN_WIDTH_INHERIT) {
- type = get_min_width(parent, &length, &unit);
- }
-
- return set_min_width(result, type, length, unit);
+ return css__copy_min_width(
+ type == CSS_MIN_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/opacity.c b/src/select/properties/opacity.c
index aadab0b..3e875f9 100644
--- a/src/select/properties/opacity.c
+++ b/src/select/properties/opacity.c
@@ -20,15 +20,15 @@ css_error css__cascade_opacity(uint32_t opv, css_style *style,
uint16_t value = CSS_OPACITY_INHERIT;
css_fixed opacity = 0;
- if (isInherit(opv) == false) {
- value = CSS_Z_INDEX_SET;
+ if (hasFlagValue(opv) == false) {
+ value = CSS_OPACITY_SET;
opacity = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(opacity));
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_opacity(state->computed, value, opacity);
}
@@ -46,6 +46,20 @@ css_error css__initial_opacity(css_select_state *state)
return set_opacity(state->computed, CSS_OPACITY_SET, INTTOFIX(1));
}
+css_error css__copy_opacity(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed opacity = 0;
+ uint8_t type = get_opacity(from, &opacity);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_opacity(to, type, opacity);
+}
+
css_error css__compose_opacity(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_opacity(const css_computed_style *parent,
css_fixed opacity = 0;
uint8_t type = get_opacity(child, &opacity);
- if (type == CSS_OPACITY_INHERIT) {
- type = get_opacity(parent, &opacity);
- }
-
- return set_opacity(result, type, opacity);
+ return css__copy_opacity(
+ type == CSS_OPACITY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/order.c b/src/select/properties/order.c
index 0366537..4004c0e 100644
--- a/src/select/properties/order.c
+++ b/src/select/properties/order.c
@@ -20,7 +20,7 @@ css_error css__cascade_order(uint32_t opv, css_style *style,
uint16_t value = CSS_ORDER_INHERIT;
css_fixed order = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_ORDER_SET;
order = FIXTOINT(*((css_fixed *) style->bytecode));
@@ -28,7 +28,7 @@ css_error css__cascade_order(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_order(state->computed, value, order);
}
@@ -46,6 +46,20 @@ css_error css__initial_order(css_select_state *state)
return set_order(state->computed, CSS_ORDER_SET, 0);
}
+css_error css__copy_order(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t order = 0;
+ uint8_t type = get_order(from, &order);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_order(to, type, order);
+}
+
css_error css__compose_order(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_order(const css_computed_style *parent,
int32_t order = 0;
uint8_t type = get_order(child, &order);
- if (type == CSS_ORDER_INHERIT) {
- type = get_order(parent, &order);
- }
-
- return set_order(result, type, order);
+ return css__copy_order(
+ type == CSS_ORDER_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/orphans.c b/src/select/properties/orphans.c
index f169b81..b0fee43 100644
--- a/src/select/properties/orphans.c
+++ b/src/select/properties/orphans.c
@@ -31,6 +31,20 @@ css_error css__initial_orphans(css_select_state *state)
return set_orphans(state->computed, CSS_ORPHANS_SET, 2);
}
+css_error css__copy_orphans(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_orphans(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_orphans(to, type, count);
+}
+
css_error css__compose_orphans(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_orphans(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_orphans(child, &count);
- if (type == CSS_ORPHANS_INHERIT) {
- type = get_orphans(parent, &count);
- }
-
- return set_orphans(result, type, count);
+ return css__copy_orphans(
+ type == CSS_ORPHANS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/outline_color.c b/src/select/properties/outline_color.c
index 97846ac..359960f 100644
--- a/src/select/properties/outline_color.c
+++ b/src/select/properties/outline_color.c
@@ -20,7 +20,7 @@ css_error css__cascade_outline_color(uint32_t opv, css_style *style,
uint16_t value = CSS_OUTLINE_COLOR_INHERIT;
css_color color = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case OUTLINE_COLOR_TRANSPARENT:
value = CSS_OUTLINE_COLOR_COLOR;
@@ -40,7 +40,7 @@ css_error css__cascade_outline_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_outline_color(state->computed, value, color);
}
@@ -58,6 +58,20 @@ css_error css__initial_outline_color(css_select_state *state)
return set_outline_color(state->computed, CSS_OUTLINE_COLOR_INVERT, 0);
}
+css_error css__copy_outline_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color = 0;
+ uint8_t type = get_outline_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_outline_color(to, type, color);
+}
+
css_error css__compose_outline_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -65,9 +79,7 @@ css_error css__compose_outline_color(const css_computed_style *parent,
css_color color = 0;
uint8_t type = get_outline_color(child, &color);
- if (type == CSS_OUTLINE_COLOR_INHERIT) {
- type = get_outline_color(parent, &color);
- }
-
- return set_outline_color(result, type, color);
+ return css__copy_outline_color(
+ type == CSS_OUTLINE_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/outline_style.c b/src/select/properties/outline_style.c
index 5c30735..acdab03 100644
--- a/src/select/properties/outline_style.c
+++ b/src/select/properties/outline_style.c
@@ -31,16 +31,25 @@ css_error css__initial_outline_style(css_select_state *state)
return set_outline_style(state->computed, CSS_OUTLINE_STYLE_NONE);
}
+css_error css__copy_outline_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_outline_style(to, get_outline_style(from));
+}
+
css_error css__compose_outline_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_outline_style(child);
- if (type == CSS_OUTLINE_STYLE_INHERIT) {
- type = get_outline_style(parent);
- }
-
- return set_outline_style(result, type);
+ return css__copy_outline_style(
+ type == CSS_OUTLINE_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/outline_width.c b/src/select/properties/outline_width.c
index 0289c57..dbc0298 100644
--- a/src/select/properties/outline_width.c
+++ b/src/select/properties/outline_width.c
@@ -33,6 +33,21 @@ css_error css__initial_outline_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_outline_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_outline_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_outline_width(to, type, length, unit);
+}
+
css_error css__compose_outline_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_outline_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_outline_width(child, &length, &unit);
- if (type == CSS_OUTLINE_WIDTH_INHERIT) {
- type = get_outline_width(parent, &length, &unit);
- }
-
- return set_outline_width(result, type, length, unit);
+ return css__copy_outline_width(
+ type == CSS_OUTLINE_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/overflow_x.c b/src/select/properties/overflow_x.c
index 817d1d2..98dfba5 100644
--- a/src/select/properties/overflow_x.c
+++ b/src/select/properties/overflow_x.c
@@ -21,7 +21,7 @@ css_error css__cascade_overflow_x(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case OVERFLOW_VISIBLE:
value = CSS_OVERFLOW_VISIBLE;
@@ -39,7 +39,7 @@ css_error css__cascade_overflow_x(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_overflow_x(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_overflow_x(css_select_state *state)
return set_overflow_x(state->computed, CSS_OVERFLOW_VISIBLE);
}
+css_error css__copy_overflow_x(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_overflow_x(to, get_overflow_x(from));
+}
+
css_error css__compose_overflow_x(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_overflow_x(child);
- if (type == CSS_OVERFLOW_INHERIT) {
- type = get_overflow_x(parent);
- }
-
- return set_overflow_x(result, type);
+ return css__copy_overflow_x(
+ type == CSS_OVERFLOW_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/overflow_y.c b/src/select/properties/overflow_y.c
index b54c4c8..d7795a2 100644
--- a/src/select/properties/overflow_y.c
+++ b/src/select/properties/overflow_y.c
@@ -21,7 +21,7 @@ css_error css__cascade_overflow_y(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case OVERFLOW_VISIBLE:
value = CSS_OVERFLOW_VISIBLE;
@@ -39,7 +39,7 @@ css_error css__cascade_overflow_y(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_overflow_y(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_overflow_y(css_select_state *state)
return set_overflow_y(state->computed, CSS_OVERFLOW_VISIBLE);
}
+css_error css__copy_overflow_y(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_overflow_y(to, get_overflow_y(from));
+}
+
css_error css__compose_overflow_y(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_overflow_y(child);
- if (type == CSS_OVERFLOW_INHERIT) {
- type = get_overflow_y(parent);
- }
-
- return set_overflow_y(result, type);
+ return css__copy_overflow_y(
+ type == CSS_OVERFLOW_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_bottom.c b/src/select/properties/padding_bottom.c
index e3b36f7..53c749c 100644
--- a/src/select/properties/padding_bottom.c
+++ b/src/select/properties/padding_bottom.c
@@ -33,6 +33,21 @@ css_error css__initial_padding_bottom(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_padding_bottom(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_bottom(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_bottom(to, type, length, unit);
+}
+
css_error css__compose_padding_bottom(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_padding_bottom(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_bottom(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_bottom(parent, &length, &unit);
- }
-
- return set_padding_bottom(result, type, length, unit);
+ return css__copy_padding_bottom(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_left.c b/src/select/properties/padding_left.c
index bdea11e..b61ca83 100644
--- a/src/select/properties/padding_left.c
+++ b/src/select/properties/padding_left.c
@@ -32,6 +32,21 @@ css_error css__initial_padding_left(css_select_state *state)
return set_padding_left(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_padding_left(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_left(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_left(to, type, length, unit);
+}
+
css_error css__compose_padding_left(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_padding_left(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_left(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_left(parent, &length, &unit);
- }
-
- return set_padding_left(result, type, length, unit);
+ return css__copy_padding_left(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_right.c b/src/select/properties/padding_right.c
index 82c1ed3..35417d6 100644
--- a/src/select/properties/padding_right.c
+++ b/src/select/properties/padding_right.c
@@ -33,6 +33,21 @@ css_error css__initial_padding_right(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_padding_right(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_right(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_right(to, type, length, unit);
+}
+
css_error css__compose_padding_right(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_padding_right(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_right(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_right(parent, &length, &unit);
- }
-
- return set_padding_right(result, type, length, unit);
+ return css__copy_padding_right(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_top.c b/src/select/properties/padding_top.c
index f6d8b3e..a2cec95 100644
--- a/src/select/properties/padding_top.c
+++ b/src/select/properties/padding_top.c
@@ -32,6 +32,21 @@ css_error css__initial_padding_top(css_select_state *state)
return set_padding_top(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_padding_top(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_top(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_top(to, type, length, unit);
+}
+
css_error css__compose_padding_top(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_padding_top(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_top(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_top(parent, &length, &unit);
- }
-
- return set_padding_top(result, type, length, unit);
+ return css__copy_padding_top(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/page_break_after.c b/src/select/properties/page_break_after.c
index fdb6774..4065a17 100644
--- a/src/select/properties/page_break_after.c
+++ b/src/select/properties/page_break_after.c
@@ -33,16 +33,25 @@ css_error css__initial_page_break_after(css_select_state *state)
CSS_PAGE_BREAK_AFTER_AUTO);
}
+css_error css__copy_page_break_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_page_break_after(to, get_page_break_after(from));
+}
+
css_error css__compose_page_break_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_page_break_after(child);
- if (type == CSS_PAGE_BREAK_AFTER_INHERIT) {
- type = get_page_break_after(parent);
- }
-
- return set_page_break_after(result, type);
+ return css__copy_page_break_after(
+ type == CSS_PAGE_BREAK_AFTER_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/page_break_before.c b/src/select/properties/page_break_before.c
index 1491997..d8fdd93 100644
--- a/src/select/properties/page_break_before.c
+++ b/src/select/properties/page_break_before.c
@@ -33,15 +33,24 @@ css_error css__initial_page_break_before(css_select_state *state)
CSS_PAGE_BREAK_BEFORE_AUTO);
}
+css_error css__copy_page_break_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_page_break_before(to, get_page_break_before(from));
+}
+
css_error css__compose_page_break_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_page_break_before(child);
- if (type == CSS_PAGE_BREAK_BEFORE_INHERIT) {
- type = get_page_break_before(parent);
- }
-
- return set_page_break_before(result, type);
+ return css__copy_page_break_before(
+ type == CSS_PAGE_BREAK_BEFORE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/page_break_inside.c b/src/select/properties/page_break_inside.c
index ddcb19f..8655c40 100644
--- a/src/select/properties/page_break_inside.c
+++ b/src/select/properties/page_break_inside.c
@@ -33,16 +33,25 @@ css_error css__initial_page_break_inside(css_select_state *state)
CSS_PAGE_BREAK_INSIDE_AUTO);
}
+css_error css__copy_page_break_inside(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_page_break_inside(to, get_page_break_inside(from));
+}
+
css_error css__compose_page_break_inside(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_page_break_inside(child);
- if (type == CSS_PAGE_BREAK_INSIDE_INHERIT) {
- type = get_page_break_inside(parent);
- }
-
- return set_page_break_inside(result, type);
+ return css__copy_page_break_inside(
+ type == CSS_PAGE_BREAK_INSIDE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/pause_after.c b/src/select/properties/pause_after.c
index 16bbefe..b8bf968 100644
--- a/src/select/properties/pause_after.c
+++ b/src/select/properties/pause_after.c
@@ -37,6 +37,16 @@ css_error css__initial_pause_after(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pause_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pause_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/pause_before.c b/src/select/properties/pause_before.c
index 7770615..74cb565 100644
--- a/src/select/properties/pause_before.c
+++ b/src/select/properties/pause_before.c
@@ -37,6 +37,16 @@ css_error css__initial_pause_before(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pause_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pause_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/pitch.c b/src/select/properties/pitch.c
index c5484d9..c0c5c88 100644
--- a/src/select/properties/pitch.c
+++ b/src/select/properties/pitch.c
@@ -20,7 +20,7 @@ css_error css__cascade_pitch(uint32_t opv, css_style *style,
css_fixed freq = 0;
uint32_t unit = UNIT_HZ;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case PITCH_FREQUENCY:
freq = *((css_fixed *) style->bytecode);
@@ -41,7 +41,7 @@ css_error css__cascade_pitch(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo pitch */
}
@@ -64,6 +64,16 @@ css_error css__initial_pitch(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pitch(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pitch(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/pitch_range.c b/src/select/properties/pitch_range.c
index 52a5751..c8f7526 100644
--- a/src/select/properties/pitch_range.c
+++ b/src/select/properties/pitch_range.c
@@ -37,6 +37,16 @@ css_error css__initial_pitch_range(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pitch_range(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pitch_range(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/play_during.c b/src/select/properties/play_during.c
index 413d75a..0f38f74 100644
--- a/src/select/properties/play_during.c
+++ b/src/select/properties/play_during.c
@@ -19,7 +19,7 @@ css_error css__cascade_play_during(uint32_t opv, css_style *style,
{
lwc_string *uri = NULL;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case PLAY_DURING_URI:
css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &uri);
@@ -35,7 +35,7 @@ css_error css__cascade_play_during(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo play-during */
}
@@ -58,6 +58,16 @@ css_error css__initial_play_during(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_play_during(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_play_during(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/position.c b/src/select/properties/position.c
index 9f9658f..cc4b3e7 100644
--- a/src/select/properties/position.c
+++ b/src/select/properties/position.c
@@ -21,7 +21,7 @@ css_error css__cascade_position(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case POSITION_STATIC:
value = CSS_POSITION_STATIC;
@@ -35,11 +35,14 @@ css_error css__cascade_position(uint32_t opv, css_style *style,
case POSITION_FIXED:
value = CSS_POSITION_FIXED;
break;
+ case POSITION_STICKY:
+ value = CSS_POSITION_STICKY;
+ break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_position(state->computed, value);
}
@@ -57,16 +60,25 @@ css_error css__initial_position(css_select_state *state)
return set_position(state->computed, CSS_POSITION_STATIC);
}
+css_error css__copy_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_position(to, get_position(from));
+}
+
css_error css__compose_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_position(child);
- if (type == CSS_POSITION_INHERIT) {
- type = get_position(parent);
- }
-
- return set_position(result, type);
+ return css__copy_position(
+ type == CSS_POSITION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h
index 6eac397..cb0b213 100644
--- a/src/select/properties/properties.h
+++ b/src/select/properties/properties.h
@@ -18,6 +18,7 @@
css_error css__cascade_##pname (uint32_t opv, css_style *style, css_select_state *state); \
css_error css__set_##pname##_from_hint(const css_hint *hint, css_computed_style *style); \
css_error css__initial_##pname (css_select_state *state); \
+ css_error css__copy_##pname (const css_computed_style *from, css_computed_style *to); \
css_error css__compose_##pname (const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); \
uint32_t destroy_##pname (void *bytecode)
@@ -71,6 +72,7 @@ PROPERTY_FUNCS(direction);
PROPERTY_FUNCS(display);
PROPERTY_FUNCS(elevation);
PROPERTY_FUNCS(empty_cells);
+PROPERTY_FUNCS(fill_opacity);
PROPERTY_FUNCS(flex_basis);
PROPERTY_FUNCS(flex_direction);
PROPERTY_FUNCS(flex_grow);
@@ -128,6 +130,7 @@ PROPERTY_FUNCS(speak_punctuation);
PROPERTY_FUNCS(speak);
PROPERTY_FUNCS(speech_rate);
PROPERTY_FUNCS(stress);
+PROPERTY_FUNCS(stroke_opacity);
PROPERTY_FUNCS(table_layout);
PROPERTY_FUNCS(text_align);
PROPERTY_FUNCS(text_decoration);
diff --git a/src/select/properties/quotes.c b/src/select/properties/quotes.c
index 4144d8e..57fc48c 100644
--- a/src/select/properties/quotes.c
+++ b/src/select/properties/quotes.c
@@ -21,7 +21,7 @@ css_error css__cascade_quotes(uint32_t opv, css_style *style,
lwc_string **quotes = NULL;
uint32_t n_quotes = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
value = CSS_QUOTES_STRING;
@@ -75,7 +75,7 @@ css_error css__cascade_quotes(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_quotes(state->computed, value, quotes);
@@ -123,43 +123,41 @@ css_error css__initial_quotes(css_select_state *state)
return css__set_quotes_from_hint(&hint, state->computed);
}
-css_error css__compose_quotes(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_quotes(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
+ lwc_string **copy = NULL;
lwc_string **quotes = NULL;
- uint8_t type = get_quotes(child, &quotes);
-
- if (type == CSS_QUOTES_INHERIT || result != child) {
- size_t n_quotes = 0;
- lwc_string **copy = NULL;
-
- if (type == CSS_QUOTES_INHERIT) {
- type = get_quotes(parent, &quotes);
- }
-
- if (quotes != NULL) {
- lwc_string **i;
+ uint8_t type = get_quotes(from, &quotes);
- for (i = quotes; (*i) != NULL; i++)
- n_quotes++;
+ if (from == to) {
+ return CSS_OK;
+ }
- copy = malloc((n_quotes + 1) * sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
+ error = css__copy_lwc_string_array(false, quotes, &copy);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
+ }
- memcpy(copy, quotes, (n_quotes + 1) *
- sizeof(lwc_string *));
- }
+ error = set_quotes(to, type, copy);
+ if (error != CSS_OK) {
+ free(copy);
+ }
- error = set_quotes(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ return error;
+}
- return error;
- }
+css_error css__compose_quotes(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ lwc_string **quotes = NULL;
+ uint8_t type = get_quotes(child, &quotes);
- return CSS_OK;
+ return css__copy_quotes(
+ type == CSS_QUOTES_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/richness.c b/src/select/properties/richness.c
index 9656486..cd62d5c 100644
--- a/src/select/properties/richness.c
+++ b/src/select/properties/richness.c
@@ -37,6 +37,16 @@ css_error css__initial_richness(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_richness(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_richness(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/right.c b/src/select/properties/right.c
index 142e7e8..ee4f4a0 100644
--- a/src/select/properties/right.c
+++ b/src/select/properties/right.c
@@ -32,6 +32,21 @@ css_error css__initial_right(css_select_state *state)
return set_right(state->computed, CSS_RIGHT_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_right(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_right(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_right(to, type, length, unit);
+}
+
css_error css__compose_right(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_right(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_right(child, &length, &unit);
- if (type == CSS_RIGHT_INHERIT) {
- type = get_right(parent, &length, &unit);
- }
-
- return set_right(result, type, length, unit);
+ return css__copy_right(
+ type == CSS_RIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/speak.c b/src/select/properties/speak.c
index eb5528b..7b0d014 100644
--- a/src/select/properties/speak.c
+++ b/src/select/properties/speak.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak(uint32_t opv, css_style *style,
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_NORMAL:
case SPEAK_NONE:
@@ -30,7 +30,7 @@ css_error css__cascade_speak(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak */
}
@@ -53,6 +53,16 @@ css_error css__initial_speak(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speak_header.c b/src/select/properties/speak_header.c
index 0935528..88ad0d7 100644
--- a/src/select/properties/speak_header.c
+++ b/src/select/properties/speak_header.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak_header(uint32_t opv, css_style *style,
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_HEADER_ONCE:
case SPEAK_HEADER_ALWAYS:
@@ -29,7 +29,7 @@ css_error css__cascade_speak_header(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak-header */
}
@@ -52,6 +52,16 @@ css_error css__initial_speak_header(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak_header(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak_header(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speak_numeral.c b/src/select/properties/speak_numeral.c
index fc54caf..1cd6e98 100644
--- a/src/select/properties/speak_numeral.c
+++ b/src/select/properties/speak_numeral.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak_numeral(uint32_t opv, css_style *style,
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_NUMERAL_DIGITS:
case SPEAK_NUMERAL_CONTINUOUS:
@@ -29,7 +29,7 @@ css_error css__cascade_speak_numeral(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak-numeral */
}
@@ -52,6 +52,16 @@ css_error css__initial_speak_numeral(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak_numeral(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak_numeral(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speak_punctuation.c b/src/select/properties/speak_punctuation.c
index 67cbdaf..916d530 100644
--- a/src/select/properties/speak_punctuation.c
+++ b/src/select/properties/speak_punctuation.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak_punctuation(
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_PUNCTUATION_CODE:
case SPEAK_PUNCTUATION_NONE:
@@ -29,7 +29,7 @@ css_error css__cascade_speak_punctuation(
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak-punctuation */
}
@@ -52,6 +52,16 @@ css_error css__initial_speak_punctuation(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak_punctuation(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak_punctuation(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speech_rate.c b/src/select/properties/speech_rate.c
index 5cec19b..296c248 100644
--- a/src/select/properties/speech_rate.c
+++ b/src/select/properties/speech_rate.c
@@ -19,7 +19,7 @@ css_error css__cascade_speech_rate(uint32_t opv, css_style *style,
{
css_fixed rate = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEECH_RATE_SET:
rate = *((css_fixed *) style->bytecode);
@@ -38,7 +38,7 @@ css_error css__cascade_speech_rate(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speech-rate */
}
@@ -61,6 +61,16 @@ css_error css__initial_speech_rate(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speech_rate(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speech_rate(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/stress.c b/src/select/properties/stress.c
index c9d61dd..0320fd0 100644
--- a/src/select/properties/stress.c
+++ b/src/select/properties/stress.c
@@ -37,6 +37,16 @@ css_error css__initial_stress(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_stress(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_stress(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/stroke_opacity.c b/src/select/properties/stroke_opacity.c
new file mode 100644
index 0000000..c27e127
--- /dev/null
+++ b/src/select/properties/stroke_opacity.c
@@ -0,0 +1,73 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ */
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+#include "select/propset.h"
+#include "select/propget.h"
+#include "utils/utils.h"
+
+#include "select/properties/properties.h"
+#include "select/properties/helpers.h"
+
+css_error css__cascade_stroke_opacity(uint32_t opv, css_style *style,
+ css_select_state *state)
+{
+ uint16_t value = CSS_STROKE_OPACITY_INHERIT;
+ css_fixed stroke_opacity = 0;
+
+ if (hasFlagValue(opv) == false) {
+ value = CSS_STROKE_OPACITY_SET;
+
+ stroke_opacity = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(stroke_opacity));
+ }
+
+ if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
+ getFlagValue(opv))) {
+ return set_stroke_opacity(state->computed, value, stroke_opacity);
+ }
+
+ return CSS_OK;
+}
+
+css_error css__set_stroke_opacity_from_hint(const css_hint *hint,
+ css_computed_style *style)
+{
+ return set_stroke_opacity(style, hint->status, hint->data.fixed);
+}
+
+css_error css__initial_stroke_opacity(css_select_state *state)
+{
+ return set_stroke_opacity(state->computed, CSS_STROKE_OPACITY_SET, INTTOFIX(1));
+}
+
+css_error css__copy_stroke_opacity(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed stroke_opacity = 0;
+ uint8_t type = get_stroke_opacity(from, &stroke_opacity);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_stroke_opacity(to, type, stroke_opacity);
+}
+
+css_error css__compose_stroke_opacity(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ css_fixed stroke_opacity = 0;
+ uint8_t type = get_stroke_opacity(child, &stroke_opacity);
+
+ return css__copy_stroke_opacity(
+ type == CSS_STROKE_OPACITY_INHERIT ? parent : child,
+ result);
+}
+
diff --git a/src/select/properties/table_layout.c b/src/select/properties/table_layout.c
index c911e10..255ce37 100644
--- a/src/select/properties/table_layout.c
+++ b/src/select/properties/table_layout.c
@@ -21,7 +21,7 @@ css_error css__cascade_table_layout(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case TABLE_LAYOUT_AUTO:
value = CSS_TABLE_LAYOUT_AUTO;
@@ -33,7 +33,7 @@ css_error css__cascade_table_layout(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_table_layout(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_table_layout(css_select_state *state)
return set_table_layout(state->computed, CSS_TABLE_LAYOUT_AUTO);
}
+css_error css__copy_table_layout(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_table_layout(to, get_table_layout(from));
+}
+
css_error css__compose_table_layout(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_table_layout(child);
- if (type == CSS_TABLE_LAYOUT_INHERIT) {
- type = get_table_layout(parent);
- }
-
- return set_table_layout(result, type);
+ return css__copy_table_layout(
+ type == CSS_TABLE_LAYOUT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_align.c b/src/select/properties/text_align.c
index 808107f..303f8f5 100644
--- a/src/select/properties/text_align.c
+++ b/src/select/properties/text_align.c
@@ -21,7 +21,7 @@ css_error css__cascade_text_align(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case TEXT_ALIGN_LEFT:
value = CSS_TEXT_ALIGN_LEFT;
@@ -48,7 +48,7 @@ css_error css__cascade_text_align(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_text_align(state->computed, value);
}
@@ -66,15 +66,24 @@ css_error css__initial_text_align(css_select_state *state)
return set_text_align(state->computed, CSS_TEXT_ALIGN_DEFAULT);
}
+css_error css__copy_text_align(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_align(to, get_text_align(from));
+}
+
css_error css__compose_text_align(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_text_align(child);
- if (type == CSS_TEXT_ALIGN_INHERIT) {
- type = get_text_align(parent);
- } else if (type == CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC) {
+ if (type == CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC) {
/* This is purely for the benefit of HTML tables */
type = get_text_align(parent);
@@ -83,10 +92,15 @@ css_error css__compose_text_align(const css_computed_style *parent,
* inherit as normal. */
if (type == CSS_TEXT_ALIGN_LIBCSS_LEFT ||
type == CSS_TEXT_ALIGN_LIBCSS_CENTER ||
- type == CSS_TEXT_ALIGN_LIBCSS_RIGHT)
+ type == CSS_TEXT_ALIGN_LIBCSS_RIGHT) {
type = CSS_TEXT_ALIGN_DEFAULT;
+ }
+
+ return set_text_align(result, type);
}
- return set_text_align(result, type);
+ return css__copy_text_align(
+ type == CSS_TEXT_ALIGN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_decoration.c b/src/select/properties/text_decoration.c
index 0e7544d..bfea8a8 100644
--- a/src/select/properties/text_decoration.c
+++ b/src/select/properties/text_decoration.c
@@ -23,7 +23,7 @@ css_error css__cascade_text_decoration(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
if (getValue(opv) == TEXT_DECORATION_NONE) {
value = CSS_TEXT_DECORATION_NONE;
} else {
@@ -41,7 +41,7 @@ css_error css__cascade_text_decoration(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_text_decoration(state->computed, value);
}
@@ -59,16 +59,25 @@ css_error css__initial_text_decoration(css_select_state *state)
return set_text_decoration(state->computed, CSS_TEXT_DECORATION_NONE);
}
+css_error css__copy_text_decoration(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_decoration(to, get_text_decoration(from));
+}
+
css_error css__compose_text_decoration(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_text_decoration(child);
- if (type == CSS_TEXT_DECORATION_INHERIT) {
- type = get_text_decoration(parent);
- }
-
- return set_text_decoration(result, type);
+ return css__copy_text_decoration(
+ type == CSS_TEXT_DECORATION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_indent.c b/src/select/properties/text_indent.c
index 787c0be..3708130 100644
--- a/src/select/properties/text_indent.c
+++ b/src/select/properties/text_indent.c
@@ -33,6 +33,21 @@ css_error css__initial_text_indent(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_text_indent(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_text_indent(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_indent(to, type, length, unit);
+}
+
css_error css__compose_text_indent(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_text_indent(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_text_indent(child, &length, &unit);
- if (type == CSS_TEXT_INDENT_INHERIT) {
- type = get_text_indent(parent, &length, &unit);
- }
-
- return set_text_indent(result, type, length, unit);
+ return css__copy_text_indent(
+ type == CSS_TEXT_INDENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_transform.c b/src/select/properties/text_transform.c
index 38cb427..3bc5757 100644
--- a/src/select/properties/text_transform.c
+++ b/src/select/properties/text_transform.c
@@ -21,7 +21,7 @@ css_error css__cascade_text_transform(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case TEXT_TRANSFORM_CAPITALIZE:
value = CSS_TEXT_TRANSFORM_CAPITALIZE;
@@ -39,7 +39,7 @@ css_error css__cascade_text_transform(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_text_transform(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_text_transform(css_select_state *state)
return set_text_transform(state->computed, CSS_TEXT_TRANSFORM_NONE);
}
+css_error css__copy_text_transform(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_transform(to, get_text_transform(from));
+}
+
css_error css__compose_text_transform(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_text_transform(child);
- if (type == CSS_TEXT_TRANSFORM_INHERIT) {
- type = get_text_transform(parent);
- }
-
- return set_text_transform(result, type);
+ return css__copy_text_transform(
+ type == CSS_TEXT_TRANSFORM_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/top.c b/src/select/properties/top.c
index 72129aa..473a105 100644
--- a/src/select/properties/top.c
+++ b/src/select/properties/top.c
@@ -32,6 +32,21 @@ css_error css__initial_top(css_select_state *state)
return set_top(state->computed, CSS_TOP_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_top(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_top(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_top(to, type, length, unit);
+}
+
css_error css__compose_top(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_top(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_top(child, &length, &unit);
- if (type == CSS_TOP_INHERIT) {
- type = get_top(parent, &length, &unit);
- }
-
- return set_top(result, type, length, unit);
+ return css__copy_top(
+ type == CSS_TOP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/unicode_bidi.c b/src/select/properties/unicode_bidi.c
index 5b91df1..ae0f4ad 100644
--- a/src/select/properties/unicode_bidi.c
+++ b/src/select/properties/unicode_bidi.c
@@ -21,7 +21,7 @@ css_error css__cascade_unicode_bidi(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case UNICODE_BIDI_NORMAL:
value = CSS_UNICODE_BIDI_NORMAL;
@@ -36,7 +36,7 @@ css_error css__cascade_unicode_bidi(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_unicode_bidi(state->computed, value);
}
@@ -54,16 +54,25 @@ css_error css__initial_unicode_bidi(css_select_state *state)
return set_unicode_bidi(state->computed, CSS_UNICODE_BIDI_NORMAL);
}
+css_error css__copy_unicode_bidi(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_unicode_bidi(to, get_unicode_bidi(from));
+}
+
css_error css__compose_unicode_bidi(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_unicode_bidi(child);
- if (type == CSS_UNICODE_BIDI_INHERIT) {
- type = get_unicode_bidi(parent);
- }
-
- return set_unicode_bidi(result, type);
+ return css__copy_unicode_bidi(
+ type == CSS_UNICODE_BIDI_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/vertical_align.c b/src/select/properties/vertical_align.c
index 9fb7143..9fbffe6 100644
--- a/src/select/properties/vertical_align.c
+++ b/src/select/properties/vertical_align.c
@@ -21,7 +21,7 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case VERTICAL_ALIGN_SET:
value = CSS_VERTICAL_ALIGN_SET;
@@ -61,7 +61,7 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_vertical_align(state->computed, value, length, unit);
}
@@ -81,6 +81,21 @@ css_error css__initial_vertical_align(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_vertical_align(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_vertical_align(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_vertical_align(to, type, length, unit);
+}
+
css_error css__compose_vertical_align(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -89,10 +104,8 @@ css_error css__compose_vertical_align(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_vertical_align(child, &length, &unit);
- if (type == CSS_VERTICAL_ALIGN_INHERIT) {
- type = get_vertical_align(parent, &length, &unit);
- }
-
- return set_vertical_align(result, type, length, unit);
+ return css__copy_vertical_align(
+ type == CSS_VERTICAL_ALIGN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/visibility.c b/src/select/properties/visibility.c
index ef95252..674e433 100644
--- a/src/select/properties/visibility.c
+++ b/src/select/properties/visibility.c
@@ -21,7 +21,7 @@ css_error css__cascade_visibility(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case VISIBILITY_VISIBLE:
value = CSS_VISIBILITY_VISIBLE;
@@ -36,7 +36,7 @@ css_error css__cascade_visibility(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_visibility(state->computed, value);
}
@@ -54,16 +54,25 @@ css_error css__initial_visibility(css_select_state *state)
return set_visibility(state->computed, CSS_VISIBILITY_VISIBLE);
}
+css_error css__copy_visibility(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_visibility(to, get_visibility(from));
+}
+
css_error css__compose_visibility(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_visibility(child);
- if (type == CSS_VISIBILITY_INHERIT) {
- type = get_visibility(parent);
- }
-
- return set_visibility(result, type);
+ return css__copy_visibility(
+ type == CSS_VISIBILITY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/voice_family.c b/src/select/properties/voice_family.c
index b370a2b..66e3123 100644
--- a/src/select/properties/voice_family.c
+++ b/src/select/properties/voice_family.c
@@ -21,7 +21,7 @@ css_error css__cascade_voice_family(uint32_t opv, css_style *style,
lwc_string **voices = NULL;
uint32_t n_voices = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
while (v != VOICE_FAMILY_END) {
@@ -92,7 +92,7 @@ css_error css__cascade_voice_family(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo voice-family */
if (n_voices > 0)
free(voices);
@@ -120,6 +120,16 @@ css_error css__initial_voice_family(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_voice_family(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_voice_family(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/volume.c b/src/select/properties/volume.c
index 96787fa..65bdd03 100644
--- a/src/select/properties/volume.c
+++ b/src/select/properties/volume.c
@@ -20,7 +20,7 @@ css_error css__cascade_volume(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_PCT;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case VOLUME_NUMBER:
val = *((css_fixed *) style->bytecode);
@@ -46,7 +46,7 @@ css_error css__cascade_volume(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo volume */
}
@@ -69,6 +69,16 @@ css_error css__initial_volume(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_volume(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_volume(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/white_space.c b/src/select/properties/white_space.c
index b8d2e02..edc35cd 100644
--- a/src/select/properties/white_space.c
+++ b/src/select/properties/white_space.c
@@ -21,7 +21,7 @@ css_error css__cascade_white_space(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case WHITE_SPACE_NORMAL:
value = CSS_WHITE_SPACE_NORMAL;
@@ -42,7 +42,7 @@ css_error css__cascade_white_space(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_white_space(state->computed, value);
}
@@ -60,16 +60,25 @@ css_error css__initial_white_space(css_select_state *state)
return set_white_space(state->computed, CSS_WHITE_SPACE_NORMAL);
}
+css_error css__copy_white_space(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_white_space(to, get_white_space(from));
+}
+
css_error css__compose_white_space(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_white_space(child);
- if (type == CSS_WHITE_SPACE_INHERIT) {
- type = get_white_space(parent);
- }
-
- return set_white_space(result, type);
+ return css__copy_white_space(
+ type == CSS_WHITE_SPACE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/widows.c b/src/select/properties/widows.c
index 61126c2..853c08d 100644
--- a/src/select/properties/widows.c
+++ b/src/select/properties/widows.c
@@ -31,6 +31,20 @@ css_error css__initial_widows(css_select_state *state)
return set_widows(state->computed, CSS_WIDOWS_SET, 2);
}
+css_error css__copy_widows(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_widows(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_widows(to, type, count);
+}
+
css_error css__compose_widows(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_widows(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_widows(child, &count);
- if (type == CSS_WIDOWS_INHERIT) {
- type = get_widows(parent, &count);
- }
-
- return set_widows(result, type, count);
+ return css__copy_widows(
+ type == CSS_WIDOWS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/width.c b/src/select/properties/width.c
index 829df91..c6d33ff 100644
--- a/src/select/properties/width.c
+++ b/src/select/properties/width.c
@@ -32,6 +32,21 @@ css_error css__initial_width(css_select_state *state)
return set_width(state->computed, CSS_WIDTH_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_width(to, type, length, unit);
+}
+
css_error css__compose_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_width(child, &length, &unit);
- if (type == CSS_WIDTH_INHERIT) {
- type = get_width(parent, &length, &unit);
- }
-
- return set_width(result, type, length, unit);
+ return css__copy_width(
+ type == CSS_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/word_spacing.c b/src/select/properties/word_spacing.c
index eb39b50..c1c6782 100644
--- a/src/select/properties/word_spacing.c
+++ b/src/select/properties/word_spacing.c
@@ -33,6 +33,21 @@ css_error css__initial_word_spacing(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_word_spacing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_word_spacing(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_word_spacing(to, type, length, unit);
+}
+
css_error css__compose_word_spacing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,9 +56,7 @@ css_error css__compose_word_spacing(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_word_spacing(child, &length, &unit);
- if (type == CSS_WORD_SPACING_INHERIT) {
- type = get_word_spacing(parent, &length, &unit);
- }
-
- return set_word_spacing(result, type, length, unit);
+ return css__copy_word_spacing(
+ type == CSS_WORD_SPACING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/writing_mode.c b/src/select/properties/writing_mode.c
index bbd3753..05c0b26 100644
--- a/src/select/properties/writing_mode.c
+++ b/src/select/properties/writing_mode.c
@@ -17,11 +17,11 @@
css_error css__cascade_writing_mode(uint32_t opv, css_style *style,
css_select_state *state)
{
- bool inherit = isInherit(opv);
+ enum flag_value flag_value = getFlagValue(opv);
uint16_t writing_mode = CSS_WRITING_MODE_INHERIT;
UNUSED(style);
- if (inherit == false) {
+ if (flag_value == FLAG_VALUE__NONE) {
switch (getValue(opv)) {
case WRITING_MODE_HORIZONTAL_TB:
writing_mode = CSS_WRITING_MODE_HORIZONTAL_TB;
@@ -36,7 +36,7 @@ css_error css__cascade_writing_mode(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- inherit)) {
+ flag_value)) {
return set_writing_mode(state->computed, writing_mode);
}
@@ -55,16 +55,25 @@ css_error css__initial_writing_mode(css_select_state *state)
CSS_WRITING_MODE_HORIZONTAL_TB);
}
+css_error css__copy_writing_mode(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_writing_mode(to, get_writing_mode(from));
+}
+
css_error css__compose_writing_mode(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- uint8_t writing_mode = get_writing_mode(child);
-
- if (writing_mode == CSS_WRITING_MODE_INHERIT) {
- writing_mode = get_writing_mode(parent);
- }
+ uint8_t type = get_writing_mode(child);
- return set_writing_mode(result, writing_mode);
+ return css__copy_writing_mode(
+ type == CSS_WRITING_MODE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/z_index.c b/src/select/properties/z_index.c
index 59cf242..e5159e5 100644
--- a/src/select/properties/z_index.c
+++ b/src/select/properties/z_index.c
@@ -20,7 +20,7 @@ css_error css__cascade_z_index(uint32_t opv, css_style *style,
uint16_t value = CSS_Z_INDEX_INHERIT;
css_fixed index = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case Z_INDEX_SET:
value = CSS_Z_INDEX_SET;
@@ -35,7 +35,7 @@ css_error css__cascade_z_index(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_z_index(state->computed, value, index);
}
@@ -53,6 +53,20 @@ css_error css__initial_z_index(css_select_state *state)
return set_z_index(state->computed, CSS_Z_INDEX_AUTO, 0);
}
+css_error css__copy_z_index(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t index = 0;
+ uint8_t type = get_z_index(from, &index);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_z_index(to, type, index);
+}
+
css_error css__compose_z_index(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -60,10 +74,8 @@ css_error css__compose_z_index(const css_computed_style *parent,
int32_t index = 0;
uint8_t type = get_z_index(child, &index);
- if (type == CSS_Z_INDEX_INHERIT) {
- type = get_z_index(parent, &index);
- }
-
- return set_z_index(result, type, index);
+ return css__copy_z_index(
+ type == CSS_Z_INDEX_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/select.c b/src/select/select.c
index f6efbfe..da0aa61 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -23,6 +23,8 @@
#include "select/propset.h"
#include "select/font_face.h"
#include "select/select.h"
+#include "select/strings.h"
+#include "select/unit.h"
#include "utils/parserutilserror.h"
#include "utils/utils.h"
@@ -51,34 +53,9 @@ struct css_select_ctx {
void *pw; /**< Client's private selection context */
- /* Useful interned strings */
- lwc_string *universal;
- lwc_string *first_child;
- lwc_string *link;
- lwc_string *visited;
- lwc_string *hover;
- lwc_string *active;
- lwc_string *focus;
- lwc_string *nth_child;
- lwc_string *nth_last_child;
- lwc_string *nth_of_type;
- lwc_string *nth_last_of_type;
- lwc_string *last_child;
- lwc_string *first_of_type;
- lwc_string *last_of_type;
- lwc_string *only_child;
- lwc_string *only_of_type;
- lwc_string *root;
- lwc_string *empty;
- lwc_string *target;
- lwc_string *lang;
- lwc_string *enabled;
- lwc_string *disabled;
- lwc_string *checked;
- lwc_string *first_line;
- lwc_string *first_letter;
- lwc_string *before;
- lwc_string *after;
+ bool uses_revert; /**< A sheet used revert property value */
+
+ css_select_strings str;
/* Interned default style */
css_computed_style *default_style;
@@ -98,6 +75,7 @@ typedef struct css_select_font_faces_list {
typedef struct css_select_font_faces_state {
lwc_string *font_family;
const css_media *media;
+ const css_unit_ctx *unit_ctx;
css_select_font_faces_list ua_font_faces;
css_select_font_faces_list user_font_faces;
@@ -123,9 +101,6 @@ static css_error set_initial(css_select_state *state,
uint32_t prop, css_pseudo_element pseudo,
void *parent);
-static css_error intern_strings(css_select_ctx *ctx);
-static void destroy_strings(css_select_ctx *ctx);
-
static css_error select_from_sheet(css_select_ctx *ctx,
const css_stylesheet *sheet, css_origin origin,
css_select_state *state);
@@ -151,7 +126,8 @@ static css_error cascade_style(const css_style *style, css_select_state *state);
static css_error select_font_faces_from_sheet(
const css_stylesheet *sheet,
css_origin origin,
- css_select_font_faces_state *state);
+ css_select_font_faces_state *state,
+ const css_select_strings *str);
#ifdef DEBUG_CHAIN_MATCHING
static void dump_chain(const css_selector *selector);
@@ -262,7 +238,7 @@ css_error css_select_ctx_create(css_select_ctx **result)
if (c == NULL)
return CSS_NOMEM;
- error = intern_strings(c);
+ error = css_select_strings_intern(&c->str);
if (error != CSS_OK) {
free(c);
return error;
@@ -284,7 +260,7 @@ css_error css_select_ctx_destroy(css_select_ctx *ctx)
if (ctx == NULL)
return CSS_BADPARM;
- destroy_strings(ctx);
+ css_select_strings_unref(&ctx->str);
if (ctx->default_style != NULL)
css_computed_style_destroy(ctx->default_style);
@@ -381,6 +357,8 @@ css_error css_select_ctx_insert_sheet(css_select_ctx *ctx,
ctx->sheets[index].origin = origin;
ctx->sheets[index].media = mq;
+ ctx->uses_revert |= sheet->uses_revert;
+
ctx->n_sheets++;
return CSS_OK;
@@ -1045,18 +1023,32 @@ static void css_select__finalise_selection_state(
if (state->element.name != NULL){
lwc_string_unref(state->element.name);
}
+
+ if (state->revert != NULL) {
+ for (size_t i = 0; i < CSS_ORIGIN_AUTHOR; i++) {
+ for (size_t j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
+ if (state->revert[i].style[j] == NULL) {
+ continue;
+ }
+ css_computed_style_destroy(
+ state->revert[i].style[j]);
+ }
+ }
+ free(state->revert);
+ }
}
/**
* Initialise a selection state.
*
- * \param[in] state The selection state to initialise
- * \param[in] node The node we are selecting for.
- * \param[in] parent The node's parent node, or NULL.
- * \param[in] media The media specification we're selecting for.
- * \param[in] handler The client selection callback table.
- * \param[in] pw The client private data, passsed out to callbacks.
+ * \param[in] state The selection state to initialise
+ * \param[in] node The node we are selecting for.
+ * \param[in] parent The node's parent node, or NULL.
+ * \param[in] media The media specification we're selecting for.
+ * \param[in] unit_ctx Unit conversion context.
+ * \param[in] handler The client selection callback table.
+ * \param[in] pw The client private data, passsed out to callbacks.
* \return CSS_OK or appropriate error otherwise.
*/
static css_error css_select__initialise_selection_state(
@@ -1064,6 +1056,7 @@ static css_error css_select__initialise_selection_state(
void *node,
void *parent,
const css_media *media,
+ const css_unit_ctx *unit_ctx,
css_select_handler *handler,
void *pw)
{
@@ -1074,6 +1067,7 @@ static css_error css_select__initialise_selection_state(
memset(state, 0, sizeof(*state));
state->node = node;
state->media = media;
+ state->unit_ctx = unit_ctx;
state->handler = handler;
state->pw = pw;
state->next_reject = state->reject_cache +
@@ -1158,12 +1152,79 @@ failed:
return error;
}
+static css_error css__select_revert_property_to_origin(
+ css_select_state *select_state,
+ prop_state *prop_state,
+ css_origin origin,
+ enum css_pseudo_element pseudo,
+ enum css_properties_e property)
+{
+ css_error error;
+
+ if (select_state->results->styles[pseudo] == NULL) {
+ return CSS_OK;
+ }
+
+ if (select_state->revert[origin].style[pseudo] == NULL) {
+ return prop_dispatch[property].initial(select_state);
+ }
+
+ error = prop_dispatch[property].copy(
+ select_state->revert[origin].style[pseudo],
+ select_state->results->styles[pseudo]);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ *prop_state = select_state->revert[origin].props[property][pseudo];
+ return CSS_OK;
+}
+
+static css_error css__select_revert_property(
+ css_select_state *select_state,
+ prop_state *prop_state,
+ enum css_pseudo_element pseudo,
+ enum css_properties_e property)
+{
+ css_error error;
+
+ switch (prop_state->origin) {
+ case CSS_ORIGIN_AUTHOR:
+ error = css__select_revert_property_to_origin(
+ select_state, prop_state, CSS_ORIGIN_USER,
+ pseudo, property);
+ if (error != CSS_OK) {
+ return error;
+ }
+ if (prop_state->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_USER:
+ error = css__select_revert_property_to_origin(
+ select_state, prop_state, CSS_ORIGIN_UA,
+ pseudo, property);
+ if (error != CSS_OK) {
+ return error;
+ }
+ if (prop_state->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_UA:
+ prop_state->explicit_default = FLAG_VALUE_UNSET;
+ break;
+ }
+
+ return CSS_OK;
+}
/**
* Select a style for the given node
*
* \param ctx Selection context to use
* \param node Node to select style for
+ * \param unit_ctx Context for length unit conversions.
* \param media Currently active media specification
* \param inline_style Corresponding inline style for node, or NULL
* \param handler Dispatch table of handler functions
@@ -1181,10 +1242,12 @@ failed:
* update the fully computed style for a node when layout changes.
*/
css_error css_select_style(css_select_ctx *ctx, void *node,
+ const css_unit_ctx *unit_ctx,
const css_media *media, const css_stylesheet *inline_style,
css_select_handler *handler, void *pw,
css_select_results **result)
{
+ css_origin origin = CSS_ORIGIN_UA;
uint32_t i, j, nhints;
css_error error;
css_select_state state;
@@ -1201,7 +1264,7 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
return error;
error = css_select__initialise_selection_state(
- &state, node, parent, media, handler, pw);
+ &state, node, parent, media, unit_ctx, handler, pw);
if (error != CSS_OK)
return error;
@@ -1237,8 +1300,18 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
printf("style:\t%s\tSELECTED\n", lwc_string_data(state.element.name));
#endif
- /* Not sharing; need to select.
- * Base element style is guaranteed to exist
+ /* Not sharing; need to select. */
+ if (ctx->uses_revert ||
+ (inline_style != NULL && inline_style->uses_revert)) {
+ /* Need to track UA and USER origin styles for revert. */
+ state.revert = calloc(CSS_ORIGIN_AUTHOR, sizeof(*state.revert));
+ if (state.revert == NULL) {
+ error = CSS_NOMEM;
+ goto cleanup;
+ }
+ }
+
+ /* Base element style is guaranteed to exist
*/
error = css__computed_style_create(
&state.results->styles[CSS_PSEUDO_ELEMENT_NONE]);
@@ -1263,10 +1336,30 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
/* Iterate through the top-level stylesheets, selecting styles
* from those which apply to our current media requirements and
* are not disabled */
+ if (ctx->n_sheets > 0) {
+ origin = ctx->sheets[0].origin;
+ }
for (i = 0; i < ctx->n_sheets; i++) {
const css_select_sheet s = ctx->sheets[i];
- if (mq__list_match(s.media, media) &&
+ if (state.revert != NULL && s.origin != origin) {
+ for (j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
+ if (state.results->styles[j] == NULL) {
+ continue;
+ }
+ error = css__computed_style_clone(
+ state.results->styles[j],
+ &state.revert[origin].style[j]);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ memcpy(state.revert[origin].props,
+ state.props, sizeof(state.props));
+ }
+ origin = s.origin;
+ }
+
+ if (mq__list_match(s.media, unit_ctx, media, &ctx->str) &&
s.sheet->disabled == false) {
error = select_from_sheet(ctx, s.sheet,
s.origin, &state);
@@ -1307,15 +1400,31 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
state.current_pseudo = CSS_PSEUDO_ELEMENT_NONE;
state.computed = state.results->styles[CSS_PSEUDO_ELEMENT_NONE];
for (i = 0; i < CSS_N_PROPERTIES; i++) {
- const prop_state *prop =
- &state.props[i][CSS_PSEUDO_ELEMENT_NONE];
+ prop_state *prop = &state.props[i][CSS_PSEUDO_ELEMENT_NONE];
+
+ if (prop->explicit_default == FLAG_VALUE_REVERT) {
+ error = css__select_revert_property(&state, prop,
+ CSS_PSEUDO_ELEMENT_NONE, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ }
+
+ if (prop->explicit_default == FLAG_VALUE_UNSET) {
+ if (prop_dispatch[i].inherited == true) {
+ prop->explicit_default = FLAG_VALUE_INHERIT;
+ } else {
+ prop->explicit_default = FLAG_VALUE_INITIAL;
+ }
+ }
/* If the property is still unset or it's set to inherit
* and we're the root element, then set it to its initial
* value. */
- if (prop->set == false ||
+ if (prop->explicit_default == FLAG_VALUE_INITIAL ||
+ prop->set == false ||
(parent == NULL &&
- prop->inherit == true)) {
+ prop->explicit_default == FLAG_VALUE_INHERIT)) {
error = set_initial(&state, i,
CSS_PSEUDO_ELEMENT_NONE, parent);
if (error != CSS_OK)
@@ -1333,11 +1442,28 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
continue;
for (i = 0; i < CSS_N_PROPERTIES; i++) {
- const prop_state *prop = &state.props[i][j];
+ prop_state *prop = &state.props[i][j];
+
+ if (prop->explicit_default == FLAG_VALUE_REVERT) {
+ error = css__select_revert_property(&state,
+ prop, j, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ }
+
+ if (prop->explicit_default == FLAG_VALUE_UNSET) {
+ if (prop_dispatch[i].inherited == true) {
+ prop->explicit_default = FLAG_VALUE_INHERIT;
+ } else {
+ prop->explicit_default = FLAG_VALUE_INITIAL;
+ }
+ }
/* If the property is still unset then set it
* to its initial value. */
- if (prop->set == false) {
+ if (prop->explicit_default == FLAG_VALUE_INITIAL ||
+ prop->set == false) {
error = set_initial(&state, i, j, parent);
if (error != CSS_OK)
goto cleanup;
@@ -1353,7 +1479,7 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
/* Only compute absolute values for the base element */
error = css__compute_absolute_values(NULL,
state.results->styles[CSS_PSEUDO_ELEMENT_NONE],
- handler->compute_font_size, pw);
+ unit_ctx);
if (error != CSS_OK)
goto cleanup;
}
@@ -1417,12 +1543,15 @@ css_error css_select_results_destroy(css_select_results *results)
*
* \param ctx Selection context
* \param media Currently active media spec
+ * \param unit_ctx Current unit conversion context.
* \param font_family Font family to search for
* \param result Pointer to location to receive result
* \return CSS_OK on success, appropriate error otherwise.
*/
css_error css_select_font_faces(css_select_ctx *ctx,
- const css_media *media, lwc_string *font_family,
+ const css_media *media,
+ const css_unit_ctx *unit_ctx,
+ lwc_string *font_family,
css_select_font_faces_results **result)
{
uint32_t i;
@@ -1436,6 +1565,7 @@ css_error css_select_font_faces(css_select_ctx *ctx,
memset(&state, 0, sizeof(css_select_font_faces_state));
state.font_family = font_family;
state.media = media;
+ state.unit_ctx = unit_ctx;
/* Iterate through the top-level stylesheets, selecting font-faces
* from those which apply to our current media requirements and
@@ -1443,10 +1573,10 @@ css_error css_select_font_faces(css_select_ctx *ctx,
for (i = 0; i < ctx->n_sheets; i++) {
const css_select_sheet s = ctx->sheets[i];
- if (mq__list_match(s.media, media) &&
+ if (mq__list_match(s.media, unit_ctx, media, &ctx->str) &&
s.sheet->disabled == false) {
error = select_font_faces_from_sheet(s.sheet,
- s.origin, &state);
+ s.origin, &state, &ctx->str);
if (error != CSS_OK)
goto cleanup;
}
@@ -1548,233 +1678,6 @@ css_error css_select_font_faces_results_destroy(
* Selection engine internals below here *
******************************************************************************/
-css_error intern_strings(css_select_ctx *ctx)
-{
- lwc_error error;
-
- /* Universal selector */
- error = lwc_intern_string("*", SLEN("*"), &ctx->universal);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- /* Pseudo classes */
- error = lwc_intern_string(
- "first-child", SLEN("first-child"),
- &ctx->first_child);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "link", SLEN("link"),
- &ctx->link);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "visited", SLEN("visited"),
- &ctx->visited);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "hover", SLEN("hover"),
- &ctx->hover);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "active", SLEN("active"),
- &ctx->active);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "focus", SLEN("focus"),
- &ctx->focus);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "nth-child", SLEN("nth-child"),
- &ctx->nth_child);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "nth-last-child", SLEN("nth-last-child"),
- &ctx->nth_last_child);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "nth-of-type", SLEN("nth-of-type"),
- &ctx->nth_of_type);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "nth-last-of-type", SLEN("nth-last-of-type"),
- &ctx->nth_last_of_type);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "last-child", SLEN("last-child"),
- &ctx->last_child);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "first-of-type", SLEN("first-of-type"),
- &ctx->first_of_type);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "last-of-type", SLEN("last-of-type"),
- &ctx->last_of_type);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "only-child", SLEN("only-child"),
- &ctx->only_child);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "only-of-type", SLEN("only-of-type"),
- &ctx->only_of_type);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "root", SLEN("root"),
- &ctx->root);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "empty", SLEN("empty"),
- &ctx->empty);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "target", SLEN("target"),
- &ctx->target);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "lang", SLEN("lang"),
- &ctx->lang);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "enabled", SLEN("enabled"),
- &ctx->enabled);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "disabled", SLEN("disabled"),
- &ctx->disabled);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "checked", SLEN("checked"),
- &ctx->checked);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- /* Pseudo elements */
- error = lwc_intern_string(
- "first-line", SLEN("first-line"),
- &ctx->first_line);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "first_letter", SLEN("first-letter"),
- &ctx->first_letter);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "before", SLEN("before"),
- &ctx->before);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- error = lwc_intern_string(
- "after", SLEN("after"),
- &ctx->after);
- if (error != lwc_error_ok)
- return css_error_from_lwc_error(error);
-
- return CSS_OK;
-}
-
-void destroy_strings(css_select_ctx *ctx)
-{
- if (ctx->universal != NULL)
- lwc_string_unref(ctx->universal);
- if (ctx->first_child != NULL)
- lwc_string_unref(ctx->first_child);
- if (ctx->link != NULL)
- lwc_string_unref(ctx->link);
- if (ctx->visited != NULL)
- lwc_string_unref(ctx->visited);
- if (ctx->hover != NULL)
- lwc_string_unref(ctx->hover);
- if (ctx->active != NULL)
- lwc_string_unref(ctx->active);
- if (ctx->focus != NULL)
- lwc_string_unref(ctx->focus);
- if (ctx->nth_child != NULL)
- lwc_string_unref(ctx->nth_child);
- if (ctx->nth_last_child != NULL)
- lwc_string_unref(ctx->nth_last_child);
- if (ctx->nth_of_type != NULL)
- lwc_string_unref(ctx->nth_of_type);
- if (ctx->nth_last_of_type != NULL)
- lwc_string_unref(ctx->nth_last_of_type);
- if (ctx->last_child != NULL)
- lwc_string_unref(ctx->last_child);
- if (ctx->first_of_type != NULL)
- lwc_string_unref(ctx->first_of_type);
- if (ctx->last_of_type != NULL)
- lwc_string_unref(ctx->last_of_type);
- if (ctx->only_child != NULL)
- lwc_string_unref(ctx->only_child);
- if (ctx->only_of_type != NULL)
- lwc_string_unref(ctx->only_of_type);
- if (ctx->root != NULL)
- lwc_string_unref(ctx->root);
- if (ctx->empty != NULL)
- lwc_string_unref(ctx->empty);
- if (ctx->target != NULL)
- lwc_string_unref(ctx->target);
- if (ctx->lang != NULL)
- lwc_string_unref(ctx->lang);
- if (ctx->enabled != NULL)
- lwc_string_unref(ctx->enabled);
- if (ctx->disabled != NULL)
- lwc_string_unref(ctx->disabled);
- if (ctx->checked != NULL)
- lwc_string_unref(ctx->checked);
- if (ctx->first_line != NULL)
- lwc_string_unref(ctx->first_line);
- if (ctx->first_letter != NULL)
- lwc_string_unref(ctx->first_letter);
- if (ctx->before != NULL)
- lwc_string_unref(ctx->before);
- if (ctx->after != NULL)
- lwc_string_unref(ctx->after);
-}
css_error set_hint(css_select_state *state, css_hint *hint)
{
@@ -1792,7 +1695,8 @@ css_error set_hint(css_select_state *state, css_hint *hint)
existing->specificity = 0;
existing->origin = CSS_ORIGIN_AUTHOR;
existing->important = 0;
- existing->inherit = (hint->status == 0);
+ existing->explicit_default = (hint->status == 0) ?
+ FLAG_VALUE_INHERIT : FLAG_VALUE__NONE;
return CSS_OK;
}
@@ -1809,7 +1713,8 @@ css_error set_initial(css_select_state *state,
* If the node is tree root and we're dealing with the base element,
* everything should be defaulted.
*/
- if (prop_dispatch[prop].inherited == false ||
+ if (state->props[prop][pseudo].explicit_default == FLAG_VALUE_INITIAL ||
+ prop_dispatch[prop].inherited == false ||
(pseudo == CSS_PSEUDO_ELEMENT_NONE && parent == NULL)) {
error = prop_dispatch[prop].initial(state);
if (error != CSS_OK)
@@ -1843,7 +1748,9 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet,
if (import->sheet != NULL &&
mq__list_match(import->media,
- state->media)) {
+ state->unit_ctx,
+ state->media,
+ &ctx->str)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
@@ -1884,9 +1791,11 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet,
static css_error _select_font_face_from_rule(
const css_rule_font_face *rule, css_origin origin,
- css_select_font_faces_state *state)
+ css_select_font_faces_state *state,
+ const css_select_strings *str)
{
- if (mq_rule_good_for_media((const css_rule *) rule, state->media)) {
+ if (mq_rule_good_for_media((const css_rule *) rule,
+ state->unit_ctx, state->media, str)) {
bool correct_family = false;
if (lwc_string_isequal(
@@ -1930,7 +1839,8 @@ static css_error _select_font_face_from_rule(
static css_error select_font_faces_from_sheet(
const css_stylesheet *sheet,
css_origin origin,
- css_select_font_faces_state *state)
+ css_select_font_faces_state *state,
+ const css_select_strings *str)
{
const css_stylesheet *s = sheet;
const css_rule *rule = s->rule_list;
@@ -1951,7 +1861,9 @@ static css_error select_font_faces_from_sheet(
if (import->sheet != NULL &&
mq__list_match(import->media,
- state->media)) {
+ state->unit_ctx,
+ state->media,
+ str)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
@@ -1969,8 +1881,7 @@ static css_error select_font_faces_from_sheet(
error = _select_font_face_from_rule(
(const css_rule_font_face *) rule,
- origin,
- state);
+ origin, state, str);
if (error != CSS_OK)
return error;
@@ -2098,8 +2009,9 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
/* Set up general selector chain requirments */
req.media = state->media;
+ req.unit_ctx = state->unit_ctx;
req.node_bloom = state->node_data->bloom;
- req.uni = ctx->universal;
+ req.str = &ctx->str;
/* Find hash chain that applies to current node */
req.qname = state->element;
@@ -2264,7 +2176,7 @@ css_error match_selector_chain(css_select_ctx *ctx,
/* Consider any combinator on this selector */
if (s->data.comb != CSS_COMBINATOR_NONE &&
s->combinator->data.qname.name !=
- ctx->universal) {
+ ctx->str.universal) {
/* Named combinator */
may_optimise &=
(s->data.comb == CSS_COMBINATOR_ANCESTOR ||
@@ -2599,7 +2511,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
return error;
if (is_root == false &&
- detail->qname.name == ctx->first_child) {
+ detail->qname.name == ctx->str.first_child) {
int32_t num_before = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2607,7 +2519,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
if (error == CSS_OK)
*match = (num_before == 0);
} else if (is_root == false &&
- detail->qname.name == ctx->nth_child) {
+ detail->qname.name == ctx->str.nth_child) {
int32_t num_before = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2619,7 +2531,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
*match = match_nth(a, b, num_before + 1);
}
} else if (is_root == false &&
- detail->qname.name == ctx->nth_last_child) {
+ detail->qname.name == ctx->str.nth_last_child) {
int32_t num_after = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2631,7 +2543,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
*match = match_nth(a, b, num_after + 1);
}
} else if (is_root == false &&
- detail->qname.name == ctx->nth_of_type) {
+ detail->qname.name == ctx->str.nth_of_type) {
int32_t num_before = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2643,7 +2555,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
*match = match_nth(a, b, num_before + 1);
}
} else if (is_root == false &&
- detail->qname.name == ctx->nth_last_of_type) {
+ detail->qname.name == ctx->str.nth_last_of_type) {
int32_t num_after = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2655,7 +2567,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
*match = match_nth(a, b, num_after + 1);
}
} else if (is_root == false &&
- detail->qname.name == ctx->last_child) {
+ detail->qname.name == ctx->str.last_child) {
int32_t num_after = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2663,7 +2575,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
if (error == CSS_OK)
*match = (num_after == 0);
} else if (is_root == false &&
- detail->qname.name == ctx->first_of_type) {
+ detail->qname.name == ctx->str.first_of_type) {
int32_t num_before = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2671,7 +2583,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
if (error == CSS_OK)
*match = (num_before == 0);
} else if (is_root == false &&
- detail->qname.name == ctx->last_of_type) {
+ detail->qname.name == ctx->str.last_of_type) {
int32_t num_after = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2679,7 +2591,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
if (error == CSS_OK)
*match = (num_after == 0);
} else if (is_root == false &&
- detail->qname.name == ctx->only_child) {
+ detail->qname.name == ctx->str.only_child) {
int32_t num_before = 0, num_after = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2693,7 +2605,7 @@ css_error match_detail(css_select_ctx *ctx, void *node,
(num_after == 0);
}
} else if (is_root == false &&
- detail->qname.name == ctx->only_of_type) {
+ detail->qname.name == ctx->str.only_of_type) {
int32_t num_before = 0, num_after = 0;
error = state->handler->node_count_siblings(state->pw,
@@ -2706,44 +2618,44 @@ css_error match_detail(css_select_ctx *ctx, void *node,
*match = (num_before == 0) &&
(num_after == 0);
}
- } else if (detail->qname.name == ctx->root) {
+ } else if (detail->qname.name == ctx->str.root) {
*match = is_root;
- } else if (detail->qname.name == ctx->empty) {
+ } else if (detail->qname.name == ctx->str.empty) {
error = state->handler->node_is_empty(state->pw,
node, match);
- } else if (detail->qname.name == ctx->link) {
+ } else if (detail->qname.name == ctx->str.link) {
error = state->handler->node_is_link(state->pw,
node, match);
flags = CSS_NODE_FLAGS_NONE;
- } else if (detail->qname.name == ctx->visited) {
+ } else if (detail->qname.name == ctx->str.visited) {
error = state->handler->node_is_visited(state->pw,
node, match);
flags = CSS_NODE_FLAGS_NONE;
- } else if (detail->qname.name == ctx->hover) {
+ } else if (detail->qname.name == ctx->str.hover) {
error = state->handler->node_is_hover(state->pw,
node, match);
flags = CSS_NODE_FLAGS_NONE;
- } else if (detail->qname.name == ctx->active) {
+ } else if (detail->qname.name == ctx->str.active) {
error = state->handler->node_is_active(state->pw,
node, match);
flags = CSS_NODE_FLAGS_NONE;
- } else if (detail->qname.name == ctx->focus) {
+ } else if (detail->qname.name == ctx->str.focus) {
error = state->handler->node_is_focus(state->pw,
node, match);
flags = CSS_NODE_FLAGS_NONE;
- } else if (detail->qname.name == ctx->target) {
+ } else if (detail->qname.name == ctx->str.target) {
error = state->handler->node_is_target(state->pw,
node, match);
- } else if (detail->qname.name == ctx->lang) {
+ } else if (detail->qname.name == ctx->str.lang) {
error = state->handler->node_is_lang(state->pw,
node, detail->value.string, match);
- } else if (detail->qname.name == ctx->enabled) {
+ } else if (detail->qname.name == ctx->str.enabled) {
error = state->handler->node_is_enabled(state->pw,
node, match);
- } else if (detail->qname.name == ctx->disabled) {
+ } else if (detail->qname.name == ctx->str.disabled) {
error = state->handler->node_is_disabled(state->pw,
node, match);
- } else if (detail->qname.name == ctx->checked) {
+ } else if (detail->qname.name == ctx->str.checked) {
error = state->handler->node_is_checked(state->pw,
node, match);
} else {
@@ -2754,13 +2666,13 @@ css_error match_detail(css_select_ctx *ctx, void *node,
case CSS_SELECTOR_PSEUDO_ELEMENT:
*match = true;
- if (detail->qname.name == ctx->first_line) {
+ if (detail->qname.name == ctx->str.first_line) {
*pseudo_element = CSS_PSEUDO_ELEMENT_FIRST_LINE;
- } else if (detail->qname.name == ctx->first_letter) {
+ } else if (detail->qname.name == ctx->str.first_letter) {
*pseudo_element = CSS_PSEUDO_ELEMENT_FIRST_LETTER;
- } else if (detail->qname.name == ctx->before) {
+ } else if (detail->qname.name == ctx->str.before) {
*pseudo_element = CSS_PSEUDO_ELEMENT_BEFORE;
- } else if (detail->qname.name == ctx->after) {
+ } else if (detail->qname.name == ctx->str.after) {
*pseudo_element = CSS_PSEUDO_ELEMENT_AFTER;
} else
*match = false;
@@ -2837,7 +2749,7 @@ css_error cascade_style(const css_style *style, css_select_state *state)
}
bool css__outranks_existing(uint16_t op, bool important, css_select_state *state,
- bool inherit)
+ enum flag_value explicit_default)
{
prop_state *existing = &state->props[op][state->current_pseudo];
bool outranks = false;
@@ -2932,7 +2844,7 @@ bool css__outranks_existing(uint16_t op, bool important, css_select_state *state
existing->specificity = state->current_specificity;
existing->origin = state->current_origin;
existing->important = important;
- existing->inherit = inherit;
+ existing->explicit_default = explicit_default;
}
return outranks;
diff --git a/src/select/select.h b/src/select/select.h
index dc9aa4a..5170e58 100644
--- a/src/select/select.h
+++ b/src/select/select.h
@@ -24,11 +24,11 @@ typedef struct reject_item {
} reject_item;
typedef struct prop_state {
- uint32_t specificity; /* Specificity of property in result */
- unsigned int set : 1, /* Whether property is set in result */
- origin : 2, /* Origin of property in result */
- important : 1, /* Importance of property in result */
- inherit : 1; /* Property is set to inherit */
+ uint32_t specificity; /* Specificity of property in result */
+ unsigned int set : 1, /* Whether property is set in result */
+ origin : 2, /* Origin of property in result */
+ important : 1; /* Importance of property in result */
+ enum flag_value explicit_default : 3; /* Property is set to inherit */
} prop_state;
@@ -58,14 +58,23 @@ struct css_node_data {
css_node_flags flags;
};
+struct revert_data {
+ prop_state props[CSS_N_PROPERTIES][CSS_PSEUDO_ELEMENT_COUNT];
+ css_computed_style *style[CSS_PSEUDO_ELEMENT_COUNT];
+};
+
/**
* Selection state
*/
typedef struct css_select_state {
void *node; /* Node we're selecting for */
const css_media *media; /* Currently active media spec */
+ const css_unit_ctx *unit_ctx; /* Unit conversion context. */
css_select_results *results; /* Result set to populate */
+ /** UA and user styles for handling revert property value. */
+ struct revert_data *revert; /* Length: CSS_ORIGIN_AUTHOR */
+
css_pseudo_element current_pseudo; /* Current pseudo element */
css_computed_style *computed; /* Computed style to populate */
@@ -97,7 +106,7 @@ static inline void advance_bytecode(css_style *style, uint32_t n_bytes)
}
bool css__outranks_existing(uint16_t op, bool important,
- css_select_state *state, bool inherit);
+ css_select_state *state, enum flag_value explicit_default);
#endif
diff --git a/src/select/select_config.py b/src/select/select_config.py
index fd9e765..1cfe05c 100644
--- a/src/select/select_config.py
+++ b/src/select/select_config.py
@@ -95,6 +95,8 @@ style = {
('min_height', 2, 'length', 'CSS_MIN_HEIGHT_SET'),
('min_width', 2, 'length', 'CSS_MIN_WIDTH_SET'),
('opacity', 1, 'fixed', 'CSS_OPACITY_SET'),
+ ('fill_opacity', 1, 'fixed', 'CSS_FILL_OPACITY_SET'),
+ ('stroke_opacity', 1, 'fixed', 'CSS_STROKE_OPACITY_SET'),
('order', 1, 'integer', 'CSS_ORDER_SET'),
('padding_top', 1, 'length', 'CSS_PADDING_SET'),
('padding_right', 1, 'length', 'CSS_PADDING_SET'),
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index 2d6afe8..9e92909 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -29,8 +29,8 @@ def shift_star(value_type, prop_name):
`lwc_string **str_array`
"""
star_i = value_type.find('*')
- v_type = value_type if star_i is -1 else value_type[:star_i]
- v_name = prop_name if star_i is -1 else value_type[star_i:] + prop_name
+ v_type = value_type if star_i == -1 else value_type[:star_i]
+ v_name = prop_name if star_i == -1 else value_type[star_i:] + prop_name
return (v_type, v_name)
class Text:
@@ -233,7 +233,7 @@ class CSSProperty:
for x in values:
if x[0] == v[0]:
value = CSSValue(*x)
- if len(v) is 2:
+ if len(v) == 2:
value.defaults = v[1]
if len(vals) > 1:
value.suffix = '_' + string.ascii_lowercase[i]
@@ -322,18 +322,16 @@ class CSSProperty:
"""
vals = []
for v in self.values:
+ star = '*' if pointer else ''
vt, vn = shift_star(v.type, v.name)
- vn += v.suffix
+ vn = star + vn + v.suffix
if pointer:
- vn = '*' + vn
if v.name == 'counter_arr' or v.name == 'content_item':
vt = 'const ' + vt
vals.append((vt, vn))
if v.bits is not None:
- bt, bn = shift_star(v.bits['type'], v.bits['name'])
- bn += v.suffix
- if pointer:
- bn = '*' + bn
+ bt = v.bits['type']
+ bn = star + v.bits['name'] + v.suffix
vals.append((bt, bn))
return vals
@@ -348,7 +346,7 @@ class CSSProperty:
bits_len = sum([ x['size'] for x in bits ])
comment = '/* {}bit{}: {} : {} */'.format(
bits_len,
- ('' if bits_len is 1 else 's'),
+ ('' if bits_len == 1 else 's'),
''.join([ b['letter'] * b['size'] for b in bits ]),
' | '.join([ b['name'] for b in bits ]))
rev_bits = list(reversed(bits))
@@ -406,7 +404,7 @@ class CSSGroup:
bin_size = 32 # We're using uint32_t as concrete bins.
bits_array = []
- props = sorted(self.props, key=(lambda x: x.bits_size), reverse=True)
+ props = sorted(self.props, key=(lambda x: (x.bits_size, x.name)), reverse=True)
for p in props:
for b in bits_array:
@@ -429,21 +427,12 @@ class CSSGroup:
return bits_array
- def get_idot_grp(self):
- """Make parameters for accessing bits and values in this group."""
- i_dot = '' if self.name is 'page' else 'i.'
- grp = '' if self.name is 'style' else '->{}{}'.format(
- '' if self.name is 'page' else i_dot, self.name)
- return (i_dot, grp)
-
def make_computed_h(self):
"""Output this group's text for the computed.h file."""
t = Text()
t.append()
- typedef = 'typedef ' if self.name is 'page' else ''
- t.append('{}struct css_computed_{}{} {{'.format(
- typedef, self.name, '' if self.name is 'page' else '_i'))
+ t.append('struct css_computed_style_i {')
t.comment()
commented = []
@@ -490,103 +479,28 @@ class CSSGroup:
t.append()
t.append(self.make_value_declaration(for_commented=False))
- if self.name is 'style':
- t.append()
- for g in css_groups:
- if g.name is not 'style' and g.name is not 'page':
- t.append('css_computed_{0} *{0};'.format(g.name))
-
t.indent(-1)
- t.append('}}{};'.format(
- ' css_computed_' + self.name if typedef else ''))
+ t.append('};')
- if self.name is not 'page':
- typedef = 'typedef ' if self.name is not 'style' else ''
- t.append()
- t.append('{}struct css_computed_{} {{'.format(
- typedef, self.name))
- t.indent(1)
- t.append('struct css_computed_' + self.name + '_i i;')
- t.append()
- t.append(self.make_value_declaration(for_commented=True))
- t.append()
+ t.append()
+ t.append('struct css_computed_style {')
+ t.indent(1)
+ t.append('struct css_computed_style_i i;')
+ t.append()
+ t.append(self.make_value_declaration(for_commented=True))
+ t.append()
- t.append('struct css_computed_' + self.name + ' *next;')
- t.append('uint32_t count;')
- t.append('uint32_t bin;')
- t.indent(-1)
- t.append('}}{};'.format(
- ' css_computed_' + self.name if typedef else ''))
+ t.append('struct css_computed_style *next;')
+ t.append('uint32_t count;')
+ t.append('uint32_t bin;')
+ t.indent(-1)
+ t.append('};')
return t.to_string()
def make_propset_h(self):
- """Output this group's property functions for the propset.h file.
-
- If group is not `style`, will also output the defaults
- and the ENSURE_{group} texts.
- """
+ """Output this group's property functions for the propset.h file."""
t = Text()
- i_dot, grp = self.get_idot_grp()
-
- if self.name is not 'style':
- t.append('static const css_computed_{0} default_{0} = {{'.format(
- self.name))
- t.indent(1)
-
- if self.name is not 'page':
- t.append('.i = {')
- t.indent(1)
-
- t.append('.bits = {')
- t.indent(1)
-
- bits_ops = []
- for b in self.bits_array:
- or_ops = []
- for p in b.contents:
- or_ops.append('({} << {})'.format(p.defaults, str(p.shift))
- if p.shift else p.defaults)
- bits_ops.append(' | '.join(or_ops))
-
- t.append(',\n'.join(bits_ops).split('\n'))
- t.indent(-1)
- t.append('},')
- t.append(',\n'.join(
- self.make_value_declaration(False, True)).split('\n'))
-
- if self.name is not 'page':
- t.indent(-1)
- t.append('},')
- t.append(',\n'.join(
- self.make_value_declaration(True, True) +
- [ '.next = NULL', '.count = 0', '.bin = UINT32_MAX' ]
- ).split('\n'))
-
- t.indent(-1)
- t.append('};')
-
- t.append()
- t.escape_newline()
- t.append('#define ENSURE_{} do {{'.format(self.name.upper()))
- t.indent(1)
- t.append('if (style->{}{} == NULL) {{'.format(i_dot, self.name))
- t.indent(1)
- t.append('style->{}{n} = malloc(sizeof(css_computed_{n}));'.format(
- i_dot, n=self.name))
- t.append('if (style->{}{} == NULL)'.format(i_dot, self.name))
- t.indent(1)
- t.append('return CSS_NOMEM;')
- t.indent(-1)
- t.append()
- t.append('memcpy(style->{}{n}, &default_{n}, '
- 'sizeof(css_computed_{n}));'.format(i_dot, n=self.name))
- t.indent(-1)
- t.append('}')
- t.indent(-1)
- t.append('} while(0)')
- t.escape_newline()
- t.append()
for p in sorted(self.props, key=(lambda x: x.name)):
defines, undefs = p.def_undefs
@@ -608,15 +522,7 @@ class CSSGroup:
t.append('{')
t.indent(1)
- t.append('uint32_t *bits;')
- t.append()
-
- if self.name is not 'style':
- t.append('ENSURE_{};'.format(self.name.upper()))
- t.append()
-
- t.append('bits = &style{}->{}bits[{}_INDEX];'.format(
- grp, i_dot, p.name.upper()))
+ t.append('uint32_t *bits = &style->i.bits[{}_INDEX];'.format(p.name.upper()))
t.append()
type_mask, shift_list, bits_comment = p.get_bits()
@@ -636,20 +542,18 @@ class CSSGroup:
old_n = 'old_' + v.name + v.suffix
old_t, old_n_shift = shift_star(v.type, old_n)
- if v.name is 'string':
- t.append('{} {} = style{}->{}{};'.format(
- old_t, old_n_shift,
- grp, i_dot, p.name + v.suffix))
+ if v.name == 'string':
+ t.append('{} {} = style->i.{};'.format(
+ old_t, old_n_shift, p.name + v.suffix))
t.append()
t.append('if ({} != NULL) {{'.format(v.name + v.suffix))
t.indent(1)
- t.append('style{}->{}{} = lwc_string_ref({});'.format(
- grp, i_dot, p.name + v.suffix, v.name + v.suffix))
+ t.append('style->i.{} = lwc_string_ref({});'.format(
+ p.name + v.suffix, v.name + v.suffix))
t.indent(-1)
t.append('} else {')
t.indent(1)
- t.append('style{}->{}{} = NULL;'.format(
- grp, i_dot, p.name + v.suffix))
+ t.append('style->i.{} = NULL;'.format(p.name + v.suffix))
t.indent(-1)
t.append('}')
t.append()
@@ -658,12 +562,12 @@ class CSSGroup:
t.append('lwc_string_unref({});'.format(old_n))
t.indent(-1)
- elif v.name is 'string_arr' or v.name is 'counter_arr':
- iter_var = 's' if v.name is 'string_arr' else 'c'
- iter_deref = '*s' if v.name is 'string_arr' else 'c->name'
- t.append('{} {} = style{}->{};'.format(
+ elif v.name == 'string_arr' or v.name == 'counter_arr':
+ iter_var = 's' if v.name == 'string_arr' else 'c'
+ iter_deref = '*s' if v.name == 'string_arr' else 'c->name'
+ t.append('{} {} = style->{};'.format(
old_t, old_n_shift,
- grp, p.name + v.suffix))
+ p.name + v.suffix))
t.append('{} {};'.format(old_t,
shift_star(v.type, iter_var)[1]))
t.append()
@@ -674,8 +578,8 @@ class CSSGroup:
t.append('{0} = lwc_string_ref({0});'.format(iter_deref))
t.indent(-1)
t.append()
- t.append('style{}->{} = {};'.format(
- grp, p.name + v.suffix, v.name + v.suffix))
+ t.append('style->{} = {};'.format(
+ p.name + v.suffix, v.name + v.suffix))
t.append()
t.append('/* Free existing array */')
t.append('if ({} != NULL) {{'.format(old_n))
@@ -693,8 +597,8 @@ class CSSGroup:
t.append('}')
elif not v.is_ptr:
- t.append('style{}->{}{} = {};'.format(
- grp, i_dot, p.name + v.suffix, v.name + v.suffix))
+ t.append('style->i.{} = {};'.format(
+ p.name + v.suffix, v.name + v.suffix))
else:
raise ValueError('Cannot handle value ' + v.name +'!')
@@ -707,54 +611,38 @@ class CSSGroup:
return t.to_string()
- def make_propget_h(self):
- """Output this group's property functions for the propget.h file."""
- t = Text()
- i_dot, grp = self.get_idot_grp()
-
- for p in sorted(self.props, key=(lambda x: x.name)):
- defines, undefs = p.def_undefs
-
- t.append()
- t.append(defines)
-
- if p.name in overrides['get']:
- t.append(overrides['get'][p.name], pre_formatted=True)
- t.append(undefs)
- continue
+ def print_propget(self, t, p, only_bits=False):
+ vals = [] if only_bits else p.get_param_values(pointer=True)
+ params = ', '.join([ 'css_computed_style *style' ]
+ + [ ' '.join(x) for x in vals ])
- vals = p.get_param_values(pointer=True)
- params = ', '.join([ 'css_computed_style *style' ]
- + [ ' '.join(x) for x in vals ])
- t.append('static inline uint8_t get_{}(const {})'.format(
- p.name, params))
- t.append('{')
- t.indent(1)
-
- if self.name is not 'style':
- t.append('if (style{} != NULL) {{'.format(grp))
- t.indent(1)
+ underscore_bits = '_bits' if only_bits else ''
+ t.append('static inline uint8_t get_{}{}(const {})'.format(
+ p.name, underscore_bits, params))
+ t.append('{')
+ t.indent(1)
- t.append('uint32_t bits = style{}->{}bits[{}_INDEX];'.format(
- grp, i_dot, p.name.upper()))
- t.append('bits &= {}_MASK;'.format(p.name.upper()))
- t.append('bits >>= {}_SHIFT;'.format(p.name.upper()))
- t.append()
+ t.append('uint32_t bits = style->i.bits[{}_INDEX];'.format(
+ p.name.upper()))
+ t.append('bits &= {}_MASK;'.format(p.name.upper()))
+ t.append('bits >>= {}_SHIFT;'.format(p.name.upper()))
+ t.append()
- type_mask, shift_list, bits_comment = p.get_bits()
- t.append(bits_comment)
+ type_mask, shift_list, bits_comment = p.get_bits()
+ t.append(bits_comment)
+ if only_bits == False:
if p.condition:
t.append('if ((bits & {}) == {}) {{'.format(
type_mask, p.condition))
t.indent(1)
for v in p.values:
- this_idot = '' if v.is_ptr and v.name != 'string' else i_dot
- t.append('*{} = style{}->{}{};'.format(
- v.name + v.suffix, grp, this_idot, p.name + v.suffix))
+ i_dot = '' if v.is_ptr and v.name != 'string' else 'i.'
+ t.append('*{} = style->{}{};'.format(
+ v.name + v.suffix, i_dot, p.name + v.suffix))
for i, v in enumerate(list(reversed(shift_list))):
- if i is 0:
+ if i == 0:
t.append('*{} = bits >> {};'.format(v[0], v[1]))
else:
t.append('*{} = (bits & 0x{:x}) >> {};'.format(
@@ -763,29 +651,35 @@ class CSSGroup:
if p.condition:
t.indent(-1)
t.append('}')
+ t.append()
+
+ t.append('return (bits & {});'.format(type_mask))
+
+ t.indent(-1)
+ t.append('}')
+
+ def make_propget_h(self):
+ """Output this group's property functions for the propget.h file."""
+ t = Text()
+
+ for p in sorted(self.props, key=(lambda x: x.name)):
+ defines, undefs = p.def_undefs
t.append()
- t.append('return (bits & {});'.format(type_mask))
+ t.append(defines)
- if self.name is not 'style':
- t.indent(-1)
- t.append('}')
- t.append()
- t.append('/* Initial value */')
- for v in p.values:
- t.append('*{} = {};'.format(v.name + v.suffix, v.defaults))
- if v.bits is not None:
- t.append('*{} = {};'.format(
- v.bits['name'] + v.suffix, v.bits['defaults']))
- t.append('return {};'.format(p.defaults))
+ self.print_propget(t, p, True)
+
+ if p.name in overrides['get']:
+ t.append(overrides['get'][p.name], pre_formatted=True)
+ else:
+ self.print_propget(t, p)
- t.indent(-1)
- t.append('}')
t.append(undefs)
return t.to_string()
- def make_value_declaration(self, for_commented, defaults=False):
+ def make_value_declaration(self, for_commented):
"""Output declarations of values for this group's properties.
Args:
@@ -797,12 +691,8 @@ class CSSGroup:
for p in sorted(self.props, key=(lambda x: x.name)):
if bool(p.comments) == for_commented:
for v in p.values:
- if defaults:
- r.append('.{}{} = {}'.format(p.name, v.suffix,
- v.defaults))
- else:
- v_type, v_name = shift_star(v.type, p.name)
- r.append('{} {}{};'.format(v_type, v_name, v.suffix))
+ v_type, v_name = shift_star(v.type, p.name)
+ r.append('{} {}{};'.format(v_type, v_name, v.suffix))
return r
def make_text(self, filename):
diff --git a/src/select/strings.c b/src/select/strings.c
new file mode 100644
index 0000000..6e9137d
--- /dev/null
+++ b/src/select/strings.c
@@ -0,0 +1,264 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
+ */
+
+#include <libwapcaplet/libwapcaplet.h>
+
+#include "select/strings.h"
+#include "utils/utils.h"
+
+css_error css_select_strings_intern(css_select_strings *str)
+{
+ lwc_error error;
+
+ /* Universal selector */
+ error = lwc_intern_string("*", SLEN("*"), &str->universal);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ /* Pseudo classes */
+ error = lwc_intern_string(
+ "first-child", SLEN("first-child"),
+ &str->first_child);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "link", SLEN("link"),
+ &str->link);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "visited", SLEN("visited"),
+ &str->visited);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "hover", SLEN("hover"),
+ &str->hover);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "active", SLEN("active"),
+ &str->active);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "focus", SLEN("focus"),
+ &str->focus);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "nth-child", SLEN("nth-child"),
+ &str->nth_child);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "nth-last-child", SLEN("nth-last-child"),
+ &str->nth_last_child);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "nth-of-type", SLEN("nth-of-type"),
+ &str->nth_of_type);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "nth-last-of-type", SLEN("nth-last-of-type"),
+ &str->nth_last_of_type);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "last-child", SLEN("last-child"),
+ &str->last_child);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "first-of-type", SLEN("first-of-type"),
+ &str->first_of_type);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "last-of-type", SLEN("last-of-type"),
+ &str->last_of_type);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "only-child", SLEN("only-child"),
+ &str->only_child);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "only-of-type", SLEN("only-of-type"),
+ &str->only_of_type);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "root", SLEN("root"),
+ &str->root);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "empty", SLEN("empty"),
+ &str->empty);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "target", SLEN("target"),
+ &str->target);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "lang", SLEN("lang"),
+ &str->lang);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "enabled", SLEN("enabled"),
+ &str->enabled);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "disabled", SLEN("disabled"),
+ &str->disabled);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "checked", SLEN("checked"),
+ &str->checked);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ /* Pseudo elements */
+ error = lwc_intern_string(
+ "first-line", SLEN("first-line"),
+ &str->first_line);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "first_letter", SLEN("first-letter"),
+ &str->first_letter);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "before", SLEN("before"),
+ &str->before);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "after", SLEN("after"),
+ &str->after);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "width", SLEN("width"),
+ &str->width);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "height", SLEN("height"),
+ &str->height);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ error = lwc_intern_string(
+ "prefers-color-scheme", SLEN("prefers-color-scheme"),
+ &str->prefers_color_scheme);
+ if (error != lwc_error_ok)
+ return css_error_from_lwc_error(error);
+
+ return CSS_OK;
+}
+
+void css_select_strings_unref(css_select_strings *str)
+{
+ if (str->universal != NULL)
+ lwc_string_unref(str->universal);
+ if (str->first_child != NULL)
+ lwc_string_unref(str->first_child);
+ if (str->link != NULL)
+ lwc_string_unref(str->link);
+ if (str->visited != NULL)
+ lwc_string_unref(str->visited);
+ if (str->hover != NULL)
+ lwc_string_unref(str->hover);
+ if (str->active != NULL)
+ lwc_string_unref(str->active);
+ if (str->focus != NULL)
+ lwc_string_unref(str->focus);
+ if (str->nth_child != NULL)
+ lwc_string_unref(str->nth_child);
+ if (str->nth_last_child != NULL)
+ lwc_string_unref(str->nth_last_child);
+ if (str->nth_of_type != NULL)
+ lwc_string_unref(str->nth_of_type);
+ if (str->nth_last_of_type != NULL)
+ lwc_string_unref(str->nth_last_of_type);
+ if (str->last_child != NULL)
+ lwc_string_unref(str->last_child);
+ if (str->first_of_type != NULL)
+ lwc_string_unref(str->first_of_type);
+ if (str->last_of_type != NULL)
+ lwc_string_unref(str->last_of_type);
+ if (str->only_child != NULL)
+ lwc_string_unref(str->only_child);
+ if (str->only_of_type != NULL)
+ lwc_string_unref(str->only_of_type);
+ if (str->root != NULL)
+ lwc_string_unref(str->root);
+ if (str->empty != NULL)
+ lwc_string_unref(str->empty);
+ if (str->target != NULL)
+ lwc_string_unref(str->target);
+ if (str->lang != NULL)
+ lwc_string_unref(str->lang);
+ if (str->enabled != NULL)
+ lwc_string_unref(str->enabled);
+ if (str->disabled != NULL)
+ lwc_string_unref(str->disabled);
+ if (str->checked != NULL)
+ lwc_string_unref(str->checked);
+ if (str->first_line != NULL)
+ lwc_string_unref(str->first_line);
+ if (str->first_letter != NULL)
+ lwc_string_unref(str->first_letter);
+ if (str->before != NULL)
+ lwc_string_unref(str->before);
+ if (str->after != NULL)
+ lwc_string_unref(str->after);
+
+ if (str->width != NULL)
+ lwc_string_unref(str->width);
+ if (str->height != NULL)
+ lwc_string_unref(str->height);
+ if (str->prefers_color_scheme != NULL)
+ lwc_string_unref(str->prefers_color_scheme);
+}
diff --git a/src/select/strings.h b/src/select/strings.h
new file mode 100644
index 0000000..ff965e5
--- /dev/null
+++ b/src/select/strings.h
@@ -0,0 +1,52 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
+ */
+
+#ifndef css_select_strings_h_
+#define css_select_strings_h_
+
+#include <libcss/errors.h>
+
+/** Useful interned strings */
+typedef struct {
+ lwc_string *universal;
+ lwc_string *first_child;
+ lwc_string *link;
+ lwc_string *visited;
+ lwc_string *hover;
+ lwc_string *active;
+ lwc_string *focus;
+ lwc_string *nth_child;
+ lwc_string *nth_last_child;
+ lwc_string *nth_of_type;
+ lwc_string *nth_last_of_type;
+ lwc_string *last_child;
+ lwc_string *first_of_type;
+ lwc_string *last_of_type;
+ lwc_string *only_child;
+ lwc_string *only_of_type;
+ lwc_string *root;
+ lwc_string *empty;
+ lwc_string *target;
+ lwc_string *lang;
+ lwc_string *enabled;
+ lwc_string *disabled;
+ lwc_string *checked;
+ lwc_string *first_line;
+ lwc_string *first_letter;
+ lwc_string *before;
+ lwc_string *after;
+
+ lwc_string *width;
+ lwc_string *height;
+ lwc_string *prefers_color_scheme;
+} css_select_strings;
+
+css_error css_select_strings_intern(css_select_strings *str);
+void css_select_strings_unref(css_select_strings *str);
+
+#endif
+
diff --git a/src/select/unit.c b/src/select/unit.c
new file mode 100644
index 0000000..3294db3
--- /dev/null
+++ b/src/select/unit.c
@@ -0,0 +1,513 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * Copyright 2021 Michael Drake <tlsa@netsurf-browser.org>
+ */
+
+#include <libcss/stylesheet.h>
+
+#include "utils/utils.h"
+
+#include "propget.h"
+#include "unit.h"
+
+/**
+ * Map viewport-relative length units to either vh or vw.
+ *
+ * Non-viewport-relative units are unchanged.
+ *
+ * \param[in] style Reference style.
+ * \param[in] viewport_height Viewport height in px.
+ * \param[in] viewport_width Viewport width in px.
+ * \param[in] unit Unit to map.
+ * \return the mapped unit.
+ */
+static inline css_unit css_unit__map_viewport_units(
+ const css_computed_style *style,
+ const css_fixed viewport_height,
+ const css_fixed viewport_width,
+ const css_unit unit)
+{
+ switch (unit) {
+ case CSS_UNIT_VI:
+ return (style != NULL && get_writing_mode(style) !=
+ CSS_WRITING_MODE_HORIZONTAL_TB) ?
+ CSS_UNIT_VH : CSS_UNIT_VW;
+
+ case CSS_UNIT_VB:
+ return (style != NULL && get_writing_mode(style) !=
+ CSS_WRITING_MODE_HORIZONTAL_TB) ?
+ CSS_UNIT_VW : CSS_UNIT_VH;
+
+ case CSS_UNIT_VMIN:
+ return (viewport_height < viewport_width) ?
+ CSS_UNIT_VH : CSS_UNIT_VW;
+
+ case CSS_UNIT_VMAX:
+ return (viewport_height > viewport_width) ?
+ CSS_UNIT_VH : CSS_UNIT_VW;
+
+ default:
+ return unit;
+ }
+}
+
+/**
+ * Convert an absolute length to points (pt).
+ *
+ * \param[in] style Style to get font-size from, or NULL.
+ * \param[in] viewport_height Client viewport height.
+ * \param[in] viewport_width Client viewport width.
+ * \param[in] length Length to convert.
+ * \param[in] unit Current unit of length.
+ * \return length in points (pt).
+ */
+static inline css_fixed css_unit__absolute_len2pt(
+ const css_computed_style *style,
+ const css_fixed viewport_height,
+ const css_fixed viewport_width,
+ const css_fixed length,
+ const css_unit unit)
+{
+ /* Length must not be relative */
+ assert(unit != CSS_UNIT_EM &&
+ unit != CSS_UNIT_EX &&
+ unit != CSS_UNIT_CH &&
+ unit != CSS_UNIT_REM);
+
+ switch (css_unit__map_viewport_units(style,
+ viewport_height,
+ viewport_width,
+ unit)) {
+ case CSS_UNIT_PX:
+ return FDIV(FMUL(length, F_72), F_96);
+
+ case CSS_UNIT_IN:
+ return FMUL(length, F_72);
+
+ case CSS_UNIT_CM:
+ return FMUL(length, FDIV(F_72, FLTTOFIX(2.54)));
+
+ case CSS_UNIT_MM:
+ return FMUL(length, FDIV(F_72, FLTTOFIX(25.4)));
+
+ case CSS_UNIT_Q:
+ return FMUL(length, FDIV(F_72, FLTTOFIX(101.6)));
+
+ case CSS_UNIT_PT:
+ return length;
+
+ case CSS_UNIT_PC:
+ return FMUL(length, INTTOFIX(12));
+
+ case CSS_UNIT_VH:
+ return FDIV(FMUL(FDIV(FMUL(length, viewport_height), F_100),
+ F_72), F_96);
+
+ case CSS_UNIT_VW:
+ return FDIV(FMUL(FDIV(FMUL(length, viewport_width), F_100),
+ F_72), F_96);
+
+ default:
+ return 0;
+ }
+}
+
+/* Exported function, documented in libcss/unit.h. */
+css_fixed css_unit_font_size_len2pt(
+ const css_computed_style *style,
+ const css_unit_ctx *ctx,
+ const css_fixed length,
+ const css_unit unit)
+{
+ return css_unit__absolute_len2pt(
+ style,
+ ctx->viewport_height,
+ ctx->viewport_width,
+ length,
+ unit);
+}
+
+/**
+ * Get font size from a style in CSS pixels.
+ *
+ * The style should have font size in absolute units.
+ *
+ * \param[in] style Style to get font-size from, or NULL.
+ * \param[in] font_size_default Client font size for NULL style.
+ * \param[in] font_size_minimum Client minimum font size clamp.
+ * \param[in] viewport_height Client viewport height.
+ * \param[in] viewport_width Client viewport width.
+ * \return font-size in CSS pixels.
+ */
+static inline css_fixed css_unit__font_size_px(
+ const css_computed_style *style,
+ const css_fixed font_size_default,
+ const css_fixed font_size_minimum,
+ const css_fixed viewport_height,
+ const css_fixed viewport_width)
+{
+ css_fixed font_length = 0;
+ css_unit font_unit = CSS_UNIT_PT;
+
+ if (style == NULL) {
+ return font_size_default;
+ }
+
+ get_font_size(style, &font_length, &font_unit);
+
+ if (font_unit != CSS_UNIT_PX) {
+ font_length = css_unit__absolute_len2pt(style,
+ viewport_height,
+ viewport_width,
+ font_length,
+ font_unit);
+
+ /* Convert from pt to CSS pixels.*/
+ font_length = FDIV(FMUL(font_length, F_96), F_72);
+ }
+
+ /* Clamp to configured minimum */
+ if (font_length < font_size_minimum) {
+ font_length = font_size_minimum;
+ }
+
+ return font_length;
+}
+
+/**
+ * Get the number of CSS pixels for a given unit.
+ *
+ * \param[in] measure Client callback for font measuring.
+ * \param[in] ref_style Reference style. (Element or parent, or NULL).
+ * \param[in] root_style Root element style or NULL.
+ * \param[in] font_size_default Client default font size in CSS pixels.
+ * \param[in] font_size_minimum Client minimum font size in CSS pixels.
+ * \param[in] viewport_height Viewport height in CSS pixels.
+ * \param[in] viewport_width Viewport width in CSS pixels.
+ * \param[in] unit The unit to convert from.
+ * \param[in] pw Client private word for measure callback.
+ * \return Number of CSS pixels equivalent to the given unit.
+ */
+static inline css_fixed css_unit__px_per_unit(
+ const css_unit_len_measure measure,
+ const css_computed_style *ref_style,
+ const css_computed_style *root_style,
+ const css_fixed font_size_default,
+ const css_fixed font_size_minimum,
+ const css_fixed viewport_height,
+ const css_fixed viewport_width,
+ const css_unit unit,
+ void *pw)
+{
+ switch (css_unit__map_viewport_units(
+ ref_style,
+ viewport_height,
+ viewport_width,
+ unit)) {
+ case CSS_UNIT_EM:
+ return css_unit__font_size_px(
+ ref_style,
+ font_size_default,
+ font_size_minimum,
+ viewport_height,
+ viewport_width);
+
+ case CSS_UNIT_EX:
+ if (measure != NULL) {
+ return measure(pw, ref_style, CSS_UNIT_EX);
+ }
+ return FMUL(css_unit__font_size_px(
+ ref_style,
+ font_size_default,
+ font_size_minimum,
+ viewport_height,
+ viewport_width), FLTTOFIX(0.6));
+
+ case CSS_UNIT_CH:
+ if (measure != NULL) {
+ return measure(pw, ref_style, CSS_UNIT_CH);
+ }
+ return FMUL(css_unit__font_size_px(
+ ref_style,
+ font_size_default,
+ font_size_minimum,
+ viewport_height,
+ viewport_width), FLTTOFIX(0.4));
+
+ case CSS_UNIT_PX:
+ return F_1;
+
+ case CSS_UNIT_IN:
+ return F_96;
+
+ case CSS_UNIT_CM:
+ return FDIV(F_96, FLTTOFIX(2.54));
+
+ case CSS_UNIT_MM:
+ return FDIV(F_96, FLTTOFIX(25.4));
+
+ case CSS_UNIT_Q:
+ return FDIV(F_96, FLTTOFIX(101.6));
+
+ case CSS_UNIT_PT:
+ return FDIV(F_96, F_72);
+
+ case CSS_UNIT_PC:
+ return FDIV(F_96, INTTOFIX(6));
+
+ case CSS_UNIT_REM:
+ return css_unit__font_size_px(
+ root_style,
+ font_size_default,
+ font_size_minimum,
+ viewport_height,
+ viewport_width);
+
+ case CSS_UNIT_VH:
+ return FDIV(viewport_width, F_100);
+
+ case CSS_UNIT_VW:
+ return FDIV(viewport_height, F_100);
+
+ default:
+ return 0;
+ }
+}
+
+/* Exported function, documented in unit.h. */
+css_fixed css_unit_len2px_mq(
+ const css_unit_ctx *ctx,
+ const css_fixed length,
+ const css_unit unit)
+{
+ /* In the media query context there is no reference or root element
+ * style, so these are hard-coded to NULL. */
+ css_fixed px_per_unit = css_unit__px_per_unit(
+ ctx->measure,
+ NULL,
+ NULL,
+ ctx->font_size_default,
+ ctx->font_size_minimum,
+ ctx->viewport_height,
+ ctx->viewport_width,
+ unit,
+ ctx->pw);
+
+ /* Ensure we round px_per_unit to the nearest whole number of pixels:
+ * the use of FIXTOINT() below will truncate. */
+ px_per_unit += F_0_5;
+
+ /* Calculate total number of pixels */
+ return FMUL(length, TRUNCATEFIX(px_per_unit));
+}
+
+/* Exported function, documented in libcss/unit.h. */
+css_fixed css_unit_len2css_px(
+ const css_computed_style *style,
+ const css_unit_ctx *ctx,
+ const css_fixed length,
+ const css_unit unit)
+{
+ css_fixed px_per_unit = css_unit__px_per_unit(
+ ctx->measure,
+ style,
+ ctx->root_style,
+ ctx->font_size_default,
+ ctx->font_size_minimum,
+ ctx->viewport_height,
+ ctx->viewport_width,
+ unit,
+ ctx->pw);
+
+ /* Ensure we round px_per_unit to the nearest whole number of pixels:
+ * the use of FIXTOINT() below will truncate. */
+ px_per_unit += F_0_5;
+
+ /* Calculate total number of pixels */
+ return FMUL(length, TRUNCATEFIX(px_per_unit));
+}
+
+/* Exported function, documented in libcss/unit.h. */
+css_fixed css_unit_len2device_px(
+ const css_computed_style *style,
+ const css_unit_ctx *ctx,
+ const css_fixed length,
+ const css_unit unit)
+{
+ css_fixed px_per_unit = css_unit__px_per_unit(
+ ctx->measure,
+ style,
+ ctx->root_style,
+ ctx->font_size_default,
+ ctx->font_size_minimum,
+ ctx->viewport_height,
+ ctx->viewport_width,
+ unit,
+ ctx->pw);
+
+ px_per_unit = css_unit_css2device_px(px_per_unit, ctx->device_dpi);
+
+ /* Ensure we round px_per_unit to the nearest whole number of pixels:
+ * the use of FIXTOINT() below will truncate. */
+ px_per_unit += F_0_5;
+
+ /* Calculate total number of pixels */
+ return FMUL(length, TRUNCATEFIX(px_per_unit));
+}
+
+/**
+ * Get font size from a computed style.
+ *
+ * The computed style will have font-size with an absolute unit.
+ * If no computed style is given, the client default font-size will be returned.
+ *
+ * \param[in] style Reference style. (Element or parent, or NULL).
+ * \param[in] font_size_default Client default font size in CSS pixels.
+ * \return The font size in absolute units.
+ */
+static inline css_hint_length css_unit__get_font_size(
+ const css_computed_style *style,
+ css_fixed font_size_default)
+{
+ css_hint_length size = {
+ .value = font_size_default,
+ .unit = CSS_UNIT_PX,
+ };
+
+ if (style != NULL) {
+ enum css_font_size_e status = get_font_size(style,
+ &size.value,
+ &size.unit);
+
+ UNUSED(status);
+
+ /* The font size must be absolute. */
+ assert(status == CSS_FONT_SIZE_DIMENSION);
+ assert(size.unit != CSS_UNIT_EM);
+ assert(size.unit != CSS_UNIT_EX);
+ assert(size.unit != CSS_UNIT_PCT);
+ }
+
+ return size;
+}
+
+/* Exported function, documented in unit.h. */
+css_error css_unit_compute_absolute_font_size(
+ const css_hint_length *ref_length,
+ const css_computed_style *root_style,
+ css_fixed font_size_default,
+ css_hint *size)
+{
+ css_hint_length ref_len = {
+ .value = font_size_default,
+ .unit = CSS_UNIT_PX,
+ };
+
+ if (ref_length != NULL) {
+ /* Must be absolute. */
+ assert(ref_length->unit != CSS_UNIT_EM);
+ assert(ref_length->unit != CSS_UNIT_EX);
+ assert(ref_length->unit != CSS_UNIT_PCT);
+
+ ref_len = *ref_length;
+ }
+
+ assert(size->status != CSS_FONT_SIZE_INHERIT);
+
+ switch (size->status) {
+ case CSS_FONT_SIZE_XX_SMALL: /* Fall-through. */
+ case CSS_FONT_SIZE_X_SMALL: /* Fall-through. */
+ case CSS_FONT_SIZE_SMALL: /* Fall-through. */
+ case CSS_FONT_SIZE_MEDIUM: /* Fall-through. */
+ case CSS_FONT_SIZE_LARGE: /* Fall-through. */
+ case CSS_FONT_SIZE_X_LARGE: /* Fall-through. */
+ case CSS_FONT_SIZE_XX_LARGE:
+ {
+ static const css_fixed factors[CSS_FONT_SIZE_XX_LARGE] = {
+ [CSS_FONT_SIZE_XX_SMALL - 1] = FLTTOFIX(0.5625),
+ [CSS_FONT_SIZE_X_SMALL - 1] = FLTTOFIX(0.6250),
+ [CSS_FONT_SIZE_SMALL - 1] = FLTTOFIX(0.8125),
+ [CSS_FONT_SIZE_MEDIUM - 1] = FLTTOFIX(1.0000),
+ [CSS_FONT_SIZE_LARGE - 1] = FLTTOFIX(1.1250),
+ [CSS_FONT_SIZE_X_LARGE - 1] = FLTTOFIX(1.5000),
+ [CSS_FONT_SIZE_XX_LARGE - 1] = FLTTOFIX(2.0000),
+ };
+ assert(CSS_FONT_SIZE_INHERIT == 0);
+ assert(CSS_FONT_SIZE_XX_SMALL == 1);
+
+ size->data.length.value = FMUL(factors[size->status - 1],
+ font_size_default);
+ size->data.length.unit = CSS_UNIT_PX;
+ size->status = CSS_FONT_SIZE_DIMENSION;
+ break;
+ }
+ case CSS_FONT_SIZE_LARGER:
+ size->data.length.value = FMUL(ref_len.value, FLTTOFIX(1.2));
+ size->data.length.unit = ref_len.unit;
+ size->status = CSS_FONT_SIZE_DIMENSION;
+ break;
+
+ case CSS_FONT_SIZE_SMALLER:
+ size->data.length.value = FDIV(ref_len.value, FLTTOFIX(1.2));
+ size->data.length.unit = ref_len.unit;
+ size->status = CSS_FONT_SIZE_DIMENSION;
+ break;
+
+ case CSS_FONT_SIZE_DIMENSION:
+ /* Convert any relative units to absolute. */
+ switch (size->data.length.unit) {
+ case CSS_UNIT_PCT:
+ size->data.length.value = FDIV(FMUL(
+ size->data.length.value,
+ ref_len.value), INTTOFIX(100));
+ size->data.length.unit = ref_len.unit;
+ break;
+
+ case CSS_UNIT_EM: /* Fall-through */
+ case CSS_UNIT_EX: /* Fall-through */
+ case CSS_UNIT_CH:
+ /* Parent relative units. */
+ size->data.length.value = FMUL(
+ size->data.length.value, ref_len.value);
+
+ switch (size->data.length.unit) {
+ case CSS_UNIT_EX:
+ size->data.length.value = FMUL(
+ size->data.length.value,
+ FLTTOFIX(0.6));
+ break;
+
+ case CSS_UNIT_CH:
+ size->data.length.value = FMUL(
+ size->data.length.value,
+ FLTTOFIX(0.4));
+ break;
+
+ default:
+ break;
+ }
+ size->data.length.unit = ref_len.unit;
+ break;
+
+ case CSS_UNIT_REM:
+ /* Root element relative units. */
+ ref_len = css_unit__get_font_size(root_style,
+ font_size_default);
+
+ size->data.length.unit = ref_len.unit;
+ size->data.length.value = FMUL(
+ size->data.length.value, ref_len.value);
+ break;
+
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+
+ return CSS_OK;
+}
diff --git a/src/select/unit.h b/src/select/unit.h
new file mode 100644
index 0000000..6a677b6
--- /dev/null
+++ b/src/select/unit.h
@@ -0,0 +1,42 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * Copyright 2021 Michael Drake <tlsa@netsurf-browser.org>
+ */
+
+#ifndef css_select_unit_h_
+#define css_select_unit_h_
+
+#include <libcss/unit.h>
+
+/**
+ * Convert a length to CSS pixels for a media query context.
+ *
+ * \param[in] ctx Document unit conversion context.
+ * \param[in] length Length to convert.
+ * \param[in] unit Current unit of length.
+ * \return A length in CSS pixels.
+ */
+css_fixed css_unit_len2px_mq(
+ const css_unit_ctx *ctx,
+ const css_fixed length,
+ const css_unit unit);
+
+/**
+ * Convert relative font size units to absolute units.
+ *
+ * \param[in] ref_length Reference font-size length or NULL.
+ * \param[in] root_style Root element style or NULL.
+ * \param[in] font_size_default Client default font size in CSS pixels.
+ * \param[in,out] size The length to convert.
+ * \return CSS_OK on success, or appropriate error otherwise.
+ */
+css_error css_unit_compute_absolute_font_size(
+ const css_hint_length *ref_length,
+ const css_computed_style *root_style,
+ css_fixed font_size_default,
+ css_hint *size);
+
+#endif
diff --git a/src/stylesheet.h b/src/stylesheet.h
index a71fca6..673bc95 100644
--- a/src/stylesheet.h
+++ b/src/stylesheet.h
@@ -188,6 +188,8 @@ struct css_stylesheet {
bool quirks_allowed; /**< Quirks permitted */
bool quirks_used; /**< Quirks actually used */
+ bool uses_revert; /**< Uses 'revert' property value */
+
bool inline_style; /**< Is an inline style */
size_t size; /**< Size, in bytes */
@@ -226,11 +228,14 @@ css_error css__stylesheet_merge_style(css_style *target, css_style *style);
static inline css_error css__stylesheet_style_appendOPV(css_style *style,
opcode_t opcode, uint8_t flags, uint16_t value)
{
+ if ((flags & (0x7 << 1)) == FLAG_REVERT) {
+ style->sheet->uses_revert = true;
+ }
return css__stylesheet_style_append(style,
buildOPV(opcode, flags, value));
}
-/** Helper function to set inherit flag */
+/** Helper function to set inherit generic value */
static inline css_error css_stylesheet_style_inherit(css_style *style,
opcode_t opcode)
{
@@ -238,6 +243,43 @@ static inline css_error css_stylesheet_style_inherit(css_style *style,
buildOPV(opcode, FLAG_INHERIT, 0));
}
+/** Helper function to set initial generic value */
+static inline css_error css_stylesheet_style_initial(css_style *style,
+ opcode_t opcode)
+{
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, FLAG_INITIAL, 0));
+}
+
+/** Helper function to set inherit generic value */
+static inline css_error css_stylesheet_style_revert(css_style *style,
+ opcode_t opcode)
+{
+ style->sheet->uses_revert = true;
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, FLAG_REVERT, 0));
+}
+
+/** Helper function to set initial generic value */
+static inline css_error css_stylesheet_style_unset(css_style *style,
+ opcode_t opcode)
+{
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, FLAG_UNSET, 0));
+}
+
+/** Helper function to set initial generic value */
+static inline css_error css_stylesheet_style_flag_value(css_style *style,
+ enum flag_value flag_value, opcode_t opcode)
+{
+ enum flag flag = flag_value << 1;
+ if (flag == FLAG_REVERT) {
+ style->sheet->uses_revert = true;
+ }
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, flag, 0));
+}
+
css_error css__stylesheet_selector_create(css_stylesheet *sheet,
css_qname *qname, css_selector **selector);
css_error css__stylesheet_selector_destroy(css_stylesheet *sheet,
diff --git a/test/data/parse/properties.dat b/test/data/parse/properties.dat
index 302b2dc..b6a0715 100644
--- a/test/data/parse/properties.dat
+++ b/test/data/parse/properties.dat
@@ -3289,6 +3289,14 @@ p:before { content: open-quote url('http://picodrive.acornarcade.com/') " : " at
| 0x000c0049
#reset
+#data
+* { position: sticky; }
+#errors
+#expected
+| 1 *
+| 0x00100049
+#reset
+
##
## 4a - quotes
##
diff --git a/test/data/parse2/INDEX b/test/data/parse2/INDEX
index 331cf5c..95534f6 100644
--- a/test/data/parse2/INDEX
+++ b/test/data/parse2/INDEX
@@ -16,6 +16,7 @@ border.dat Border property tests
font.dat Font property tests
list.dat List property tests
margin.dat Margin property tests
+mq.dat Media queries
outline.dat Outline property tests
overflow.dat Overflow property tests
padding.dat Padding property tests
@@ -23,3 +24,4 @@ multicol.dat Multi-column layout property tests
flexbox.dat Flexbox properties and shorthands tests
units.dat Length unit tests
dodgy-media-block.dat Media block with incomplete ruleset
+svg.dat SVG property tests
diff --git a/test/data/parse2/dodgy-media-block.dat b/test/data/parse2/dodgy-media-block.dat
index 61179c3..4b6c220 100644
--- a/test/data/parse2/dodgy-media-block.dat
+++ b/test/data/parse2/dodgy-media-block.dat
@@ -2,7 +2,7 @@
@media only screen { dodgy } .outer { top: 0px }
#errors
#expected
-| @media
+| @media 040
| dodgy
| .outer
| top: 0px
diff --git a/test/data/parse2/eof.dat b/test/data/parse2/eof.dat
index 2f238d7..7fc4ab7 100644
--- a/test/data/parse2/eof.dat
+++ b/test/data/parse2/eof.dat
@@ -180,49 +180,49 @@ f{clear:both}
@media screen
#errors
#expected
-| @media
+| @media 040
#reset
#data
@media screen
#errors
#expected
-| @media
+| @media 040
#reset
#data
@media screen{
#errors
#expected
-| @media
+| @media 040
#reset
#data
@media screen{
#errors
#expected
-| @media
+| @media 040
#reset
#data
@media screen{{
#errors
#expected
-| @media
+| @media 040
#reset
#data
@media screen{;
#errors
#expected
-| @media
+| @media 040
#reset
#data
@media screen{f
#errors
#expected
-| @media
+| @media 040
| f
#reset
@@ -230,7 +230,7 @@ f{clear:both}
@media screen{f{
#errors
#expected
-| @media
+| @media 040
| f
#reset
@@ -238,7 +238,7 @@ f{clear:both}
@media screen{f{color
#errors
#expected
-| @media
+| @media 040
| f
#reset
@@ -246,7 +246,7 @@ f{clear:both}
@media screen{f{color:
#errors
#expected
-| @media
+| @media 040
| f
#reset
@@ -254,7 +254,7 @@ f{clear:both}
@media screen{f{color:blue
#errors
#expected
-| @media
+| @media 040
| f
| color: #ff0000ff
#reset
@@ -263,7 +263,7 @@ f{clear:both}
@media screen{f{color:blue;
#errors
#expected
-| @media
+| @media 040
| f
| color: #ff0000ff
#reset
@@ -272,7 +272,7 @@ f{clear:both}
@media screen{f{color:blue}
#errors
#expected
-| @media
+| @media 040
| f
| color: #ff0000ff
#reset
@@ -281,7 +281,7 @@ f{clear:both}
@media screen{f{color:blue;}
#errors
#expected
-| @media
+| @media 040
| f
| color: #ff0000ff
#reset
@@ -290,7 +290,7 @@ f{clear:both}
@media screen{f{color:blue;}}
#errors
#expected
-| @media
+| @media 040
| f
| color: #ff0000ff
#reset
diff --git a/test/data/parse2/mq.dat b/test/data/parse2/mq.dat
new file mode 100644
index 0000000..5119d35
--- /dev/null
+++ b/test/data/parse2/mq.dat
@@ -0,0 +1,83 @@
+#data
+@media not
+#errors
+#expected
+| @media not 3ff
+#reset
+
+#data
+@media and
+#errors
+#expected
+| @media not 3ff
+#reset
+
+#data
+@media or
+#errors
+#expected
+| @media not 3ff
+#reset
+
+#data
+@media only
+#errors
+#expected
+| @media not 3ff
+#reset
+
+#data
+@media only not
+#errors
+#expected
+| @media not 3ff
+#reset
+
+#data
+@media only only
+#errors
+#expected
+| @media not 3ff
+#reset
+
+#data
+@media not not
+#errors
+#expected
+| @media not 3ff
+#reset
+
+#data
+@media not only
+#errors
+#expected
+| @media not 3ff
+#reset
+
+#data
+@media screen
+#errors
+#expected
+| @media 040
+#reset
+
+#data
+@media unknown
+#errors
+#expected
+| @media 000
+#reset
+
+#data
+@media not unknown
+#errors
+#expected
+| @media not 000
+#reset
+
+#data
+@media (color)
+#errors
+#expected
+| @media 3ff
+#reset
diff --git a/test/data/parse2/svg.dat b/test/data/parse2/svg.dat
new file mode 100644
index 0000000..e5ee2a3
--- /dev/null
+++ b/test/data/parse2/svg.dat
@@ -0,0 +1,79 @@
+#data
+* { fill-opacity: inherit; }
+#errors
+#expected
+| *
+| fill-opacity: inherit
+#reset
+
+#data
+* { fill-opacity: revert; }
+#errors
+#expected
+| *
+| fill-opacity: revert
+#reset
+
+#data
+* { fill-opacity: 0.867; }
+#errors
+#expected
+| *
+| fill-opacity: 0.867
+#reset
+
+#data
+* { fill-opacity: -0.5; }
+#errors
+#expected
+| *
+| fill-opacity: 0
+#reset
+
+#data
+* { fill-opacity: 5; }
+#errors
+#expected
+| *
+| fill-opacity: 1
+#reset
+
+#data
+* { stroke-opacity: inherit; }
+#errors
+#expected
+| *
+| stroke-opacity: inherit
+#reset
+
+#data
+* { stroke-opacity: revert; }
+#errors
+#expected
+| *
+| stroke-opacity: revert
+#reset
+
+#data
+* { stroke-opacity: 0.00000; }
+#errors
+#expected
+| *
+| stroke-opacity: 0
+#reset
+
+#data
+* { stroke-opacity: -0.5; }
+#errors
+#expected
+| *
+| stroke-opacity: 0
+#reset
+
+#data
+* { stroke-opacity: 5; }
+#errors
+#expected
+| *
+| stroke-opacity: 1
+#reset
diff --git a/test/data/parse2/units.dat b/test/data/parse2/units.dat
index 1052dc5..800df75 100644
--- a/test/data/parse2/units.dat
+++ b/test/data/parse2/units.dat
@@ -70,14 +70,6 @@
#reset
#data
-* { width: 10cap; }
-#errors
-#expected
-| *
-| width: 10cap
-#reset
-
-#data
* { width: 10ch; }
#errors
#expected
@@ -86,14 +78,6 @@
#reset
#data
-* { width: 10ic; }
-#errors
-#expected
-| *
-| width: 10ic
-#reset
-
-#data
* { width: 10rem; }
#errors
#expected
@@ -110,14 +94,6 @@
#reset
#data
-* { width: 10rlh; }
-#errors
-#expected
-| *
-| width: 10rlh
-#reset
-
-#data
* { width: 10vh; }
#errors
#expected
diff --git a/test/data/select/INDEX b/test/data/select/INDEX
index fb15ad4..c05567a 100644
--- a/test/data/select/INDEX
+++ b/test/data/select/INDEX
@@ -3,3 +3,4 @@
# Test Description
tests1.dat Basic tests
+defaulting.dat Explicit defaulting tests
diff --git a/test/data/select/defaulting.dat b/test/data/select/defaulting.dat
new file mode 100644
index 0000000..9548ae8
--- /dev/null
+++ b/test/data/select/defaulting.dat
@@ -0,0 +1,1478 @@
+#tree screen
+| div*
+#ua
+div { display: block; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: initial; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { display: block; }
+#user
+p { display: inherit; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { display: block; }
+#user
+p { display: table-cell; }
+p { display: unset; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { font-style: italic; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: italic
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { font-style: italic; }
+#user
+p { font-style: oblique; }
+p { font-style: unset; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: italic
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: inline-block; }
+div { display: table-cell; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: table-cell
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { font-style: italic; }
+p { font-style: oblique; }
+p { font-style: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: italic
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { display: block; }
+p { display: table-cell; }
+p { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: inline-block; }
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: inline-block; }
+#author
+div { display: table-cell; }
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline-block
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: revert; }
+#author
+div { display: table-cell; }
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index 33ba589..9240ed6 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -52,6 +52,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -59,7 +60,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -93,6 +94,120 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: grid; }
+#user
+div { display: inline-grid; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline-grid
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -166,6 +281,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -173,7 +289,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -207,6 +323,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -284,6 +401,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -291,7 +409,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -325,6 +443,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -403,6 +522,7 @@ cursor: auto
direction: ltr
display: table-cell
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -410,7 +530,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -444,6 +564,7 @@ padding-left: 0px
position: absolute
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -522,6 +643,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -529,7 +651,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -563,6 +685,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -641,6 +764,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -648,7 +772,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -682,6 +806,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -750,6 +875,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -757,7 +883,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -791,6 +917,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -860,6 +987,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -867,7 +995,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -901,6 +1029,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -970,6 +1099,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -977,7 +1107,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -1011,6 +1141,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1079,6 +1210,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1086,7 +1218,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -1120,6 +1252,7 @@ padding-left: 0px
position: static
quotes: "a" "b"
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1193,6 +1326,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1200,7 +1334,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -1234,6 +1368,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1307,6 +1442,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1314,7 +1450,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -1348,6 +1484,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1422,6 +1559,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1429,7 +1567,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -1463,6 +1601,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1540,6 +1679,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1547,7 +1687,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -1581,6 +1721,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1657,6 +1798,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1664,7 +1806,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -1698,6 +1840,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1780,6 +1923,7 @@ cursor: auto
direction: ltr
display: table-row
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1787,7 +1931,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -1821,6 +1965,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1903,6 +2048,7 @@ cursor: auto
direction: ltr
display: table-cell
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1910,7 +2056,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -1944,6 +2090,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2026,6 +2173,7 @@ cursor: auto
direction: ltr
display: table-cell
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2033,7 +2181,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -2067,6 +2215,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2153,6 +2302,7 @@ cursor: auto
direction: ltr
display: table-cell
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2160,7 +2310,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -2194,6 +2344,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2279,6 +2430,7 @@ cursor: auto
direction: ltr
display: table-cell
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2286,7 +2438,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -2320,6 +2472,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2403,6 +2556,7 @@ cursor: auto
direction: ltr
display: table-cell
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2410,7 +2564,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -2444,6 +2598,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2526,6 +2681,7 @@ cursor: auto
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2533,7 +2689,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -2567,6 +2723,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2649,6 +2806,7 @@ cursor: auto
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2656,7 +2814,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -2690,6 +2848,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2772,6 +2931,7 @@ cursor: auto
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2779,7 +2939,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -2813,6 +2973,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2895,6 +3056,7 @@ cursor: crosshair
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2902,7 +3064,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -2936,6 +3098,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3018,6 +3181,7 @@ cursor: default
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3025,7 +3189,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -3059,6 +3223,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3141,6 +3306,7 @@ cursor: pointer
direction: ltr
display: table
empty-cells: hide
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3148,7 +3314,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -3182,6 +3348,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3264,6 +3431,7 @@ cursor: move
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3271,7 +3439,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -3305,6 +3473,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3387,6 +3556,7 @@ cursor: e-resize
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3394,7 +3564,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -3428,6 +3598,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3510,6 +3681,7 @@ cursor: ne-resize
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3517,7 +3689,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -3551,6 +3723,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3633,6 +3806,7 @@ cursor: nw-resize
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3640,7 +3814,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 10.600pt
+font-size: 13.342px
font-style: normal
font-variant: normal
font-weight: normal
@@ -3674,6 +3848,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3756,6 +3931,7 @@ cursor: n-resize
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3763,7 +3939,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 14.391pt
+font-size: 19.187px
font-style: normal
font-variant: normal
font-weight: normal
@@ -3797,6 +3973,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3879,6 +4056,7 @@ cursor: se-resize
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3886,7 +4064,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 24pt
+font-size: 32px
font-style: normal
font-variant: normal
font-weight: normal
@@ -3920,6 +4098,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4002,6 +4181,7 @@ cursor: sw-resize
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4009,7 +4189,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 18pt
+font-size: 24px
font-style: normal
font-variant: normal
font-weight: normal
@@ -4043,6 +4223,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4125,6 +4306,7 @@ cursor: s-resize
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4132,7 +4314,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 13.500pt
+font-size: 18px
font-style: normal
font-variant: normal
font-weight: normal
@@ -4166,6 +4348,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4248,6 +4431,7 @@ cursor: w-resize
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4255,7 +4439,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -4289,6 +4473,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4371,6 +4556,7 @@ cursor: text
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4378,7 +4564,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 9.750pt
+font-size: 13px
font-style: normal
font-variant: normal
font-weight: normal
@@ -4412,6 +4598,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4494,6 +4681,7 @@ cursor: wait
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4501,7 +4689,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 7.500pt
+font-size: 10px
font-style: normal
font-variant: normal
font-weight: normal
@@ -4535,6 +4723,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4617,6 +4806,7 @@ cursor: help
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4624,7 +4814,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 6.750pt
+font-size: 9px
font-style: normal
font-variant: normal
font-weight: normal
@@ -4658,6 +4848,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4740,6 +4931,7 @@ cursor: progress
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4781,6 +4973,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4863,6 +5056,7 @@ cursor: url('sonic-team.png') pointer
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4870,7 +5064,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -4904,6 +5098,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4979,6 +5174,7 @@ cursor: auto
direction: ltr
display: none
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4986,7 +5182,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -5020,6 +5216,7 @@ padding-left: 0px
position: absolute
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5095,6 +5292,7 @@ cursor: auto
direction: ltr
display: none
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5102,7 +5300,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -5136,6 +5334,7 @@ padding-left: 0px
position: absolute
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5211,6 +5410,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5218,7 +5418,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -5252,6 +5452,7 @@ padding-left: 0px
position: absolute
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5324,6 +5525,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5331,7 +5533,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -5365,6 +5567,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5438,6 +5641,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5445,7 +5649,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -5479,6 +5683,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5552,6 +5757,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5559,7 +5765,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -5593,6 +5799,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5666,6 +5873,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5673,7 +5881,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -5707,6 +5915,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5776,6 +5985,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5783,7 +5993,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -5817,6 +6027,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5887,6 +6098,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5894,7 +6106,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -5928,6 +6140,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5997,6 +6210,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6004,7 +6218,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -6038,6 +6252,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6107,6 +6322,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6114,7 +6330,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -6148,6 +6364,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6217,6 +6434,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6224,7 +6442,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -6258,6 +6476,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6327,6 +6546,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6334,7 +6554,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -6368,6 +6588,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6437,6 +6658,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6444,7 +6666,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -6478,6 +6700,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6549,6 +6772,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6556,7 +6780,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -6590,6 +6814,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6659,6 +6884,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6666,7 +6892,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -6700,6 +6926,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6769,6 +6996,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6776,7 +7004,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -6810,6 +7038,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6880,6 +7109,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6887,7 +7117,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -6921,6 +7151,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6990,6 +7221,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 10px
flex-direction: row
flex-grow: 2.000
@@ -6997,7 +7229,7 @@ flex-shrink: 3.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -7031,6 +7263,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7100,6 +7333,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 1.000
@@ -7107,7 +7341,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -7141,6 +7375,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7210,6 +7445,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -7217,7 +7453,7 @@ flex-shrink: 0.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -7251,6 +7487,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7320,6 +7557,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 0.000
@@ -7327,7 +7565,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -7361,6 +7599,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7430,6 +7669,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 0.000
@@ -7437,7 +7677,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -7471,6 +7711,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7540,6 +7781,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 0.000
@@ -7547,7 +7789,7 @@ flex-shrink: 0.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -7581,6 +7823,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7650,6 +7893,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 3.000
@@ -7657,7 +7901,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -7691,6 +7935,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7759,6 +8004,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3px
flex-direction: row
flex-grow: 0.000
@@ -7766,7 +8012,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -7800,6 +8046,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7868,6 +8115,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3em
flex-direction: row
flex-grow: 2.000
@@ -7875,7 +8123,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -7909,6 +8157,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7977,6 +8226,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 20.000
@@ -7984,7 +8234,7 @@ flex-shrink: 30.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -8018,6 +8268,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8088,6 +8339,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 3.000
@@ -8095,7 +8347,7 @@ flex-shrink: 3.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -8129,6 +8381,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8199,6 +8452,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3px
flex-direction: row
flex-grow: 3.000
@@ -8206,7 +8460,7 @@ flex-shrink: 3.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -8240,6 +8494,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8308,6 +8563,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 0.000
@@ -8315,7 +8571,7 @@ flex-shrink: 0.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -8349,6 +8605,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8419,6 +8676,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -8426,7 +8684,7 @@ flex-shrink: 0.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -8460,6 +8718,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8530,6 +8789,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3%
flex-direction: row
flex-grow: 3.000
@@ -8537,7 +8797,7 @@ flex-shrink: 3.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -8571,6 +8831,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8641,6 +8902,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3%
flex-direction: row
flex-grow: 3.000
@@ -8648,7 +8910,7 @@ flex-shrink: 3.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -8682,6 +8944,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8750,6 +9013,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -8757,7 +9021,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -8791,6 +9055,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8859,6 +9124,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -8866,7 +9132,7 @@ flex-shrink: 1.000
flex-wrap: wrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -8900,6 +9166,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8968,6 +9235,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -8975,7 +9243,7 @@ flex-shrink: 1.000
flex-wrap: wrap-reverse
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9009,6 +9277,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9077,6 +9346,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -9084,7 +9354,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9118,6 +9388,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9186,6 +9457,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: column
flex-grow: 0.000
@@ -9193,7 +9465,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9227,6 +9499,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9295,6 +9568,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row-reverse
flex-grow: 0.000
@@ -9302,7 +9576,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9336,6 +9610,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9404,6 +9679,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: column-reverse
flex-grow: 0.000
@@ -9411,7 +9687,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9445,6 +9721,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9513,6 +9790,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: column-reverse
flex-grow: 0.000
@@ -9520,7 +9798,7 @@ flex-shrink: 1.000
flex-wrap: wrap-reverse
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9554,6 +9832,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9624,6 +9903,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: column
flex-grow: 0.000
@@ -9631,7 +9911,7 @@ flex-shrink: 1.000
flex-wrap: wrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9665,6 +9945,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9735,6 +10016,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row-reverse
flex-grow: 0.000
@@ -9742,7 +10024,7 @@ flex-shrink: 1.000
flex-wrap: wrap-reverse
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9776,6 +10058,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9844,6 +10127,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 4.500em
flex-direction: row
flex-grow: 2.370
@@ -9851,7 +10135,7 @@ flex-shrink: 0.899
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9885,6 +10169,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9953,6 +10238,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -9960,7 +10246,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -9994,6 +10280,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10062,6 +10349,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10069,7 +10357,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -10103,6 +10391,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10171,6 +10460,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10178,7 +10468,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -10212,6 +10502,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10280,6 +10571,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10287,7 +10579,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -10321,6 +10613,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10389,6 +10682,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10396,7 +10690,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -10430,6 +10724,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10498,6 +10793,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10505,7 +10801,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -10539,6 +10835,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10609,6 +10906,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10616,7 +10914,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -10650,6 +10948,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10720,6 +11019,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10727,7 +11027,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -10761,6 +11061,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10829,6 +11130,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10836,7 +11138,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -10870,6 +11172,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10938,6 +11241,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10945,7 +11249,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -10979,6 +11283,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11047,6 +11352,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11054,7 +11360,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -11088,6 +11394,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11158,6 +11465,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11165,7 +11473,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -11199,6 +11507,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11267,6 +11576,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 4.500em
flex-direction: column
flex-grow: 2.300
@@ -11274,7 +11584,7 @@ flex-shrink: 3.780
flex-wrap: wrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -11308,6 +11618,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11378,6 +11689,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 4.500em
flex-direction: column
flex-grow: 2.300
@@ -11385,7 +11697,7 @@ flex-shrink: 3.780
flex-wrap: wrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -11419,6 +11731,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11487,6 +11800,7 @@ cursor: auto
direction: ltr
display: flex
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11494,7 +11808,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -11528,6 +11842,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11596,6 +11911,7 @@ cursor: auto
direction: ltr
display: inline-flex
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11603,7 +11919,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -11637,6 +11953,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11705,6 +12022,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11712,7 +12030,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -11746,6 +12064,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11814,6 +12133,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11821,7 +12141,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -11855,6 +12175,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11923,6 +12244,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11930,7 +12252,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -11964,6 +12286,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12032,6 +12355,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12039,7 +12363,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -12073,6 +12397,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12141,6 +12466,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12148,7 +12474,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -12182,6 +12508,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12250,6 +12577,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12257,7 +12585,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -12291,6 +12619,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12359,6 +12688,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12366,7 +12696,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -12400,6 +12730,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12419,7 +12750,7 @@ z-index: auto
#tree
| div*
#ua
-div { width: 10cap; }
+div { width: 10em; }
#errors
#expected
align-content: stretch
@@ -12468,6 +12799,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12475,7 +12807,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -12509,6 +12841,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12519,7 +12852,7 @@ unicode-bidi: normal
vertical-align: baseline
visibility: visible
white-space: normal
-width: 10cap
+width: 10em
word-spacing: normal
writing-mode: horizontal-tb
z-index: auto
@@ -12577,6 +12910,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12584,7 +12918,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -12618,6 +12952,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12637,7 +12972,7 @@ z-index: auto
#tree
| div*
#ua
-div { width: 10ic; }
+div { width: 10ch; }
#errors
#expected
align-content: stretch
@@ -12686,6 +13021,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12693,7 +13029,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -12727,6 +13063,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12737,7 +13074,7 @@ unicode-bidi: normal
vertical-align: baseline
visibility: visible
white-space: normal
-width: 10ic
+width: 10ch
word-spacing: normal
writing-mode: horizontal-tb
z-index: auto
@@ -12795,6 +13132,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12802,7 +13140,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -12836,6 +13174,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12904,6 +13243,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12911,7 +13251,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -12945,6 +13285,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12964,7 +13305,7 @@ z-index: auto
#tree
| div*
#ua
-div { width: 10rlh; }
+div { width: 10rem; }
#errors
#expected
align-content: stretch
@@ -13013,6 +13354,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13020,7 +13362,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -13054,6 +13396,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13064,7 +13407,7 @@ unicode-bidi: normal
vertical-align: baseline
visibility: visible
white-space: normal
-width: 10rlh
+width: 10rem
word-spacing: normal
writing-mode: horizontal-tb
z-index: auto
@@ -13122,6 +13465,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13129,7 +13473,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -13163,6 +13507,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13231,6 +13576,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13238,7 +13584,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -13272,6 +13618,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13340,6 +13687,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13347,7 +13695,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -13381,6 +13729,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13449,6 +13798,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13456,7 +13806,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -13490,6 +13840,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13558,6 +13909,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13565,7 +13917,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -13599,6 +13951,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13667,6 +14020,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13674,7 +14028,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -13708,6 +14062,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13776,6 +14131,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13783,7 +14139,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -13817,6 +14173,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13885,6 +14242,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13892,7 +14250,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -13926,6 +14284,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -14013,6 +14372,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -14020,7 +14380,7 @@ flex-shrink: 1.000
flex-wrap: nowrap
float: none
font-family: sans-serif
-font-size: 12pt
+font-size: 16px
font-style: normal
font-variant: normal
font-weight: normal
@@ -14054,6 +14414,229 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree
+| p*
+#ua
+p { font: special-system-font }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: "special-system-font" sans-serif
+font-size: 22pt
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: 33em
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { position: sticky; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+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
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: sticky
+quotes: none
+right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
diff --git a/test/dump.h b/test/dump.h
index d67bb2a..09a35b0 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -131,7 +131,9 @@ void dump_rule_media(css_rule_media *s, char **buf, size_t *buflen)
char *ptr = *buf;
css_rule *rule;
- ptr += sprintf(ptr, "| @media ");
+ ptr += sprintf(ptr, "| @media %s%03lx",
+ s->media->negate_type ? "not " : "",
+ s->media->type);
/* \todo media list */
@@ -489,6 +491,8 @@ static const char *opcode_names[] = {
"flex-wrap",
"justify-content",
"order",
+ "fill-opacity",
+ "stroke-opacity",
};
static void dump_css_fixed(css_fixed f, char **ptr)
@@ -584,24 +588,15 @@ static void dump_unit(css_fixed val, uint32_t unit, char **ptr)
case UNIT_PC:
*ptr += sprintf(*ptr, "pc");
break;
- case UNIT_CAP:
- *ptr += sprintf(*ptr, "cap");
- break;
case UNIT_CH:
*ptr += sprintf(*ptr, "ch");
break;
- case UNIT_IC:
- *ptr += sprintf(*ptr, "ic");
- break;
case UNIT_REM:
*ptr += sprintf(*ptr, "rem");
break;
case UNIT_LH:
*ptr += sprintf(*ptr, "lh");
break;
- case UNIT_RLH:
- *ptr += sprintf(*ptr, "rlh");
- break;
case UNIT_VH:
*ptr += sprintf(*ptr, "vh");
break;
@@ -795,8 +790,14 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*((*ptr)++) = ' ';
*ptr += sprintf(*ptr, "%s: ", opcode_names[op]);
- if (isInherit(opv)) {
+ if (getFlagValue(opv) == FLAG_VALUE_INHERIT) {
*ptr += sprintf(*ptr, "inherit");
+ } else if (getFlagValue(opv) == FLAG_VALUE_INITIAL) {
+ *ptr += sprintf(*ptr, "initial");
+ } else if (getFlagValue(opv) == FLAG_VALUE_REVERT) {
+ *ptr += sprintf(*ptr, "revert");
+ } else if (getFlagValue(opv) == FLAG_VALUE_UNSET) {
+ *ptr += sprintf(*ptr, "unset");
} else {
value = getValue(opv);
@@ -1820,6 +1821,28 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
}
break;
+ case CSS_PROP_FILL_OPACITY:
+ switch (value) {
+ case FILL_OPACITY_SET:
+ {
+ css_fixed val = *((css_fixed *) bytecode);
+ ADVANCE(sizeof(val));
+ dump_number(val, ptr);
+ }
+ break;
+ }
+ break;
+ case CSS_PROP_STROKE_OPACITY:
+ switch (value) {
+ case STROKE_OPACITY_SET:
+ {
+ css_fixed val = *((css_fixed *) bytecode);
+ ADVANCE(sizeof(val));
+ dump_number(val, ptr);
+ }
+ break;
+ }
+ break;
case CSS_PROP_FLEX_BASIS:
switch (value) {
case FLEX_BASIS_AUTO:
diff --git a/test/dump_computed.h b/test/dump_computed.h
index b0c8bda..f769075 100644
--- a/test/dump_computed.h
+++ b/test/dump_computed.h
@@ -105,24 +105,15 @@ static size_t dump_css_unit(css_fixed val, css_unit unit, char *ptr, size_t len)
case CSS_UNIT_PC:
ret += snprintf(ptr + ret, len - ret, "pc");
break;
- case CSS_UNIT_CAP:
- ret += snprintf(ptr + ret, len - ret, "cap");
- break;
case CSS_UNIT_CH:
ret += snprintf(ptr + ret, len - ret, "ch");
break;
- case CSS_UNIT_IC:
- ret += snprintf(ptr + ret, len - ret, "ic");
- break;
case CSS_UNIT_REM:
ret += snprintf(ptr + ret, len - ret, "rem");
break;
case CSS_UNIT_LH:
ret += snprintf(ptr + ret, len - ret, "lh");
break;
- case CSS_UNIT_RLH:
- ret += snprintf(ptr + ret, len - ret, "rlh");
- break;
case CSS_UNIT_VH:
ret += snprintf(ptr + ret, len - ret, "vh");
break;
@@ -1612,6 +1603,12 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
case CSS_DISPLAY_INLINE_FLEX:
wrote = snprintf(ptr, *len, "display: inline-flex\n");
break;
+ case CSS_DISPLAY_GRID:
+ wrote = snprintf(ptr, *len, "display: grid\n");
+ break;
+ case CSS_DISPLAY_INLINE_GRID:
+ wrote = snprintf(ptr, *len, "display: inline-grid\n");
+ break;
default:
wrote = 0;
break;
@@ -1638,6 +1635,30 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
ptr += wrote;
*len -= wrote;
+ /* fill-opacity */
+ val = css_computed_fill_opacity(style, &len1);
+ switch (val) {
+ case CSS_FILL_OPACITY_INHERIT:
+ wrote = snprintf(ptr, *len, "fill-opacity: inherit\n");
+ break;
+ case CSS_FILL_OPACITY_SET:
+ wrote = snprintf(ptr, *len, "fill-opacity: ");
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = dump_css_fixed(len1, ptr, *len);
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = snprintf(ptr, *len, "\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
/* flex-basis */
val = css_computed_flex_basis(style, &len1, &unit1);
switch (val) {
@@ -2728,6 +2749,9 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
case CSS_POSITION_FIXED:
wrote = snprintf(ptr, *len, "position: fixed\n");
break;
+ case CSS_POSITION_STICKY:
+ wrote = snprintf(ptr, *len, "position: sticky\n");
+ break;
default:
wrote = 0;
break;
@@ -2796,6 +2820,30 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
ptr += wrote;
*len -= wrote;
+ /* stroke-opacity */
+ val = css_computed_stroke_opacity(style, &len1);
+ switch (val) {
+ case CSS_STROKE_OPACITY_INHERIT:
+ wrote = snprintf(ptr, *len, "stroke-opacity: inherit\n");
+ break;
+ case CSS_STROKE_OPACITY_SET:
+ wrote = snprintf(ptr, *len, "stroke-opacity: ");
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = dump_css_fixed(len1, ptr, *len);
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = snprintf(ptr, *len, "\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
/* table-layout */
val = css_computed_table_layout(style);
switch (val) {
diff --git a/test/select.c b/test/select.c
index 664994e..5bc7856 100644
--- a/test/select.c
+++ b/test/select.c
@@ -70,830 +70,7 @@ typedef struct line_ctx {
lwc_string *attr_id;
} line_ctx;
-
-
-
-static bool handle_line(const char *data, size_t datalen, void *pw);
-static void css__parse_tree(line_ctx *ctx, const char *data, size_t len);
-static void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len);
-static void css__parse_sheet(line_ctx *ctx, const char *data, size_t len);
-static void css__parse_media_list(const char **data, size_t *len, css_media *media);
-static void css__parse_pseudo_list(const char **data, size_t *len,
- uint32_t *element);
-static void css__parse_expected(line_ctx *ctx, const char *data, size_t len);
-static void run_test(line_ctx *ctx, const char *exp, size_t explen);
-static void destroy_tree(node *root);
-
-static css_error node_name(void *pw, void *node,
- css_qname *qname);
-static css_error node_classes(void *pw, void *n,
- lwc_string ***classes, uint32_t *n_classes);
-static css_error node_id(void *pw, void *node,
- lwc_string **id);
-static css_error named_ancestor_node(void *pw, void *node,
- const css_qname *qname,
- void **ancestor);
-static css_error named_parent_node(void *pw, void *node,
- const css_qname *qname,
- void **parent);
-static css_error named_sibling_node(void *pw, void *node,
- const css_qname *qname,
- void **sibling);
-static css_error named_generic_sibling_node(void *pw, void *node,
- const css_qname *qname,
- void **sibling);
-static css_error parent_node(void *pw, void *node, void **parent);
-static css_error sibling_node(void *pw, void *node, void **sibling);
-static css_error node_has_name(void *pw, void *node,
- const css_qname *qname,
- bool *match);
-static css_error node_has_class(void *pw, void *node,
- lwc_string *name,
- bool *match);
-static css_error node_has_id(void *pw, void *node,
- lwc_string *name,
- bool *match);
-static css_error node_has_attribute(void *pw, void *node,
- const css_qname *qname,
- bool *match);
-static css_error node_has_attribute_equal(void *pw, void *node,
- const css_qname *qname,
- lwc_string *value,
- bool *match);
-static css_error node_has_attribute_dashmatch(void *pw, void *node,
- const css_qname *qname,
- lwc_string *value,
- bool *match);
-static css_error node_has_attribute_includes(void *pw, void *node,
- const css_qname *qname,
- lwc_string *value,
- bool *match);
-static css_error node_has_attribute_prefix(void *pw, void *node,
- const css_qname *qname,
- lwc_string *value,
- bool *match);
-static css_error node_has_attribute_suffix(void *pw, void *node,
- const css_qname *qname,
- lwc_string *value,
- bool *match);
-static css_error node_has_attribute_substring(void *pw, void *node,
- const css_qname *qname,
- lwc_string *value,
- bool *match);
-static css_error node_is_root(void *pw, void *node, bool *match);
-static css_error node_count_siblings(void *pw, void *node,
- bool same_name, bool after, int32_t *count);
-static css_error node_is_empty(void *pw, void *node, bool *match);
-static css_error node_is_link(void *pw, void *node, bool *match);
-static css_error node_is_visited(void *pw, void *node, bool *match);
-static css_error node_is_hover(void *pw, void *node, bool *match);
-static css_error node_is_active(void *pw, void *node, bool *match);
-static css_error node_is_focus(void *pw, void *node, bool *match);
-static css_error node_is_enabled(void *pw, void *node, bool *match);
-static css_error node_is_disabled(void *pw, void *node, bool *match);
-static css_error node_is_checked(void *pw, void *node, bool *match);
-static css_error node_is_target(void *pw, void *node, bool *match);
-static css_error node_is_lang(void *pw, void *node,
- lwc_string *lang, bool *match);
-static css_error node_presentational_hint(void *pw, void *node,
- uint32_t *nhints, css_hint **hints);
-static css_error ua_default_for_property(void *pw, uint32_t property,
- css_hint *hints);
-static css_error compute_font_size(void *pw, const css_hint *parent,
- css_hint *size);
-static css_error set_libcss_node_data(void *pw, void *n,
- void *libcss_node_data);
-static css_error get_libcss_node_data(void *pw, void *n,
- void **libcss_node_data);
-
-static css_select_handler select_handler = {
- CSS_SELECT_HANDLER_VERSION_1,
-
- node_name,
- node_classes,
- node_id,
- named_ancestor_node,
- named_parent_node,
- named_sibling_node,
- named_generic_sibling_node,
- parent_node,
- sibling_node,
- node_has_name,
- node_has_class,
- node_has_id,
- node_has_attribute,
- node_has_attribute_equal,
- node_has_attribute_dashmatch,
- node_has_attribute_includes,
- node_has_attribute_prefix,
- node_has_attribute_suffix,
- node_has_attribute_substring,
- node_is_root,
- node_count_siblings,
- node_is_empty,
- node_is_link,
- node_is_visited,
- node_is_hover,
- node_is_active,
- node_is_focus,
- node_is_enabled,
- node_is_disabled,
- node_is_checked,
- node_is_target,
- node_is_lang,
- node_presentational_hint,
- ua_default_for_property,
- compute_font_size,
- set_libcss_node_data,
- get_libcss_node_data
-};
-
-static css_error resolve_url(void *pw,
- const char *base, lwc_string *rel, lwc_string **abs)
-{
- UNUSED(pw);
- UNUSED(base);
-
- /* About as useless as possible */
- *abs = lwc_string_ref(rel);
-
- return CSS_OK;
-}
-
-static bool fail_because_lwc_leaked = false;
-
-static void
-printing_lwc_iterator(lwc_string *str, void *pw)
-{
- UNUSED(pw);
-
- printf(" DICT: %*s\n", (int)(lwc_string_length(str)), lwc_string_data(str));
- fail_because_lwc_leaked = true;
-}
-
-int main(int argc, char **argv)
-{
- line_ctx ctx;
-
- if (argc != 2) {
- printf("Usage: %s <filename>\n", argv[0]);
- return 1;
- }
-
- memset(&ctx, 0, sizeof(ctx));
-
-
- lwc_intern_string("class", SLEN("class"), &ctx.attr_class);
- lwc_intern_string("id", SLEN("id"), &ctx.attr_id);
-
- assert(css__parse_testfile(argv[1], handle_line, &ctx) == true);
-
- /* and run final test */
- if (ctx.tree != NULL)
- run_test(&ctx, ctx.exp, ctx.expused);
-
- free(ctx.exp);
-
- lwc_string_unref(ctx.attr_class);
- lwc_string_unref(ctx.attr_id);
-
- lwc_iterate_strings(printing_lwc_iterator, NULL);
-
- assert(fail_because_lwc_leaked == false);
-
- printf("PASS\n");
- return 0;
-}
-
-bool handle_line(const char *data, size_t datalen, void *pw)
-{
- line_ctx *ctx = (line_ctx *) pw;
- css_error error;
-
- if (data[0] == '#') {
- if (ctx->intree) {
- if (strncasecmp(data+1, "errors", 6) == 0) {
- ctx->intree = false;
- ctx->insheet = false;
- ctx->inerrors = true;
- ctx->inexp = false;
- } else {
- /* Assume start of stylesheet */
- css__parse_sheet(ctx, data + 1, datalen - 1);
-
- ctx->intree = false;
- ctx->insheet = true;
- ctx->inerrors = false;
- ctx->inexp = false;
- }
- } else if (ctx->insheet) {
- if (strncasecmp(data+1, "errors", 6) == 0) {
- assert(css_stylesheet_data_done(
- ctx->sheets[ctx->n_sheets - 1].sheet)
- == CSS_OK);
-
- ctx->intree = false;
- ctx->insheet = false;
- ctx->inerrors = true;
- ctx->inexp = false;
- } else if (strncasecmp(data+1, "ua", 2) == 0 ||
- strncasecmp(data+1, "user", 4) == 0 ||
- strncasecmp(data+1, "author", 6) == 0) {
- assert(css_stylesheet_data_done(
- ctx->sheets[ctx->n_sheets - 1].sheet)
- == CSS_OK);
-
- css__parse_sheet(ctx, data + 1, datalen - 1);
- } else {
- error = css_stylesheet_append_data(
- ctx->sheets[ctx->n_sheets - 1].sheet,
- (const uint8_t *) data,
- datalen);
- assert(error == CSS_OK ||
- error == CSS_NEEDDATA);
- }
- } else if (ctx->inerrors) {
- ctx->intree = false;
- ctx->insheet = false;
- ctx->inerrors = false;
- ctx->inexp = true;
- } else if (ctx->inexp) {
- /* This marks end of testcase, so run it */
- run_test(ctx, ctx->exp, ctx->expused);
-
- ctx->expused = 0;
-
- ctx->intree = false;
- ctx->insheet = false;
- ctx->inerrors = false;
- ctx->inexp = false;
- } else {
- /* Start state */
- if (strncasecmp(data+1, "tree", 4) == 0) {
- css__parse_tree(ctx, data + 5, datalen - 5);
-
- ctx->intree = true;
- ctx->insheet = false;
- ctx->inerrors = false;
- ctx->inexp = false;
- }
- }
- } else {
- if (ctx->intree) {
- /* Not interested in the '|' */
- css__parse_tree_data(ctx, data + 1, datalen - 1);
- } else if (ctx->insheet) {
- error = css_stylesheet_append_data(
- ctx->sheets[ctx->n_sheets - 1].sheet,
- (const uint8_t *) data, datalen);
- assert(error == CSS_OK || error == CSS_NEEDDATA);
- } else if (ctx->inexp) {
- css__parse_expected(ctx, data, datalen);
- }
- }
-
- return true;
-}
-
-void css__parse_tree(line_ctx *ctx, const char *data, size_t len)
-{
- const char *p = data;
- const char *end = data + len;
- size_t left;
-
- /* [ <media_list> <pseudo>? ] ? */
-
- ctx->media.type = CSS_MEDIA_ALL;
- ctx->pseudo_element = CSS_PSEUDO_ELEMENT_NONE;
-
- /* Consume any leading whitespace */
- while (p < end && isspace(*p))
- p++;
-
- if (p < end) {
- left = end - p;
-
- css__parse_media_list(&p, &left, &ctx->media);
-
- end = p + left;
- }
-
- if (p < end) {
- left = end - p;
-
- css__parse_pseudo_list(&p, &left, &ctx->pseudo_element);
- }
-}
-
-void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len)
-{
- const char *p = data;
- const char *end = data + len;
- const char *name = NULL;
- const char *value = NULL;
- size_t namelen = 0;
- size_t valuelen = 0;
- uint32_t depth = 0;
- bool target = false;
-
- /* ' '{depth+1} [ <element> '*'? | <attr> ]
- *
- * <element> ::= [^=*[:space:]]+
- * <attr> ::= [^=*[:space:]]+ '=' [^[:space:]]*
- */
-
- while (p < end && isspace(*p)) {
- depth++;
- p++;
- }
- depth--;
-
- /* Get element/attribute name */
- name = p;
- while (p < end && *p != '=' && *p != '*' && isspace(*p) == false) {
- namelen++;
- p++;
- }
-
- /* Skip whitespace */
- while (p < end && isspace(*p))
- p++;
-
- if (p < end && *p == '=') {
- /* Attribute value */
- p++;
-
- value = p;
-
- while (p < end && isspace(*p) == false) {
- valuelen++;
- p++;
- }
- } else if (p < end && *p == '*') {
- /* Element is target node */
- target = true;
- }
-
- if (value == NULL) {
- /* We have an element, so create it */
- node *n = malloc(sizeof(node));
- assert(n != NULL);
-
- memset(n, 0, sizeof(node));
-
- lwc_intern_string(name, namelen, &n->name);
-
- /* Insert it into tree */
- if (ctx->tree == NULL) {
- ctx->tree = n;
- } else {
- assert(depth > 0);
- assert(depth <= ctx->depth + 1);
-
- /* Find node to insert into */
- while (depth <= ctx->depth) {
- ctx->depth--;
- ctx->current = ctx->current->parent;
- }
-
- /* Insert into current node */
- if (ctx->current->children == NULL) {
- ctx->current->children = n;
- ctx->current->last_child = n;
- } else {
- ctx->current->last_child->next = n;
- n->prev = ctx->current->last_child;
-
- ctx->current->last_child = n;
- }
- n->parent = ctx->current;
- }
-
- ctx->current = n;
- ctx->depth = depth;
-
- /* Mark the target, if it's us */
- if (target)
- ctx->target = n;
- } else {
- /* New attribute */
- bool amatch = false;
- attribute *attr;
- node *n = ctx->current;
-
- attribute *temp = realloc(n->attrs,
- (n->n_attrs + 1) * sizeof(attribute));
- assert(temp != NULL);
-
- n->attrs = temp;
-
- attr = &n->attrs[n->n_attrs];
-
- lwc_intern_string(name, namelen, &attr->name);
- lwc_intern_string(value, valuelen, &attr->value);
-
- assert(lwc_string_caseless_isequal(
- n->attrs[n->n_attrs].name,
- ctx->attr_class, &amatch) == lwc_error_ok);
- if (amatch == true) {
- n->classes = realloc(NULL, sizeof(lwc_string **));
- assert(n->classes != NULL);
-
- n->classes[0] = lwc_string_ref(
- n->attrs[n->n_attrs].
- value);
- n->n_classes = 1;
- }
-
- n->n_attrs++;
- }
-}
-
-void css__parse_sheet(line_ctx *ctx, const char *data, size_t len)
-{
- css_stylesheet_params params;
- const char *p;
- const char *end = data + len;
- css_origin origin = CSS_ORIGIN_AUTHOR;
- css_stylesheet *sheet;
- sheet_ctx *temp;
- char *media = NULL;
-
- /* <origin> <media_list>? */
-
- /* Find end of origin */
- for (p = data; p < end; p++) {
- if (isspace(*p))
- break;
- }
-
- if (p - data == 6 && strncasecmp(data, "author", 6) == 0)
- origin = CSS_ORIGIN_AUTHOR;
- else if (p - data == 4 && strncasecmp(data, "user", 4) == 0)
- origin = CSS_ORIGIN_USER;
- else if (p - data == 2 && strncasecmp(data, "ua", 2) == 0)
- origin = CSS_ORIGIN_UA;
- else
- assert(0 && "Unknown stylesheet origin");
-
- /* Skip any whitespace */
- while (p < end && isspace(*p))
- p++;
-
- assert(end >= p);
- media = malloc(end - p + 1);
- assert(media != NULL);
- memcpy(media, p, end - p);
- media[end - p] = '\0';
-
- params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1;
- params.level = CSS_LEVEL_21;
- params.charset = "UTF-8";
- params.url = "foo";
- params.title = "foo";
- params.allow_quirks = false;
- params.inline_style = false;
- params.resolve = resolve_url;
- params.resolve_pw = NULL;
- params.import = NULL;
- params.import_pw = NULL;
- params.color = NULL;
- params.color_pw = NULL;
- params.font = NULL;
- params.font_pw = NULL;
-
- /** \todo How are we going to handle @import? */
- assert(css_stylesheet_create(&params, &sheet) == CSS_OK);
-
- /* Extend array of sheets and append new sheet to it */
- temp = realloc(ctx->sheets,
- (ctx->n_sheets + 1) * sizeof(sheet_ctx));
- assert(temp != NULL);
-
- ctx->sheets = temp;
-
- ctx->sheets[ctx->n_sheets].sheet = sheet;
- ctx->sheets[ctx->n_sheets].origin = origin;
- ctx->sheets[ctx->n_sheets].media = media;
-
- ctx->n_sheets++;
-}
-
-void css__parse_media_list(const char **data, size_t *len, css_media *media)
-{
- const char *p = *data;
- const char *end = p + *len;
- uint64_t result = 0;
-
- /* <medium> [ ',' <medium> ]* */
-
- while (p < end) {
- const char *start = p;
-
- /* consume a medium */
- while (isspace(*p) == false && *p != ',')
- p++;
-
- if (p - start == 10 &&
- strncasecmp(start, "projection", 10) == 0)
- result |= CSS_MEDIA_PROJECTION;
- else if (p - start == 8 &&
- strncasecmp(start, "handheld", 8) == 0)
- result |= CSS_MEDIA_HANDHELD;
- else if (p - start == 8 &&
- strncasecmp(start, "embossed", 8) == 0)
- result |= CSS_MEDIA_EMBOSSED;
- else if (p - start == 7 &&
- strncasecmp(start, "braille", 7) == 0)
- result |= CSS_MEDIA_BRAILLE;
- else if (p - start == 6 &&
- strncasecmp(start, "speech", 6) == 0)
- result |= CSS_MEDIA_SPEECH;
- else if (p - start == 6 &&
- strncasecmp(start, "screen", 6) == 0)
- result |= CSS_MEDIA_SCREEN;
- else if (p - start == 5 &&
- strncasecmp(start, "print", 5) == 0)
- result |= CSS_MEDIA_PRINT;
- else if (p - start == 5 &&
- strncasecmp(start, "aural", 5) == 0)
- result |= CSS_MEDIA_AURAL;
- else if (p - start == 3 &&
- strncasecmp(start, "tty", 3) == 0)
- result |= CSS_MEDIA_TTY;
- else if (p - start == 3 &&
- strncasecmp(start, "all", 3) == 0)
- result |= CSS_MEDIA_ALL;
- else if (p - start == 2 &&
- strncasecmp(start, "tv", 2) == 0)
- result |= CSS_MEDIA_TV;
- else
- assert(0 && "Unknown media type");
-
- /* Consume whitespace */
- while (p < end && isspace(*p))
- p++;
-
- /* Stop if we've reached the end */
- if (p == end || *p != ',')
- break;
-
- /* Consume comma */
- p++;
-
- /* Consume whitespace */
- while (p < end && isspace(*p))
- p++;
- }
-
- media->type = result;
-
- *data = p;
- *len = end - p;
-}
-
-void css__parse_pseudo_list(const char **data, size_t *len, uint32_t *element)
-{
- const char *p = *data;
- const char *end = p + *len;
-
- /* <pseudo> [ ',' <pseudo> ]* */
-
- *element = CSS_PSEUDO_ELEMENT_NONE;
-
- while (p < end) {
- const char *start = p;
-
- /* consume a pseudo */
- while (isspace(*p) == false && *p != ',')
- p++;
-
- /* Pseudo elements */
- if (p - start == 12 &&
- strncasecmp(start, "first-letter", 12) == 0)
- *element = CSS_PSEUDO_ELEMENT_FIRST_LETTER;
- else if (p - start == 10 &&
- strncasecmp(start, "first-line", 10) == 0)
- *element = CSS_PSEUDO_ELEMENT_FIRST_LINE;
- else if (p - start == 6 &&
- strncasecmp(start, "before", 6) == 0)
- *element = CSS_PSEUDO_ELEMENT_BEFORE;
- else if (p - start == 5 &&
- strncasecmp(start, "after", 5) == 0)
- *element = CSS_PSEUDO_ELEMENT_AFTER;
- else
- assert(0 && "Unknown pseudo");
-
- /* Consume whitespace */
- while (p < end && isspace(*p))
- p++;
-
- /* Stop if we've reached the end */
- if (p == end || *p != ',')
- break;
-
- /* Consume comma */
- p++;
-
- /* Consume whitespace */
- while (p < end && isspace(*p))
- p++;
- }
-
- *data = p;
- *len = end - p;
-}
-
-void css__parse_expected(line_ctx *ctx, const char *data, size_t len)
-{
- while (ctx->expused + len >= ctx->explen) {
- size_t required = ctx->explen == 0 ? 64 : ctx->explen * 2;
- char *temp = realloc(ctx->exp, required);
- if (temp == NULL) {
- assert(0 && "No memory for expected output");
- }
-
- ctx->exp = temp;
- ctx->explen = required;
- }
-
- memcpy(ctx->exp + ctx->expused, data, len);
-
- ctx->expused += len;
-}
-
-static void show_differences(size_t len, const char *exp, const char *res)
-{
- const char *pos_exp, *opos_exp;
- const char *pos_res, *opos_res;
-
- opos_exp = pos_exp = exp;
- opos_res = pos_res = res;
-
- printf("Line differences:\n");
- while (pos_exp < exp + len && pos_res < res + len) {
- if (*pos_exp == '\n' && *pos_res == '\n') {
- if (pos_exp - opos_exp != pos_res - opos_res ||
- memcmp(opos_exp, opos_res,
- pos_exp - opos_exp) != 0) {
- printf("Expected:\t%.*s\n",
- (int)(pos_exp - opos_exp),
- opos_exp);
- printf(" Result:\t%.*s\n",
- (int)(pos_res - opos_res),
- opos_res);
- printf("\n");
- }
- opos_exp = ++pos_exp;
- opos_res = ++pos_res;
- } else if (*pos_exp == '\n') {
- pos_res++;
- } else if (*pos_res == '\n') {
- pos_exp++;
- } else {
- pos_exp++;
- pos_res++;
- }
- }
-}
-
-
-static void run_test_select_tree(css_select_ctx *select,
- node *node, line_ctx *ctx,
- char *buf, size_t *buflen)
-{
- css_select_results *sr;
- struct node *n = NULL;
-
- assert(css_select_style(select, node, &ctx->media, NULL,
- &select_handler, ctx, &sr) == CSS_OK);
-
- if (node->parent != NULL) {
- css_computed_style *composed;
- assert(css_computed_style_compose(
- node->parent->sr->styles[ctx->pseudo_element],
- sr->styles[ctx->pseudo_element],
- compute_font_size, NULL,
- &composed) == CSS_OK);
- css_computed_style_destroy(sr->styles[ctx->pseudo_element]);
- sr->styles[ctx->pseudo_element] = composed;
- }
-
- node->sr = sr;
-
- if (node == ctx->target) {
- dump_computed_style(sr->styles[ctx->pseudo_element],
- buf, buflen);
- }
-
- for (n = node->children; n != NULL; n = n->next) {
- run_test_select_tree(select, n, ctx, buf, buflen);
- }
-}
-
-
-void run_test(line_ctx *ctx, const char *exp, size_t explen)
-{
- css_select_ctx *select;
- css_select_results *results;
- uint32_t i;
- char *buf;
- size_t buflen;
- static int testnum;
-
- UNUSED(exp);
-
- buf = malloc(8192);
- if (buf == NULL) {
- assert(0 && "No memory for result data");
- }
- buflen = 8192;
-
- assert(css_select_ctx_create(&select) == CSS_OK);
-
- for (i = 0; i < ctx->n_sheets; i++) {
- assert(css_select_ctx_append_sheet(select,
- ctx->sheets[i].sheet, ctx->sheets[i].origin,
- ctx->sheets[i].media) == CSS_OK);
- }
-
- testnum++;
-
- run_test_select_tree(select, ctx->tree, ctx, buf, &buflen);
-
- results = ctx->target->sr;
- assert(results->styles[ctx->pseudo_element] != NULL);
-
- if (8192 - buflen != explen || memcmp(buf, exp, explen) != 0) {
- size_t len = 8192 - buflen < explen ? 8192 - buflen : explen;
- printf("Expected (%u):\n%.*s\n",
- (int) explen, (int) explen, exp);
- printf("Result (%u):\n%.*s\n", (int) (8192 - buflen),
- (int) (8192 - buflen), buf);
-
- show_differences(len, exp, buf);
- assert(0 && "Result doesn't match expected");
- }
-
- /* Clean up */
- css_select_ctx_destroy(select);
- destroy_tree(ctx->tree);
-
- for (i = 0; i < ctx->n_sheets; i++) {
- css_stylesheet_destroy(ctx->sheets[i].sheet);
- free(ctx->sheets[i].media);
- }
-
- ctx->tree = NULL;
- ctx->current = NULL;
- ctx->depth = 0;
- ctx->n_sheets = 0;
- free(ctx->sheets);
- ctx->sheets = NULL;
- ctx->target = NULL;
-
- free(buf);
-
- printf("Test %d: PASS\n", testnum);
-}
-
-void destroy_tree(node *root)
-{
- node *n, *p;
- uint32_t i;
-
- for (n = root->children; n != NULL; n = p) {
- p = n->next;
-
- destroy_tree(n);
- }
-
- css_select_results_destroy(root->sr);
-
- for (i = 0; i < root->n_attrs; ++i) {
- lwc_string_unref(root->attrs[i].name);
- lwc_string_unref(root->attrs[i].value);
- }
- free(root->attrs);
-
- if (root->classes != NULL) {
- for (i = 0; i < root->n_classes; ++i) {
- lwc_string_unref(root->classes[i]);
- }
- free(root->classes);
- }
-
- if (root->libcss_node_data != NULL) {
- css_libcss_node_data_handler(&select_handler, CSS_NODE_DELETED,
- NULL, root, NULL, root->libcss_node_data);
- }
-
- lwc_string_unref(root->name);
- free(root);
-}
-
-
-css_error node_name(void *pw, void *n, css_qname *qname)
+static css_error node_name(void *pw, void *n, css_qname *qname)
{
node *node = n;
@@ -921,7 +98,7 @@ static css_error node_classes(void *pw, void *n,
}
-css_error node_id(void *pw, void *n,
+static css_error node_id(void *pw, void *n,
lwc_string **id)
{
node *node = n;
@@ -945,7 +122,7 @@ css_error node_id(void *pw, void *n,
return CSS_OK;
}
-css_error named_ancestor_node(void *pw, void *n,
+static css_error named_ancestor_node(void *pw, void *n,
const css_qname *qname,
void **ancestor)
{
@@ -966,7 +143,7 @@ css_error named_ancestor_node(void *pw, void *n,
return CSS_OK;
}
-css_error named_parent_node(void *pw, void *n,
+static css_error named_parent_node(void *pw, void *n,
const css_qname *qname,
void **parent)
{
@@ -986,7 +163,7 @@ css_error named_parent_node(void *pw, void *n,
return CSS_OK;
}
-css_error named_sibling_node(void *pw, void *n,
+static css_error named_sibling_node(void *pw, void *n,
const css_qname *qname,
void **sibling)
{
@@ -1006,7 +183,7 @@ css_error named_sibling_node(void *pw, void *n,
return CSS_OK;
}
-css_error named_generic_sibling_node(void *pw, void *n,
+static css_error named_generic_sibling_node(void *pw, void *n,
const css_qname *qname,
void **sibling)
{
@@ -1027,7 +204,7 @@ css_error named_generic_sibling_node(void *pw, void *n,
return CSS_OK;
}
-css_error parent_node(void *pw, void *n, void **parent)
+static css_error parent_node(void *pw, void *n, void **parent)
{
node *node = n;
@@ -1038,7 +215,7 @@ css_error parent_node(void *pw, void *n, void **parent)
return CSS_OK;
}
-css_error sibling_node(void *pw, void *n, void **sibling)
+static css_error sibling_node(void *pw, void *n, void **sibling)
{
node *node = n;
@@ -1049,7 +226,7 @@ css_error sibling_node(void *pw, void *n, void **sibling)
return CSS_OK;
}
-css_error node_has_name(void *pw, void *n,
+static css_error node_has_name(void *pw, void *n,
const css_qname *qname,
bool *match)
{
@@ -1066,7 +243,7 @@ css_error node_has_name(void *pw, void *n,
return CSS_OK;
}
-css_error node_has_class(void *pw, void *n,
+static css_error node_has_class(void *pw, void *n,
lwc_string *name,
bool *match)
{
@@ -1092,7 +269,7 @@ css_error node_has_class(void *pw, void *n,
return CSS_OK;
}
-css_error node_has_id(void *pw, void *n,
+static css_error node_has_id(void *pw, void *n,
lwc_string *name,
bool *match)
{
@@ -1118,7 +295,7 @@ css_error node_has_id(void *pw, void *n,
return CSS_OK;
}
-css_error node_has_attribute(void *pw, void *n,
+static css_error node_has_attribute(void *pw, void *n,
const css_qname *qname,
bool *match)
{
@@ -1138,7 +315,7 @@ css_error node_has_attribute(void *pw, void *n,
return CSS_OK;
}
-css_error node_has_attribute_equal(void *pw, void *n,
+static css_error node_has_attribute_equal(void *pw, void *n,
const css_qname *qname,
lwc_string *value,
bool *match)
@@ -1166,7 +343,7 @@ css_error node_has_attribute_equal(void *pw, void *n,
return CSS_OK;
}
-css_error node_has_attribute_includes(void *pw, void *n,
+static css_error node_has_attribute_includes(void *pw, void *n,
const css_qname *qname,
lwc_string *value,
bool *match)
@@ -1212,7 +389,7 @@ css_error node_has_attribute_includes(void *pw, void *n,
return CSS_OK;
}
-css_error node_has_attribute_dashmatch(void *pw, void *n,
+static css_error node_has_attribute_dashmatch(void *pw, void *n,
const css_qname *qname,
lwc_string *value,
bool *match)
@@ -1258,7 +435,7 @@ css_error node_has_attribute_dashmatch(void *pw, void *n,
return CSS_OK;
}
-css_error node_has_attribute_prefix(void *pw, void *n,
+static css_error node_has_attribute_prefix(void *pw, void *n,
const css_qname *qname,
lwc_string *value,
bool *match)
@@ -1293,7 +470,7 @@ css_error node_has_attribute_prefix(void *pw, void *n,
return CSS_OK;
}
-css_error node_has_attribute_suffix(void *pw, void *n,
+static css_error node_has_attribute_suffix(void *pw, void *n,
const css_qname *qname,
lwc_string *value,
bool *match)
@@ -1332,7 +509,7 @@ css_error node_has_attribute_suffix(void *pw, void *n,
return CSS_OK;
}
-css_error node_has_attribute_substring(void *pw, void *n,
+static css_error node_has_attribute_substring(void *pw, void *n,
const css_qname *qname,
lwc_string *value,
bool *match)
@@ -1380,7 +557,7 @@ css_error node_has_attribute_substring(void *pw, void *n,
return CSS_OK;
}
-css_error node_is_root(void *pw, void *n, bool *match)
+static css_error node_is_root(void *pw, void *n, bool *match)
{
node *node = n;
UNUSED(pw);
@@ -1390,7 +567,7 @@ css_error node_is_root(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_count_siblings(void *pw, void *n,
+static css_error node_count_siblings(void *pw, void *n,
bool same_name, bool after, int32_t *count)
{
int32_t cnt = 0;
@@ -1436,7 +613,7 @@ css_error node_count_siblings(void *pw, void *n,
return CSS_OK;
}
-css_error node_is_empty(void *pw, void *n, bool *match)
+static css_error node_is_empty(void *pw, void *n, bool *match)
{
node *node = n;
UNUSED(pw);
@@ -1446,7 +623,7 @@ css_error node_is_empty(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_link(void *pw, void *n, bool *match)
+static css_error node_is_link(void *pw, void *n, bool *match)
{
node *node = n;
@@ -1458,7 +635,7 @@ css_error node_is_link(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_visited(void *pw, void *n, bool *match)
+static css_error node_is_visited(void *pw, void *n, bool *match)
{
node *node = n;
@@ -1470,7 +647,7 @@ css_error node_is_visited(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_hover(void *pw, void *n, bool *match)
+static css_error node_is_hover(void *pw, void *n, bool *match)
{
node *node = n;
@@ -1482,7 +659,7 @@ css_error node_is_hover(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_active(void *pw, void *n, bool *match)
+static css_error node_is_active(void *pw, void *n, bool *match)
{
node *node = n;
@@ -1494,7 +671,7 @@ css_error node_is_active(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_focus(void *pw, void *n, bool *match)
+static css_error node_is_focus(void *pw, void *n, bool *match)
{
node *node = n;
@@ -1506,7 +683,7 @@ css_error node_is_focus(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_enabled(void *pw, void *n, bool *match)
+static css_error node_is_enabled(void *pw, void *n, bool *match)
{
node *node = n;
@@ -1518,7 +695,7 @@ css_error node_is_enabled(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_disabled(void *pw, void *n, bool *match)
+static css_error node_is_disabled(void *pw, void *n, bool *match)
{
node *node = n;
@@ -1530,7 +707,7 @@ css_error node_is_disabled(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_checked(void *pw, void *n, bool *match)
+static css_error node_is_checked(void *pw, void *n, bool *match)
{
node *node = n;
@@ -1542,7 +719,7 @@ css_error node_is_checked(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_target(void *pw, void *n, bool *match)
+static css_error node_is_target(void *pw, void *n, bool *match)
{
node *node = n;
@@ -1554,7 +731,7 @@ css_error node_is_target(void *pw, void *n, bool *match)
return CSS_OK;
}
-css_error node_is_lang(void *pw, void *n,
+static css_error node_is_lang(void *pw, void *n,
lwc_string *lang,
bool *match)
{
@@ -1569,7 +746,7 @@ css_error node_is_lang(void *pw, void *n,
return CSS_OK;
}
-css_error node_presentational_hint(void *pw, void *node,
+static css_error node_presentational_hint(void *pw, void *node,
uint32_t *nhints, css_hint **hints)
{
UNUSED(pw);
@@ -1581,7 +758,7 @@ css_error node_presentational_hint(void *pw, void *node,
return CSS_OK;
}
-css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint)
+static css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint)
{
UNUSED(pw);
@@ -1606,89 +783,796 @@ css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint)
return CSS_OK;
}
-css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size)
+static css_error set_libcss_node_data(void *pw, void *n,
+ void *libcss_node_data)
{
- static css_hint_length sizes[] = {
- { FLTTOFIX(6.75), CSS_UNIT_PT },
- { FLTTOFIX(7.50), CSS_UNIT_PT },
- { FLTTOFIX(9.75), CSS_UNIT_PT },
- { FLTTOFIX(12.0), CSS_UNIT_PT },
- { FLTTOFIX(13.5), CSS_UNIT_PT },
- { FLTTOFIX(18.0), CSS_UNIT_PT },
- { FLTTOFIX(24.0), CSS_UNIT_PT }
- };
- const css_hint_length *parent_size;
-
+ node *node = n;
UNUSED(pw);
- /* Grab parent size, defaulting to medium if none */
- if (parent == NULL) {
- parent_size = &sizes[CSS_FONT_SIZE_MEDIUM - 1];
- } else {
- assert(parent->status == CSS_FONT_SIZE_DIMENSION);
- assert(parent->data.length.unit != CSS_UNIT_EM);
- assert(parent->data.length.unit != CSS_UNIT_EX);
- parent_size = &parent->data.length;
- }
+ node->libcss_node_data = libcss_node_data;
- assert(size->status != CSS_FONT_SIZE_INHERIT);
-
- if (size->status < CSS_FONT_SIZE_LARGER) {
- /* Keyword -- simple */
- size->data.length = sizes[size->status - 1];
- } else if (size->status == CSS_FONT_SIZE_LARGER) {
- /** \todo Step within table, if appropriate */
- size->data.length.value =
- FMUL(parent_size->value, FLTTOFIX(1.2));
- size->data.length.unit = parent_size->unit;
- } else if (size->status == CSS_FONT_SIZE_SMALLER) {
- /** \todo Step within table, if appropriate */
- size->data.length.value =
- FDIV(parent_size->value, FLTTOFIX(1.2));
- size->data.length.unit = parent_size->unit;
- } else if (size->data.length.unit == CSS_UNIT_EM ||
- size->data.length.unit == CSS_UNIT_EX) {
- size->data.length.value =
- FMUL(size->data.length.value, parent_size->value);
-
- if (size->data.length.unit == CSS_UNIT_EX) {
- size->data.length.value = FMUL(size->data.length.value,
- FLTTOFIX(0.6));
- }
+ return CSS_OK;
+}
- size->data.length.unit = parent_size->unit;
- } else if (size->data.length.unit == CSS_UNIT_PCT) {
- size->data.length.value = FDIV(FMUL(size->data.length.value,
- parent_size->value), FLTTOFIX(100));
- size->data.length.unit = parent_size->unit;
- }
+static css_error get_libcss_node_data(void *pw, void *n,
+ void **libcss_node_data)
+{
+ node *node = n;
+ UNUSED(pw);
- size->status = CSS_FONT_SIZE_DIMENSION;
+ /* Pass any node data back to libcss */
+ *libcss_node_data = node->libcss_node_data;
return CSS_OK;
}
-static css_error set_libcss_node_data(void *pw, void *n,
- void *libcss_node_data)
+static css_unit_ctx unit_ctx = {
+ .font_size_default = 16 * (1 << CSS_RADIX_POINT),
+};
+
+static css_select_handler select_handler = {
+ CSS_SELECT_HANDLER_VERSION_1,
+
+ node_name,
+ node_classes,
+ node_id,
+ named_ancestor_node,
+ named_parent_node,
+ named_sibling_node,
+ named_generic_sibling_node,
+ parent_node,
+ sibling_node,
+ node_has_name,
+ node_has_class,
+ node_has_id,
+ node_has_attribute,
+ node_has_attribute_equal,
+ node_has_attribute_dashmatch,
+ node_has_attribute_includes,
+ node_has_attribute_prefix,
+ node_has_attribute_suffix,
+ node_has_attribute_substring,
+ node_is_root,
+ node_count_siblings,
+ node_is_empty,
+ node_is_link,
+ node_is_visited,
+ node_is_hover,
+ node_is_active,
+ node_is_focus,
+ node_is_enabled,
+ node_is_disabled,
+ node_is_checked,
+ node_is_target,
+ node_is_lang,
+ node_presentational_hint,
+ ua_default_for_property,
+
+ set_libcss_node_data,
+ get_libcss_node_data,
+};
+
+static css_error resolve_url(void *pw,
+ const char *base, lwc_string *rel, lwc_string **abs)
{
- node *node = n;
UNUSED(pw);
+ UNUSED(base);
- node->libcss_node_data = libcss_node_data;
+ /* About as useless as possible */
+ *abs = lwc_string_ref(rel);
return CSS_OK;
}
-static css_error get_libcss_node_data(void *pw, void *n,
- void **libcss_node_data)
+static bool fail_because_lwc_leaked = false;
+
+static void
+printing_lwc_iterator(lwc_string *str, void *pw)
{
- node *node = n;
UNUSED(pw);
- /* Pass any node data back to libcss */
- *libcss_node_data = node->libcss_node_data;
+ printf(" DICT: %*s\n", (int)(lwc_string_length(str)), lwc_string_data(str));
+ fail_because_lwc_leaked = true;
+}
+
+static css_error css_font_resolution_func(void *pw, lwc_string *name,
+ css_system_font *system_font)
+{
+ lwc_error err;
+
+ if (system_font == NULL) {
+ return CSS_BADPARM;
+ }
+
+ (void)(pw);
+
+ if (strncmp(lwc_string_data(name), "special-system-font",
+ lwc_string_length(name)) != 0) {
+ return CSS_INVALID;
+ }
+
+ system_font->style = CSS_FONT_STYLE_NORMAL;
+ system_font->variant = CSS_FONT_VARIANT_NORMAL;
+ system_font->weight = CSS_FONT_WEIGHT_NORMAL;
+ system_font->size.size = INTTOFIX(22);
+ system_font->size.unit = CSS_UNIT_PT;
+ system_font->line_height.size = INTTOFIX(33);
+ system_font->line_height.unit = CSS_UNIT_EM;
+ err = lwc_intern_string("special-system-font",
+ strlen("special-system-font"),
+ &system_font->family);
+ if (err != lwc_error_ok) {
+ return CSS_NOMEM;
+ }
return CSS_OK;
}
+static void css__parse_sheet(line_ctx *ctx, const char *data, size_t len)
+{
+ css_stylesheet_params params;
+ const char *p;
+ const char *end = data + len;
+ css_origin origin = CSS_ORIGIN_AUTHOR;
+ css_stylesheet *sheet;
+ sheet_ctx *temp;
+ char *media = NULL;
+
+ /* <origin> <media_list>? */
+
+ /* Find end of origin */
+ for (p = data; p < end; p++) {
+ if (isspace(*p))
+ break;
+ }
+
+ if (p - data == 6 && strncasecmp(data, "author", 6) == 0)
+ origin = CSS_ORIGIN_AUTHOR;
+ else if (p - data == 4 && strncasecmp(data, "user", 4) == 0)
+ origin = CSS_ORIGIN_USER;
+ else if (p - data == 2 && strncasecmp(data, "ua", 2) == 0)
+ origin = CSS_ORIGIN_UA;
+ else
+ assert(0 && "Unknown stylesheet origin");
+
+ /* Skip any whitespace */
+ while (p < end && isspace(*p))
+ p++;
+
+ assert(end >= p);
+ media = malloc(end - p + 1);
+ assert(media != NULL);
+ memcpy(media, p, end - p);
+ media[end - p] = '\0';
+
+ params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1;
+ params.level = CSS_LEVEL_21;
+ params.charset = "UTF-8";
+ params.url = "foo";
+ params.title = "foo";
+ params.allow_quirks = false;
+ params.inline_style = false;
+ params.resolve = resolve_url;
+ params.resolve_pw = NULL;
+ params.import = NULL;
+ params.import_pw = NULL;
+ params.color = NULL;
+ params.color_pw = NULL;
+ params.font = css_font_resolution_func;
+ params.font_pw = NULL;
+
+ /** \todo How are we going to handle @import? */
+ assert(css_stylesheet_create(&params, &sheet) == CSS_OK);
+
+ /* Extend array of sheets and append new sheet to it */
+ temp = realloc(ctx->sheets,
+ (ctx->n_sheets + 1) * sizeof(sheet_ctx));
+ assert(temp != NULL);
+
+ ctx->sheets = temp;
+
+ ctx->sheets[ctx->n_sheets].sheet = sheet;
+ ctx->sheets[ctx->n_sheets].origin = origin;
+ ctx->sheets[ctx->n_sheets].media = media;
+
+ ctx->n_sheets++;
+}
+
+static void css__parse_media_list(const char **data, size_t *len, css_media *media)
+{
+ const char *p = *data;
+ const char *end = p + *len;
+ uint64_t result = 0;
+
+ /* <medium> [ ',' <medium> ]* */
+
+ while (p < end) {
+ const char *start = p;
+
+ /* consume a medium */
+ while (isspace(*p) == false && *p != ',')
+ p++;
+
+ if (p - start == 10 &&
+ strncasecmp(start, "projection", 10) == 0)
+ result |= CSS_MEDIA_PROJECTION;
+ else if (p - start == 8 &&
+ strncasecmp(start, "handheld", 8) == 0)
+ result |= CSS_MEDIA_HANDHELD;
+ else if (p - start == 8 &&
+ strncasecmp(start, "embossed", 8) == 0)
+ result |= CSS_MEDIA_EMBOSSED;
+ else if (p - start == 7 &&
+ strncasecmp(start, "braille", 7) == 0)
+ result |= CSS_MEDIA_BRAILLE;
+ else if (p - start == 6 &&
+ strncasecmp(start, "speech", 6) == 0)
+ result |= CSS_MEDIA_SPEECH;
+ else if (p - start == 6 &&
+ strncasecmp(start, "screen", 6) == 0)
+ result |= CSS_MEDIA_SCREEN;
+ else if (p - start == 5 &&
+ strncasecmp(start, "print", 5) == 0)
+ result |= CSS_MEDIA_PRINT;
+ else if (p - start == 5 &&
+ strncasecmp(start, "aural", 5) == 0)
+ result |= CSS_MEDIA_AURAL;
+ else if (p - start == 3 &&
+ strncasecmp(start, "tty", 3) == 0)
+ result |= CSS_MEDIA_TTY;
+ else if (p - start == 3 &&
+ strncasecmp(start, "all", 3) == 0)
+ result |= CSS_MEDIA_ALL;
+ else if (p - start == 2 &&
+ strncasecmp(start, "tv", 2) == 0)
+ result |= CSS_MEDIA_TV;
+ else
+ assert(0 && "Unknown media type");
+
+ /* Consume whitespace */
+ while (p < end && isspace(*p))
+ p++;
+
+ /* Stop if we've reached the end */
+ if (p == end || *p != ',')
+ break;
+
+ /* Consume comma */
+ p++;
+
+ /* Consume whitespace */
+ while (p < end && isspace(*p))
+ p++;
+ }
+
+ media->type = result;
+
+ *data = p;
+ *len = end - p;
+}
+
+static void css__parse_pseudo_list(const char **data, size_t *len, uint32_t *element)
+{
+ const char *p = *data;
+ const char *end = p + *len;
+
+ /* <pseudo> [ ',' <pseudo> ]* */
+
+ *element = CSS_PSEUDO_ELEMENT_NONE;
+
+ while (p < end) {
+ const char *start = p;
+
+ /* consume a pseudo */
+ while (isspace(*p) == false && *p != ',')
+ p++;
+
+ /* Pseudo elements */
+ if (p - start == 12 &&
+ strncasecmp(start, "first-letter", 12) == 0)
+ *element = CSS_PSEUDO_ELEMENT_FIRST_LETTER;
+ else if (p - start == 10 &&
+ strncasecmp(start, "first-line", 10) == 0)
+ *element = CSS_PSEUDO_ELEMENT_FIRST_LINE;
+ else if (p - start == 6 &&
+ strncasecmp(start, "before", 6) == 0)
+ *element = CSS_PSEUDO_ELEMENT_BEFORE;
+ else if (p - start == 5 &&
+ strncasecmp(start, "after", 5) == 0)
+ *element = CSS_PSEUDO_ELEMENT_AFTER;
+ else
+ assert(0 && "Unknown pseudo");
+
+ /* Consume whitespace */
+ while (p < end && isspace(*p))
+ p++;
+
+ /* Stop if we've reached the end */
+ if (p == end || *p != ',')
+ break;
+
+ /* Consume comma */
+ p++;
+
+ /* Consume whitespace */
+ while (p < end && isspace(*p))
+ p++;
+ }
+
+ *data = p;
+ *len = end - p;
+}
+
+static void css__parse_tree(line_ctx *ctx, const char *data, size_t len)
+{
+ const char *p = data;
+ const char *end = data + len;
+ size_t left;
+
+ /* [ <media_list> <pseudo>? ] ? */
+
+ ctx->media.type = CSS_MEDIA_ALL;
+ ctx->pseudo_element = CSS_PSEUDO_ELEMENT_NONE;
+
+ /* Consume any leading whitespace */
+ while (p < end && isspace(*p))
+ p++;
+
+ if (p < end) {
+ left = end - p;
+
+ css__parse_media_list(&p, &left, &ctx->media);
+ end = p + left;
+ }
+
+ if (p < end) {
+ left = end - p;
+
+ css__parse_pseudo_list(&p, &left, &ctx->pseudo_element);
+ }
+}
+
+static void css__parse_expected(line_ctx *ctx, const char *data, size_t len)
+{
+ while (ctx->expused + len >= ctx->explen) {
+ size_t required = ctx->explen == 0 ? 64 : ctx->explen * 2;
+ char *temp = realloc(ctx->exp, required);
+ if (temp == NULL) {
+ assert(0 && "No memory for expected output");
+ }
+
+ ctx->exp = temp;
+ ctx->explen = required;
+ }
+
+ memcpy(ctx->exp + ctx->expused, data, len);
+
+ ctx->expused += len;
+}
+
+static void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len)
+{
+ const char *p = data;
+ const char *end = data + len;
+ const char *name = NULL;
+ const char *value = NULL;
+ size_t namelen = 0;
+ size_t valuelen = 0;
+ uint32_t depth = 0;
+ bool target = false;
+
+ /* ' '{depth+1} [ <element> '*'? | <attr> ]
+ *
+ * <element> ::= [^=*[:space:]]+
+ * <attr> ::= [^=*[:space:]]+ '=' [^[:space:]]*
+ */
+
+ while (p < end && isspace(*p)) {
+ depth++;
+ p++;
+ }
+ depth--;
+
+ /* Get element/attribute name */
+ name = p;
+ while (p < end && *p != '=' && *p != '*' && isspace(*p) == false) {
+ namelen++;
+ p++;
+ }
+
+ /* Skip whitespace */
+ while (p < end && isspace(*p))
+ p++;
+
+ if (p < end && *p == '=') {
+ /* Attribute value */
+ p++;
+
+ value = p;
+
+ while (p < end && isspace(*p) == false) {
+ valuelen++;
+ p++;
+ }
+ } else if (p < end && *p == '*') {
+ /* Element is target node */
+ target = true;
+ }
+
+ if (value == NULL) {
+ /* We have an element, so create it */
+ node *n = malloc(sizeof(node));
+ assert(n != NULL);
+
+ memset(n, 0, sizeof(node));
+
+ lwc_intern_string(name, namelen, &n->name);
+
+ /* Insert it into tree */
+ if (ctx->tree == NULL) {
+ ctx->tree = n;
+ } else {
+ assert(depth > 0);
+ assert(depth <= ctx->depth + 1);
+
+ /* Find node to insert into */
+ while (depth <= ctx->depth) {
+ ctx->depth--;
+ ctx->current = ctx->current->parent;
+ }
+
+ /* Insert into current node */
+ if (ctx->current->children == NULL) {
+ ctx->current->children = n;
+ ctx->current->last_child = n;
+ } else {
+ ctx->current->last_child->next = n;
+ n->prev = ctx->current->last_child;
+
+ ctx->current->last_child = n;
+ }
+ n->parent = ctx->current;
+ }
+
+ ctx->current = n;
+ ctx->depth = depth;
+
+ /* Mark the target, if it's us */
+ if (target)
+ ctx->target = n;
+ } else {
+ /* New attribute */
+ bool amatch = false;
+ attribute *attr;
+ node *n = ctx->current;
+
+ attribute *temp = realloc(n->attrs,
+ (n->n_attrs + 1) * sizeof(attribute));
+ assert(temp != NULL);
+
+ n->attrs = temp;
+
+ attr = &n->attrs[n->n_attrs];
+
+ lwc_intern_string(name, namelen, &attr->name);
+ lwc_intern_string(value, valuelen, &attr->value);
+
+ assert(lwc_string_caseless_isequal(
+ n->attrs[n->n_attrs].name,
+ ctx->attr_class, &amatch) == lwc_error_ok);
+ if (amatch == true) {
+ n->classes = realloc(NULL, sizeof(lwc_string **));
+ assert(n->classes != NULL);
+
+ n->classes[0] = lwc_string_ref(
+ n->attrs[n->n_attrs].
+ value);
+ n->n_classes = 1;
+ }
+
+ n->n_attrs++;
+ }
+}
+
+
+static void run_test_select_tree(css_select_ctx *select,
+ node *node, line_ctx *ctx,
+ char *buf, size_t *buflen)
+{
+ css_select_results *sr;
+ struct node *n = NULL;
+
+ if (node->parent == NULL) {
+ unit_ctx.root_style = NULL;
+ }
+
+
+ assert(css_select_style(select, node, &unit_ctx, &ctx->media, NULL,
+ &select_handler, ctx, &sr) == CSS_OK);
+
+ if (node->parent != NULL) {
+ css_computed_style *composed;
+ assert(css_computed_style_compose(
+ node->parent->sr->styles[ctx->pseudo_element],
+ sr->styles[ctx->pseudo_element],
+ &unit_ctx,
+ &composed) == CSS_OK);
+ css_computed_style_destroy(sr->styles[ctx->pseudo_element]);
+ sr->styles[ctx->pseudo_element] = composed;
+ }
+
+ node->sr = sr;
+
+ if (node == ctx->target) {
+ dump_computed_style(sr->styles[ctx->pseudo_element],
+ buf, buflen);
+ }
+
+ if (node->parent == NULL) {
+ unit_ctx.root_style = node->sr->styles[ctx->pseudo_element];
+ }
+
+ for (n = node->children; n != NULL; n = n->next) {
+ run_test_select_tree(select, n, ctx, buf, buflen);
+ }
+}
+
+static void show_differences(size_t len, const char *exp, const char *res)
+{
+ const char *pos_exp, *opos_exp;
+ const char *pos_res, *opos_res;
+
+ opos_exp = pos_exp = exp;
+ opos_res = pos_res = res;
+
+ printf("Line differences:\n");
+ while (pos_exp < exp + len && pos_res < res + len) {
+ if (*pos_exp == '\n' && *pos_res == '\n') {
+ if (pos_exp - opos_exp != pos_res - opos_res ||
+ memcmp(opos_exp, opos_res,
+ pos_exp - opos_exp) != 0) {
+ printf("Expected:\t%.*s\n",
+ (int)(pos_exp - opos_exp),
+ opos_exp);
+ printf(" Result:\t%.*s\n",
+ (int)(pos_res - opos_res),
+ opos_res);
+ printf("\n");
+ }
+ opos_exp = ++pos_exp;
+ opos_res = ++pos_res;
+ } else if (*pos_exp == '\n') {
+ pos_res++;
+ } else if (*pos_res == '\n') {
+ pos_exp++;
+ } else {
+ pos_exp++;
+ pos_res++;
+ }
+ }
+}
+
+static void destroy_tree(node *root)
+{
+ node *n, *p;
+ uint32_t i;
+
+ for (n = root->children; n != NULL; n = p) {
+ p = n->next;
+
+ destroy_tree(n);
+ }
+
+ css_select_results_destroy(root->sr);
+
+ for (i = 0; i < root->n_attrs; ++i) {
+ lwc_string_unref(root->attrs[i].name);
+ lwc_string_unref(root->attrs[i].value);
+ }
+ free(root->attrs);
+
+ if (root->classes != NULL) {
+ for (i = 0; i < root->n_classes; ++i) {
+ lwc_string_unref(root->classes[i]);
+ }
+ free(root->classes);
+ }
+
+ if (root->libcss_node_data != NULL) {
+ css_libcss_node_data_handler(&select_handler, CSS_NODE_DELETED,
+ NULL, root, NULL, root->libcss_node_data);
+ }
+
+ lwc_string_unref(root->name);
+ free(root);
+}
+
+static void run_test(line_ctx *ctx, const char *exp, size_t explen)
+{
+ css_select_ctx *select;
+ css_select_results *results;
+ uint32_t i;
+ char *buf;
+ size_t buflen;
+ static int testnum;
+
+ UNUSED(exp);
+
+ buf = malloc(8192);
+ if (buf == NULL) {
+ assert(0 && "No memory for result data");
+ }
+ buflen = 8192;
+
+ assert(css_select_ctx_create(&select) == CSS_OK);
+
+ for (i = 0; i < ctx->n_sheets; i++) {
+ assert(css_select_ctx_append_sheet(select,
+ ctx->sheets[i].sheet, ctx->sheets[i].origin,
+ ctx->sheets[i].media) == CSS_OK);
+ }
+
+ testnum++;
+
+ run_test_select_tree(select, ctx->tree, ctx, buf, &buflen);
+
+ results = ctx->target->sr;
+ assert(results->styles[ctx->pseudo_element] != NULL);
+
+ if (8192 - buflen != explen || memcmp(buf, exp, explen) != 0) {
+ size_t len = 8192 - buflen < explen ? 8192 - buflen : explen;
+ printf("Expected (%u):\n%.*s\n",
+ (int) explen, (int) explen, exp);
+ printf("Result (%u):\n%.*s\n", (int) (8192 - buflen),
+ (int) (8192 - buflen), buf);
+
+ show_differences(len, exp, buf);
+ assert(0 && "Result doesn't match expected");
+ }
+
+ /* Clean up */
+ css_select_ctx_destroy(select);
+ destroy_tree(ctx->tree);
+
+ for (i = 0; i < ctx->n_sheets; i++) {
+ css_stylesheet_destroy(ctx->sheets[i].sheet);
+ free(ctx->sheets[i].media);
+ }
+
+ ctx->tree = NULL;
+ ctx->current = NULL;
+ ctx->depth = 0;
+ ctx->n_sheets = 0;
+ free(ctx->sheets);
+ ctx->sheets = NULL;
+ ctx->target = NULL;
+
+ free(buf);
+
+ printf("Test %d: PASS\n", testnum);
+}
+
+static bool handle_line(const char *data, size_t datalen, void *pw)
+{
+ line_ctx *ctx = (line_ctx *) pw;
+ css_error error;
+
+ if (data[0] == '#') {
+ if (ctx->intree) {
+ if (strncasecmp(data+1, "errors", 6) == 0) {
+ ctx->intree = false;
+ ctx->insheet = false;
+ ctx->inerrors = true;
+ ctx->inexp = false;
+ } else {
+ /* Assume start of stylesheet */
+ css__parse_sheet(ctx, data + 1, datalen - 1);
+
+ ctx->intree = false;
+ ctx->insheet = true;
+ ctx->inerrors = false;
+ ctx->inexp = false;
+ }
+ } else if (ctx->insheet) {
+ if (strncasecmp(data+1, "errors", 6) == 0) {
+ assert(css_stylesheet_data_done(
+ ctx->sheets[ctx->n_sheets - 1].sheet)
+ == CSS_OK);
+
+ ctx->intree = false;
+ ctx->insheet = false;
+ ctx->inerrors = true;
+ ctx->inexp = false;
+ } else if (strncasecmp(data+1, "ua", 2) == 0 ||
+ strncasecmp(data+1, "user", 4) == 0 ||
+ strncasecmp(data+1, "author", 6) == 0) {
+ assert(css_stylesheet_data_done(
+ ctx->sheets[ctx->n_sheets - 1].sheet)
+ == CSS_OK);
+
+ css__parse_sheet(ctx, data + 1, datalen - 1);
+ } else {
+ error = css_stylesheet_append_data(
+ ctx->sheets[ctx->n_sheets - 1].sheet,
+ (const uint8_t *) data,
+ datalen);
+ assert(error == CSS_OK ||
+ error == CSS_NEEDDATA);
+ }
+ } else if (ctx->inerrors) {
+ ctx->intree = false;
+ ctx->insheet = false;
+ ctx->inerrors = false;
+ ctx->inexp = true;
+ } else if (ctx->inexp) {
+ /* This marks end of testcase, so run it */
+ run_test(ctx, ctx->exp, ctx->expused);
+
+ ctx->expused = 0;
+
+ ctx->intree = false;
+ ctx->insheet = false;
+ ctx->inerrors = false;
+ ctx->inexp = false;
+ } else {
+ /* Start state */
+ if (strncasecmp(data+1, "tree", 4) == 0) {
+ css__parse_tree(ctx, data + 5, datalen - 5);
+
+ ctx->intree = true;
+ ctx->insheet = false;
+ ctx->inerrors = false;
+ ctx->inexp = false;
+ }
+ }
+ } else {
+ if (ctx->intree) {
+ /* Not interested in the '|' */
+ css__parse_tree_data(ctx, data + 1, datalen - 1);
+ } else if (ctx->insheet) {
+ error = css_stylesheet_append_data(
+ ctx->sheets[ctx->n_sheets - 1].sheet,
+ (const uint8_t *) data, datalen);
+ assert(error == CSS_OK || error == CSS_NEEDDATA);
+ } else if (ctx->inexp) {
+ css__parse_expected(ctx, data, datalen);
+ }
+ }
+
+ return true;
+}
+
+int main(int argc, char **argv)
+{
+ line_ctx ctx;
+
+ if (argc != 2) {
+ printf("Usage: %s <filename>\n", argv[0]);
+ return 1;
+ }
+
+ memset(&ctx, 0, sizeof(ctx));
+
+
+ lwc_intern_string("class", SLEN("class"), &ctx.attr_class);
+ lwc_intern_string("id", SLEN("id"), &ctx.attr_id);
+
+ assert(css__parse_testfile(argv[1], handle_line, &ctx) == true);
+
+ /* and run final test */
+ if (ctx.tree != NULL)
+ run_test(&ctx, ctx.exp, ctx.expused);
+
+ free(ctx.exp);
+
+ lwc_string_unref(ctx.attr_class);
+ lwc_string_unref(ctx.attr_id);
+
+ lwc_iterate_strings(printing_lwc_iterator, NULL);
+
+ assert(fail_because_lwc_leaked == false);
+
+ printf("PASS\n");
+ return 0;
+}