@@ -3075,6 +3075,7 @@ static const char * css_cr_only_if_names[]={
3075
3075
" inside-inpage-footnote" ,
3076
3076
" not-inside-inpage-footnote" ,
3077
3077
" following-inpage-footnote" ,
3078
+ " not-following-inpage-footnote" ,
3078
3079
" line-height-normal" ,
3079
3080
" not-line-height-normal" ,
3080
3081
NULL
@@ -3115,6 +3116,7 @@ enum cr_only_if_t {
3115
3116
cr_only_if_inside_inpage_footnote,
3116
3117
cr_only_if_not_inside_inpage_footnote,
3117
3118
cr_only_if_following_inpage_footnote,
3119
+ cr_only_if_not_following_inpage_footnote,
3118
3120
cr_only_if_line_height_normal,
3119
3121
cr_only_if_not_line_height_normal,
3120
3122
};
@@ -5366,6 +5368,36 @@ void LVCssDeclaration::apply( css_style_rec_t * style, const ldomNode * node ) c
5366
5368
prevsibling = prevsibling->getUnboxedPrevSibling (true );
5367
5369
}
5368
5370
}
5371
+ else if ( only_if == cr_only_if_not_following_inpage_footnote) {
5372
+ if ( ! STYLE_HAS_CR_HINT (style, FOOTNOTE_INPAGE)) {
5373
+ ldomNode * prevsibling = node->getUnboxedPrevSibling (true );
5374
+ while (true ) {
5375
+ if ( prevsibling == NULL || prevsibling->isNull () ) {
5376
+ break ;
5377
+ }
5378
+
5379
+ css_style_ref_t prevstyle = prevsibling->getStyle ();
5380
+ if ( prevstyle.isNull () ) {
5381
+ break ;
5382
+ }
5383
+ if ( STYLE_HAS_CR_HINT (prevstyle, FOOTNOTE_INPAGE)) {
5384
+ // found a footnote that we are following
5385
+ return ; // don't apply anything more of this declaration to this style
5386
+ }
5387
+ if ( ! STYLE_HAS_CR_HINT (prevstyle, EXTEND_FOOTNOTE_INPAGE) ) {
5388
+ // if the sibling doesn't have `extend-footnote-inpage` then the chain
5389
+ // of footnote extensions has been explicitly broken and we want to stop.
5390
+ // Otherwise, we continue to look for an actual footnote node in the
5391
+ // siblings before this one.
5392
+ break ;
5393
+ }
5394
+
5395
+ // NOTE: This needs to skip over text nodes because they don't have a style here that we can check
5396
+ // They can still be matched via the `autoBoxing` selector
5397
+ prevsibling = prevsibling->getUnboxedPrevSibling (true );
5398
+ }
5399
+ }
5400
+ }
5369
5401
else if ( only_if == cr_only_if_line_height_normal || only_if == cr_only_if_not_line_height_normal ) {
5370
5402
if ( const ldomNode * parent_node = node->getParentNode (); style->line_height == css_length_t (css_val_inherited, 0 ) && parent_node ) {
5371
5403
const css_style_ref_t parent_style = node->getParentNode ()->getStyle ();
0 commit comments