Skip to content

layout: background-origin attribute for gradients - #19568

Merged
bors-servo merged 1 commit into
servo:masterfrom
pyfisch:background-origin-gradients1
Dec 15, 2017
Merged

bors-servo merged 1 commit into
servo:masterfrom
pyfisch:background-origin-gradients1

Conversation

@pyfisch

@pyfisch pyfisch commented Dec 14, 2017 •

Copy link
Copy Markdown
Contributor

Fixes the glitches mentioned in #19554.
Now gradient tiles are placed in the whole bounding box.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes

This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @emilio: components/layout/display_list_builder.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Dec 14, 2017
@mbrubeck mbrubeck assigned mbrubeck and unassigned metajack Dec 14, 2017
@mbrubeck

Copy link
Copy Markdown
Contributor

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 26dfa64 with merge f13ed64...

bors-servo pushed a commit that referenced this pull request Dec 14, 2017
layout: background-origin attribute for gradients

Fixes the glitches mentioned in #19554.
Now gradient tiles are placed in the whole bounding box.

<!-- Please describe your changes on the following line: -->

---
<!-- 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

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/19568)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-rel-css2

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Dec 14, 2017
@mbrubeck

Copy link
Copy Markdown
Contributor

linux-rel-css:

Details

  ▶ TIMEOUT [expected PASS] /css/css-variables/vars-background-shorthand-001.html
  │ 
  │ VMware, Inc.
  │ softpipe
  │ 3.3 (Core Profile) Mesa 17.3.0-devel
  │ attempt to divide by zero (thread LayoutThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(NonZero(NonZero(1))) }, at components/layout/display_list_builder.rs:1431)
  │ stack backtrace:
  │    0:     0x7fdfa15681ac - backtrace::backtrace::trace::h6b0af94f74672f08
  │    1:     0x7fdfa15681e2 - backtrace::capture::Backtrace::new::hbff890d685663b85
  │    2:     0x7fdf9fb63f22 - servo::main::{{closure}}::had33bee6de6d1b98
  │    3:     0x7fdfa216adb5 - std::panicking::rust_panic_with_hook
  │                         at /checkout/src/libstd/panicking.rs:578
  │    4:     0x7fdfa216ac3e - std::panicking::begin_panic<alloc::string::String>
  │                         at /checkout/src/libstd/panicking.rs:538
  │    5:     0x7fdfa216ab3a - std::panicking::begin_panic_fmt
  │                         at /checkout/src/libstd/panicking.rs:522
  │    6:     0x7fdfa216aad2 - std::panicking::rust_begin_panic
  │                         at /checkout/src/libstd/panicking.rs:498
  │    7:     0x7fdfa2190460 - core::panicking::panic_fmt
  │                         at /checkout/src/libcore/panicking.rs:71
  │    8:     0x7fdfa2190386 - core::panicking::panic
  │                         at /checkout/src/libcore/panicking.rs:51
  │    9:     0x7fdf9feeeaaf - <layout::fragment::Fragment as layout::display_list_builder::FragmentDisplayListBuilding>::build_display_list_for_background_gradient::get_first_tile::h2a0f3eb1523778d9
  │   10:     0x7fdf9feee1e7 - <layout::fragment::Fragment as layout::display_list_builder::FragmentDisplayListBuilding>::build_display_list_for_background_gradient::h9f93fc9fe56acef7
  │   11:     0x7fdf9feead65 - <layout::fragment::Fragment as layout::display_list_builder::FragmentDisplayListBuilding>::build_display_list_for_background_if_applicable::hf1e093669a79dd39
  │   12:     0x7fdf9fef3476 - <layout::fragment::Fragment as layout::display_list_builder::FragmentDisplayListBuilding>::build_display_list::h847c7c87b3767ca9
  │   13:     0x7fdf9fede1d2 - <layout::block::BlockFlow as layout::flow::Flow>::build_display_list::h2f65aeb935438ad7
  │   14:     0x7fdf9ff46d62 - layout::traversal::BuildDisplayList::traverse::hbc459f200e07dde6
  │   15:     0x7fdf9ff46da8 - layout::traversal::BuildDisplayList::traverse::hbc459f200e07dde6
  │   16:     0x7fdf9ff46da8 - layout::traversal::BuildDisplayList::traverse::hbc459f200e07dde6
  │   17:     0x7fdf9ff46da8 - layout::traversal::BuildDisplayList::traverse::hbc459f200e07dde6
  │   18:     0x7fdf9ff2bbc9 - layout::sequential::build_display_list_for_subtree::hdd6c42347e78601d
  │   19:     0x7fdf9fe8c1f5 - layout_thread::LayoutThread::compute_abs_pos_and_build_display_list::{{closure}}::hcf36cc529ecdf5b2
  │   20:     0x7fdf9fe997b3 - layout_thread::LayoutThread::perform_post_style_recalc_layout_passes::h0980753df99092d6
  │   21:     0x7fdf9fe9492c - layout_thread::LayoutThread::handle_reflow::he6158bfd6f760a9b
  │   22:     0x7fdf9fe85340 - layout_thread::LayoutThread::handle_request_helper::h8f209e0aa0030ea8
  │   23:     0x7fdf9fe81683 - <layout_thread::LayoutThread as layout_traits::LayoutThreadFactory>::create::{{closure}}::haf3314d84a3b735e
  │   24:     0x7fdf9fde6b57 - std::sys_common::backtrace::__rust_begin_short_backtrace::hf9255409d34ee2c4
  │   25:     0x7fdf9fdef147 - std::panicking::try::do_call::hd0a36f931cc07617
  │   26:     0x7fdfa218629e - panic_unwind::__rust_maybe_catch_panic
  │                         at /checkout/src/libpanic_unwind/lib.rs:101
  │   27:     0x7fdf9fe1ded2 - <F as alloc::boxed::FnBox<A>>::call_box::h4881a72f70974b80
  │   28:     0x7fdfa2161f8b - std::sys_common::thread::start_thread
  │                         at /checkout/src/liballoc/boxed.rs:827
  │                          - std::sys::unix::thread::{{impl}}::new::thread_start
  │                         at /checkout/src/libstd/sys/unix/thread.rs:90
  │   29:     0x7fdf9ec7c183 - start_thread
  │   30:     0x7fdf9d351ffc - clone
  │   31:                0x0 - <unknown>
  │ ERROR:servo: attempt to divide by zero
  │ called `Result::unwrap()` on an `Err` value: RecvError (thread ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(NonZero(NonZero(1))) }, at /checkout/src/libcore/result.rs:906)
  │ stack backtrace:
  │    0:     0x7fdfa15681ac - backtrace::backtrace::trace::h6b0af94f74672f08
  │    1:     0x7fdfa15681e2 - backtrace::capture::Backtrace::new::hbff890d685663b85
  │    2:     0x7fdf9fb63f22 - servo::main::{{closure}}::had33bee6de6d1b98
  │    3:     0x7fdfa216adb5 - std::panicking::rust_panic_with_hook
  │                         at /checkout/src/libstd/panicking.rs:578
  │    4:     0x7fdfa216ac3e - std::panicking::begin_panic<alloc::string::String>
  │                         at /checkout/src/libstd/panicking.rs:538
  │    5:     0x7fdfa216ab3a - std::panicking::begin_panic_fmt
  │                         at /checkout/src/libstd/panicking.rs:522
  │    6:     0x7fdfa216aad2 - std::panicking::rust_begin_panic
  │                         at /checkout/src/libstd/panicking.rs:498
  │    7:     0x7fdfa2190460 - core::panicking::panic_fmt
  │                         at /checkout/src/libcore/panicking.rs:71
  │    8:     0x7fdfa03948e5 - core::result::unwrap_failed::h8e0005e6023ea49f
  │    9:     0x7fdfa07e52d3 - script::dom::window::Window::force_reflow::h2bc49c171e839928
  │   10:     0x7fdfa0857e0d - script::script_thread::ScriptThread::handle_event::hd3e1bba1e93423da
  │   11:     0x7fdfa082a49a - script::script_thread::ScriptThread::handle_msgs::h404502fd62fa14ff
  │   12:     0x7fdfa082a0ab - script::script_thread::ScriptThread::start::h68db47c516b95238
  │   13:     0x7fdf9ffe7e1c - std::sys_common::backtrace::__rust_begin_short_backtrace::h8d9a2717ba6cf586
  │   14:     0x7fdfa007c7d7 - std::panicking::try::do_call::h3a70cc5ee8709dd0
  │   15:     0x7fdfa218629e - panic_unwind::__rust_maybe_catch_panic
  │                         at /checkout/src/libpanic_unwind/lib.rs:101
  │   16:     0x7fdfa0398072 - <F as alloc::boxed::FnBox<A>>::call_box::h5e7f0ad71edfeded
  │   17:     0x7fdfa2161f8b - std::sys_common::thread::start_thread
  │                         at /checkout/src/liballoc/boxed.rs:827
  │                          - std::sys::unix::thread::{{impl}}::new::thread_start
  │                         at /checkout/src/libstd/sys/unix/thread.rs:90
  │   18:     0x7fdf9ec7c183 - start_thread
  │   19:     0x7fdf9d351ffc - clone
  │   20:                0x0 - <unknown>
  └ ERROR:servo: called `Result::unwrap()` on an `Err` value: RecvError

  ▶ FAIL [expected PASS] /_mozilla/mozilla/simple_scroll_to_fragment.html
  └   → /_mozilla/mozilla/simple_scroll_to_fragment.html 2d5103c1d79069b6628ffe931d05456e5b9244b2
