Page MenuHomePhabricator

Bug 1606771 - Implement border-image-repeat: round in WebRender. r=mstange
ClosedPublic

Authored by nical on Jan 9 2020, 5:13 PM.

Details

Summary

border-image-repeat: Round is equivalent to Repeat with the pattern size adjusted to fill the area with a whole number of repetitions. This is done by adjusting the segment's stretch_size in the shader so that it fits a whole number of times in the segment's size.

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

nical created this revision.Jan 9 2020, 5:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2020, 5:13 PM
phab-bot requested review of this revision.Jan 9 2020, 5:13 PM
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: Restricted Project.
jrmuizel requested changes to this revision.Jan 9 2020, 5:42 PM

Can you add a better commit message?

This revision now requires changes to proceed.Jan 9 2020, 5:42 PM
kvark accepted this revision.Jan 9 2020, 5:52 PM
kvark added a subscriber: kvark.
kvark added inline comments.
gfx/wr/webrender/res/brush.glsl
115–117

do I understand correctly that each axis is basically:

enum Repeat {
  No,
  Yes,
  YesRounded,
}
gfx/wr/webrender/res/brush_image.glsl
129

if the stretch size is bigger than the segment rect, the desired behavior is stretching the image to the available size, as opposed to culling it?

gfx/wr/webrender/src/border.rs
1354–1356

now that we allow uv1 == uv0, we need to double-check if the shader isn't going to go crazy with some division by zero

nical added inline comments.Jan 9 2020, 11:46 PM
gfx/wr/webrender/res/brush.glsl
115–117

Yes for now, and there will be also YesSpaced in the future.

gfx/wr/webrender/res/brush_image.glsl
129

That is my understanding.

gfx/wr/webrender/src/border.rs
1354–1356

As far as I understand, div by zero in a vertex shader effectively discards the triangle which wouldn't be a bad outcome if the uv rect is empty.

nical updated this revision to Diff 216967.Jan 13 2020, 11:44 AM

Revision updated.

nical updated this revision to Diff 217793.Jan 14 2020, 5:25 PM

Revision updated.

jrmuizel accepted this revision.Jan 15 2020, 10:30 PM

Not sure if I'm block here but the gecko parts look good.

This revision is now accepted and ready to land.Jan 15 2020, 10:30 PM
nical updated this revision to Diff 220129.Jan 21 2020, 11:11 AM

Revision updated.

nical retitled this revision from Bug 1606771 - Implement border-image-repeat: round in WebRender. r=jrmuizel to Bug 1606771 - Implement border-image-repeat: round in WebRender. r=mstange.Jan 21 2020, 11:11 AM
nical updated this revision to Diff 221258.Jan 22 2020, 11:17 PM

Revision updated.

nical updated this revision to Diff 221543.Jan 23 2020, 2:19 PM

Revision updated.