Bug 695994

Summary: child selector not working in ePub CSS
Product: MuPDF Reporter: Pablo Rodríguez <ghostscript>
Component: mupdfAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: tor.andersson
Priority: P4    
Version: master   
Hardware: Other   
OS: All   
Customer: Word Size: ---
Bug Depends on:    
Bug Blocks: 695935    
Attachments: ePub document with child and descendant selectors
display selectors (mupdf vs. ebook-viewer)

Description Pablo Rodríguez 2015-05-18 09:26:19 UTC
Created attachment 11687 [details]
ePub document with child and descendant selectors

Tor,

the attached ePub document contains the following code:

    <div id="leftaligned-title" class="section level2 part">
        <h2>Left–aligned title</h2>
        <div id="centered-title" class="section level3">
            <h3>Centered title</h3>
        </div>
    </div>
    
    <div id="leftaligned-title-1" class="section level2 mark">
        <h2>Left–aligned title</h2>
        <div id="centered-title-1" class="section level3">
            <h3>Centered title</h3>
        </div>
    </div>

The child selector (http://www.w3.org/TR/CSS2/selector.html#child-selectors) doesn’t work:

    .mark > .level3 > h3

Althought the descendant selector is working:

    .part .level3 h3

Could you implement this?

Many thanks for your help,


Pablo
Comment 1 Pablo Rodríguez 2015-05-18 09:27:53 UTC
Created attachment 11688 [details]
display selectors (mupdf vs. ebook-viewer)

mupdf-x11 display on the left and ebook-viewer (from calibre-2.28) on the right.

Centered titles should be centered.
Comment 2 Tor Andersson 2015-05-19 08:38:09 UTC
Should be fixed in:

commit 02cc7931ef0f04218bd50b3e0e396a6dcb009962
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Tue May 19 17:14:28 2015 +0200

    epub: Parse CSS combinators left-associatively.
    
    Fixes bug 695994 where multiple child selectors would not match properly.
    
    The "a > b > c" rule should be interpreted as ((a > b) > c) in order
    to match properly.
Comment 3 Pablo Rodríguez 2015-05-19 10:18:55 UTC
Tor,

child selectors work fine now.

Many thanks for the fix,

Pablo