Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background images enhancements, fix FB2 footnotes alignment #353

Merged
merged 8 commits into from
Jul 5, 2020
1 change: 0 additions & 1 deletion crengine/include/lvstyles.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ enum lvdom_element_render_method
erm_block, ///< render as block element (render as containing other elements)
erm_final, ///< final element: render the whole it's content as single render block
erm_inline, ///< inline element
erm_runin, ///< run-in (used as a solution to inline FB2 footnotes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a Norse mythological bird named something like Runin — I can't quite think of the name right now. I didn't immediately realize it said run-in. :-)

Copy link
Member

@NiLuJe NiLuJe Jul 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muninn, (one of) Odin's raven (Memory, IIRC).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erm_table, ///< table element: render as table
erm_table_row_group, ///< table row group
erm_table_header_group, ///< table header group
Expand Down
1 change: 0 additions & 1 deletion crengine/src/lvrend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,6 @@ class CCRTable {
}
break;
case erm_inline:
case erm_runin:
// do nothing
break;
}
Expand Down
18 changes: 8 additions & 10 deletions crengine/src/lvtinydom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3975,7 +3975,7 @@ static void writeNodeEx( LVStream * stream, ldomNode * node, lString16Collection
rm = erm_final;
}
}
if ( (rm != erm_inline && rm != erm_runin) || node->isBoxingInlineBox()) {
if ( rm != erm_inline || node->isBoxingInlineBox()) {
doNewLineBeforeStartTag = true;
doNewLineAfterStartTag = true;
// doNewLineBeforeEndTag = false; // done by child elements
Expand Down Expand Up @@ -4113,7 +4113,6 @@ static void writeNodeEx( LVStream * stream, ldomNode * node, lString16Collection
case erm_block: *stream << "B"; break;
case erm_final: *stream << "F"; break;
case erm_inline: *stream << "i"; break;
case erm_runin: *stream << "r"; break;
case erm_table: *stream << "T"; break;
case erm_table_row_group: *stream << "TRG"; break;
case erm_table_header_group: *stream << "THG"; break;
Expand Down Expand Up @@ -4969,7 +4968,7 @@ static bool isInlineNode( ldomNode * node )
//int d = node->getStyle()->display;
//return ( d==css_d_inline || d==css_d_run_in );
int m = node->getRendMethod();
return m==erm_inline || m==erm_runin;
return m == erm_inline;
}

static bool isFloatingNode( ldomNode * node )
Expand Down Expand Up @@ -5429,7 +5428,7 @@ static void detectChildTypes( ldomNode * parent, bool & hasBlockItems, bool & ha
int m = node->getRendMethod();
if ( d==css_d_none || m==erm_invisible )
continue;
if ( m==erm_inline || m==erm_runin) { //d==css_d_inline || d==css_d_run_in
if ( m==erm_inline ) { //d==css_d_inline || d==css_d_run_in
hasInline = true;
} else {
hasBlockItems = true;
Expand Down Expand Up @@ -5801,7 +5800,7 @@ bool ldomNode::isEmbeddedBlockBoxingInlineBox(bool inline_box_checks_done) const
if ( hasAttribute( attr_T ) ) { // T="EmbeddedBlock"
// (no other possible value yet, no need to compare strings)
int cm = getChildNode(0)->getRendMethod();
if ( cm == erm_inline || cm == erm_runin || cm == erm_invisible || cm == erm_killed )
if ( cm == erm_inline || cm == erm_invisible || cm == erm_killed )
return false; // child has been reset to inline
return true;
}
Expand Down Expand Up @@ -5901,7 +5900,7 @@ void ldomNode::initNodeRendMethod()
if ( !child->isElement() ) // text node
continue;
int cm = child->getRendMethod();
if ( cm == erm_inline || cm == erm_runin ) {
if ( cm == erm_inline ) {
has_inline_nodes = true; // We won't be able to make it erm_block
continue;
}
Expand Down Expand Up @@ -5945,7 +5944,7 @@ void ldomNode::initNodeRendMethod()
if ( !child->isElement() ) // text node
continue;
int cm = child->getRendMethod();
if ( cm == erm_inline || cm == erm_runin || cm == erm_invisible || cm == erm_killed )
if ( cm == erm_inline || cm == erm_invisible || cm == erm_killed )
continue;
if ( !isNotBoxWrappingNode( child ) )
continue;
Expand Down Expand Up @@ -6007,7 +6006,7 @@ void ldomNode::initNodeRendMethod()
// runin
//CRLog::trace("switch all children elements of <%s> to inline", LCSTR(getNodeName()));
recurseElements( resetRendMethodToInline );
setRendMethod(erm_runin);
setRendMethod(erm_inline);
} else if ( d==css_d_list_item_legacy ) {
// list item (no more used, obsolete rendering method)
setRendMethod(erm_final);
Expand Down Expand Up @@ -6214,7 +6213,7 @@ void ldomNode::initNodeRendMethod()
inBetweenTextNode = prev;
prev = getChildNode(i-2);
}
if ( prev->isElement() && prev->getRendMethod()==erm_runin ) {
if ( prev->isElement() && prev->getStyle()->display == css_d_run_in ) {
bool do_autoboxing = true;
int run_in_idx = inBetweenTextNode ? i-2 : i-1;
int block_idx = i;
Expand Down Expand Up @@ -11516,7 +11515,6 @@ ldomNode * ldomXPointerEx::getThisBlockNode()
return NULL;
lvdom_element_render_method rm = node->getRendMethod();
switch ( rm ) {
case erm_runin: // treat as separate block
case erm_block:
case erm_final:
case erm_table:
Expand Down