bump crengine: support inline-block, better text selection (#5763)

Includes:
- lvtinydom.cpp: fix Use-after-free
- lvtextfm: fix/cleanup lastnonspace code bits
- lvtextfm: fix vertical-align: top & bottom
- renderBlockElementEnhanced: minor fixes related to floats
- renderBlockElementEnhanced: compute baseline of block
- Add support for display: inline-block/inline-table
- Better selection highlighting by using getSegmentRects()
- getHtml(): add flag to get text soft-hyphenated

cre.cpp: toggable text selection highlighting method,
default to the new one using segments.

Update various cre flags to use the new features (and
to conform with some flags re-ordering):
- support display: inline-block in flat, book and web
  render modes.
- get HTML with soft-hyphens for footnote popups, so MuPDF
  can use them when rendering the footnote.
pull/5769/head
poire-z 4 years ago committed by GitHub
parent 4a6b8587d7
commit 7eee758149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 53ff64833621a1d85c04111ac7c05094f585fe0d
Subproject commit 5c3978a802f2e2bc0a92d938c048a4c11c7800b9

@ -783,17 +783,19 @@ function ReaderHighlight:viewSelectionHTML(debug_view)
end
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
local html_flags = 0x3030 -- 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.
local html_flags = 0x6030
if not debug_view then
debug_view = 0
end
if debug_view == 1 then
-- Each node on a line, with markers and numbers of skipped chars and siblings shown,
-- with possibly invalid HTML (text nodes not escaped)
html_flags = 0x3353
html_flags = 0x635A
elseif debug_view == 2 then
-- Additionally see rendering methods and unicode codepoint of each char
html_flags = 0x3757
html_flags = 0x675E
end
local html, css_files = self.ui.document:getHTMLFromXPointers(self.selected_text.pos0,
self.selected_text.pos1, html_flags, true)

@ -1064,13 +1064,15 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
-- then just ignore the whole stylesheet, including our own declarations
-- we add at start)
--
-- flags = 0x0001 to get the simplest/purest HTML without CSS, and dir=
-- and lang= attributes grabbed from parent nodes
-- flags = 0x1001 to get the simplest/purest HTML without CSS, with added
-- soft-hyphens where hyphenation is allowed (done by crengine according
-- to user's hyphenation settings), and dir= and lang= attributes grabbed
-- from parent nodes
local html
if extStartXP and extEndXP then
html = self.ui.document:getHTMLFromXPointers(extStartXP, extEndXP, 0x0001)
html = self.ui.document:getHTMLFromXPointers(extStartXP, extEndXP, 0x1001)
else
html = self.ui.document:getHTMLFromXPointer(target_xpointer, 0x0001, true)
html = self.ui.document:getHTMLFromXPointer(target_xpointer, 0x1001, true)
-- from_final_parent = true to get a possibly more complete footnote
end
if not html then

@ -342,11 +342,13 @@ end
-- FLOAT_FLOATBOXES 0x00040000 x x
-- DO_NOT_CLEAR_OWN_FLOATS 0x00100000 x x
-- ALLOW_EXACT_FLOATS_FOOTPRINTS 0x00200000 x x
--
-- BOX_INLINE_BLOCKS 0x01000000 x x x
local BLOCK_RENDERING_FLAGS = {
0x00000000, -- legacy block rendering
0x00030031, -- flat mode (with prepared floatBoxes, so inlined, to avoid display hash mismatch)
0x00375131, -- book mode (floating floatBoxes, limited widths support)
0x01030031, -- flat mode (with prepared floatBoxes, so inlined, to avoid display hash mismatch)
0x01375131, -- book mode (floating floatBoxes, limited widths support)
0x7FFFFFFF, -- web mode, all features/flags
}

Loading…
Cancel
Save