mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Need to make sure we don't create text containers with negative dimensions.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27766 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a815330b26
commit
f35949036f
4 changed files with 38 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2009-02-03 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSTextContainer.m: Add some frame size checks.
|
||||
* Source/NSScrollView.m: ditto
|
||||
* Source/NSHelpPanel.m: Make sure we create with a reasonable size.
|
||||
|
||||
2009-02-01 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSTextView.m (-dragSelectionWithEvent:...): Correct
|
||||
|
|
|
@ -140,7 +140,10 @@ static NSHelpPanel *_sharedPanel = nil;
|
|||
NSTextView *v;
|
||||
NSRect r;
|
||||
|
||||
self = [super initWithContentRect: NSMakeRect(100,100,400,500)
|
||||
/* We have a standard start size.
|
||||
*/
|
||||
contentRect = NSMakeRect(100,100,400,500);
|
||||
self = [super initWithContentRect: contentRect
|
||||
styleMask: NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO
|
||||
|
@ -164,7 +167,7 @@ static NSHelpPanel *_sharedPanel = nil;
|
|||
[v setMaxSize: NSMakeSize (1E7, 1E7)];
|
||||
[v setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];
|
||||
[[v textContainer] setContainerSize:
|
||||
NSMakeSize (r.size.width, 1e7)];
|
||||
NSMakeSize (MAX(r.size.width, 0.0), 1e7)];
|
||||
[[v textContainer] setWidthTracksTextView: YES];
|
||||
|
||||
[s setDocumentView: v];
|
||||
|
|
|
@ -1005,6 +1005,11 @@ static float scrollerWidth;
|
|||
|
||||
/* Prepare the contentRect by insetting the borders. */
|
||||
contentRect = NSInsetRect(_bounds, border.width, border.height);
|
||||
if (contentRect.size.width < 0 || contentRect.size.height < 0)
|
||||
{
|
||||
NSWarnMLog(@"given too small a size to tile", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
[self _synchronizeHeaderAndCornerView];
|
||||
|
||||
|
|
|
@ -71,8 +71,7 @@ use bounds rectangle instead of frame? */
|
|||
}
|
||||
if (_heightTracksTextView)
|
||||
{
|
||||
size.height = MAX(newTextViewSize.height - (inset.height * 2.0),
|
||||
0.0);
|
||||
size.height = MAX(newTextViewSize.height - (inset.height * 2.0), 0.0);
|
||||
}
|
||||
|
||||
[self setContainerSize: size];
|
||||
|
@ -94,6 +93,16 @@ use bounds rectangle instead of frame? */
|
|||
- (id) initWithContainerSize: (NSSize)aSize
|
||||
{
|
||||
NSDebugLLog(@"NSText", @"NSTextContainer initWithContainerSize");
|
||||
if (aSize.width < 0)
|
||||
{
|
||||
NSWarnMLog(@"given negative width", 0);
|
||||
aSize.width = 0;
|
||||
}
|
||||
if (aSize.height < 0)
|
||||
{
|
||||
NSWarnMLog(@"given negative height", 0);
|
||||
aSize.height = 0;
|
||||
}
|
||||
_layoutManager = nil;
|
||||
_textView = nil;
|
||||
_containerRect.size = aSize;
|
||||
|
@ -223,6 +232,17 @@ framework intact.
|
|||
return;
|
||||
}
|
||||
|
||||
if (aSize.width < 0)
|
||||
{
|
||||
NSWarnMLog(@"given negative width", 0);
|
||||
aSize.width = 0;
|
||||
}
|
||||
if (aSize.height < 0)
|
||||
{
|
||||
NSWarnMLog(@"given negative height", 0);
|
||||
aSize.height = 0;
|
||||
}
|
||||
|
||||
_containerRect = NSMakeRect(0, 0, aSize.width, aSize.height);
|
||||
|
||||
if (_layoutManager)
|
||||
|
|
Loading…
Reference in a new issue