1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 02:09:35 +02:00

fixed CSS applying

This commit is contained in:
Nikolay Pultsin 2014-09-09 21:59:25 +01:00
parent 7e5b019201
commit 82cdca266c

View file

@ -447,22 +447,11 @@ bool HtmlBookReader::tagHandler(const HtmlTag &tag) {
tagData->addEntry(myStyleSheetTable.control(tag.Name, *cls));
}
myTagDataStack.push_back(tagData);
for (std::vector<shared_ptr<TagData> >::const_iterator it = myTagDataStack.begin(); it != myTagDataStack.end(); ++it) {
const std::vector<shared_ptr<ZLTextStyleEntry> > &entries = (*it)->StyleEntries;
const bool inheritedOnly = it + 1 != myTagDataStack.end();
for (std::vector<shared_ptr<ZLTextStyleEntry> >::const_iterator jt = entries.begin(); jt != entries.end(); ++jt) {
shared_ptr<ZLTextStyleEntry> entry = inheritedOnly ? (*jt)->inherited() : *jt;
myBookReader.addStyleEntry(*entry);
}
}
} else {
if (!myTagDataStack.empty()) {
for (int i = myTagDataStack.back()->StyleEntries.size(); i > 0; --i) {
myBookReader.addStyleCloseEntry();
}
myTagDataStack.pop_back();
} else if (!myTagDataStack.empty()) {
for (int i = myTagDataStack.back()->StyleEntries.size(); i > 0; --i) {
myBookReader.addStyleCloseEntry();
}
myTagDataStack.pop_back();
}
const std::string *id = tag.find("id");
if (id != 0) {
@ -475,6 +464,17 @@ bool HtmlBookReader::tagHandler(const HtmlTag &tag) {
}
action->run(tag);
if (tag.Start) {
for (std::vector<shared_ptr<TagData> >::const_iterator it = myTagDataStack.begin(); it != myTagDataStack.end(); ++it) {
const std::vector<shared_ptr<ZLTextStyleEntry> > &entries = (*it)->StyleEntries;
const bool inheritedOnly = it + 1 != myTagDataStack.end();
for (std::vector<shared_ptr<ZLTextStyleEntry> >::const_iterator jt = entries.begin(); jt != entries.end(); ++jt) {
shared_ptr<ZLTextStyleEntry> entry = inheritedOnly ? (*jt)->inherited() : *jt;
myBookReader.addStyleEntry(*entry);
}
}
}
return true;
}