• K Moon's avatar
    Split options from chrome_pdf::DocumentLayout · eb9e000c
    K Moon authored
    Due to the loose, asynchronous coupling between the C++ and JavaScript
    portions of the layout code, we need to pass certain layout "options"
    (such as the default page orientation) back and forth by value.
    
    As a result, it makes sense to have a separate Options class to hold
    these settings, which then can be used to recalculate the layout.
    
    The expected layout lifecycle eventually should look like this:
    1. Update desired layout options one or more times.
    2. Estimate layout size with new layout options.
    3. Send options and estimated size to JavaScript.
    4. Receive updated options from JavaScript.
    5. Apply final options to current layout.
    6. Repaint using updated layout.
    
    As a side effect of this change, I added the desired_layout_options_
    field to PDFiumEngine. This new field holds the mutable state about
    page orientation that was split off into DocumentLayout::Options.
    
    Miscellaneous changes:
    * Revised some of the API comments for DocumentLayout
    * Eliminated need for unsigned math by replacing -1 with +3 (mod 4)
    * DocumentLayout no longer needs to be copyable, so it isn't
    
    Bug: 885110
    Change-Id: I89714c4c2cba6c0ab354c0696ec3943327c979d0
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733795
    Commit-Queue: K Moon <kmoon@chromium.org>
    Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#684441}
    eb9e000c
pdfium_engine.cc 119 KB