Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUse more WebRender types in gfx/display_list. #19782
Conversation
highfive
commented
Jan 16, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jan 16, 2018
|
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
| @@ -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.
This comment has been minimized.
| /// 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.
This comment has been minimized.
|
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. |
|
All comments addressed except for |
|
|
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.
|
Rebased and updated. Copied the MaxRect trait. |
|
This looks great! Thank you for the cleanups. |
|
@bors-servo r+ |
|
|
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 -->
|
|
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 -->
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 -->
pyfisch commentedJan 16, 2018
•
edited by SimonSapin
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