• Stephen Chenney's avatar
    Fix the sizing when a srcset is used with scale-down · 80441f0a
    Stephen Chenney authored
    The object-fit: scale-down property requires that the image be
    sized to the smaller of "none" or "contain". When a srcset is used,
    the IntrinsicSize of the image is scaled such that the srcset fills
    the expected area. This causes scale-down to consider the intrinsic
    size to be bigger than the actual image, and size things too large.
    
    This change modifies the intrinsic size for content-fit: scale-down
    in LayoutReplaced::ComputeObjectFit to un-apply the
    ImageDevicePixelRatio, that is the scale that resized the src.
    
    Chrome's behavior now matches Firefox.
    
    BUG=818630
    
    Change-Id: Ifbd63bbd6d905673e8058b49173b604cd9c8083e
    Reviewed-on: https://chromium-review.googlesource.com/957131
    Commit-Queue: Stephen Chenney <schenney@chromium.org>
    Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#543082}
    80441f0a
image-srcset-fit-scale-down.html 336 Bytes