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
Support property aliases #14893
Support property aliases #14893
Conversation
Heads up! This PR modifies the following files:
|
I'm concerned about serialization, should we serialize as the alias? |
This was discussed yesterday, and the conclusion was that aliases should disappear when serializing. In firefox: #foo {
word-wrap: break-word;
overflow-wrap: break-word;
align-items: flex-end;
-webkit-align-items: baseline;
foobar: baz;
} serializes to |
Specifically for
However, Firefox implements word-wrap as an alias of overflow-wrap. Chrome and Safari implement it as a shorthand. Prefix aliases are not specced but behave consistently across browsers (the irony). The alias mapping is done at parse time, and no trace of their existence is left behind. CSSOM allows access to the same property through regular and alias accessors. This is what this PR does. So perhaps we shouldn't be using this alias infra for We should probably update Gecko to use a shorthand here. And change this PR to use -webkit-align-items or something? |
Gecko bug that made it an alias is in https://bugzilla.mozilla.org/show_bug.cgi?id=955857 . It doesn't seem like making it not a shorthand was a deliberate decision, it was a different interpretation with the spec. Filed w3c/csswg-drafts#866 to deal with the spec ambiguities. Not sure how that will turn out, but we would prefer it to be specced so that it is an alias, not a shorthand. |
Turns out that basically nobody follows the "implement it as a shorthand" thing correctly anyway. Chrome and webkit do their own special-snowflake thing that only is used for word-wrap. I'm going to leave it as is as an alias since that's the direction the spec discussion is going in. |
Thanks Manish, makes sense.
|
|
Disregard those last two comments, too sleepy to see that Sorry :( |
@bors-servo r+ |
📌 Commit 78cb160 has been approved by |
@bors-servo r-
Fails tidy, not reason to take space in the queue, feel free to r=me when fixed. |
@bors-servo r=emilio |
📌 Commit 3081bc9 has been approved by |
Support property aliases Aliases now get forwarded to their "original" property name at parse time. CSSOM continues to provide access through alias getters. We'll need to probably add `${"-webkit-foo -moz-foo" if gecko else ""}` all over the place. Might want to come up with a convenient attibute name for that (`gecko_prefix="mw"`) or something. r? @heycam or @bholley <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14893) <!-- Reviewable:end -->
💔 Test failed - mac-dev-unit |
@bors-servo r=emilio removed a test that doesn't make sense anymore |
📌 Commit 33966a8 has been approved by |
Support property aliases Aliases now get forwarded to their "original" property name at parse time. CSSOM continues to provide access through alias getters. We'll need to probably add `${"-webkit-foo -moz-foo" if gecko else ""}` all over the place. Might want to come up with a convenient attibute name for that (`gecko_prefix="mw"`) or something. r? @heycam or @bholley <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14893) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev |
From // FIXME(https://github.com/rust-lang/rust/issues/33156): remove this enum and use PropertyId
// when stable Rust allows destructors in statics.
enum StaticId {
Longhand(LonghandId),
Shorthand(ShorthandId),
}
// ...
pub enum PropertyId {
Longhand(LonghandId),
Shorthand(ShorthandId),
Custom(::custom_properties::Name),
} ( |
Yeah, that's compatible with this change. |
Aliases now get forwarded to their "original" property name at parse time. CSSOM continues to provide access through alias getters.
We'll need to probably add
${"-webkit-foo -moz-foo" if gecko else ""}
all over the place. Might want to come up with a convenient attibute name for that (gecko_prefix="mw"
) or something.r? @heycam or @bholley
This change is