height:calc() of display:block elements in some cases is calculated wrong if calc() contains percent values

RESOLVED INVALID

Status

()

Core
CSS Parsing and Computation
RESOLVED INVALID
2 years ago
2 years ago

People

(Reporter: arni2033, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(firefox44 affected)

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
Created attachment 8678498 [details]
testcase - display-block elements have wrong height if it's defined as calc(percent).htm

STR:   (Win7_64, Nightly 44, 32bit, ID 20151020031317, new profile)
1. Open attached testcase. It contains 2 iframes:
<body><div style="height:100%"/><body>  vs  <body><div style="height:calc(100%)"/><body>

Expectations: Both <div>s should take equal space (have equal height), just like in GoogleChrome
Result:     <div> in the first iframe takes 100% of page, <div> in the second iframe has height == 0px
            This also happens with other (not <div>) elements. E.g. <input style="display:block;">
            This also happens if I set "height:calc(100% + 1000px)" to <div> in second iframe has 

Maybe it's one of those "weird but works as expected"-things - I can't tell.
Thank you for the bug report.

The issue is that the testcases are in quirks mode.

Percentage heights do some weird stuff in quirks mode, but that weird stuff is limited to heights actually specified as a percentage.  calc() heights, even with percentages in them, are not supposed to do the weirdness.  Chrome has a known bug here where they apply the quirky behavior to calc() even though they're not supposed to.  See https://code.google.com/p/chromium/issues/detail?id=388892

If you add "<!DOCTYPE html>" to your testcases, you will see the correct standards-mode rendering in both of them in all browsers.  In this case, that's 0 height for the div, since its parent is auto height so percentage height means the same thing as auto height.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INVALID
(Reporter)

Updated

2 years ago
Has STR: --- → yes
You need to log in before you can comment on or make changes to this bug.