Closed
Bug 836329
Opened 12 years ago
Closed 12 years ago
Rem Media Query Condition Bug
Categories
(Core :: CSS Parsing and Computation, defect, P2)
Tracking
()
VERIFIED
FIXED
mozilla21
People
(Reporter: grayghost, Assigned: dbaron)
References
()
Details
(Keywords: regression)
Attachments
(1 file)
|
4.25 KB,
patch
|
bzbarsky
:
review+
akeybl
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17
Steps to reproduce:
Preface: This worked in previous versions < 18.0.1 but not as of 1/30/13.
Demo of Firefox Bug: http://cdpn.io/AFjDK
Actual results:
The demo's media query condition for the column count should convert to 1 column below 50rem but doesn't as of Firefox 18.0.1. This bug was also reported for webkit but has been resolved as of 1/30/13. It seems Firefox is playing browser ping pong.
Expected results:
The media query should snap the column count to 1 w/conditions < 50 rem. However, this condition does switch to 2 columns as it should for conditions >= 50rem.
URL: http://cdpn.io/AFjDK
Updated•12 years ago
|
Component: Untriaged → Style System (CSS)
Product: Firefox → Core
Comment 1•12 years ago
|
||
Looks like the behavior changed in http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=5ecff3e46ed5&tochange=f9acc2e4d4e3
Given that, possibly a regression from bug 804970...
Updated•12 years ago
|
Keywords: regression
Comment 2•12 years ago
|
||
So we get into nsRuleNode::CalcLengthWithInitialFont, called from nsMediaExpression::Matches. This calls:
434 return CalcLengthWith(aValue, -1, &defaultFont,
435 nullptr, aPresContext,
436 true, false, canStoreInRuleTree);
which is passing -1 for aFontSize and true for aUseProvidedRootEmSize. Which means we end up setting rootFontSize to -1 and then returning "-50" as the value to compare to the actual viewport width, which is clearly broken.
What I don't understand is how this could have possibly worked...
Flags: needinfo?(dbaron)
| Assignee | ||
Comment 3•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #2)
> So we get into nsRuleNode::CalcLengthWithInitialFont, called from
> nsMediaExpression::Matches. This calls:
>
> 434 return CalcLengthWith(aValue, -1, &defaultFont,
> 435 nullptr, aPresContext,
> 436 true, false, canStoreInRuleTree);
>
> which is passing -1 for aFontSize and true for aUseProvidedRootEmSize.
> Which means we end up setting rootFontSize to -1 and then returning "-50" as
> the value to compare to the actual viewport width, which is clearly broken.
>
> What I don't understand is how this could have possibly worked...
Probably because the fixup for aFontSize == -1 moved across to after the 'rem' code in https://hg.mozilla.org/releases/mozilla-aurora/rev/1f9ef298ceeb because I didn't want the broader aStyleContext dependency in code where aCanStoreInRuleTree was set to false.
Flags: needinfo?(dbaron)
| Assignee | ||
Comment 4•12 years ago
|
||
I confirmed that the added tests fail without the patch and pass with
the patch.
Attachment #712736 -
Flags: review?(bzbarsky)
| Assignee | ||
Updated•12 years ago
|
Assignee: nobody → dbaron
Comment 5•12 years ago
|
||
Comment on attachment 712736 [details] [diff] [review]
Fix regression handling 'rem' units in media queries.
r=me
Attachment #712736 -
Flags: review?(bzbarsky) → review+
| Assignee | ||
Comment 6•12 years ago
|
||
OS: Mac OS X → All
Priority: -- → P2
Hardware: x86 → All
| Assignee | ||
Comment 7•12 years ago
|
||
Comment on attachment 712736 [details] [diff] [review]
Fix regression handling 'rem' units in media queries.
[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 804970
User impact if declined: media queries using 'rem' units produce incorrect results
Testing completed (on m-c, etc.): on m-c (shortly), mochitests in patch
Risk to taking this patch (and alternatives if risky): very low; patch targeted to the specific case that broke
String or UUID changes made by this patch: none
Attachment #712736 -
Flags: approval-mozilla-aurora?
Comment 8•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Comment 9•12 years ago
|
||
Comment on attachment 712736 [details] [diff] [review]
Fix regression handling 'rem' units in media queries.
Low risk fix for a regression found in FF18, this is appropriate for landing to Aurora 20.
Attachment #712736 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
| Assignee | ||
Comment 10•12 years ago
|
||
status-firefox18:
--- → affected
status-firefox19:
--- → affected
status-firefox20:
--- → fixed
status-firefox21:
--- → fixed
Comment 11•12 years ago
|
||
http://cdpn.io/AFjDK
The 2 columns become 1 column when reducing the browser's size.
Verified fixed FF 20.0a2, 21.0a1 (2013-02-17) Win 7
Comment 12•12 years ago
|
||
But the testcase (http://fvsch.com/code/bugs/rem-mediaquery/) from https://bugs.webkit.org/show_bug.cgi?id=78295 seems to not be completely fixed in FF 20, 21. The background is not changing right when hitting the colored bars.
Comment 13•12 years ago
|
||
That testcase is just wrong. It even says so itself, if you read carefully enough, though it's pretty obfuscated.
You need to log in
before you can comment on or make changes to this bug.
Description
•