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

Various fixes related to text-indent, CSS order. Adds -cr-hint: strut-confined #326

Merged
merged 16 commits into from
Jan 29, 2020

Commits on Jan 22, 2020

  1. ldomXRange/ldomMarkedRange: update enhanced drawing flag

    Follow-up to a76d14e: update enhanced drawing flag
    from 2 to 0x11, as 0, 1, 2 and 3 might be used for
    categorising crengine internal bookmarks.
    This might avoid breaking upstream/other client code,
    which could then just add 'flags &= 0x10' somewhere to
    benefit from enhanced drawing.
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    1bbc4d9 View commit details
    Browse the repository at this point in the history
  2. Hardcoded elements list: add <script>

    So it gets a fixed id and we get more cache stability.
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    0604510 View commit details
    Browse the repository at this point in the history
  3. CSS: ensure selectors are applied in the order met

    By storing an order sequence number in the _specificity field,
    which will ensure selectors with the same specificity are checked
    and applied in the order we parsed them.
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    deded0e View commit details
    Browse the repository at this point in the history
  4. elementFromPoint(): fix some floats not being visited

    Embedded floats overflowing their containing paragraph, and
    not directly children of that final node (so, wrapped by more
    inlines nodes), would not be visited by elementFromPoint()
    and text or image inside them would not be found.
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    640b69c View commit details
    Browse the repository at this point in the history
  5. Fix getPageDocumentRange() on bidi text

    Made the 'direction' argument to elementFromPoint() and
    createXPointer() more explicite, and allow finding the first
    or last word on a line in logical-order.
    This allows not missing text and links in pages where the
    first or last line is RTL or bidi.
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    cb65b3c View commit details
    Browse the repository at this point in the history
  6. Text: fix: allow wrap on space around images

    Previously, images were incorrectly skipped in the avoidWrap
    checks. So, a sequence of word-space-image-period was handled
    as word-space-period, and a wrap avoid before a period forced
    the whole thing to be on a same line.
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    9542931 View commit details
    Browse the repository at this point in the history
  7. CSS/Text: adds "-cr-hint: strut-confined"

    Will allow a style tweak to confine text to its paragraph
    line height (aka the strut):
    - this will prevent sub- and superscript-like inline elements from
      increasing line height and pushing down the baseline, and will
      reposition them if needed to limit their overflow.
    - this will resize inline images so they are not taller than the
      line height.
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    f86204b View commit details
    Browse the repository at this point in the history
  8. Rename mispelled 'ident' and field 'margin' to 'indent"

    Makes thing easier to read and understand.
    Also use proper lInt16 for it, as it can be negative.
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    228d18b View commit details
    Browse the repository at this point in the history
  9. text-indent: some fixes, handle negative & hanging indent

    Positive text-indent should apply only on the first line of
    a final block (paragraph), and should not apply after a <BR>.
    (Same for negative indent, that should apply on all but first
    line, including the first line after a <BR>.)
    Properly handle negative indents (that induce a left shift of
    the first line in LTR, possible overflowing its container),
    and hanging indents (that induce a right shift of the non-first
    lines in LTR, without any overflow), both in RTL a LTR cases.
    (Note that the text-indent "hanging" it not handled by all
    current browsers, but we do, as it is used in fb2.css.)
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    080e359 View commit details
    Browse the repository at this point in the history
  10. (Upstream) Minor cleanup and ifdef wraps

    From upstream in-progress "merge with KOReader" PR125.
    poire-z committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    4403d09 View commit details
    Browse the repository at this point in the history

Commits on Jan 24, 2020

  1. lvtextfm: avoid possible segfault when hyphenating

    Some word segment might start with a non-text source, without
    a ->t.font field, which could cause a segfault when accessed.
    Very rare and hard to reproduce, so did not try to make that
    skipping more part of the whole flow (we should probably also
    not provide them to HyphMan::hyphenate() to not miss some
    hyphenation opportunities).
    
    Also renamed inner 'start' and 'end' vars to avoid shadowing
    upper ones with the same names, to avoid confusion.
    poire-z committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    05f0507 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2020

  1. lvtextfm: avoid spurious spaces when hyphenating

    Since f3b5958 and possibly looking for hyphenation on more
    than one word word, we may set hyph flags at multiple positions,
    and have non last words larger than they should, causing the
    appearance of a space. So, only add the hyphen width on
    the last word of a line.
    Noticed when hyphenating "extre<SPAN id=z/>mement", hyphenable
    as "extre-me-ment" and chosing the 2nd one: it would be rendered
    as "extre me-" (with a spurious space) on first line and "ment"
    on next line.
    poire-z committed Jan 27, 2020
    Configuration menu
    Copy the full SHA
    b2841e4 View commit details
    Browse the repository at this point in the history
  2. lvtextfm: dont adjust space after initial quotation mark/dash

    If a paragraph starts with a quotation mark or dash, and is
    followed by a space (classic or nbsp): don't have this space
    width widened or shortened in the process of text justification.
    This generalizes the existing code that was doing this only
    for 4 kind of dashes: we do it for more opening marks, dashes,
    bullets, and other ascii chars that could start a line.
    poire-z committed Jan 27, 2020
    Configuration menu
    Copy the full SHA
    5c6ca22 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9e57b3a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    60dd9ef View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1471283 View commit details
    Browse the repository at this point in the history