generated from oddbird/polyfill-template
-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for anchor-size()
fn.
#70
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1e84ebf
First pass at anchor-size() support.
jgerigmeyer 4545d4a
Use getBoundingClientRect() because ¯\_(ツ)_/¯
jgerigmeyer e029dd1
Revert getBoundingClientRect usage
jgerigmeyer 689200a
use offset values instead of client values
jgerigmeyer 2b48e06
Add hack for inline containing-blocks
jgerigmeyer 45f520e
add tests
jgerigmeyer 4ec64c0
Merge branch 'main' into anchor-size
jgerigmeyer 650e972
review
jgerigmeyer 12d5933
add support notes
jgerigmeyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mirisuzanne I think these changes from
clientWidth
tooffsetWidth
might actually be incorrect -- and I'm also not sure if I need to worry about scaling here. This change seemed to fix one test (first test in https://github.com/web-platform-tests/wpt/blob/6cd6741bc20cd6b3ad9f95d19123b7850c696d79/css/css-anchor-position/anchor-position-inline-004.html), but it also caused other tests with borders to fail (first 2 in https://github.com/web-platform-tests/wpt/blob/7a0b0c285b91a0b1fa08da58c964b82e5cf40733/css/css-anchor-position/anchor-position-borders-001.html).Do you know what the correct way to convert from a
left
to aright
px value is? That's the goal here. E.g. given the distancex
that would theleft
position to the right edge of a rectangle, how to consistently convert that to aright
positioning value?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I play with this, it looks like
right: 0px
does not include borders for the containing block -- so I think this should remainclientWidth
andclientHeight
... 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, to get the right offset based on the x offset, you need: the width of the reference box, minus the x offset, minus the width of the target.
For the parent context width, the relevant box is the 'content box' (
clientWidth
?), but for the the target element you would need the full 'border box' including borders (offsetWidth
?).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I added a hack in 2b48e06, but I'm not confident in it.