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

Background follow ups #25594

Merged
merged 10 commits into from Jan 25, 2020
Merged

Background follow ups #25594

merged 10 commits into from Jan 25, 2020

Conversation

@SimonSapin
Copy link
Member

SimonSapin commented Jan 24, 2020

  • Fix background-clip + border-radius
  • Fix background-clip + background-color
  • Render linear and radial gradients
  • Enable css/css-background/ in WPT
@SimonSapin SimonSapin added this to In progress in Layout 2020 via automation Jan 24, 2020
@highfive
Copy link

highfive commented Jan 24, 2020

Heads up! This PR modifies the following files:

  • @jgraham: tests/wpt/metadata-layout-2020/css/css-backgrounds/background-size/vector/tall--cover--percent-width-omitted-height-viewbox.html.ini, tests/wpt/metadata-layout-2020/css/css-backgrounds/background-size/vector/background-size-vector-006.html.ini, tests/wpt/metadata-layout-2020/css/css-backgrounds/background-size/vector/tall--cover--nonpercent-width-nonpercent-height-viewbox.html.ini, tests/wpt/metadata-layout-2020/css/css-backgrounds/background-size/vector/background-size-vector-008.html.ini, tests/wpt/metadata-layout-2020/css/css-backgrounds/parsing/border-image-width-computed.html.ini and 325 more
Copy link
Member

mrobinson left a comment

This looks pretty good to me modulo a few small doubts.

use style::values::specified::background::BackgroundRepeatKeyword as Repeat;
use webrender_api::{self as wr, units};

pub(super) struct Layer {

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 24, 2020

Member

Layer is pretty overloaded name. Maybe something like BackgroundLayer would be a bit less opaque?

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Jan 25, 2020

Author Member

Done.


/// Abstract over the horizontal or vertical dimension
/// Coordinates (0, 0) for the purpose of this function are the positioning area’s origin.
fn layout_1d(

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 24, 2020

Member

Perhaps it makes sense to make this a factory method for Layout1DResult?

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Jan 25, 2020

Author Member

I think that would be slightly nicer API design, but perhaps not worth the rightwards drift for a private function called exactly twice

tile_size: &mut f32,
tile_spacing: &mut f32,
mut repeat: Repeat,
Comment on lines 181 to 183

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 24, 2020

Member

Any reason to have input/output parameters and a return struct here instead of simply returning these values in Layout1DResult?

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Jan 25, 2020

Author Member

I’ve done so for tile_spacing but kept tile_size since it already has a non-trivial value before this call and is only sometimes modified.


// `{ x, y }` is now a vector of arbitrary length
// with the same direction as the gradient line.

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 24, 2020

Member

Extra line here?

}

/// https://drafts.csswg.org/css-images-4/#color-stop-fixup
fn stops_fixup(

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 24, 2020

Member

Maybe name this fixup_stops to make the function name a verb?

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Jan 25, 2020

Author Member

Done

}

fn content_edge_clip(&self, builder: &mut DisplayListBuilder) -> Option<wr::ClipId> {
*self.content_edge_clip_id.init_once(|| {

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 24, 2020

Member

Nice use of init_once here and above!

}

fn build(&mut self, builder: &mut DisplayListBuilder) {
let hit_info = hit_info(&self.fragment.style, self.fragment.tag, Cursor::Default);
if hit_info.is_some() {
let mut common = builder.common_properties(self.border_rect);
common.hit_info = hit_info;
self.with_border_edge_clip(builder, &mut common);
if let Some(clip_id) = self.border_edge_clip(builder) {

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 24, 2020

Member

At some point it would be good to keep a stack of clips and spatial node ids, but for the moment I don't think it's necessary.

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Jan 25, 2020

Author Member

Yes, having that stack on the call stack is the idea of:

// FIXME: use this for the `overflow` property or anything else that clips an entire subtree.
#[allow(unused)]
fn clipping_and_scrolling_scope<R>(&mut self, f: impl FnOnce(&mut Self) -> R) -> R {
let previous = self.current_space_and_clip;
let result = f(self);
self.current_space_and_clip = previous;
result
}

… which I copied from Layout 2013 code, but ended up not using for backgrounds because each background layer has a potentially-different background-clip value that only applies to one display item, so pushing/popping to the stack isn’t as useful.

@SimonSapin
Copy link
Member Author

SimonSapin commented Jan 25, 2020

@bors-servo r=mrobinson

@bors-servo
Copy link
Contributor

bors-servo commented Jan 25, 2020

📌 Commit 923cddf has been approved by mrobinson

@bors-servo
Copy link
Contributor

bors-servo commented Jan 25, 2020

Testing commit 37ccefb with merge d9cd4ab...

bors-servo added a commit that referenced this pull request Jan 25, 2020
Background follow ups

* Fix `background-clip` + `border-radius`
* Fix `background-clip` + `background-color`
* Render linear and radial gradients
* Enable `css/css-background/` in WPT
@bors-servo
Copy link
Contributor

bors-servo commented Jan 25, 2020

☀️ Test successful - status-taskcluster
State: approved= try=False

@jdm
Copy link
Member

jdm commented Jan 25, 2020

@bors-servo retry

@jdm
Copy link
Member

jdm commented Jan 25, 2020

@jdm
Copy link
Member

jdm commented Jan 25, 2020

@jdm
Copy link
Member

jdm commented Jan 25, 2020

@bors-servo r=mrobinson

@bors-servo
Copy link
Contributor

bors-servo commented Jan 25, 2020

📌 Commit 37ccefb has been approved by mrobinson

@bors-servo
Copy link
Contributor

bors-servo commented Jan 25, 2020

Testing commit 37ccefb with merge 31eafad...

bors-servo added a commit that referenced this pull request Jan 25, 2020
Background follow ups

* Fix `background-clip` + `border-radius`
* Fix `background-clip` + `background-color`
* Render linear and radial gradients
* Enable `css/css-background/` in WPT
@bors-servo
Copy link
Contributor

bors-servo commented Jan 25, 2020

☀️ Test successful - status-taskcluster
Approved by: mrobinson
Pushing 31eafad to master...

@bors-servo bors-servo merged commit 37ccefb into master Jan 25, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
Layout 2020 automation moved this from In progress to Merged / resolved Jan 25, 2020
@bors-servo bors-servo deleted the gradient branch Jan 25, 2020
@SimonSapin
Copy link
Member Author

SimonSapin commented Jan 25, 2020

What happened, here? https://community-tc.services.mozilla.com/tasks/groups/afsyHI-hQuC1cMli-ibEQQ was all green and d9cd4ab got a green Status but it wasn’t merged. Did Homu drop it on the floor?

(After the second r+ Homu made an other merge commit 31eafad and https://community-tc.services.mozilla.com/tasks/groups/dvO_ldpRSwmaBBVTrhc06w re-used successful tasks from the previous task group, as intended.)

@jdm
Copy link
Member

jdm commented Jan 25, 2020

I looked at all of the webhooks and github did not report having problems delivering all of them. The homu log on servo-master1 didn't show any useful information. It's a mystery!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Layout 2020
  
Merged / resolved
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.