Skip to content
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

Shorthand properties of computed CSSStyleDeclaration don't return correct values #22838

Open
jdm opened this issue Feb 6, 2019 · 7 comments
Open

Comments

@jdm
Copy link
Member

@jdm jdm commented Feb 6, 2019

<div id="test" style="overflow: hidden"></div>
<script>onload = function() {
  var div = document.getElementById('test');
  console.log(getComputedStyle(div).overflow)
  console.log(getComputedStyle(div).overflowX);
};
</script>

In Firefox, this shows hidden twice. In Servo this shows an empty string, followed by hidden.

@jdm
Copy link
Member Author

@jdm jdm commented Feb 6, 2019

There's a comment in processed_resolved_style_request and process_resolved_style_request_internal that looks fishy to me given Firefox's behaviour:

        // Firefox returns blank strings for the computed value of shorthands,
        // so this should be web-compatible.
@jdm
Copy link
Member Author

@jdm jdm commented Feb 6, 2019

@emilio This behaviour was introduced in 0ad2d39. Firefox appears to behave differently now; do you know when that changed?

@jdm
Copy link
Member Author

@jdm jdm commented Feb 6, 2019

Mmm, maybe it was introduced in 58d452f instead.

@jdm
Copy link
Member Author

@jdm jdm commented Feb 6, 2019

Chrome also returns real values for shorthands, so Servo's behaviour is definitely not web compatible.

@jdm jdm changed the title Shorthand properties of CSSStyleDeclaration don't return correct values Shorthand properties of computed CSSStyleDeclaration don't return correct values Feb 6, 2019
@jdm
Copy link
Member Author

@jdm jdm commented Feb 6, 2019

I think the right thing to do here is implement the same shorthand logic as Servo_GetPropertyValue in at least process_resolved_style_request_internal, possibly process_resolved_style_request as well.

@jdm
Copy link
Member Author

@jdm jdm commented Feb 6, 2019

Ah, I see w3c/csswg-drafts#2529 and the note in the spec for step 5 of https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle which explicitly mentions overflow.

@emilio
Copy link
Member

@emilio emilio commented Apr 3, 2019

Sorry I never replied here. Shorthands are special, but firefox only serializes some (in particular, it only serializes the ones that used to be longhands).

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.