Closed
Bug 1025833
Opened 11 years ago
Closed 11 years ago
Aurora selects wrong URI from img srcset when zoomed
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla33
Tracking | Status | |
---|---|---|
firefox30 | --- | unaffected |
firefox31 | --- | unaffected |
firefox32 | --- | fixed |
firefox33 | --- | fixed |
People
(Reporter: koch, Assigned: johns)
References
Details
(Keywords: testcase)
Attachments
(2 files)
1013 bytes,
text/html
|
Details | |
1.15 KB,
patch
|
jst
:
review+
lmandel
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0 (Beta/Release)
Build ID: 20140614004002
Steps to reproduce:
I tested this in current Aurora (Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0) with dom.image.srcset.enabled true.
Given the following code:
<img src="900x450.png" width="300" srcset="225x112.png 0.75x, 300x150.png 1x, 450x225.png 1.5x, 600x300.png 2x" alt="Test.">
(available at http://waldbaer.leute.server.de/srcset/)
I change the zoom (CTRL + '-' or CTRL + '+') and then reload.
Actual results:
The following URIs are selected for the following DPRs:
225x112.png for DPR: 0.30000001192092896
300x150.png for DPR: 0.5, 0.6666666865348816, 0.8, 0.89552241563797, 1, 1.0909091234207153, 1.2000000476837158, 1.3333333730697632
600x300.png for DPR: 1.5, 1.7142857313156128, 2, 2.4000000953674316
900x450.png for DPR: 3
Expected results:
I would have expected the following URIs to be selected for the following DPRs:
225x112.png for DPR <= 0.75
300x150.png for 0.75 < DPR <= 1
450x225.png for 1 < DPR <= 1.5
600x300.png for 1.5 <= DPR <= 2
900x450.png for 2 < DPR <= 3
So
225x112.png for DPR: 0.30000001192092896, 0.5, 0.6666666865348816
300x150.png for DPR: 0.8, 0.89552241563797, 1
450x225.png for DOR: 1.0909091234207153, 1.2000000476837158, 1.3333333730697632, 1.5
600x300.png for DPR: 1.7142857313156128, 2
900x450.png for DPR: 2.4000000953674316, 3
Updated•11 years ago
|
Reporter | ||
Comment 1•11 years ago
|
||
Sorry, the code I tested is
<img src="300x150.png" width="300" srcset="225x112.png 0.75x, 300x150.png 1x, 450x225.png 1.5x, 600x300.png 2x, 900x450.png 3x" alt="Test.">
![]() |
||
Updated•11 years ago
|
Flags: needinfo?(jschoenick)
Assignee | ||
Comment 2•11 years ago
|
||
The issue here is PresContext::CSSPixelsToDevPixels has a int -> int as well as a float -> float definition, so |double CSSPixelsToDevPixels(1)| is invisibly rounding our current density estimate to the nearest int.
http://dxr.mozilla.org/mozilla-central/source/content/base/src/ResponsiveImageSelector.cpp#230
Assignee: nobody → jschoenick
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(jschoenick)
OS: Windows 7 → All
Hardware: x86 → All
Assignee | ||
Comment 3•11 years ago
|
||
(The tests in bug 1023516 will catch this)
Assignee | ||
Updated•11 years ago
|
Blocks: srcset-tests
Assignee | ||
Updated•11 years ago
|
Attachment #8440889 -
Flags: review?(jst)
Updated•11 years ago
|
Attachment #8440889 -
Flags: review?(jst) → review+
Assignee | ||
Comment 4•11 years ago
|
||
Comment 5•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Assignee | ||
Updated•11 years ago
|
Assignee | ||
Comment 6•11 years ago
|
||
Comment on attachment 8440889 [details] [diff] [review]
Fix img srcset inadvertently rounding density estimate to nearest int
[Approval Request Comment]
Bug caused by (feature/regressing bug #):
bug 870021 (introduced srcset support)
User impact if declined:
Incorrect behavior for developers testing srcset feature with dom.image.srcset.enabled, no effect on default configuration.
Testing completed (on m-c, etc.):
on m-c
Risk to taking this patch (and alternatives if risky):
None, only affects new feature behind pref, and trivial patch at that.
String or IDL/UUID changes made by this patch:
None
Attachment #8440889 -
Flags: approval-mozilla-aurora?
Updated•11 years ago
|
status-firefox30:
--- → unaffected
Comment 7•11 years ago
|
||
Comment on attachment 8440889 [details] [diff] [review]
Fix img srcset inadvertently rounding density estimate to nearest int
Aurora approval granted.
Attachment #8440889 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 8•11 years ago
|
||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•