New issue
Advanced search Search tips

Issue 904042 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 14
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

background-size with no height specified (one-value syntax) causes a wrong width calculation

Reported by briana...@gmail.com, Nov 10

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36

Example URL:
https://www.bpak.org/background_size.html

Steps to reproduce the problem:
1. Make the Chrome browser full size (not necessarily full screen).
2. Go to the URL or open the attached html file on Chrome.

What is the expected behavior?
The background image (png encoded in base64) should be rendered half (50%) of the progress bar, as it's told with the style: "background-size: 50%".

What went wrong?
The background image is rendered incorrectly. But it comes back if you switch to "background-size: 30%" or similarly smaller value.

The Chrome browser has a *correct* behavior when "two-value syntax" is used instead. For example, if you set "background-size: 50% 100%", it works as expected.

Does it occur on multiple sites: N/A

Is it a problem with a plugin? No 

Did this work before? Yes 571502

Does this work in other browsers? Yes

Chrome version: 70.0.3538.77  Channel: stable
OS Version: 10.0
Flash Version: 

From the result of bisect, it seems to indicate that the regression appeared somewhere in between revisions 571502 and 571512.

Looking at the logs for those revisions, only one that seems relevant to the issue I'm having is this commit: https://chromium.googlesource.com/chromium/src.git/+/ae49f5caf2943049acab4abe802e82c8dc001184
 
test.html
561 bytes View Download
chrome_vs_ff.png
20.7 KB View Download
I believe this affects Chrome on other OSes as well.
Labels: Needs-Triage-M70 Needs-Bisect
Cc: viswa.karala@chromium.org
Components: Blink>Paint
Labels: -Pri-2 -Type-Compat -Needs-Bisect hasbisect-per-revision Triaged-ET Target-70 Target-71 Target-72 RegressedIn-69 M-72 FoundIn-71 FoundIn-70 FoundIn-72 OS-Linux OS-Mac Pri-1 Type-Bug-Regression
Owner: schenney@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on reported version 70.0.3538.77 and latest chrome 72.0.3608.0 using Mac 10.12.6, Ubuntu 14.04 and Windows-10, hence providing Bisect Info

Bisect Info:
================
Good build: 69.0.3476.0
Bad build: 69.0.3477.0

You are probably looking for a change made after 571504 (known good), but no later than 571505 (first known bad).
https://chromium.googlesource.com/chromium/src/+log/8117ad42726252bd38e4f4908f9e15daa0b4c831..ae49f5caf2943049acab4abe802e82c8dc001184
Change-Id: I32689f285d621afb7ec929eb193d7683dd15ff01
Reviewed-on: https://chromium-review.googlesource.com/1112563

@Stephen Chenney: Please confirm the issue and help in re-assigning if it is not related to your change.

Thanks!	
Status: Started (was: Assigned)
The background position is not directly relevant, which is a bit of a relief.
The issue is the 1x1 image, so something odd happening with scale.
Very odd. It works until the tile width (as determined by the percentage) is 2x the positioning are size. Looking into why this might be.

Meanwhile, if this is hard to fix, you might try using a larger image intrinsic size. I suspect that will fix it.
The issue will go away if you use an image size at least half the aspect ratio of the requested size. So in the given test case, say you're in a 1000px width box at 100px high, you have 10:1, so use at least 5x5.

I'm looking at various ways to fix this, but it's non-obvious.
Project Member

Comment 9 by bugdroid1@chromium.org, Nov 14

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

commit 0eaa27d31b4d727a10363cc2ef000b84438d9696
Author: Stephen Chenney <schenney@chromium.org>
Date: Wed Nov 14 04:19:30 2018

Fix background image painting of very small images

The background image fast path painting rounds the image src rect
to integer sizes assuming sprite maps and/or reasonably large images.
When a very small image is used scaled up to a large size (such as
constant color images scaled up to form progress bars by animating
background size) the src rect may be 1 x [small number] which gets
rounded to zero size.

This patch changes the code to detect this situation and not round
in such cases.

It's worth recording that an alternate approach is to detect when
the rounding results in a significant change in src rect and always
switch to unrounded in that case. But it would be more expensive for
a relatively uncommon case.

R=fmalita
BUG= 904042 

Change-Id: I24657a5d087c0dda0fd8a5e3c3d08e1e4eb02473
Reviewed-on: https://chromium-review.googlesource.com/c/1334291
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607901}
[add] https://crrev.com/0eaa27d31b4d727a10363cc2ef000b84438d9696/third_party/WebKit/LayoutTests/external/wpt/css/css-backgrounds/background-size-one-value-1x1-image.html
[add] https://crrev.com/0eaa27d31b4d727a10363cc2ef000b84438d9696/third_party/WebKit/LayoutTests/external/wpt/css/css-backgrounds/reference/background-size-one-value-1x1-image-ref.html
[modify] https://crrev.com/0eaa27d31b4d727a10363cc2ef000b84438d9696/third_party/blink/renderer/core/paint/box_painter_base.cc

Cc: pdr@chromium.org
Status: Fixed (was: Started)
While a merge to M-71 would be reasonable, the issue is easy to work around so the importance is not very high.

CC pdr@ to respond while I'm OOO.
Because there's only one report of this bug and there's a workaround, I'm leaning towards not merging and letting this roll out as part of M72.
r607901 also fixes  bug 905645 .
 Issue 905645  has been merged into this issue.
Cc: santhoshkumar@chromium.org schenney@chromium.org
 Issue 918192  has been merged into this issue.
 Issue 918505  has been merged into this issue.

Sign in to add a comment