/_mozilla/mozilla/simple_scroll_to_fragment_ref.html 7949e80732fa0f4afdbae3b1cad96ccd75bb04f6
Testing 2d5103c1d79069b6628ffe931d05456e5b9244b2 == 7949e80732fa0f4afdbae3b1cad96ccd75bb04f6

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] rgb(calc(100 + 155), 255, 255) (quirks)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] rgb(calc(100 + 155), 255, 255) (almost standards)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] rgb(calc(100 + 155), 255, 255) (standards)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] rgba(calc(100 + 155), 255, 255, 001) (quirks)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] rgba(calc(100 + 155), 255, 255, 001) (almost standards)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] rgba(calc(100 + 155), 255, 255, 001) (standards)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] hsl(calc(050 + 050), 100%, 100%) (quirks)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] hsl(calc(050 + 050), 100%, 100%) (almost standards)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] hsl(calc(050 + 050), 100%, 100%) (standards)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] hsla(calc(050 + 050), 100%, 100%, 001) (quirks)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] hsla(calc(050 + 050), 100%, 100%, 001) (almost standards)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] hsla(calc(050 + 050), 100%, 100%, 001) (standards)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] rgb(calc(/**/100/**/ + /**/155/**/), 255, 255) (quirks)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] rgb(calc(/**/100/**/ + /**/155/**/), 255, 255) (almost standards)

  ▶ Unexpected subtest result in /quirks-mode/hashless-hex-color.html:
  └ PASS [expected FAIL] rgb(calc(/**/100/**/ + /**/155/**/), 255, 255) (standards)

