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

Support cross references by target-counter()/target-counters() #248

Merged
merged 24 commits into from
Jun 8, 2016

Commits on Jun 1, 2016

  1. Support target-counter()/target-counters() for counters on elements

    - `target-counter()`/`target-counters()` support for counters on elements, i.e., defined by `counter-reset`/`counter-increment` specified on elements.
    - Page-based counters are not yet taken into account in this implementation.
    - `attr()` function cannot be used inside `target-counter()`/`target-counters()` yet.
    - If target element is in a source document other than the current one (on which `target-counter()`/`target-counters()` is specified), the target counter cannot be retrieved and fallback to 0.
    kwkbtr committed Jun 1, 2016
    Configuration menu
    Copy the full SHA
    433284f View commit details
    Browse the repository at this point in the history
  2. Support attr() function in the first argument of target-counter()

    …/`target-counters()` function
    kwkbtr committed Jun 1, 2016
    Configuration menu
    Copy the full SHA
    eb48049 View commit details
    Browse the repository at this point in the history
  3. Merge functionalities of vivliostyle.page.PageCounterStore into `vi…

    …vliostyle.counters.CounterStore`
    
    - `adapt.csscasc.PageCounterResolver` interface has been removed. Its methods are merged into `adapt.csscasc.CounterResolver`.
    - `vivliostyle.page.PageCounterStore` class has bee removed. Its functionalities are merged into `vivliostyle.counters.CounterStore`.
    kwkbtr committed Jun 1, 2016
    Configuration menu
    Copy the full SHA
    6b43120 View commit details
    Browse the repository at this point in the history
  4. [WIP] Support target-counter()/target-counters() for page-based c…

    …ounters
    
    - Only effective for a target ID such that the corresponding element is already laid out before the referring pseudoelement (i.e. the pseudoelement on which `target-counter()`/`target-counters()` is specified)
    kwkbtr committed Jun 1, 2016
    Configuration menu
    Copy the full SHA
    6936785 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    348f350 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5c0148f View commit details
    Browse the repository at this point in the history
  7. target-counter(): re-layout pages with page number references when …

    …the target element is laid out
    
    - Added `vivliostyle.counters.TargetCounterReference` class. If no element-based counter id defined on the element specified by ID in `target-counter()` and the element has not been laid out yet, a `TargetCounterReference` object is saved in `CounterStore`.
    - When finishing layout of a page, elements with IDs and unresolved references that appeared on the page are collected. After that, it is deteremined that whether any unresolved references appeared so far can be resolved by the elements with IDs in the page. If there are any, each page containing such references are re-laid out, calling `renderSinglePage` method recursively.
     - Note that in this commit only a single page is re-laid out at a time, i.e., even if the end position of the page is changed as a result of the re-layout, the next page is not re-laid out.
    - TODO: take unresolved element-based (non page-based) counters into account (when the referenced element is in another source document in EPUB)
    - TODO: support `target-counters()` too.
    - TODO: control visibility of the re-laid out page appropriately.
    kwkbtr committed Jun 1, 2016
    Configuration menu
    Copy the full SHA
    9d95b63 View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2016

  1. Fix incorrect page reference in some cases

    If an element with an ID does not fit in a page, the view node is removed and deferred to the next page.
    However, the ID and the element are registered to an `adapt.vtree.Page` object during creation of the view node and the regitration has not been removed even if the element does not fit in the page.
    This has been causing incorrect page references.
    In this commit, the registered IDs are checked after layout of the page.
    If the page container does not contain an element (elements) corresponding to a registered ID, the registration of the ID is removed.
    kwkbtr committed Jun 6, 2016
    Configuration menu
    Copy the full SHA
    1d9d334 View commit details
    Browse the repository at this point in the history
  2. Refresh page display when a currently displayed page is re-laid out b…

    …y resolutions of cross references
    kwkbtr committed Jun 6, 2016
    Configuration menu
    Copy the full SHA
    d5d7125 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2016

  1. Configuration menu
    Copy the full SHA
    ede7e10 View commit details
    Browse the repository at this point in the history
  2. Properly resolves references (by 'target-counter()') to another sourc…

    …e document in the EPUB
    kwkbtr committed Jun 7, 2016
    Configuration menu
    Copy the full SHA
    f6211a0 View commit details
    Browse the repository at this point in the history
  3. Make 'target-counter()` work even if the target URL points to another…

    … source document in EPUB and does not have a fragment
    kwkbtr committed Jun 7, 2016
    Configuration menu
    Copy the full SHA
    95e5ab9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cf1a2d9 View commit details
    Browse the repository at this point in the history
  5. Optimize 'target-counter()' for a case where the target element comes…

    … before the reference
    kwkbtr committed Jun 7, 2016
    Configuration menu
    Copy the full SHA
    2767d8f View commit details
    Browse the repository at this point in the history
  6. Optimize 'target-counter()' for a case where the target element comes…

    … before the reference
    kwkbtr committed Jun 7, 2016
    Configuration menu
    Copy the full SHA
    ff40b52 View commit details
    Browse the repository at this point in the history
  7. Re-layout next page too if page break position has been moved by cros…

    …s reference resolution
    kwkbtr committed Jun 7, 2016
    Configuration menu
    Copy the full SHA
    aed6cf9 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ff87651 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f738271 View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2016

  1. Re-layout next page too if page break position has been moved by cros…

    …s reference resolution *only if the next page has been already laid out*
    kwkbtr committed Jun 8, 2016
    Configuration menu
    Copy the full SHA
    5bec940 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ab3d9c9 View commit details
    Browse the repository at this point in the history
  3. Prevent reference target from going back to the previous page by refe…

    …rence resolution
    
    If a reference target is allowed to go back to a page earlier than one on which it was placed previously, reference resolution can lead to an infinite loop.
    To avoid infinite loops, a reference target is allowed to go to a page later than one on which it was placed previously, but it is not allowed to go back to an earlier page.
    If the target can fit in an earlier page, a page break is inserted just before the target and the target is laid out on the page on which it was placed previously.
    
    To represent the influence reference resolution has on layout, `adapt.layout.LayoutConstraint` interface is introduced.
    `allowLayout` method of `LayoutConstraint` receives a `NodeContext` and returns whether it can be laid out at the current position.
    In this case, a `NodeContext` is not allowed to be laid out at the current position if the page index of the current position is earlier than the index of the page on which the target was placed previously.
    kwkbtr committed Jun 8, 2016
    Configuration menu
    Copy the full SHA
    b0288a3 View commit details
    Browse the repository at this point in the history
  4. Refresh cross reference that was already resolved from the beginning …

    …when it has been moved to another page
    kwkbtr committed Jun 8, 2016
    Configuration menu
    Copy the full SHA
    0d9973b View commit details
    Browse the repository at this point in the history
  5. Update Change Log

    kwkbtr committed Jun 8, 2016
    Configuration menu
    Copy the full SHA
    6aa423e View commit details
    Browse the repository at this point in the history
  6. Update Supported Features

    kwkbtr committed Jun 8, 2016
    Configuration menu
    Copy the full SHA
    0d151f1 View commit details
    Browse the repository at this point in the history