bump crengine, migrate books to normalized xpointers

Enable new rendering feature COMPLETE_INCOMPLETE_TABLES
on all enhanced rendering mode, but have it disabled for
earlier cre_dom_version.
Also increase default_cre_storage_size_factor from 20 to 40.
This commit is contained in:
poire-z
2020-02-24 15:25:08 +01:00
parent 7d7781b768
commit 5a4f5b4d59
5 changed files with 276 additions and 8 deletions

View File

@@ -55,13 +55,13 @@ function CreDocument:cacheInit()
-- the less recently used ones when this limit is reached
local default_cre_disk_cache_max_size = 64 -- in MB units
-- crengine various in-memory caches max-sizes are rather small
-- (2.5 / 4.5 / 1.5 / 1 MB), and we can avoid some bugs if we
-- increase them. Let's multiply them by 20 (each cache would
-- (2.5 / 4.5 / 4.5 / 1 MB), and we can avoid some bugs if we
-- increase them. Let's multiply them by 40 (each cache would
-- grow only when needed, depending on book characteristics).
-- People who would get out of memory crashes with big books on
-- older devices can decrease that with setting:
-- "cre_storage_size_factor"=1 (or 2, or 5)
local default_cre_storage_size_factor = 20
local default_cre_storage_size_factor = 40
cre.initCache(DataStorage:getDataDir() .. "/cache/cr3cache",
(G_reader_settings:readSetting("cre_disk_cache_max_size") or default_cre_disk_cache_max_size)*1024*1024,
G_reader_settings:nilOrTrue("cre_compress_cached_data"),
@@ -138,6 +138,10 @@ function CreDocument:init()
self:setupCallCache()
end
function CreDocument:getDomVersionWithNormalizedXPointers()
return cre.getDomVersionWithNormalizedXPointers()
end
function CreDocument:getLatestDomVersion()
return cre.getLatestDomVersion()
end
@@ -522,6 +526,13 @@ function CreDocument:getHTMLFromXPointers(xp0, xp1, flags, from_root_node)
end
end
function CreDocument:getNormalizedXPointer(xp)
-- Returns false when xpointer is not found in the DOM.
-- When requested DOM version >= getDomVersionWithNormalizedXPointers,
-- should return xp unmodified when found.
return self._document:getNormalizedXPointer(xp)
end
function CreDocument:gotoPos(pos)
logger.dbg("CreDocument: goto position", pos)
self._document:gotoPos(pos)
@@ -1152,6 +1163,7 @@ function CreDocument:setupCallCache()
elseif name == "getNextVisibleChar" then no_wrap = true
elseif name == "getCacheFilePath" then no_wrap = true
elseif name == "getStatistics" then no_wrap = true
elseif name == "getNormalizedXPointer" then no_wrap = true
-- Some get* have different results by page/pos
elseif name == "getLinkFromPosition" then cache_by_tag = true