Commit graph

59 commits

Author SHA1 Message Date
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
Slava Monich
220f4feaa3 Support <percentage> and <relative-size> values for "font-size" property 2015-07-03 15:22:54 +03:00
Slava Monich
74d70a9d3a Respect "page-break-before" and "page-break-after" inline styles 2015-07-03 14:52:42 +03:00
Slava Monich
fc3171abad Ignore "!important" modifier for the "margin" property 2015-07-03 13:59:09 +03:00
Slava Monich
d2789e5662 Fixed infinite loop if left indent is greater than available width 2015-07-03 01:43:35 +03:00
Slava Monich
e8914786d1 Create one combined CSS entry per XHTML element 2015-07-03 01:42:03 +03:00
Slava Monich
c9419843cc Don't allow setting invalid or unknown language 2015-07-03 01:01:05 +03:00
Slava Monich
22884ccdf3 Eliminated hard dependency on expat 2015-06-28 22:28:54 +03:00
Slava Monich
e9db1e773a Sailfish integration 2015-06-28 14:22:35 +03:00
Slava Monich
9629f7bb46 Sum up lineStart/EndIndent values rather than overwrite them
Perhaps the same thing should be done to vertical margins as well.
2015-06-26 23:47:46 +03:00
Slava Monich
562c507a75 Handle "margin" element 2015-06-26 23:46:56 +03:00
Slava Monich
a6a17622d7 Fixed potential crash in ZLInputStreamDecorator::open() 2015-06-17 01:00:56 +03:00
Slava Monich
c143108ff3 Removed executable attributes from installable xml files 2015-06-09 11:40:05 +03:00