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

Use more WebRender types in gfx/display_list. #19782

Merged
merged 2 commits into from Jan 18, 2018
Merged

Conversation

@pyfisch
Copy link
Contributor

pyfisch commented Jan 16, 2018

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

highfive commented Jan 16, 2018

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

highfive commented Jan 16, 2018

warning Warning warning

  • These commits modify gfx and layout code, but no tests are modified. Please consider adding a test!
@emilio emilio requested a review from mrobinson Jan 16, 2018
Copy link
Member

mrobinson left a comment

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.

@@ -423,7 +423,11 @@ impl BaseDisplayItem {
node: OpaqueNode(0),
pointing: None,
},
local_clip: LocalClip::from(max_rect().to_rectf()),
// Create a rectangle of maximal size.
local_clip: LocalClip::from(LayoutRect::new(

This comment has been minimized.

@mrobinson

mrobinson Jan 16, 2018

Member

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

This comment has been minimized.

@pyfisch

pyfisch Jan 16, 2018

Author Contributor

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

Maybe this trait should instead live in euclid?

This comment has been minimized.

@mrobinson

mrobinson Jan 16, 2018

Member

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


/// 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,

This comment has been minimized.

@mrobinson

mrobinson Jan 16, 2018

Member

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.

/// True if gradient repeats infinitly.
pub repeating: bool,
/// Whether the gradient is repeated or clamped.
pub extend: webrender_api::ExtendMode,

This comment has been minimized.

@mrobinson

mrobinson Jan 16, 2018

Member

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.

@@ -370,6 +370,14 @@ fn convert_gradient_stops(gradient_items: &[GradientItem], total_length: Au) ->
stops
}

fn as_gradient_extend(repeating: bool) -> ExtendMode {

This comment has been minimized.

@mrobinson

mrobinson Jan 16, 2018

Member

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 {

This comment has been minimized.

@mrobinson

mrobinson Jan 16, 2018

Member

Again, I'd say just import NormalBorder directly.

@@ -1374,20 +1378,31 @@ impl FragmentDisplayListBuilding for Fragment {
display_list_section,
);

let radius_tmp = build_border_radius(&bounds, border_style_struct);

This comment has been minimized.

@mrobinson

mrobinson Jan 16, 2018

Member

Why not just call this radius or border_radius?

/// True if gradient repeats infinitly.
pub repeating: bool,
/// Whether the gradient is repeated or clamped.
pub extend: webrender_api::ExtendMode,

This comment has been minimized.

@mrobinson

mrobinson Jan 16, 2018

Member

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

@mrobinson
Copy link
Member

mrobinson commented Jan 16, 2018

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 force-pushed the pyfisch:dl-simple branch from a4c3ff6 to a1adc9e Jan 16, 2018
@pyfisch
Copy link
Contributor Author

pyfisch commented Jan 16, 2018

All comments addressed except for max_rect.

@pyfisch pyfisch force-pushed the pyfisch:dl-simple branch from a1adc9e to 3f168cc Jan 16, 2018
@bors-servo
Copy link
Contributor

bors-servo commented Jan 17, 2018

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

pyfisch added 2 commits Jan 12, 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 force-pushed the pyfisch:dl-simple branch from 0ffe5d8 to af52233 Jan 17, 2018
@pyfisch
Copy link
Contributor Author

pyfisch commented Jan 17, 2018

Rebased and updated. Copied the MaxRect trait.

@jdm jdm removed the S-needs-rebase label Jan 18, 2018
Copy link
Member

mrobinson left a comment

This looks great! Thank you for the cleanups.

@mrobinson
Copy link
Member

mrobinson commented Jan 18, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jan 18, 2018

📌 Commit af52233 has been approved by mrobinson

@bors-servo
Copy link
Contributor

bors-servo commented Jan 18, 2018

Testing commit af52233 with merge aee0d69...

bors-servo added 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
Contributor

bors-servo commented Jan 18, 2018

@bors-servo bors-servo merged commit af52233 into servo:master Jan 18, 2018
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@bors-servo bors-servo mentioned this pull request Jan 18, 2018
5 of 5 tasks complete
@pyfisch pyfisch deleted the pyfisch:dl-simple branch Jan 18, 2018
bors-servo added 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 added 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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

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