• mstensho's avatar
    Handle exclusive end offsets when translating from flow thread coordinates. · 8403c150
    mstensho authored
    If we're in flipped blocks writing mode (i.e. vertical-rl), the flow thread
    block offset we're dealing with may be a logical end point, and end points are
    exclusive. This means that we need to pick the previous column, not the next,
    if the offset is exactly at a column boundary.
    
    Let flowThreadTranslationAtOffset() and columnIndexAtOffset() take a
    PageBoundaryRule argument to handle this.
    
    This makes offsetLeft and offsetTop work properly in vertical-rl writing mode
    for elements that end at column boundaries. Added a test for that, and threw in
    a vertical-lr test too, for good measure.
    
    Remove ColumnIndexCalculationMode from columnIndexAtOffset(). It was partially
    and inaccurately used to make sure we didn't escape the valid column range in
    case an exclusive end offset was passed. Have the call sites that really need
    to clamp the column index do it themselves. It's up to the callers to decide
    how to treat offsets outside the range of columns anyway.
    
    Review-Url: https://codereview.chromium.org/2339973002
    Cr-Commit-Position: refs/heads/master@{#418800}
    8403c150
offset-top-and-left-at-boundaries.html 1.17 KB