• kuan@chromium.org's avatar
    DomDistiller: fix 0 document width · 2ba6b280
    kuan@chromium.org authored
    bug:
    When distilling a page with new WebContents, document.offsetWidth in
    domdistiller.js is always 0, because the newly created RenderView doesn't have a
    size.
    
    fix:
    DistillerPageWebContents extends WebContentsDelegate and implements
    GetNewSizeForRenderView() to return the size for the new RenderView.  This size
    is the container bounds of the WebContents from where the distillation is
    triggered.  The size is plumbed through the pipeline from the following sources
    all the way down to DistillerPageWebContents.
    1) WebUI: WebContents of chrome:://dom-distiller
    3) ReadingList: WebContents currently associated with the extension
    2) standalone ContentExtractor: WebContents of content::Shell
    As for the reused WebContents (via "Distill page" in wrench menu), it already
    has a size, so we just use it.
    
    BUG=368941,367254
    TBR=danakj (ui/gfx/size.h)
    
    Review URL: https://codereview.chromium.org/396503003
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284094 0039d316-1c4b-4281-b951-d872f2087c98
    2ba6b280
lazy_dom_distiller_service.cc 3.43 KB