summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-01-02 14:50:20 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2015-01-02 14:50:20 (GMT)
commitca9fa11e374cd2e48d904e8a9f186e1a6eadf8e4 (patch)
tree2ea98cbbc6354ce16649d561710aed1a3b399121
parent73da56edc77b70ed4d95db94cbb3d986dd47bf1c (diff)
downloadlibcss-ca9fa11e374cd2e48d904e8a9f186e1a6eadf8e4.tar.gz
libcss-ca9fa11e374cd2e48d904e8a9f186e1a6eadf8e4.tar.bz2
Ensure letter and word spacing are always absolutified.
-rw-r--r--src/select/computed.c18
-rw-r--r--test/data/select/tests1.dat64
2 files changed, 48 insertions, 34 deletions
diff --git a/src/select/computed.c b/src/select/computed.c
index 2dc9055..9028710 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -314,7 +314,14 @@ css_error css_computed_style_compose(const css_computed_style *parent,
uint8_t css_computed_letter_spacing(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
- return get_letter_spacing(style, length, unit);
+ /* This property is in the uncommon block, so we need to do
+ * absolute value calculation here. */
+ if (get_letter_spacing(style, length, unit) != CSS_LETTER_SPACING_SET) {
+ *length = INTTOFIX(0);
+ *unit = CSS_UNIT_PX;
+ }
+
+ return CSS_LETTER_SPACING_SET;
}
uint8_t css_computed_outline_color(const css_computed_style *style,
@@ -339,7 +346,14 @@ uint8_t css_computed_border_spacing(const css_computed_style *style,
uint8_t css_computed_word_spacing(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
- return get_word_spacing(style, length, unit);
+ /* This property is in the uncommon block, so we need to do
+ * absolute value calculation here. */
+ if (get_word_spacing(style, length, unit) != CSS_WORD_SPACING_SET) {
+ *length = INTTOFIX(0);
+ *unit = CSS_UNIT_PX;
+ }
+
+ return CSS_WORD_SPACING_SET;
}
uint8_t css_computed_writing_mode(const css_computed_style *style)
diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index fde8e4a..1b4ad54 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -56,7 +56,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -93,7 +93,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -159,7 +159,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -196,7 +196,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -266,7 +266,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -303,7 +303,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -374,7 +374,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -411,7 +411,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -482,7 +482,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -519,7 +519,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -590,7 +590,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -627,7 +627,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -688,7 +688,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -725,7 +725,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -787,7 +787,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -824,7 +824,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -886,7 +886,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -923,7 +923,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -984,7 +984,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -1021,7 +1021,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -1087,7 +1087,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -1124,7 +1124,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -1190,7 +1190,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -1227,7 +1227,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -1294,7 +1294,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -1331,7 +1331,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -1401,7 +1401,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -1438,7 +1438,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -1507,7 +1507,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -1544,7 +1544,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset
@@ -4532,7 +4532,7 @@ font-variant: normal
font-weight: normal
height: auto
left: auto
-letter-spacing: normal
+letter-spacing: 0px
line-height: normal
list-style-image: none
list-style-position: outside
@@ -4569,7 +4569,7 @@ vertical-align: baseline
visibility: visible
white-space: normal
width: auto
-word-spacing: normal
+word-spacing: 0px
writing-mode: horizontal-tb
z-index: auto
#reset