Bug 103150

Summary: Range.getBoundingClientRect() does not handle max-height correctly
Product: WebKit Reporter: Daniel Trebbien <dtrebbien>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, dtrebbien, rniwa, simon.fraser, zalan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test case
none
Testcase #2 none

Description Daniel Trebbien 2012-11-23 09:02:44 PST
Created attachment 175814 [details]
Test case

Range.getBoundingClientRect() does not factor in the elements' max-heights when calculating the height of the bounding client rectangle.  Elements' max-widths seem to be correctly handled, but not max-heights.

Attached is a reduced test case.  The test case works as expected (the alert dialog shows "bcr.width = 202, bcr.height = 12") in Firefox 17.0 and Opera 12.11, but fails in Safari 6.0.2, Chrome 23.0.1271.64, and the latest WebKit nightly r135516 built on 22 November 2012.
Comment 1 Daniel Trebbien 2012-11-27 09:34:27 PST
Possibly related:  Bug 103430 - Range.getClientRects() and Range.getBoundingClientRect() incorrectly include hidden overflown content
Comment 2 Mats Palmgren 2012-11-29 12:50:40 PST
Created attachment 176797 [details]
Testcase #2

Here's the same test that demonstrates that 'max-height' is handled
correctly (getClientRects()[0] has height 12).  The real bug is
that the rectangles of the text nodes are included and that affects
the final getBoundingClientRect() result.  That's bug 103658.
Comment 3 Daniel Trebbien 2012-11-29 15:37:15 PST

*** This bug has been marked as a duplicate of bug 103658 ***
Comment 4 Daniel Trebbien 2013-01-15 13:45:19 PST
https://bugzilla.mozilla.org/show_bug.cgi?id=816238
Comment 5 Ahmad Saleem 2022-09-21 15:47:51 PDT
Testcase:

*** Safari 16 & STP 154 ***

bcr.width = 202, bcr.height = 433
bcr.width = 202, bcr.height = 433 <--- STP 154

*** Chrome Canary 108 ***

bcr.width = 202, bcr.height = 445

*** Firefox Nightly 107 ***

bcr.width = 202, bcr.height = 12

___________-

Testcase # 02:

*** Safari 16 ***

range.getClientRects()[0] = 8,8,202,12
range.getClientRects()[1] = 9,9,181.75,18
range.getClientRects()[2] = 9,27,171.0546875,18
range.getClientRects()[3] = 9,45,157.3046875,18
range.getClientRects()[4] = 9,63,199.90625,18
range.getClientRects()[5] = 9,81,181.34375,18
range.getClientRects()[6] = 9,99,148.390625,18
range.getClientRects()[7] = 9,117,181.7109375,18
range.getClientRects()[8] = 9,135,185.265625,18
range.getClientRects()[9] = 9,153,198.6484375,18
range.getClientRects()[10] = 9,171,198.6328125,18
range.getClientRects()[11] = 9,189,180.859375,18
range.getClientRects()[12] = 9,207,160.8515625,18
range.getClientRects()[13] = 9,225,196.40625,18
range.getClientRects()[14] = 9,243,193.734375,18
range.getClientRects()[15] = 9,261,175.9921875,18
range.getClientRects()[16] = 9,279,191.046875,18
range.getClientRects()[17] = 9,297,148.3984375,18
range.getClientRects()[18] = 9,315,190.6015625,18
range.getClientRects()[19] = 9,333,177.7265625,18
range.getClientRects()[20] = 9,351,167.0625,18
range.getClientRects()[21] = 9,369,179.4921875,18
range.getClientRects()[22] = 9,387,175.9453125,18
range.getClientRects()[23] = 9,405,156.8515625,18
range.getClientRects()[24] = 9,423,151.046875,18
range.getBoundingClientRect() = 8,8,202,433

*** STP 154 ***

range.getClientRects()[0] = 8,8,202,12
range.getClientRects()[1] = 9,9,181.75,18
range.getClientRects()[2] = 9,27,171.0546875,18
range.getClientRects()[3] = 9,45,157.3046875,18
range.getClientRects()[4] = 9,63,199.90625,18
range.getClientRects()[5] = 9,81,181.34375,18
range.getClientRects()[6] = 9,99,148.390625,18
range.getClientRects()[7] = 9,117,181.7109375,18
range.getClientRects()[8] = 9,135,185.265625,18
range.getClientRects()[9] = 9,153,198.6484375,18
range.getClientRects()[10] = 9,171,198.6328125,18
range.getClientRects()[11] = 9,189,180.859375,18
range.getClientRects()[12] = 9,207,160.8515625,18
range.getClientRects()[13] = 9,225,196.40625,18
range.getClientRects()[14] = 9,243,193.734375,18
range.getClientRects()[15] = 9,261,175.9921875,18
range.getClientRects()[16] = 9,279,191.046875,18
range.getClientRects()[17] = 9,297,148.3984375,18
range.getClientRects()[18] = 9,315,190.6015625,18
range.getClientRects()[19] = 9,333,177.7265625,18
range.getClientRects()[20] = 9,351,167.0625,18
range.getClientRects()[21] = 9,369,179.4921875,18
range.getClientRects()[22] = 9,387,175.9453125,18
range.getClientRects()[23] = 9,405,156.8515625,18
range.getClientRects()[24] = 9,423,151.046875,18
range.getBoundingClientRect() = 8,8,202,433

*** Chrome Canary 108 ***

range.getClientRects()[0] = 8,8,202,12
range.getClientRects()[1] = 9,9,181.75,18.5
range.getClientRects()[2] = 9,27.5,171.0546875,18.5
range.getClientRects()[3] = 9,46,157.3046875,18.5
range.getClientRects()[4] = 9,64.5,199.90625,18.5
range.getClientRects()[5] = 9,83,181.34375,18.5
range.getClientRects()[6] = 9,101.5,148.390625,18.5
range.getClientRects()[7] = 9,120,181.7109375,18.5
range.getClientRects()[8] = 9,138.5,185.265625,18.5
range.getClientRects()[9] = 9,157,198.6484375,18.5
range.getClientRects()[10] = 9,175.5,198.6328125,18.5
range.getClientRects()[11] = 9,194,180.859375,18.5
range.getClientRects()[12] = 9,212.5,160.8515625,18.5
range.getClientRects()[13] = 9,231,196.40625,18.5
range.getClientRects()[14] = 9,249.5,193.734375,18.5
range.getClientRects()[15] = 9,268,175.9921875,18.5
range.getClientRects()[16] = 9,286.5,191.046875,18.5
range.getClientRects()[17] = 9,305,148.3984375,18.5
range.getClientRects()[18] = 9,323.5,190.6015625,18.5
range.getClientRects()[19] = 9,342,177.7265625,18.5
range.getClientRects()[20] = 9,360.5,167.0625,18.5
range.getClientRects()[21] = 9,379,178.6171875,18.5
range.getClientRects()[22] = 9,397.5,175.9453125,18.5
range.getClientRects()[23] = 9,416,156.8515625,18.5
range.getClientRects()[24] = 9,434.5,151.046875,18.5
range.getBoundingClientRect() = 8,8,202,445

*** Firefox Nightly 107 ***

range.getClientRects()[0] = 8,8,202,12
range.getBoundingClientRect() = 8,8,202,12

_______

Comment 04 refers to Mozilla bug but appreciate if someone can confirm whether it need something to be done in Webkit or not? Thanks!