Commit 922ba374 authored by darin's avatar darin

- fixed 3079214 -- text/plain page shows up slowly, a few pages at a time

        * WebView.subproj/WebTextView.m:
        (-[WebTextView initWithFrame:]): Remove unneeded setWidthTracksTextView:, because
	that's the default.
        (-[WebTextView dataSourceUpdated:]): Replace the thing each time in the RTF case.
        (-[WebTextView viewDidMoveToSuperview]): Here's where we resize, but only the width.
	Resizing the height was causing the bug.
        (-[WebTextView layout]): Do nothing.
        (-[WebTextView setAcceptsDrags:]): Update to new name. Since we weren't
	importing WebDocument.h, we never noticed that this file got out of sync.
        (-[WebTextView acceptsDrags]): Ditto.
        (-[WebTextView setAcceptsDrops:]): Ditto.
        (-[WebTextView acceptsDrops]): Ditto.

        * WebView.subproj/WebDocument.h: Fix typo. It said setAcceptsDrags: twice.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2702 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eb003b81
2002-11-15 Darin Adler <darin@apple.com>
- fixed 3079214 -- text/plain page shows up slowly, a few pages at a time
* WebView.subproj/WebTextView.m:
(-[WebTextView initWithFrame:]): Remove unneeded setWidthTracksTextView:, because
that's the default.
(-[WebTextView dataSourceUpdated:]): Replace the thing each time in the RTF case.
(-[WebTextView viewDidMoveToSuperview]): Here's where we resize, but only the width.
Resizing the height was causing the bug.
(-[WebTextView layout]): Do nothing.
(-[WebTextView setAcceptsDrags:]): Update to new name. Since we weren't
importing WebDocument.h, we never noticed that this file got out of sync.
(-[WebTextView acceptsDrags]): Ditto.
(-[WebTextView setAcceptsDrops:]): Ditto.
(-[WebTextView acceptsDrops]): Ditto.
* WebView.subproj/WebDocument.h: Fix typo. It said setAcceptsDrags: twice.
2002-11-15 Darin Adler <darin@apple.com>
* WebView.subproj/WebFramePrivate.m: Removed a bunch of tabs and fixed indenting.
......
2002-11-15 Darin Adler <darin@apple.com>
- fixed 3079214 -- text/plain page shows up slowly, a few pages at a time
* WebView.subproj/WebTextView.m:
(-[WebTextView initWithFrame:]): Remove unneeded setWidthTracksTextView:, because
that's the default.
(-[WebTextView dataSourceUpdated:]): Replace the thing each time in the RTF case.
(-[WebTextView viewDidMoveToSuperview]): Here's where we resize, but only the width.
Resizing the height was causing the bug.
(-[WebTextView layout]): Do nothing.
(-[WebTextView setAcceptsDrags:]): Update to new name. Since we weren't
importing WebDocument.h, we never noticed that this file got out of sync.
(-[WebTextView acceptsDrags]): Ditto.
(-[WebTextView setAcceptsDrops:]): Ditto.
(-[WebTextView acceptsDrops]): Ditto.
* WebView.subproj/WebDocument.h: Fix typo. It said setAcceptsDrags: twice.
2002-11-15 Darin Adler <darin@apple.com>
* WebView.subproj/WebFramePrivate.m: Removed a bunch of tabs and fixed indenting.
......
......@@ -64,11 +64,11 @@
- (BOOL)acceptsDrags;
/*!
@method setAcceptsDrags:
@method setAcceptsDrops:
@abstract Sets whether one can drag to the document view or not.
@param flag YES allows drags to the document view, NO disallows drags to the document view.
*/
- (void)setAcceptsDrags: (BOOL)flag;
- (void)setAcceptsDrops: (BOOL)flag;
/*!
@method acceptsDrops
......
......@@ -5,11 +5,12 @@
#import <WebKit/WebTextView.h>
#import <WebFoundation/WebResourceResponse.h>
#import <WebKit/WebDataSource.h>
#import <WebKit/WebDocument.h>
#import <WebKit/WebPreferences.h>
#import <WebFoundation/WebResourceResponse.h>
@implementation WebTextView
- (id)initWithFrame:(NSRect)frame
......@@ -18,7 +19,6 @@ - (id)initWithFrame:(NSRect)frame
if (self) {
canDragFrom = YES;
canDragTo = YES;
[[self textContainer] setWidthTracksTextView:YES];
[self setAutoresizingMask:NSViewWidthSizable];
[self setEditable:NO];
[[NSNotificationCenter defaultCenter] addObserver:self
......@@ -49,18 +49,25 @@ - (void)setDataSource:(WebDataSource *)dataSource
- (void)dataSourceUpdated:(WebDataSource *)dataSource
{
NSString *string;
// FIXME: This needs to be more efficient for progressively loading documents.
if ([[[dataSource response] contentType] isEqualToString:@"text/rtf"]) {
[self setRichText:YES];
[self replaceCharactersInRange:NSMakeRange(0,0) withRTF:[dataSource data]];
[self replaceCharactersInRange:NSMakeRange(0, [[self string] length]) withRTF:[dataSource data]];
} else {
[self setRichText:NO];
[self setFixedWidthFont];
string = [dataSource stringWithData:[dataSource data]];
[self setString:string];
[self setString:[dataSource stringWithData:[dataSource data]]];
}
}
- (void)viewDidMoveToSuperview
{
NSView *superview = [self superview];
if (superview) {
[self setFrameSize:NSMakeSize([superview frame].size.width, [self frame].size.height)];
}
}
......@@ -70,35 +77,31 @@ - (void)setNeedsLayout:(BOOL)flag
- (void)layout
{
NSRect superFrame = [[self superview] frame];
NSRect frame = [self frame];
[self setFrame:NSMakeRect(frame.origin.x, frame.origin.y, superFrame.size.width, frame.size.height)];
}
- (void)setCanDragFrom: (BOOL)flag
- (void)setAcceptsDrags:(BOOL)flag
{
canDragFrom = flag;
}
- (BOOL)canDragFrom
- (BOOL)acceptsDrags
{
return canDragFrom;
}
- (void)setCanDragTo: (BOOL)flag
- (void)setAcceptsDrops:(BOOL)flag
{
canDragTo = flag;
}
- (BOOL)canDragTo
- (BOOL)acceptsDrops
{
return canDragTo;
}
- (void)defaultsChanged:(NSNotification *)notification
{
if(![self isRichText]){
if (![self isRichText]) {
[self setFixedWidthFont];
}
}
......@@ -137,4 +140,5 @@ - (void)keyUp:(NSEvent *)event
{
[[self nextResponder] keyUp:event];
}
@end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment