Bug 47618

Summary: offsetHeight and offsetWidth of inline box wrapping a block box is 0
Product: WebKit Reporter: vagell
Component: Layout and RenderingAssignee: zalan <zalan>
Status: REOPENED    
Severity: Normal CC: ahmad.saleem792, annevk, ap, bfulgham, changseok, commit-queue, esprehn+autocc, ews-watchlist, glenn, karlcow, koivisto, kondapallykalyan, mike, pdr, rniwa, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=28810
Bug Depends on: 267596    
Bug Blocks:    
Attachments:
Description Flags
Simplest repro case
none
Patch
none
Patch
none
Patch
none
Patch
none
[fast-cq]Patch none

vagell
Reported 2010-10-13 13:38:39 PDT
Created attachment 70653 [details] Simplest repro case offsetHeight and offsetWidth are always reported as 0 for <ins> elements with text content enclosed in some other element. The <ins> element still renders properly. See simple-test-ins.html for simplest case that reproduces. NOTE: Tested same case with <del> and it is NOT affected by this bug. Noticed on WebKit 534.7 from a Linux Google Chrome beta, and also reproduced on OSX Safari 5.0 (5533.16).
Attachments
Simplest repro case (1.01 KB, text/html)
2010-10-13 13:38 PDT, vagell
no flags
Patch (4.97 KB, patch)
2023-12-19 15:57 PST, zalan
no flags
Patch (4.97 KB, patch)
2023-12-19 18:44 PST, zalan
no flags
Patch (9.72 KB, patch)
2023-12-20 11:00 PST, zalan
no flags
Patch (9.60 KB, patch)
2023-12-20 11:11 PST, zalan
no flags
[fast-cq]Patch (10.50 KB, patch)
2023-12-20 12:41 PST, zalan
no flags
Ahmad Saleem
Comment 1 2022-07-30 06:02:32 PDT
I am able to reproduce this bug in Safari 15.6 on macOS 12.5 based on attached test cases and it shows following values across all browsers: *** Safari 15.6 on macOS 12.5 *** This insertion's content is wrapped in a <p>: offsetHeight of ins with p-wrapped content: 0 offsetWidth of ins with p-wrapped content: 0 *** Chrome Canary 106 *** offsetHeight of ins with p-wrapped content: 19 offsetWidth of ins with p-wrapped content: 948 *** Firefox Nightly 105 *** offsetHeight of ins with p-wrapped content: 19 offsetWidth of ins with p-wrapped content: 966 Just wanted to share updated test results. Thanks!
Anne van Kesteren
Comment 2 2023-12-19 07:06:00 PST
It seems it's now consistent across ins/del/span at least.
Anne van Kesteren
Comment 3 2023-12-19 07:53:04 PST
I briefly looked into this. RenderInline uses linesBoundingBox() for offset size calculations. However, for <span><div>test</div></span> the span is not considered to have hasContent() so LineLayout::enclosingBorderBoxRectFor() returns a 0-rect. If I remove the hasContent() check it returns what appears to be the correct height, but the width is still 0. And who knows what side effects removing the hasContent() check might have. As such this seems like something best tackled by the layout team.
zalan
Comment 4 2023-12-19 08:00:35 PST
(In reply to Anne van Kesteren from comment #3) > I briefly looked into this. > > RenderInline uses linesBoundingBox() for offset size calculations. > > However, for <span><div>test</div></span> the span is not considered to have > hasContent() so LineLayout::enclosingBorderBoxRectFor() returns a 0-rect. If > I remove the hasContent() check it returns what appears to be the correct > height, but the width is still 0. And who knows what side effects removing > the hasContent() check might have. > > As such this seems like something best tackled by the layout team. <span><div>test</div></span> creates continuation which probably confuses enclosing logic somewhere.
zalan
Comment 5 2023-12-19 15:57:06 PST
zalan
Comment 6 2023-12-19 16:01:14 PST
(In reply to Anne van Kesteren from comment #3) > I briefly looked into this. > > RenderInline uses linesBoundingBox() for offset size calculations. > > However, for <span><div>test</div></span> the span is not considered to have > hasContent() so LineLayout::enclosingBorderBoxRectFor() returns a 0-rect. If > I remove the hasContent() check it returns what appears to be the correct > height It only returns the height of the pre block of the continuation which is not quite the height of the entire inline box. e.g. in case of this <span>pre block content<div>block</div>post block content</span> the height would still be incorrect as both the block container (<div>) and "post block content" part would be ignored.
zalan
Comment 7 2023-12-19 18:44:26 PST
zalan
Comment 8 2023-12-20 11:00:50 PST
zalan
Comment 9 2023-12-20 11:11:37 PST
zalan
Comment 10 2023-12-20 12:41:50 PST
Created attachment 469149 [details] [fast-cq]Patch
EWS
Comment 11 2023-12-20 15:00:43 PST
Committed 272386@main (cfe7ff2ca750): <https://commits.webkit.org/272386@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 469149 [details].
Radar WebKit Bug Importer
Comment 12 2023-12-20 15:01:15 PST
WebKit Commit Bot
Comment 13 2024-01-16 11:10:12 PST
Re-opened since this is blocked by bug 267596
zalan
Comment 14 2024-08-13 07:38:07 PDT
*** Bug 277733 has been marked as a duplicate of this bug. ***
Karl Dubost
Comment 15 2024-08-13 07:40:13 PDT
Brent Fulgham
Comment 16 2024-08-13 16:11:51 PDT
This is now tracked by: <rdar://119955792>
Karl Dubost
Comment 17 2024-11-06 18:22:01 PST
See the testcase in https://bug-277733-attachments.webkit.org/attachment.cgi?id=472138 and the comment in https://bugs.webkit.org/show_bug.cgi?id=277733#c6 which shows the difference in between Safari on one side and Firefox/Chrome on the other.
Note You need to log in before you can comment on or make changes to this bug.