Commit graph

71 commits

Author SHA1 Message Date
Slava Monich
022056efee [fbreader] Fixed apparent bug in ZLStringUtil::replaceAll
Caught by gcc:

ZLStringUtil.cpp:132:38: warning: comparison of constant '4294967295' with boolean
expression is always true [-Wbool-compare]
   while ((pos == str.find(find, pos)) != std::string::npos) {
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
2019-12-10 03:21:16 +03:00
Slava Monich
85a121633b [fbreader] Prevent a crash in <aside> blocks 2019-11-28 00:52:04 +02:00
Slava Monich
ffb9e883fa [fbreader] Don't require book language to be in languagePatterns.zip
There ain't that many languages there, really. Not setting the language
may cause some format plugins to reset book encoding to "windows-1252".
2019-03-31 02:02:42 +02:00
Slava Monich
99d4a63e93 [fbreader] Don't undo text styles that we haven't applied 2018-07-27 01:19:31 +03:00
Slava Monich
139460734b [fbreader] Fixed a bug in ZLTextForcedStyle::lineEndIndent 2018-07-27 01:18:24 +03:00
Slava Monich
bb587bd397 [fbreader] Ignore AT-rules like @charset "utf-8"; 2018-07-27 01:16:48 +03:00
Slava Monich
c49d8af7a3 [fbreader] Fixed a few memory leaks 2018-05-06 00:57:34 +03:00
Slava Monich
7a7067869d [fbreader] Fixed FB2 footnotes
FB2 reader strips the leading hash sign from href, XHTML wasn't doing it.
Unified their behavior.
2018-01-20 02:43:05 +02:00
Slava Monich
6f6e037eb3 [fbreader] Added optional arguments to ZLTextSelectionModel methods
... extendTo() and selectWord() to make it easier to implement selection
by words.
2017-09-07 18:16:03 +03:00
Slava Monich
c8bad41b7f [fbreader] Added ZLTextArea::selectionIsEmpty() and clearSelection() 2017-09-07 18:13:54 +03:00
Slava Monich
e0eb60b8a1 [fbreader] Removed unnecessary files from the project 2017-08-29 12:31:53 +03:00
Slava Monich
077e86da62 [fbreader] Fixed a problem with displaying certain images
Some images (those with empty style stack) were erroneously
recognized as hidden.
2017-08-01 18:16:26 +03:00
Slava Monich
34ed5ac9ce [fbreader] Fixed crash in ZLTextModel::addText with certain models 2017-08-01 18:15:26 +03:00
Slava Monich
1320c9d61d [fbreader] Feed expat with a random hash salt
That's supposed to prevent DoS attacks based on predicting hash
function behavior (although it's hard to imagine that someone
would ever decide to attack the poor little Books app).
2017-04-30 22:57:48 +03:00
Slava Monich
41765e9b95 [fbreader] Ignore images with display:none 2017-01-28 18:25:12 +02:00
Slava Monich
83ca0db6bb [fbreader] Improved handling of broken CSS input
Particularly, curly brackets in inline CSS would make the parser crash.
Generally, it's better to stop parsing than crash when we get into an
unexpected state.
2017-01-20 00:39:24 +02:00
Slava Monich
35757ce03d [fbreader] Support for footnotes 2016-11-02 16:28:59 +03:00
Slava Monich
c2558fbb3f [fbreader] Removed unnecessary stuff from ZLTextParagraphCursorCache
ourLastAdded member was causing a crash on destruction (double free),
get() and put() methods were just unnecessary.
2016-10-30 11:40:57 +03:00
Slava Monich
6d0b79fb16 [fbreader] Added NUM_KINDS to FBTextKind 2016-10-15 13:18:32 +03:00
Slava Monich
c27cccee7f [fbreader] Handle empty XHTML style stack 2016-02-21 13:51:49 +03:00
Slava Monich
bd3dbb7d19 [fbreader] Fixed the problem with external XML entities
XML parser's "hash_secret_salt" has to be set to anything non-zero.
Otherwise this parser won't be able to use the entity cache filled
by the child DTD parsers. For more details see CVE-2012-0876 and
http://sourceforge.net/p/expat/bugs/496/
2015-12-14 12:33:29 +03:00
Slava Monich
4704c68caf [fbreader] Handle SVG image element when looking for cover 2015-12-13 18:25:09 +03:00
Slava Monich
94af49b211 [fbreader] Added ZLFile::flushCache 2015-09-13 13:17:52 +03:00
Slava Monich
b6a5dd4576 [fbreader] Reduced the number of atomic builtins used by the code 2015-09-13 13:16:19 +03:00
Slava Monich
b70dd1bcf9 [fbreader] Fixed incorrect use of atomic builtins
Which resulted in memory leaks
2015-09-13 13:14:13 +03:00
Slava Monich
de7028bf5a [fbreader] Enabled thread-local plain file stream cache 2015-08-21 15:18:07 +03:00
Slava Monich
c9a7225138 [fbreader] Read the path to the default OPF from container.xml 2015-08-21 14:41:34 +03:00
Slava Monich
ba402d79ff [fbreader] Handle slightly broken zip files
Only DEFLATED entries can have EXT descriptor, ignore this flag
for STORED entries.
2015-08-21 13:42:45 +03:00
Slava Monich
f30d83bf39 [fbreader] Added limited support for left/right auto margins
They only work if width property is set, otherwise they are ignored.
Top/bottom don't work at all (and never did)
2015-08-18 01:31:02 +03:00
Slava Monich
97ce479c50 [fbreader] Added support for text color
Specified with CSS color attribute
2015-08-11 13:53:21 +03:00
Slava Monich
dac803cd4e [fbreader] Changed getPwdDir to return the current directory
It was returning the value of PWD environment variable which
isn't necessarily the same thing.
2015-08-09 14:36:51 +03:00
Slava Monich
c6e46b94a2 [fbreader] Refactored CSS and XHTML support
This significantly improves EPUB rendering.
2015-08-09 00:54:38 +03:00
Slava Monich
ab68bef4e6 [fbreader] Housekeeping
Indentation
2015-08-07 15:55:06 +03:00
Slava Monich
ae8986bb4f [fbreader] Flush text buffer when adding HSpace or LineBreak 2015-08-05 19:10:29 +03:00
Slava Monich
764af720e4 [fbreader] Housekeeping
Indentation fix
2015-08-05 19:08:27 +03:00
Slava Monich
2457795ce8 [fbreader] Center justified images 2015-08-04 18:33:10 +03:00
Slava Monich
b3acda416c [fbreader] Optimized ZLZipHeader::readShort and readLong
For little endian CPUs. Unnecessary byte shuffling does show up
on the performance graph. Both Jolla tablet and Jolla phone are
little endian.
2015-07-29 18:53:48 +03:00
Slava Monich
4026ae35d1 [fbreader] Optimized ZLUnicodeUtil::toLower and toUpper for ASCII
Performance analysis shows that UTF8->UCS4->UTF8 conversion takes
noticeable amount of CPU time. For ASCII strings it's unnecessary.
2015-07-29 18:46:36 +03:00
Slava Monich
36e69aef3b [fbreader] Relax restrictions on EPUB files
Some epubs are detected by libmagic as application/zip rather than
application/epub+zip. Let's give those a chance too.
2015-07-18 00:49:10 +03:00
Slava Monich
3a41165b09 [fbreader] Removed unnecessary define 2015-07-16 23:18:50 +03:00
Slava Monich
d6cacd2fd1 Invert colors on double-click 2015-07-11 01:35:13 +03:00
Slava Monich
16ee7b07c6 Calculate margins relative to the base style 2015-07-07 20:19:44 +03:00
Slava Monich
248b307696 Major refactoring of CSS support
Also, improved support for line breaks.
2015-07-07 20:17:30 +03:00
Slava Monich
11f516e8fa Implemented ZLUnixFSManager::mimeType 2015-07-07 13:05:12 +03:00
Slava Monich
6385be36c0 Fixed a bug in ZLTextStyleEntry::apply 2015-07-06 16:46:37 +03:00
Slava Monich
27e8af932d Removed a few unused files from the project 2015-07-05 12:34:00 +03:00
Slava Monich
a6a5773fb6 Support multiple inline styles 2015-07-04 02:37:30 +03:00
Slava Monich
c787512e99 Support multiple selectors per CSS rule
Also, added more length units for margins
2015-07-04 02:25:14 +03:00
Slava Monich
eb5928a5ba Only apply first line indent to left-aligned and justified layouts 2015-07-04 00:36:46 +03:00
Slava Monich
b704fb1289 Fixed CSS comment handling
Control characters inside the comment were not ignored, and the
statement following such comment was usually lost.
2015-07-03 23:20:16 +03:00