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

Update bounds on NSClipView in setFrame only when frame value has changed #313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

williameveretteggplant
Copy link
Contributor

We are seeing a loop occur where the NSTextFieldCell calls _drawEditorWithFrame:inView: which then calls setFrame: on the NSClipView which then sets the boundsOrigin on the NSClipView based on contrainScrollPoint:. The problem is the constrainScrollPoint: causes the origin to shift by 0.5, so then needsDisplay is set on the clip view, which triggers another draw, and then constrainsScrollPoint: shifts the origin back by 0.5, so it does it again, and again...

The frame being set, however, is the same every time. So this just checks if the frame is actually a new frame, and if not it treats the call as no-op, which is what the super call to setFrame: does.

@fredkiefer
Copy link
Member

Sorry for not repeating. I am still in the process of trying to understand why this could lead to an offset of 0.5. If possible we should try to remove that and not just work around it.

@williameveretteggplant
Copy link
Contributor Author

It converts from one view coordinate system to another. Then it rounds, then it converts back again. If there is an offset of 0.5 between the two view systems you will get that adjustment of 0.5, then it gets adjusted back again. wash, rinse, repeat. Basically, you can't control all the variables in the system to guarantee that it never gets in a loop. The need to guard against it here. Basically, you make the adjustment when you first change the frame. After that, if the frame doesn't change, why go through all that logic again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants