Skip to content

Implement correct corner clipping for background color - #19675

Merged
bors-servo merged 1 commit into
servo:masterfrom
pyfisch:issue19649
Jan 3, 2018
Merged

bors-servo merged 1 commit into
servo:masterfrom
pyfisch:issue19649

Conversation

@pyfisch

@pyfisch pyfisch commented Jan 2, 2018 •

Copy link
Copy Markdown
Contributor

Add one regression ref test.

See also #19649


  • ./mach build -d does not report any errors

  • ./mach test-tidy does not report any errors

  • There are tests for these changes


This change is Reviewable

@highfive

highfive commented Jan 2, 2018

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @emilio: components/layout/display_list_builder.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 2, 2018
@pyfisch

pyfisch commented Jan 2, 2018

Copy link
Copy Markdown
Contributor Author

r? @emilio

@bors-servo try

I need help to also support background images. They already have a clip from CSS as a local clip and the corner clipping should attach another clip. How is this best done?

@highfive highfive assigned emilio and unassigned mbrubeck Jan 2, 2018
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 528214c with merge 3276785...

bors-servo pushed a commit that referenced this pull request Jan 2, 2018
Implement correct corner clipping for background color

Add one regression ref test.

See also #19649

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

- [x] There are tests for these changes

<!-- 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/19675)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

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

LGTM with those comments addressed. Thanks a lot!


fn calculate_inner_border_radii(
mut radii: BorderRadii<Au>,
offsets: SideOffsets2D<Au>)

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.

nit:

) -> BorderRadii<Au> {

height: 80px;
border: 20px blue solid;
border-top-right-radius: 20px;
background-color: red;

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.

Consider using a color other than red for the test? red is usually used to signal failure.

</style>
<body>
<div id="a"></div>
<div id="shield"></div>

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.

Maybe the shield comment is useful here too?

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.

Well, I guess there's no corner to hide here, so nbd, please ignore this comment.

@emilio

emilio commented Jan 3, 2018

Copy link
Copy Markdown
Member

I need help to also support background images. They already have a clip from CSS as a local clip and the corner clipping should attach another clip. How is this best done?

I think @mrobinson can help you faster than I can, but I can try to look into it if he is busy :)

@mrobinson

Copy link
Copy Markdown
Member

@pyfisch The right way to do this in WebRender world is to make the corner clip a child of the CSS clip and to ensure that display items for the border use that new clip in the clipping part of their ClipAndScrollInfo. I'm not sure how easy that is to do with our current setup, but creating clips during display list building will be important for the future in order to allow removing the rounded corner API for local clips.

@pyfisch

pyfisch commented Jan 3, 2018

Copy link
Copy Markdown
Contributor Author

Comments addressed.

The shield basically hides the rounded outer border. This is needed because the background usually covers the whole border-box and ends at the same line as the border. Due to anti aliasing the background shines through at this line and causes slightly different output for both the test and the reference.

In current servo some white is visible between border and background. After this patch there is no more white.

test
ref

fn calculate_inner_border_radii(
mut radii: BorderRadii<Au>,
offsets: SideOffsets2D<Au>
) -> BorderRadii<Au> {

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.

Minor nit:

I think the indentation @emilio means is

fn calculate_inner_border_radii(
    mut radii: BorderRadii<Au>,
    offsets: SideOffsets2D<Au>
) -> BorderRadii<Au> {

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.

Yeah, that's right, that's the indentation rustfmt would use for multi-line functions.

@pyfisch

pyfisch commented Jan 3, 2018

Copy link
Copy Markdown
Contributor Author

Changed indentation.

@emilio

emilio commented Jan 3, 2018

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit b3b49e3 has been approved by emilio

@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 3, 2018
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit b3b49e3 with merge ef42465...

bors-servo pushed a commit that referenced this pull request Jan 3, 2018
Implement correct corner clipping for background color

Add one regression ref test.

See also #19649

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

- [x] There are tests for these changes

<!-- 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/19675)
<!-- 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: emilio
Pushing ef42465 to master...

@bors-servo
bors-servo merged commit b3b49e3 into servo:master Jan 3, 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 3, 2018
@pyfisch
pyfisch deleted the issue19649 branch January 3, 2018 20:17
nox pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 10, 2018
Add one regression ref test.

See also #19649

Upstreamed from servo/servo#19675 [ci skip]
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.

7 participants