Commit c0fe7310 authored by Luna Lu's avatar Luna Lu Committed by Commit Bot

Update feature policy unoptimized-images policy

After research, tentatively updating the unoptimized-images policy as:
no using more than 0.5 byte per pixel of image data with approximate
header size (1KB) removed.

Bug: 901925
Change-Id: Ibc5b2e2e6ccaba7a273c63440d48d4e0d154cc2e
Reviewed-on: https://chromium-review.googlesource.com/c/1318372Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Reviewed-by: default avatarPaul Meyer <paulmeyer@chromium.org>
Commit-Queue: Luna Lu <loonybear@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605677}
parent e6d255b3
......@@ -5475,9 +5475,6 @@ crbug.com/898378 [ Mac10.13 ] virtual/scroll_customization/fast/scroll-behavior/
crbug.com/889185 [ Win10 ] http/tests/images/feature-policy-image-policies-with-border-radius.html [ Failure ]
crbug.com/889185 [ Win10 ] http/tests/images/feature-policy-legacy-formats.html [ Failure ]
# Sheriff 2018-10-25
crbug.com/874576 http/tests/images/feature-policy-unoptimized-images-cached-image.html [ Skip ]
# Sheriff 2018-10-26
### See crbug.com/891427 comment near the top of this file:
####crbug.com/899087 [ Linux ] virtual/android/fullscreen/full-screen-iframe-allowed-video.html [ Failure Pass ]
......
......@@ -501,8 +501,8 @@ bool ImageResourceContent::IsAcceptableContentType() {
}
// Return true if the image content is well-compressed (and not full of
// extraneous metadata). This is currently defined as no using more than 10 bits
// per pixel of image data.
// extraneous metadata). This is currently defined as no using more than 0.5
// byte per pixel of image data with approximate header size(1KB) removed.
// TODO(crbug.com/838263): Support site-defined bit-per-pixel ratio through
// feature policy declarations.
bool ImageResourceContent::IsAcceptableCompressionRatio() {
......@@ -512,7 +512,7 @@ bool ImageResourceContent::IsAcceptableCompressionRatio() {
DCHECK(image_);
double resource_length = image_->Data() ? image_->Data()->size() : 0;
// Allow no more than 10 bits per compressed pixel
return resource_length / pixels <= 1.25;
return (resource_length - 1024) / pixels <= 0.5;
}
void ImageResourceContent::DecodedSizeChangedTo(const blink::Image* image,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment