Bug 64046 - Wrong image height in absolutely positioned div in relatively positioned parent with bottom padding
Summary: Wrong image height in absolutely positioned div in relatively positioned pare...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows 7
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-06 18:11 PDT by Silas Brill
Modified: 2011-07-27 11:54 PDT (History)
5 users (show)

See Also:


Attachments
Test HTML file (745 bytes, text/html)
2011-07-06 18:12 PDT, Silas Brill
no flags Details
Screenshot (17.79 KB, image/png)
2011-07-06 18:13 PDT, Silas Brill
no flags Details
Proposed patch. (8.98 KB, patch)
2011-07-19 14:19 PDT, Kulanthaivel Palanichamy
no flags Details | Formatted Diff | Diff
Proposed patch V2 (4.47 KB, patch)
2011-07-21 11:40 PDT, Kulanthaivel Palanichamy
no flags Details | Formatted Diff | Diff
add pixel test result (192.07 KB, patch)
2011-07-21 18:11 PDT, Ryosuke Niwa
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Silas Brill 2011-07-06 18:11:19 PDT
Safari version: 5.0.5 (7533.21.1)

Other browsers tested:
Chrome 12: FAIL
Firefox 5: OK
IE 7/8/9: OK

Steps to reproduce:
1. Create a relatively positioned div with a height and a bottom padding
2. Put in that div an absolutely positioned div with height 100%
3. Put in the second div an image with height 100%
4. Open the file in Chrome or Safari

Expected behavior:

The image should fill the height of the second div

Actual behavior:

The image inherits the height value that was set on the first div

More information:

The attached file has steps 1, 2 and 3 already completed.  I have only tested this with the XHTML Transitional doctype.
Comment 1 Silas Brill 2011-07-06 18:12:40 PDT
Created attachment 99909 [details]
Test HTML file
Comment 2 Silas Brill 2011-07-06 18:13:14 PDT
Created attachment 99910 [details]
Screenshot
Comment 3 Alice Boxhall 2011-07-06 20:36:54 PDT
Pulling together the relevant parts of the CSS spec:
http://www.w3.org/TR/CSS2/visudet.html#propdef-height
"<percentage> Specifies a percentage height. The percentage is calculated with respect to the height of the generated box's containing block."

http://www.w3.org/TR/CSS2/visudet.html#containing-block-details
"If the element has 'position: absolute', the containing block is established by the nearest ancestor with a 'position' of 'absolute', 'relative' or 'fixed', in the following way:
In the case that the ancestor is an inline element (...)
Otherwise, the containing block is formed by the padding edge of the ancestor."

So yes, this is a bug.
Comment 4 Kulanthaivel Palanichamy 2011-07-19 14:19:22 PDT
Created attachment 101384 [details]
Proposed patch.
Comment 5 Kulanthaivel Palanichamy 2011-07-21 11:40:47 PDT
Created attachment 101616 [details]
Proposed patch V2
Comment 6 Dave Hyatt 2011-07-21 17:02:35 PDT
Comment on attachment 101616 [details]
Proposed patch V2

r=me. Much nicer!
Comment 7 WebKit Review Bot 2011-07-21 17:14:55 PDT
Comment on attachment 101616 [details]
Proposed patch V2

Clearing flags on attachment: 101616

Committed r91533: <http://trac.webkit.org/changeset/91533>
Comment 8 WebKit Review Bot 2011-07-21 17:15:00 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Ryosuke Niwa 2011-07-21 18:11:01 PDT
Created attachment 101681 [details]
add pixel test result
Comment 10 Ryosuke Niwa 2011-07-21 18:21:12 PDT
Can someone check & see if the pixel result is good or not?
Comment 11 Dave Hyatt 2011-07-27 11:06:16 PDT
Comment on attachment 101681 [details]
add pixel test result

r=me
Comment 12 Dave Hyatt 2011-07-27 11:07:05 PDT
r=me to add it, but should it really be in the cross-platform dir? The changelog says that at least.
Comment 13 Ryosuke Niwa 2011-07-27 11:54:59 PDT
Committed r91862: <http://trac.webkit.org/changeset/91862>