Skip to content

Use more WebRender types in gfx/display_list. - #19782

Merged
bors-servo merged 2 commits into
servo:masterfrom
pyfisch:dl-simple
Jan 18, 2018
Merged

bors-servo merged 2 commits into
servo:masterfrom
pyfisch:dl-simple

Conversation

@pyfisch

@pyfisch pyfisch commented Jan 16, 2018 •

Copy link
Copy Markdown
Contributor

Use more WebRender types in gfx/display_list.
This uses floating-point (Layout) coordinates in where possible.
Replace NormalBorder struct with WebRender equivalent.
Remove ToPointF and ToRectF traits.
Convert border RepeatKeyword with ToLayout.
Add some definitions to malloc_size_of for WebRender types.


This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @emilio: components/layout/display_list/webrender_helpers.rs, components/layout/display_list/builder.rs, components/layout/display_list/conversions.rs, components/layout/display_list/background.rs

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify gfx and layout code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 16, 2018
@emilio
emilio requested a review from mrobinson January 16, 2018 10:02

@mrobinson mrobinson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is great work! I'm really glad to see us moving iteratively toward building a WebRender display list directly. In general, this looks very good to me, but I have a few comments on some minor details that would be good to change.

Comment thread components/gfx/display_list/mod.rs Outdated
},
local_clip: LocalClip::from(max_rect().to_rectf()),
// Create a rectangle of maximal size.
local_clip: LocalClip::from(LayoutRect::new(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It probably makes sense to implement max_rect for LayoutRect if we can. Perhaps this can be a trait.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is a trait MaxRect in webrender but I can't use it from servo.

Maybe this trait should instead live in euclid?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it makes sense to at least copy the trait from WebRender and replace max_rect with it.

Comment thread components/gfx/display_list/mod.rs Outdated
/// The algorithm we should use to stretch the image. See `image_rendering` in CSS-IMAGES-3 §
/// 5.3.
pub image_rendering: image_rendering::T,
pub image_rendering: webrender_api::ImageRendering,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are importing the other webrender_api types directly in this file, so we should probably be consistent here and import ImageRendering directly as well.

Comment thread components/gfx/display_list/mod.rs Outdated
/// True if gradient repeats infinitly.
pub repeating: bool,
/// Whether the gradient is repeated or clamped.
pub extend: webrender_api::ExtendMode,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same comment here and other places in the file as well. I would also call this extend_mode in order to make the code more readable.

stops
}

fn as_gradient_extend(repeating: bool) -> ExtendMode {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably better to call this as as_gradient_extend_mode since, in my opinion, it makes it more obvious what this function does.

fn simple_normal_border(
color: ColorF,
style: webrender_api::BorderStyle,
) -> webrender_api::NormalBorder {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Again, I'd say just import NormalBorder directly.

display_list_section,
);

let radius_tmp = build_border_radius(&bounds, border_style_struct);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not just call this radius or border_radius?

Comment thread components/gfx/display_list/mod.rs Outdated
/// True if gradient repeats infinitly.
pub repeating: bool,
/// Whether the gradient is repeated or clamped.
pub extend: webrender_api::ExtendMode,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would cal this extend_mode in order to make the code more readable.

@mrobinson

Copy link
Copy Markdown
Member

I would also go ahead and title this commit 'Use more WebRender types in gfx/display_list' since I think that's a really excellent summary of what it does.

@pyfisch pyfisch changed the title Cleanup Display List Use more WebRender types in gfx/display_list. Jan 16, 2018
@pyfisch

pyfisch commented Jan 16, 2018

Copy link
Copy Markdown
Contributor Author

All comments addressed except for max_rect.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #19780) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jan 17, 2018
This uses floating-point (Layout) coordinates in where possible.
Replace NormalBorder struct with WebRender equivalent.
Remove ToPointF and ToRectF traits.
Convert border RepeatKeyword with ToLayout.
Add some definitions to malloc_size_of for WebRender types.
It is implemented for LayoutRect and Rect<Au>.
Replaces the max_rect() function from servo_geometry.
@pyfisch

pyfisch commented Jan 17, 2018

Copy link
Copy Markdown
Contributor Author

Rebased and updated. Copied the MaxRect trait.

@jdm jdm removed the S-needs-rebase There are merge conflict errors. label Jan 18, 2018

@mrobinson mrobinson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great! Thank you for the cleanups.

@mrobinson

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit af52233 has been approved by mrobinson

@highfive highfive assigned mrobinson and unassigned Manishearth Jan 18, 2018
@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 Jan 18, 2018
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit af52233 with merge aee0d69...

bors-servo pushed a commit that referenced this pull request Jan 18, 2018
Use more WebRender types in gfx/display_list.

Use more WebRender types in gfx/display_list.
This uses floating-point (Layout) coordinates in where possible.
Replace NormalBorder struct with WebRender equivalent.
Remove ToPointF and ToRectF traits.
Convert border RepeatKeyword with ToLayout.
Add some definitions to malloc_size_of for WebRender types.

<!-- 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/19782)
<!-- 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: mrobinson
Pushing aee0d69 to master...

@bors-servo
bors-servo merged commit af52233 into servo:master Jan 18, 2018
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 18, 2018
@bors-servo bors-servo mentioned this pull request Jan 18, 2018
5 tasks done
@pyfisch
pyfisch deleted the dl-simple branch January 18, 2018 14:22
bors-servo pushed a commit that referenced this pull request Jan 20, 2018
Use more WebRender types in gfx

Removes ImageBorder details from gfx.
Use WebRender BorderRadius in BoxShadow.
Stores cursors as integer.
Use FilterOp, BorderWidths from WebRender.
Store content_rect as LayoutRect.

This amends #19782.

<!-- 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/19824)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Jan 30, 2018
Use more WebRender types in gfx

Removes ImageBorder details from gfx.
Use WebRender BorderRadius in BoxShadow.
Stores cursors as integer.
Use FilterOp, BorderWidths from WebRender.
Store content_rect as LayoutRect.

This amends #19782.

<!-- 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/19824)
<!-- Reviewable:end -->
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.

6 participants