Closes #664. Fixed: web view sizing bug when loading contents prior to adding the view to the display tree.

This commit is contained in:
Alexander Ljungberg
2011-05-09 14:54:30 -04:00
parent eb8d9775aa
commit d51921d4f3
+10 -1
View File
@@ -229,7 +229,8 @@ CPWebViewAppKitScrollMaxPollCount = 3;
- (void)viewDidUnhide
{
// Catch up on resizing which happened while hidden.
// Sizing cannot properly happen while we're hidden because the iframe is inaccessible.
// So now that it is accessible again, make sure to catch up.
[_frameView setFrameSize:[_scrollView contentSize]];
[self _resizeWebFrame];
[self _scheduleContentSizeCheck];
@@ -262,6 +263,14 @@ CPWebViewAppKitScrollMaxPollCount = 3;
- (void)_resizeWebFrame
{
// When a webview is not in the DOM we can't inspect its contents for sizing information.
// If we try, we might end up setting the fallback frame size which will then become
// somewhat sticky.
if (![self _isVisible])
{
return;
}
if (_effectiveScrollMode === CPWebViewScrollAppKit)
{
var visibleRect = [_frameView visibleRect];