mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[css] line-through
This commit is contained in:
parent
524b4e0469
commit
80a33fd3ea
@ -326,10 +326,10 @@ css_parse_text_decoration_value(struct css_property_info *propinfo,
|
||||
* 'background'-style. --pasky */
|
||||
if (scanner_token_contains(token, "underline")) {
|
||||
value->font_attribute.add |= AT_UNDERLINE;
|
||||
|
||||
} else if (scanner_token_contains(token, "line-through")) {
|
||||
value->font_attribute.add |= AT_STRIKE;
|
||||
} else if (scanner_token_contains(token, "none")) {
|
||||
value->font_attribute.rem |= AT_UNDERLINE;
|
||||
|
||||
value->font_attribute.rem |= (AT_UNDERLINE | AT_STRIKE);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1873,7 +1873,7 @@ apply_background_color(struct html_context *html_context, struct html_element *h
|
||||
|
||||
static void
|
||||
apply_font_attribute(struct html_context *html_context,
|
||||
struct html_element *element, bool underline, bool bold)
|
||||
struct html_element *element, bool underline, bool bold, bool strike)
|
||||
{
|
||||
int add = 0;
|
||||
int rem = 0;
|
||||
@ -1888,6 +1888,13 @@ apply_font_attribute(struct html_context *html_context,
|
||||
} else {
|
||||
rem |= AT_BOLD;
|
||||
}
|
||||
|
||||
if (strike) {
|
||||
add |= AT_STRIKE;
|
||||
} else {
|
||||
rem |= AT_STRIKE;
|
||||
}
|
||||
|
||||
element->attr.style.attr |= add;
|
||||
element->attr.style.attr &= ~rem;
|
||||
}
|
||||
@ -2121,9 +2128,10 @@ select_css(struct html_context *html_context, struct html_element *html_element)
|
||||
}
|
||||
|
||||
bool underline = css_computed_text_decoration(style->styles[CSS_PSEUDO_ELEMENT_NONE]) & CSS_TEXT_DECORATION_UNDERLINE;
|
||||
bool strike = css_computed_text_decoration(style->styles[CSS_PSEUDO_ELEMENT_NONE]) & CSS_TEXT_DECORATION_LINE_THROUGH;
|
||||
bool bold = is_bold(css_computed_font_weight(style->styles[CSS_PSEUDO_ELEMENT_NONE]));
|
||||
|
||||
apply_font_attribute(html_context, html_element, underline, bold);
|
||||
apply_font_attribute(html_context, html_element, underline, bold, strike);
|
||||
|
||||
uint8_t font_style = css_computed_font_style(style->styles[CSS_PSEUDO_ELEMENT_NONE]);
|
||||
|
||||
|
5
test/css/strike.html
Normal file
5
test/css/strike.html
Normal file
@ -0,0 +1,5 @@
|
||||
<style>
|
||||
H2 { text-decoration: line-through }
|
||||
</style>
|
||||
|
||||
<h2>Test text</h2>
|
Loading…
x
Reference in New Issue
Block a user