@pyfisch
pyfisch force-pushed the background-origin-gradients1 branch from 26dfa64 to 5a3c827 Compare December 15, 2017 09:21
@pyfisch

pyfisch commented Dec 15, 2017

Copy link
Copy Markdown
Contributor Author

Fixed the zero division bug.

@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Dec 15, 2017
@pyfisch

pyfisch commented Dec 15, 2017

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 5a3c827 with merge be8d66b...

bors-servo pushed a commit that referenced this pull request Dec 15, 2017
layout: background-origin attribute for gradients

Fixes the glitches mentioned in #19554.
Now gradient tiles are placed in the whole bounding box.

<!-- Please describe your changes on the following line: -->

---
<!-- 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

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/19568)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

@mbrubeck mbrubeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks! A couple of minor things below:

}

bounds.origin.x = bounds.origin.x + bg_position_x.to_used_value(bounds.size.width);
bounds.origin.y = bounds.origin.y + bg_position_y.to_used_value(bounds.size.height);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change all the above code to use += and -= operators, instead of a = a + b?

I know the previous code used the long form, but I find the += form much easier to read and review.

// * tile is the length of the "tile"
// Returns a difference between start and new start.
// It holds that base - tile < start - diff <= base
fn get_first_tile(base: i32, start: i32, tile: i32) -> i32 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should take and return Au instead of i32. This would be more straightforward with servo/app_units#40.

@pyfisch
pyfisch force-pushed the background-origin-gradients1 branch from 5a3c827 to 6695141 Compare December 15, 2017 20:19
@pyfisch

pyfisch commented Dec 15, 2017

Copy link
Copy Markdown
Contributor Author

updated

use dom_struct::dom_struct;
#[cfg(all(any(target_os = "macos", target_os = "linux"), not(any(target_arch = "arm", target_arch = "aarch64"))))]
use gecko_media::{CanPlayType, GeckoMedia};
//#[cfg(all(any(target_os = "macos", target_os = "linux"), not(any(target_arch = "arm", target_arch = "aarch64"))))]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes should be reverted.

Fixes the glitches mentioned in servo#19554.
Now gradient tiles are placed in the whole bounding box.
@pyfisch
pyfisch force-pushed the background-origin-gradients1 branch from 6695141 to b0492f5 Compare December 15, 2017 21:17
@pyfisch

pyfisch commented Dec 15, 2017

Copy link
Copy Markdown
Contributor Author

Removed files accidentally committed.

@mbrubeck mbrubeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbrubeck

Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit b0492f5 has been approved by mbrubeck

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Dec 15, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit b0492f5 with merge dbfcb7b...

bors-servo pushed a commit that referenced this pull request Dec 15, 2017
layout: background-origin attribute for gradients

Fixes the glitches mentioned in #19554.
Now gradient tiles are placed in the whole bounding box.

<!-- Please describe your changes on the following line: -->

---
<!-- 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

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/19568)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: mbrubeck
Pushing dbfcb7b to master...

@bors-servo
bors-servo merged commit b0492f5 into servo:master Dec 15, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 15, 2017
@pyfisch
pyfisch deleted the background-origin-gradients1 branch December 16, 2017 08:54
jdm pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 4, 2018
Fixes the glitches mentioned in #19554.
Now gradient tiles are placed in the whole bounding box.

Upstreamed from servo/servo#19568 [ci skip]
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

Successfully merging this pull request may close these issues.

5 participants