2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00

bump crengine: support for pseudo elements ::before/after

Includes:
- GIF decoding: avoid crash on some images
- Top progress bar: avoid re-computing when not needed
- Top progress bar: allow external filling of marks
- CSS/Text: properly inherit and handle text-align-last
- getRenderedWidths(): fix handling of text-indent
- Reorder some flags to make the sets clearer
- CSS: support more white-space named values
- Text: fix standalone BR not making an empty line (rework)
- CSS: support for pseudo elements ::before & ::after
- CSS: content: open-quote support via TextLangMan
- CSS/Text selection: adds a few "-cr-hint:" tweaks
cre.cpp: adds setHeaderProgressMarks()

Added 2 style tweaks to disable pseudo elements
::before/after and common ligatures.
This commit is contained in:
poire-z 2020-06-05 10:06:37 +02:00 committed by Frans de Jonge
parent 21847dfb40
commit 3e71e4985e
3 changed files with 34 additions and 11 deletions

2
base

@ -1 +1 @@
Subproject commit 9f3f0093267b75da1d3772a006d0138124544fc2 Subproject commit 7b5568a3c44179fbcedafa22ee03701171539727

View File

@ -828,21 +828,21 @@ function ReaderHighlight:viewSelectionHTML(debug_view)
if self.selected_text and self.selected_text.pos0 and self.selected_text.pos1 then if self.selected_text and self.selected_text.pos0 and self.selected_text.pos1 then
-- For available flags, see the "#define WRITENODEEX_*" in crengine/src/lvtinydom.cpp -- For available flags, see the "#define WRITENODEEX_*" in crengine/src/lvtinydom.cpp
-- Start with valid and classic displayed HTML (with only block nodes indented), -- Start with valid and classic displayed HTML (with only block nodes indented),
-- including styles found in <HEAD>, and linked CSS files content. -- including styles found in <HEAD>, linked CSS files content, and misc info.
local html_flags = 0x6030 local html_flags = 0x6830
if not debug_view then if not debug_view then
debug_view = 0 debug_view = 0
end end
if debug_view == 1 then if debug_view == 1 then
-- Each node on a line, with markers and numbers of skipped chars and siblings shown, -- Each node on a line, with markers and numbers of skipped chars and siblings shown,
-- with possibly invalid HTML (text nodes not escaped) -- with possibly invalid HTML (text nodes not escaped)
html_flags = 0x635A html_flags = 0x6B5A
elseif debug_view == 2 then elseif debug_view == 2 then
-- Additionally see rendering methods of each node -- Additionally see rendering methods of each node
html_flags = 0x675A html_flags = 0x6F5A
elseif debug_view == 3 then elseif debug_view == 3 then
-- Or additionally see unicode codepoint of each char -- Or additionally see unicode codepoint of each char
html_flags = 0x635E html_flags = 0x6B5E
end end
local html, css_files = self.ui.document:getHTMLFromXPointers(self.selected_text.pos0, local html, css_files = self.ui.document:getHTMLFromXPointers(self.selected_text.pos0,
self.selected_text.pos1, html_flags, true) self.selected_text.pos1, html_flags, true)

View File

@ -281,13 +281,26 @@ DocFragment {
}, },
}, },
{ {
id = "hyphenate_all_auto"; title = _("Hyphenation and ligatures"),
title = _("Allow hyphenation on all text"), {
description = _("Allow hyphenation on all text (except headings), in case the publisher has disabled it."), id = "hyphenate_all_auto";
css = [[ title = _("Allow hyphenation on all text"),
description = _("Allow hyphenation on all text (except headings), in case the publisher has disabled it."),
css = [[
* { hyphens: auto !important; } * { hyphens: auto !important; }
h1, h2, h3, h4, h5, h6 { hyphens: none !important; } h1, h2, h3, h4, h5, h6 { hyphens: none !important; }
]], ]],
},
{
id = "ligature_all_no_common_ligature";
title = _("Disable common ligatures"),
description = _("Disable common ligatures, which are enabled by default in 'best' kerning mode."),
-- We don't use !important, as this would stop other font-variant properties
-- from being applied
css = [[
* { font-variant: no-common-ligatures; }
]],
},
separator = true, separator = true,
}, },
{ {
@ -454,6 +467,7 @@ body, h1, h2, h3, h4, h5, h6, div, li, td, th { text-indent: 0 !important; }
title = _("Full-width tables"), title = _("Full-width tables"),
description = _("Make table expand to the full width of the page. (Tables with small content now use only the width needed to display that content. This restores the previous behavior.)"), description = _("Make table expand to the full width of the page. (Tables with small content now use only the width needed to display that content. This restores the previous behavior.)"),
css = [[table { width: 100% !important; }]], css = [[table { width: 100% !important; }]],
priority = 2, -- Override next one
}, },
{ {
id = "table_td_width_auto"; id = "table_td_width_auto";
@ -790,6 +804,15 @@ switch > case { display: inline; }
switch > default { display: none; } switch > default { display: none; }
]], ]],
}, },
{
id = "no_pseudo_element_before_after";
title = _("Disable before/after pseudo elements"),
description = _([[Disable generated text from ::before and ::after pseudo elements, usually used to add cosmetic text around some content.]]),
css = [[
*::before { display: none !important; }
*::after { display: none !important; }
]],
},
{ {
id = "pure_black_and_white"; id = "pure_black_and_white";
title = _("Pure black and white"), title = _("Pure black and white"),