Skip to content


CPScrollView adjusts documentView's origin incorrectly on CPScrollView resize #1674

bradytrix opened this Issue · 9 comments

5 participants


When a CPScrollView is created in IB, and its autosizing is set in such a way that the CPScrollView will change its height when the window changes height, the CPScrollView will adjust the origin of its documentView when the CPScrollView's height changes. This is not how the NSScrollView will behave when working from the same NIB.

My guess is that this is related to nib2cib's attempt to swap the autosizing mask flags for the browser's coordinate system. I say that because of the fix (below)...

How to reproduce:

1) Create new project with capp with the NIB template: "capp gen -t NibApplication bugTest", listen to the project with XcodeCapp, and open the project in Xcode/IB

2) Add an NSScrollView to the NIB, and under Autosizing, attach the view to the TOP, BOTTOM, and LEFT. Also, make the Height sizable so that the view will grow/shrink when the window's height changes.

3) Create an NSImageView that will become the document view. Choose a tall image for the imageView's content obviously so that scrolling will be tested appropriately. (Don't add the NSImageView as a subview of the NSScrollView in IB, just leave it as a root-level object, and we'll set it as the documentView in code.) Set the NSImageView's autosize mask thusly: attach to TOP and LEFT (should be the default).

4) Create outlets for the NSScrollView and NSImageView in the app controller and hook them up.

5) In the app controller, inside of awakeFromCib, set the imageView as the documentView of the scrollView. Also be sure to tell the scrollView setHasVerticalScroller:YES.

6) Open this project in your browser and resize the browser window. Watch as the scrollView changes in height (expected) but also moves the origin of the imageView (not expected).


1) Go into our NIB in Xcode/IB and change the autosize mask settings of the NSImageView from (attach TOP, attach LEFT) to this (attach BOTTOM, attach LEFT).

2) Now run in the browser again and notice that the origin of the documentView is no longer modified on the scrollView resize.

The reason that I'm pointing the finger at nib2cib is because when doing the above steps programmatically, same values and sizes for everything but leaving IB out of the process completely, everything works fine.

Hope this bug report helps. Thanks for the great work on Cappuccino, I think it's remarkable.


Milestone: Someday. Label: #new. What's next? A reviewer should examine this issue.


Forgot to include my OS/dev info:

Cappuccino Version: v0.9.6-RC2 (git commit -- d4b0e2a)
OS: OSX 10.7.4
Xcode Version 4.3.2 (4E2002)
Browsers Tested: Firefox 15.01, Safari 5.1.6 (7534.56.5)




Milestone: Someday. Labels: #needs-confirmation, tools. What's next? This issue needs a volunteer to independently reproduce the issue.


@bradytrix: can you please put your reduction online?


Milestone: Someday. Labels: #needs-confirmation, #needs-reduction, tools. What's next?

  • This issue needs a volunteer to independently reproduce the issue.
  • A minimal test app should be created which demonstrates the concern of this issue in isolation.

I've made a reduction of it here:

The bug is still present, as far as I can tell.


thank you!


Milestone: Someday. Labels: #acknowledged, #needs-patch, tools. What's next? This issue needs a volunteer to write and submit code to address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.