New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 858897 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Aug 13
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

max-downscaling-image downscaling threshold is too small

Project Member Reported by ericbidelman@chromium.org, Jun 29 2018

Issue description

Chrome Version: 69.0.3475.0 (Official Build) canary (64-bit)
OS: Mac OS X

What steps will reproduce the problem?
(1) Go to http://jsbin.com/zodulowopo/edit?html,output

Markup inline:
<iframe allow="max-downscaling-image 'none'" srcdoc='<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" width="272" height="92">'></iframe>

What is the expected result?

The "Google" image does not invert colors when the image is sized by 0.5
of its natural width (e.g. to look great on a retina display). 

What happens instead?

The image has inverted colors. The image's natural dimensions are 544x184.
The image declared in the markup to be 1/2 that size: `<img width="272" height="92">`.

It's very common to size 2x images down by 0.5 for retina displays). Should the downscaling ratio be increased for cases like this?


 
Status: WontFix (was: Untriaged)
Weird. I'm no longer seeing this in 69.0.3479.0. Marking this WontFix.
Cc: cha...@chromium.org lunalu@chromium.org
Status: Untriaged (was: WontFix)
Seeing this again. Reopening.

Luna/Jason, not sure who is working on this policy, but can someone verify the repro?
Cc: -lunalu@chromium.org -cha...@chromium.org loonyb...@chromium.org
Status: Assigned (was: Untriaged)
I can fix this. But I will need to do some research on what is the best practice to set the ratio.

I know there are IOS devices that have device pixel ratio to be ~4. But this feature did take device pixel ratio into consideration, i.e., it is actually computing actual pixels that are actually being down-scaled on the physical device. 
Cc: cha...@chromium.org iclell...@chromium.org
Owner: loonyb...@chromium.org
It appears that declaring any image size smaller than the natural dimensions (544x184) causes the colours to be inverted on my retina MacBook. I suspect that it's a problem with the calculations around DPR, rather than the threshold itself.
Update: the previous implementation in terms of respecting device pixel ratio was reverted.

The downscaling ratio should still be 2, with respect to device pixel ratio. I.e. we are using the physical pixels image is being displayed on the device instead of the css  pixels. 

Fixing it in https://chromium-review.googlesource.com/c/chromium/src/+/1170853
Project Member

Comment 9 by bugdroid1@chromium.org, Aug 13

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f13747ae5ba4a4ec081376955d691dcd93b40ae0

commit f13747ae5ba4a4ec081376955d691dcd93b40ae0
Author: Luna Lu <loonybear@chromium.org>
Date: Mon Aug 13 21:13:48 2018

Bug fix: max-downscaling-image policy should respect device pixel ratio

When the device pixel ratio is > 1, image with (device_pixel_ratio *
container_size * max_downscaling_ratio) pixels should be allowed by
max-downscaling-image policy.

BUG:858897

Change-Id: Ic85e79e487c77296556c69b5dc5872e85b22d23e
Reviewed-on: https://chromium-review.googlesource.com/1170853
Reviewed-by: Steve Kobes <skobes@chromium.org>
Reviewed-by: Luna Lu <loonybear@chromium.org>
Commit-Queue: Luna Lu <loonybear@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582705}
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/images/feature-policy-max-downscaling-image-edge-cases-expected.png
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/images/feature-policy-max-downscaling-image-edge-cases-expected.txt
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/images/feature-policy-max-downscaling-image-edge-cases.html
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/images/resources/frame-with-max-downscaling-image-test-images-edge-cases.html
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/platform/mac/images/feature-policy-max-downscaling-image-edge-cases-expected.png
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/platform/mac/images/feature-policy-max-downscaling-image-edge-cases-expected.txt
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/feature-policy-max-downscaling-image-edge-cases-expected.png
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/feature-policy-max-downscaling-image-edge-cases-expected.txt
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/images/feature-policy-max-downscaling-image-edge-cases-expected.png
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/images/feature-policy-max-downscaling-image-edge-cases-expected.txt
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/virtual/exotic-color-space/images/feature-policy-max-downscaling-image-edge-cases-expected.png
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/virtual/exotic-color-space/images/feature-policy-max-downscaling-image-edge-cases-expected.txt
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/virtual/gpu-rasterization/images/feature-policy-max-downscaling-image-edge-cases-expected.png
[add] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/WebKit/LayoutTests/virtual/gpu-rasterization/images/feature-policy-max-downscaling-image-edge-cases-expected.txt
[modify] https://crrev.com/f13747ae5ba4a4ec081376955d691dcd93b40ae0/third_party/blink/renderer/core/layout/layout_image.cc

Status: Fixed (was: Assigned)
Verified!

Sign in to add a comment