-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
serialize font: to empty on non-default subprops #15604
serialize font: to empty on non-default subprops #15604
Conversation
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @metajack (or someone else) soon. |
r? @SimonSapin |
try!(stretch.to_css(dest)); | ||
try!(write!(dest, " ")); | ||
% for sub_property in "font_style font_variant font_weight font_stretch".split(): | ||
match extract_value(self.${sub_property}) { |
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.
Would something like this be preferable?
if let Some(val) = extract_value(self.${sub_property}) {
try!(val.to_css(dest));
try!(write!(dest, " "));
}
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.
Yes.
These latest changes fix some problems with my first attempt, and considerably simplify the changes needed to to_css_declared(). I believe the handling of non-default subproperties now meets the requirements. Unless the mako variable product is somehow set to "gecko" or "none", it is not really possible for the What I can do is fix the test so that it will fail with the current test configuration, but we may want to either disable it or somehow mark it as a known failure. I see some documentation about annotating with "ignore" but nothing about known failures... maybe If there are no objections, I'll go ahead and fix the test by switching it to have at least one normal property of the font shorthand, call |
Went ahead and adjusted the test as I described and ignored it. When enabled it fails for me with: thread 'properties::serialization::shorthand_serialization::font::should_serialize_to_empty_if_there_are_nondefault_subproperties' panicked at 'assertion failed: And now of course I just noticed that it is not producing a |
Ok I think the test is now fixed to the extent that I think it can be. When enabled, it now fails with: thread 'properties::serialization::shorthand_serialization::font::should_serialize_to_empty_if_there_are_nondefault_subproperties' panicked at 'assertion failed:
I think that's all I can do for now. I'll wait for feedback. |
fb0f4a7
to
14b2065
Compare
Changes have been rebased on master, intermediate commits squashed, and test changes split into a separate commit. Moved comment on one of the test functions above its annotations. Made some improvements to the commit messages. |
@SimonSapin Review ping. |
14b2065
to
ed3a40a
Compare
Sorry I only realized now, but I think there is a misunderstanding. When @upsuper in #15036 writes "The The tests in this PR are based on the Rust method Although the two algorithms have some parts in common, they are different. They should be tested separately. When asking for the value of a specific shorthand, there may be no syntax that would expand to the current values of all the corresponding longhands. In that case we return an empty string. When serializing an entire block, however, there is no such limitations since (in the general case) we’re serializing multiple declarations anyway. When a shorthand doesn’t have appropriate syntax, we can fall back to multiple longhand declarations instead. In no case should a (set of) declarations be entirely skipped from the serialization. The links above lead to the parts of the CSSOM specification that specify these algorithms, including the fallback case: Part of https://drafts.csswg.org/cssom/#serialize-a-css-declaration-block
|
@SimonSapin Thanks for the clarification. My apologies for misunderstanding, this is my first PR on servo. If I change the test to the following, attempting to use
The approach is similar to |
Do you mean |
Ignored test
because the products that would let this test pass are not enabled in the unit tests. |
☔ The latest upstream changes (presumably #15779) made this pull request unmergeable. Please resolve the merge conflicts. |
32b0e1a
to
2f8eb9d
Compare
PR was rebased on master. Changes in #15779 made the fn @SimonSapin This is ready for review again. |
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.
A few nits.
|
||
% if product == "gecko": | ||
% for sub_property in "font_size_adjust font_kerning font_variant_caps font_variant_position".split(): | ||
if let Some(_) = self.${sub_property} { |
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.
if self.${sub_property}.is_some() { ... }
% endif | ||
|
||
% if product == "none": | ||
if let Some(_) = self.font_language_override { |
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.
if self.font_language_override.is_some() { ... }
let font_family = DeclaredValue::Value( | ||
FamilyContainer(vec![FontFamily::Generic(atom!("serif"))]) | ||
FamilyContainer(vec![FontFamily::Generic(Atom::from("serif"))]) |
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.
Why change that?
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.
@nox It looks like you removed this comment, but in case it's not clear to others now that I've addressed the other nits: This did not compile using atom!
, because the string_cache
crate is not available, but this variation works. This test was commented out before, so I just uncommented and got it to compile by using Atom::from
based on a suggestion from someone in IRC.
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.
I removed it because I thought you had reverted the change, but I'm ok with your explanation and we don't need atom!
performance benefits here anyway.
@SimonSapin This is ready to be reviewed. |
…=SimonSapin serialize font: to empty on non-default subprops Fixes font shorthand serialization so that it serializes to "" when non-default subproperties are defined. These subproperties are those defined in #15033. Adds tests: - font_should_serialize_to_empty_if_there_are_nondefault_subproperties - font_should_serialize_all_available_properties The second test was previously commented out and underwent some cleanup to make it run. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15036 <!-- Either: --> - [X] There are tests for these changes <!-- 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/15604) <!-- Reviewable:end -->
💔 Test failed - linux-rel-wpt |
The two not-already-marked-intermittent failures match error messages and stack traces in #13509 and #14323. (@jdm, is this the right way to tag things, with the list of filenames removed from #14323’s title?) @bors-servo retry ▶ TIMEOUT [expected PASS] /html/dom/elements/global-attributes/dir_auto-textarea-N-EN.html │ │ VMware, Inc. │ Gallium 0.4 on softpipe │ 3.3 (Core Profile) Mesa 12.0.1 │ Shutting down the Constellation after generating an output file or exit flag specified │ VMware, Inc. │ Gallium 0.4 on softpipe │ 3.3 (Core Profile) Mesa 12.0.1 │ failed to receive response to font request: IoError(Error { repr: Os { code: 104, message: "Connection reset by peer" } }) (thread LayoutThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(1) }, at /checkout/src/libcore/result.rs:860) │ stack backtrace: │ 0: 0x7fc9a0662c2d - backtrace::backtrace::trace::hce6a3819d897a887 │ 1: 0x7fc9a0663112 - backtrace::capture::Backtrace::new::hb5a725a088a2a2fc │ 2: 0x7fc99f586523 - servo::main::{{closure}}::h9d96b5c32a8afffa │ 3: 0x7fc9a147c6bd - std::panicking::rust_panic_with_hook │ at /checkout/src/libstd/panicking.rs:550 │ 4: 0x7fc9a147c554 - std::panicking::begin_panic │ at /checkout/src/libstd/panicking.rs:511 │ 5: 0x7fc9a147c489 - std::panicking::begin_panic_fmt │ at /checkout/src/libstd/panicking.rs:495 │ 6: 0x7fc9a147c417 - std::panicking::rust_begin_panic │ at /checkout/src/libstd/panicking.rs:471 │ 7: 0x7fc9a14a947d - core::panicking::panic_fmt │ at /checkout/src/libcore/panicking.rs:69 │ 8: 0x7fc9a038f51b - core::result::unwrap_failed::hd6c954846ed51283 │ 9: 0x7fc9a03a4a28 - gfx::font_cache_thread::FontCacheThread::last_resort_font_template::h1802e896535d574d │ 10: 0x7fc9a03a5d87 - gfx::font_context::FontContext::layout_font_group_for_style::he3ec5275d9cc8fd2 │ 11: 0x7fc9a02ebf75 - layout::text::TextRunScanner::scan_for_runs::h9e7b4d5cef563b9e │ 12: 0x7fc99f846c18 - >::build_flow_for_block_starting_with_fragments::heca9cf2293a81bc4 │ 13: 0x7fc99f842f7c - >::build_flow_for_block_like::h3f6021bd678bdf31 │ 14: 0x7fc99f8425e0 - >::build_flow_for_block::h99cf3ea7a8a001fe │ 15: 0x7fc99f7f2e20 - as layout::traversal::PostorderNodeMutTraversal>::process::h7163180639338351 │ 16: 0x7fc99f7e36be - >::process_postorder::hb395296ca2e298d3 │ 17: 0x7fc99f81fbb7 - style::sequential::traverse_dom::doit::h473529d272cb7d1d │ 18: 0x7fc99f81fb86 - style::sequential::traverse_dom::doit::h473529d272cb7d1d │ 19: 0x7fc99f81fb86 - style::sequential::traverse_dom::doit::h473529d272cb7d1d │ 20: 0x7fc99f81fb86 - style::sequential::traverse_dom::doit::h473529d272cb7d1d │ 21: 0x7fc99f85dbb8 - layout_thread::LayoutThread::handle_reflow::hbab16fcce01ae6f3 │ 22: 0x7fc99f856495 - layout_thread::LayoutThread::handle_request_helper::h6861378e293d9e98 │ 23: 0x7fc99f852218 - ::create::{{closure}}::he70c89f1fd32aa44 │ 24: 0x7fc99f804487 - std::panicking::try::do_call::h761cbb26c4556062 │ 25: 0x7fc9a14836da - panic_unwind::__rust_maybe_catch_panic │ at /checkout/src/libpanic_unwind/lib.rs:98 │ 26: 0x7fc99f81a3d7 - >::call_box::h1a58b1b3d97e5f50 │ 27: 0x7fc9a147b2a4 - alloc::boxed::{{impl}}::call_once<(),()> │ at /checkout/src/liballoc/boxed.rs:650 │ - std::sys_common::thread::start_thread │ at /checkout/src/libstd/sys_common/thread.rs:21 │ - std::sys::imp::thread::{{impl}}::new::thread_start │ at /checkout/src/libstd/sys/unix/thread.rs:84 │ 28: 0x7fc99d450183 - start_thread │ 29: 0x7fc99cf6737c - clone │ 30: 0x0 - │ ERROR:servo: failed to receive response to font request: IoError(Error { repr: Os { code: 104, message: "Connection reset by peer" } }) │ called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }" (thread ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(1) }, at /checkout/src/libcore/result.rs:860) │ stack backtrace: │ 0: 0x7fc9a0662c2d - backtrace::backtrace::trace::hce6a3819d897a887 │ 1: 0x7fc9a0663112 - backtrace::capture::Backtrace::new::hb5a725a088a2a2fc │ 2: 0x7fc99f586523 - servo::main::{{closure}}::h9d96b5c32a8afffa │ 3: 0x7fc9a147c6bd - std::panicking::rust_panic_with_hook │ at /checkout/src/libstd/panicking.rs:550 │ 4: 0x7fc9a147c554 - std::panicking::begin_panic │ at /checkout/src/libstd/panicking.rs:511 │ 5: 0x7fc9a147c489 - std::panicking::begin_panic_fmt │ at /checkout/src/libstd/panicking.rs:495 │ 6: 0x7fc9a147c417 - std::panicking::rust_begin_panic │ at /checkout/src/libstd/panicking.rs:471 │ 7: 0x7fc9a14a947d - core::panicking::panic_fmt │ at /checkout/src/libcore/panicking.rs:69 │ 8: 0x7fc9a0275a39 - core::result::unwrap_failed::h8f88b98f0a536369 │ 9: 0x7fc9a02d756d - ::pending_images::h91063c5b1c3f0432 │ 10: 0x7fc99fe37a59 - script::dom::window::Window::force_reflow::hc4df658a79834119 │ 11: 0x7fc99fe3accb - script::dom::window::Window::reflow::h394a9997bedf7be7 │ 12: 0x7fc99fcacddf - script::dom::document::Document::finish_load::h1d8d2d557ecf4cc8 │ 13: 0x7fc99fdd86b3 - script::dom::servoparser::ServoParser::do_parse_sync::h2676270b9bff96b9 │ 14: 0x7fc99fdd806c - script::dom::servoparser::ServoParser::parse_sync::h4a7419b789141155 │ 15: 0x7fc99fde096a - ::process_response_eof::h0e6d7b63846ee146 │ 16: 0x7fc99fe6447a - as script::script_thread::Runnable>::handler::h9c76f08103f95c48 │ 17: 0x7fc99fe872b5 - script::script_thread::ScriptThread::handle_msg_from_script::h4fb921a02f36cead │ 18: 0x7fc99fe7ea8c - script::script_thread::ScriptThread::handle_msgs::{{closure}}::h95a96e772221ddd7 │ 19: 0x7fc99fe79d5a - script::script_thread::ScriptThread::handle_msgs::hb7c261538c9b5201 │ 20: 0x7fc99fe746c7 - script::script_thread::ScriptThread::start::hb46c4910de904afb │ 21: 0x7fc99f9e0914 - std::panicking::try::do_call::ha18c2fc1e2f674e1 │ 22: 0x7fc9a14836da - panic_unwind::__rust_maybe_catch_panic │ at /checkout/src/libpanic_unwind/lib.rs:98 │ 23: 0x7fc99fae5597 - >::call_box::h667d881caee9bfc3 │ 24: 0x7fc9a147b2a4 - alloc::boxed::{{impl}}::call_once<(),()> │ at /checkout/src/liballoc/boxed.rs:650 │ - std::sys_common::thread::start_thread │ at /checkout/src/libstd/sys_common/thread.rs:21 │ - std::sys::imp::thread::{{impl}}::new::thread_start │ at /checkout/src/libstd/sys/unix/thread.rs:84 │ 25: 0x7fc99d450183 - start_thread │ 26: 0x7fc99cf6737c - clone │ 27: 0x0 - └ ERROR:servo: called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }" ▶ CRASH [expected OK] /navigation-timing/nav2_test_open_data_uri.html │ │ VMware, Inc. │ Gallium 0.4 on softpipe │ 3.3 (Core Profile) Mesa 12.0.1 │ ERROR:script::dom::bindings::error: Error at data:text/html;charset=utf-8,%3C%21DOCTYPE%20html%3E%0D%0A%3Ctitle%3Edata%20URL%20source%20for%20navigation-timing%2Fnav2_test_open_data_uri.html%3C%2Ftitle%3E%0D%0A%3C%21--%20NB%3A%20this%20file%20isn%27t%20actually%20used%20any%20where%21%20--%3E%0D%0A%3Clink%20rel%3D%22author%22%20title%3D%22Google%22%20href%3D%22http%3A%2F%2Fwww.google.com%2F%22%20%2F%3E%0D%0A%3Cscript%3E%0D%0Avar%20observer%20%3D%20new%20PerformanceObserver%28%0D%0A%20%20%20%20function%20%28entryList%29%20%7B%0D%0A%20%20%20%20%20%20%20%20parent.postMessage%28%22observed%22%2C%20%22%2A%22%29%3B%0D%0A%20%20%20%20%20%20%20%20observer.disconnect%28%29%3B%0D%0A%20%20%20%20%7D%29%3B%0D%0Aobserver.observe%28%7BentryTypes%3A%20%5B%22navigation%22%5D%7D%29%3B%0D%0A%3C%2Fscript%3E%0D%0A:6:5 PerformanceObserver is not defined │ called `Result::unwrap()` on an `Err` value: Error { repr: Custom(Custom { kind: UnexpectedEof, error: StringError("failed to fill whole buffer") }) } (thread RenderBackend, at /checkout/src/libcore/result.rs:860) │ stack backtrace: │ 0: 0x7f93640e7c2d - backtrace::backtrace::trace::hce6a3819d897a887 │ 1: 0x7f93640e8112 - backtrace::capture::Backtrace::new::hb5a725a088a2a2fc │ 2: 0x7f936300b523 - servo::main::{{closure}}::h9d96b5c32a8afffa │ 3: 0x7f9364f016bd - std::panicking::rust_panic_with_hook │ at /checkout/src/libstd/panicking.rs:550 │ 4: 0x7f9364f01554 - std::panicking::begin_panic │ at /checkout/src/libstd/panicking.rs:511 │ 5: 0x7f9364f01489 - std::panicking::begin_panic_fmt │ at /checkout/src/libstd/panicking.rs:495 │ 6: 0x7f9364f01417 - std::panicking::rust_begin_panic │ at /checkout/src/libstd/panicking.rs:471 │ 7: 0x7f9364f2e47d - core::panicking::panic_fmt │ at /checkout/src/libcore/panicking.rs:69 │ 8: 0x7f936414b10d - core::result::unwrap_failed::h482e2085da99dab3 │ 9: 0x7f936419c017 - webrender::render_backend::RenderBackend::run::h586004cebbd294f6 │ 10: 0x7f936413e957 - std::panicking::try::do_call::h17d08941604712ad │ 11: 0x7f9364f086da - panic_unwind::__rust_maybe_catch_panic │ at /checkout/src/libpanic_unwind/lib.rs:98 │ 12: 0x7f9364155837 - >::call_box::h4111409bfcdae236 │ 13: 0x7f9364f002a4 - alloc::boxed::{{impl}}::call_once<(),()> │ at /checkout/src/liballoc/boxed.rs:650 │ - std::sys_common::thread::start_thread │ at /checkout/src/libstd/sys_common/thread.rs:21 │ - std::sys::imp::thread::{{impl}}::new::thread_start │ at /checkout/src/libstd/sys/unix/thread.rs:84 │ 14: 0x7f9360ed5183 - start_thread │ 15: 0x7f93609ec37c - clone │ 16: 0x0 - │ ERROR:servo: called `Result::unwrap()` on an `Err` value: Error { repr: Custom(Custom { kind: UnexpectedEof, error: StringError("failed to fill whole buffer") }) } └ Pipeline failed in hard-fail mode. Crashing! |
⚡ Previous build results for android, arm32, arm64, linux-dev, linux-rel-css, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev are reusable. Rebuilding only linux-rel-wpt... |
⚡ Previous build results for android, arm32, arm64, linux-dev, linux-rel-css, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev are reusable. Rebuilding only linux-rel-wpt... |
💔 Test failed - linux-rel-wpt |
#14323 again ¯\_(ツ)_/¯ |
@bors-servo: retry |
…=SimonSapin serialize font: to empty on non-default subprops Fixes font shorthand serialization so that it serializes to "" when non-default subproperties are defined. These subproperties are those defined in #15033. Adds tests: - font_should_serialize_to_empty_if_there_are_nondefault_subproperties - font_should_serialize_all_available_properties The second test was previously commented out and underwent some cleanup to make it run. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15036 <!-- Either: --> - [X] There are tests for these changes <!-- 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/15604) <!-- 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-msvc-dev |
…o#16028. r=me MozReview-Commit-ID: 9c8jmRqvVEz
…o#16028: Fix reftest expectation format. r=reftest-fix on a CLOSED TREE --HG-- extra : amend_source : 673cc7490524789c15a9dca831c70b6cfe1fe8c4
…o#16028. r=me MozReview-Commit-ID: 9c8jmRqvVEz
…o#16028: Fix reftest expectation format. r=reftest-fix on a CLOSED TREE
…o#16028. r=me MozReview-Commit-ID: 9c8jmRqvVEz UltraBlame original commit: c6e919aa3aa9d1e73d3e649a1bae7c8488f05554
…o#16028: Fix reftest expectation format. r=reftest-fix on a CLOSED TREE UltraBlame original commit: d81996338334449f47ad72be802f564c3d39a43d
…o#16028. r=me MozReview-Commit-ID: 9c8jmRqvVEz UltraBlame original commit: c6e919aa3aa9d1e73d3e649a1bae7c8488f05554
…o#16028: Fix reftest expectation format. r=reftest-fix on a CLOSED TREE UltraBlame original commit: d81996338334449f47ad72be802f564c3d39a43d
…o#16028. r=me MozReview-Commit-ID: 9c8jmRqvVEz UltraBlame original commit: c6e919aa3aa9d1e73d3e649a1bae7c8488f05554
…o#16028: Fix reftest expectation format. r=reftest-fix on a CLOSED TREE UltraBlame original commit: d81996338334449f47ad72be802f564c3d39a43d
Fixes font shorthand serialization so that it serializes to "" when non-default subproperties are defined. These subproperties are those defined in #15033.
Adds tests:
The second test was previously commented out and underwent some cleanup to make it run.
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsfont
shorthand should be serialized to empty when some of its subproperties have non-default value #15036This change is