Skip to content

[resize-observer] Add layoutBox property to constructor #3238

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

Closed
gregwhitworth opened this issue Oct 23, 2018 · 5 comments
Closed

[resize-observer] Add layoutBox property to constructor #3238

gregwhitworth opened this issue Oct 23, 2018 · 5 comments
Assignees

Comments

@gregwhitworth
Copy link
Contributor

Currently, the default box returned to the author is the content-box but there are many scenarios in which the author wants the border box.

@gregwhitworth
Copy link
Contributor Author

I have added layoutBox to the WebIDL and outlined how this is set - it's allowed values and generalized it under ResizeObserverEntry. I'm not extremely versed in writing WebIDL so I welcome any feedback that @tabatkins or @heycam may have on these changes as can be seen here in the ED. After your feedback I'll add it to the agenda for review and feedback from others.

@gregwhitworth
Copy link
Contributor Author

@atotic can you review and provide feedback as well.

@heycam
Copy link
Contributor

heycam commented Oct 23, 2018

A few comments:

We should use an enum to define the value space of layoutBox, so that what happens when we pass in an invalid value is handled in a way consistent with other APIs. So something like:

enum ResizeObserverLayoutBox {
    "padding-box",
    "border-box",
    "content-box"
};

and then use that instead of DOMString in all places. The result will be that an exception is thrown when invalid values are passed in.

Then we should make the ResizeObserver constructor argument have a default value, so:

[Constructor(ResizeObserverCallback callback, ResizeObserverLayoutBox layoutBox = "content-box")]

so then we don't need to do anything in the prose for the constructor to handle a missing/default value either.

The header for the prose section describing the ResizeObserver constructor should be updated to have the layoutBox argument.

The layoutBox declaration itself should be readonly attribute ResizeObserverLayoutBox layoutBox;.

The prose description of new ResizeObserverEntry(target) talks about this.layoutBox, but there's no layoutBox on ResizeObserverEntry.

@gregwhitworth
Copy link
Contributor Author

@heycam @tabatkins thanks for the feedback. @atotic were both working in parallel on this and he has some solid ideas in a Google doc. After the breakout session we'll update the spec and get review again.

@gregwhitworth
Copy link
Contributor Author

Based on discussions and changes made by Alek I'm going to close this one out as we went in a slightly different direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants