mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-31 04:17:36 +00:00
Fixed: in certain degenerate cases, CPTextField may not have a window within _isWithinUsablePlatformRect
Previously, a case could arise where a text field was set as the initial first responder but during cib loading was not yet assigned to a window. In this case _isWithinUsablePlatformRect would fail. Now _isWithinUsablePlatformRect checks to make sure the text field has a window.
This commit is contained in:
1 parent
e8b2f2e39f
commit
fbc869ad29
1 file changed
+7
-2
@@ -1605,8 +1605,13 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
// Make sure the text field is completely within the platform window
|
||||
// so the browser will not scroll it into view.
|
||||
|
||||
var wind = [self window],
|
||||
frame = [self convertRectToBase:[self bounds]],
|
||||
var wind = [self window];
|
||||
|
||||
// If the field is not yet within a window, it can't be first responder
|
||||
if (!wind)
|
||||
return NO;
|
||||
|
||||
var frame = [self convertRectToBase:[self bounds]],
|
||||
usableRect = [[wind platformWindow] usableContentFrame];
|
||||
|
||||
frame.origin = [wind convertBaseToGlobal:frame.origin];
|
||||
|
||||
Reference in new issue
Block a user