Skip to content

[cssom] [css-overflow-3] Behaviour of getPropertyValue() unclear when the result doesn't match the property grammar #1100

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
darrnshn opened this issue Mar 14, 2017 · 2 comments

Comments

@darrnshn
Copy link

In getPropertyValue(), for shorthand properties, it says to simply append the value of the CSS declaration of each longhand. However, this might result in something that doesn't conform to the grammar of the shorthand property. For example, the overflow shorthand only accepts 1 keyword, but getPropertyValue() would return a list containing the value for overflow-x and overflow-y. What should be the correct behaviour of getPropertyValue() in these cases?

@zcorpan
Copy link
Member

zcorpan commented Mar 15, 2017

It doesn't say to append the value of the longhand, it says to append the longhand itself. And then serialize the list of longhands using https://drafts.csswg.org/cssom/#serialize-a-css-value which says

Return the result of joining values as appropriate according to the grammar of shorthand and terminate these steps.

That's certainly hand-waving and there may be bugs in the spec's algorithm... but the intent is to serialize something that follows the grammar for the shorthand.

But also see #1033

@darrnshn
Copy link
Author

I see, thanks!

MXEBot pushed a commit to mirror/chromium that referenced this issue Apr 3, 2017
According to the CSSOM spec [1], when overflow-x and overflow-y
are different, the computed value of overflow should be the empty
string since it cannot be expressed in the grammar (step 1.2.).

However, we currently return the max of overflow-x and overflow-y
in terms of their enum values, which does not follow the spec.
Firefox handles this issue correctly.

This patch fixes this issue by return an empty string if the two
overflows are different.

[1] https://drafts.csswg.org/cssom/#serialize-a-css-value
[2] w3c/csswg-drafts#1100

BUG=701235

Review-Url: https://codereview.chromium.org/2752623002
Cr-Commit-Position: refs/heads/master@{#461352}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants