WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
258886
offsetParent is wrong for a nested element
https://bugs.webkit.org/show_bug.cgi?id=258886
Summary
offsetParent is wrong for a nested element
Kanaru Sato
Reported
2023-07-05 08:41:08 PDT
Created
attachment 466934
[details]
this html produces the bug Hi, hope you all are well :) I found offsetParent is wrong for a bit nested element. In the attached HTML, the offsetParent of the div element with id, "target", should be the span with id, "offsetParent". But the webkit(
265767@main
) recognizes the offsetParent is the span with id, "not-offsetParent". It affects many libraries which insert elements with consideration of setting position properties correctly. This kind of library, e.g. floating UI, detects offsetParents of elements and calculates the position related properties of element to be inserted. (floating UI:
https://github.com/floating-ui/floating-ui
) FYI: I found the offsetParent is correctly set when you remove the parent element(div) of the element with id, "target". But idk this helps debug. Thank you for checking this report and look forward to your reply :)
Attachments
this html produces the bug
(786 bytes, text/plain)
2023-07-05 08:41 PDT
,
Kanaru Sato
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Kanaru Sato
Comment 1
2023-07-05 08:44:32 PDT
I've already checked chrome and firefox correctly recognize the offsetParent...!
Ahmad Saleem
Comment 2
2023-07-05 11:28:20 PDT
I am able to reproduce this bug on WebKit ToT (
265772@main
) and Safari 16.5.1, so it might not be recent regression.
alan
Comment 3
2023-07-05 15:38:30 PDT
This is caused by the continuation tree structure (caused by the inline level element's block level child <span><div>) where we fail to follow the continuation chain for our containing block.
Ahmad Saleem
Comment 4
2023-07-05 16:31:38 PDT
(In reply to zalan from
comment #3
)
> This is caused by the continuation tree structure (caused by the inline > level element's block level child <span><div>) where we fail to follow the > continuation chain for our containing block.
By any chance, is this relevant WPT?
http://wpt.live/css/cssom-view/offsetParent-block-in-inline.html
alan
Comment 5
2023-07-05 20:01:05 PDT
yeah(In reply to Ahmad Saleem from
comment #4
)
> (In reply to zalan from
comment #3
) > > This is caused by the continuation tree structure (caused by the inline > > level element's block level child <span><div>) where we fail to follow the > > continuation chain for our containing block. > > By any chance, is this relevant WPT? > >
http://wpt.live/css/cssom-view/offsetParent-block-in-inline.html
yah, it's all about continuation. :/
Kanaru Sato
Comment 6
2023-07-09 22:03:44 PDT
Thank you for giving replies :) I'd like to debug and fix it. Could I try that? According to your guess, I will take a look on the below parts of WebKit. - `RenderObject::offsetParent()` - `RenderElement::canContainAbsolutelyPositionedObjects()` BTW, should I refer to the below page for how to debug webkit?
https://webkit.org/debugging-webkit/
Actually, I'd tried to build and run webkit on local before according to this link, and didn't succeed...TT If there was the better or latest document, could you please give me that??
Radar WebKit Bug Importer
Comment 7
2023-07-12 08:42:17 PDT
<
rdar://problem/112140677
>
Ahmad Saleem
Comment 8
2023-07-29 06:30:54 PDT
(In reply to Kanaru Sato from
comment #6
)
> Thank you for giving replies :) > > I'd like to debug and fix it. Could I try that? > According to your guess, I will take a look on the below parts of WebKit. > - `RenderObject::offsetParent()` > - `RenderElement::canContainAbsolutelyPositionedObjects()` > > BTW, should I refer to the below page for how to debug webkit? >
https://webkit.org/debugging-webkit/
> Actually, I'd tried to build and run webkit on local before according to > this link, and didn't succeed...TT > > If there was the better or latest document, could you please give me that??
I think you can try
bug 253147
, which has more details in where the culprit code is and also potential Blink merge candidate. Also can you share your steps and what error you faced? Also join WebKit Slack Channel to get more help and support on how to build local WebKit test environment.
Ahmad Saleem
Comment 9
2025-11-28 11:09:32 PST
Solved with `Block-in-inline` work.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug