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

[ASImageNode] Enable .clipsToBounds by default (fix .cornerRadius, GIFs overflow). #466

Merged
merged 3 commits into from
Aug 20, 2017

Conversation

appleguy
Copy link
Member

We've seen a number of bugs reported over time that .cornerRadius didn't work on
ASNetworkImageNode. This wasn't much of a concern because cornerRadius is very
inefficient anyway, and there are better ways to round corners, but it should
certainly work.

It turns out that clipsToBounds has been off for images, and this ultimately
was behind another issue recently seen where decoded GIFs would spill outside
the bounds area to overlap nearby content.

Although there is some risk of behavior change from this, I think the risk
is fairly small, and in most cases it will probably fix behaviors in a way
that doesn't cause problems for the app.

We should consider if this property should be on for all ASDisplayNodes,
but for now it would be a great step to be confident it's on for all
ASImageNodes.

One of the reports of this issue:
facebookarchive/AsyncDisplayKit#490

…Fs overflow).

We've seen a number of bugs reported over time that .cornerRadius didn't work on
ASNetworkImageNode. This wasn't much of a concern because cornerRadius is very
inefficient anyway, and there are better ways to round corners, but it should
certainly work.

It turns out that clipsToBounds has been off for images, and this ultimately
was behind another issue recently seen wehre decoded GIFs would spill outside
the bounds area to overlap nearby content.

Although there is some risk of behavior change from this, I think the risk
is fairly small, and in most cases it will probably fix behaviors in a way
that doesn't cause problems for the app.

We should consider if this property should be on for all ASDisplayNodes,
but for now it would be a great step to be confident it's on for all
ASImageNodes.
Copy link
Contributor

@maicki maicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm generally fine and as @appleguy said the impact should be reasonable small and the behavior is mostly the one you would like to have. @appleguy just curious is there any performance impact having this property set to YES?

It would differ to the UIKit behavior, if we would enable it for ASDisplayNode though. The interesting thing is that UILabel also overwrites this property and changes it to yes by default. UILabel has this documented, so would be great if we would explicitly document that at least in the header of ASImageNode.

@Adlai-Holler
Copy link
Member

Concur with Michael this is a reasonable move, with an assumption that clipsToBounds is pretty fast unless you're masking/rounding corners. But we should document the different default. At first blush I would support generalizing this to ASDisplayNode on that same assumption – having content spill over the bounds should be the exception not the rule.

@appleguy appleguy merged commit 65fabf4 into master Aug 20, 2017
@appleguy appleguy deleted the ImageNodeClips branch August 20, 2017 10:17
@appleguy
Copy link
Member Author

appleguy commented Oct 16, 2017 via email

bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…Fs overflow). (TextureGroup#466)

* [ASImageNode] Enable .clipsToBounds by default (fix .cornerRadius, GIFs overflow).

We've seen a number of bugs reported over time that .cornerRadius didn't work on
ASNetworkImageNode. This wasn't much of a concern because cornerRadius is very
inefficient anyway, and there are better ways to round corners, but it should
certainly work.

It turns out that clipsToBounds has been off for images, and this ultimately
was behind another issue recently seen wehre decoded GIFs would spill outside
the bounds area to overlap nearby content.

Although there is some risk of behavior change from this, I think the risk
is fairly small, and in most cases it will probably fix behaviors in a way
that doesn't cause problems for the app.

We should consider if this property should be on for all ASDisplayNodes,
but for now it would be a great step to be confident it's on for all
ASImageNodes.

* Update changelog for ImageNode Clipping.
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.

3 participants