Skip to content

Implement support for (most of) border-image. - #895

Merged
bors-servo merged 3 commits into
servo:masterfrom
glennw:border-image
Feb 22, 2017
Merged

bors-servo merged 3 commits into
servo:masterfrom
glennw:border-image

Conversation

@glennw

@glennw glennw commented Feb 17, 2017 •

Copy link
Copy Markdown
Member

Add support for borders that use:

  • border-image-source (images only, not gradients yet).
  • border-image-slice
  • border-image-repeat (repeat + stretch only, for now).
  • border-image-outset

The major part of the work is supporting sub-rects when drawing images.

The rest of the work is simply generating image primitives from the
border-image display item description.


This change is Reviewable

@glennw

glennw commented Feb 17, 2017

Copy link
Copy Markdown
Member Author

r? @kvark

cc @jrmuizel

This will also need a version number bump once all comments are addressed, before it can be landed.

The corresponding Servo patch is here if you want to do some testing with it: https://github.com/glennw/servo/tree/border-image

@jrmuizel

Copy link
Copy Markdown
Collaborator

I had a quick look at this and it looks good to me.

@kvark kvark 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.

Did the first pass

Comment thread webrender/src/frame_builder.rs Outdated
BorderDetails::Image(ref border) => {
// Calculate the modified rect as specific by border-image-outset
let origin = LayerPoint::new(rect.origin.x - border.outset.left,
rect.origin.x - border.outset.top);

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.

was this meant to be rect.origin.y - border.outset.top?

repeat_vertical: RepeatMode) -> ImageBorderSegment {
let tile_spacing = LayerSize::zero();

let image_size = LayerSize::new(sub_rect.uv1.x - sub_rect.uv0.x,

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.

does it handle uv1 < uv0 case correctly?

Add support for borders that use:
 * border-image-source (images only, not gradients yet).
 * border-image-slice
 * border-image-repeat (repeat + stretch only, for now).
 * border-image-outset

The major part of the work is supporting sub-rects when drawing images.

The rest of the work is simply generating image primitives from the
border-image display item description.
@glennw

glennw commented Feb 19, 2017

Copy link
Copy Markdown
Member Author

@kvark Thanks! Fixed those issues and rebased. With the corresponding Servo PR, this adds 13 new test passes and no new failures.

@jrmuizel jrmuizel mentioned this pull request Feb 20, 2017

@kvark kvark 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.

I wonder how you are not facing the snapping problem @nical got when splitting stuff into sub-rectangles. I have a solution, going to implement it right after finishing a bit of reviews, including the vector PR.

@glennw

glennw commented Feb 21, 2017

Copy link
Copy Markdown
Member Author

@bors-servo r=kvark

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 8ea8410 has been approved by kvark

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 8ea8410 with merge 49aa9f5...

bors-servo pushed a commit that referenced this pull request Feb 21, 2017
Implement support for (most of) border-image.

Add support for borders that use:
 * border-image-source (images only, not gradients yet).
 * border-image-slice
 * border-image-repeat (repeat + stretch only, for now).
 * border-image-outset

The major part of the work is supporting sub-rects when drawing images.

The rest of the work is simply generating image primitives from the
border-image display item description.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/895)
<!-- Reviewable:end -->
@kvark

kvark commented Feb 21, 2017

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 403b44b has been approved by kvark

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 403b44b with merge 4ac616a...

bors-servo pushed a commit that referenced this pull request Feb 22, 2017
Implement support for (most of) border-image.

Add support for borders that use:
 * border-image-source (images only, not gradients yet).
 * border-image-slice
 * border-image-repeat (repeat + stretch only, for now).
 * border-image-outset

The major part of the work is supporting sub-rects when drawing images.

The rest of the work is simply generating image primitives from the
border-image display item description.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/895)
<!-- Reviewable:end -->
@glennw

glennw commented Feb 22, 2017

Copy link
Copy Markdown
Member Author

@bors-servo r=kvark

(Fixed a tidy error).

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 7b377ac has been approved by kvark

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 7b377ac with merge e41f141...

bors-servo pushed a commit that referenced this pull request Feb 22, 2017
Implement support for (most of) border-image.

Add support for borders that use:
 * border-image-source (images only, not gradients yet).
 * border-image-slice
 * border-image-repeat (repeat + stretch only, for now).
 * border-image-outset

The major part of the work is supporting sub-rects when drawing images.

The rest of the work is simply generating image primitives from the
border-image display item description.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/895)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - status-travis
Approved by: kvark
Pushing e41f141 to master...

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