[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:48:18 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 857862d444c02ce713e81280937e91fc4c15c4d7
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 24 18:43:57 2004 +0000

            Reviewed by John.
    
            - fixed <rdar://problem/3709385> Find on page doesn't find a string at the very end of the file
    
            * khtml/misc/khtml_text_operations.cpp: (khtml::findPlainText): Rearrange loop to avoid an early
            exit once we have all the characters we need, but are at the end of the range we are searching.
    
            - fixed <rdar://problem/3102271>: (text areas have scroll bars even when they don't need them)
            - fixed <rdar://problem/3665430>: (horizontal scroll bar of text area does not show, even when text is wide in "no wrap" mode)
    
            * kwq/KWQTextArea.mm:
            (-[KWQTextArea _configureTextViewForWordWrapMode]): Added. Helper method that sets up the
            view for a new word wrap mode.
            (-[KWQTextArea _createTextView]): Moved much of the code inside _configureTextViewForWordWrapMode.
            (-[KWQTextArea _frameSizeChanged]): Added. Method shared by setFrame: and initWithFrame: to
            avoid duplicate code that was there before. The old code also had redundant code to update
            the text container size, but NSText handles that automatically.
            (-[KWQTextArea initWithFrame:]): Set wrap to YES by default, which is the key to fixing bug 3665430.
            Call setAutohidesScrollers:YES, which fixes bug 3102271. Also call the new _frameSizeChanged method.
            (-[KWQTextArea setWordWrap:]): Call _configureTextViewForWordWrapMode instead of trying
            to do the work here. The old version did both too little and too much.
            (-[KWQTextArea setFrame:]): Call _frameSizeChanged instead of trying to do the work here.
            The old version did both too little and too much.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6920 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index aadb29d..75c8f09 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,29 @@
+2004-06-24  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+        - fixed <rdar://problem/3709385> Find on page doesn't find a string at the very end of the file
+
+        * khtml/misc/khtml_text_operations.cpp: (khtml::findPlainText): Rearrange loop to avoid an early
+        exit once we have all the characters we need, but are at the end of the range we are searching.
+
+        - fixed <rdar://problem/3102271>: (text areas have scroll bars even when they don't need them)
+        - fixed <rdar://problem/3665430>: (horizontal scroll bar of text area does not show, even when text is wide in "no wrap" mode)
+
+        * kwq/KWQTextArea.mm:
+        (-[KWQTextArea _configureTextViewForWordWrapMode]): Added. Helper method that sets up the
+        view for a new word wrap mode.
+        (-[KWQTextArea _createTextView]): Moved much of the code inside _configureTextViewForWordWrapMode.
+        (-[KWQTextArea _frameSizeChanged]): Added. Method shared by setFrame: and initWithFrame: to
+        avoid duplicate code that was there before. The old code also had redundant code to update
+        the text container size, but NSText handles that automatically.
+        (-[KWQTextArea initWithFrame:]): Set wrap to YES by default, which is the key to fixing bug 3665430.
+        Call setAutohidesScrollers:YES, which fixes bug 3102271. Also call the new _frameSizeChanged method.
+        (-[KWQTextArea setWordWrap:]): Call _configureTextViewForWordWrapMode instead of trying
+        to do the work here. The old version did both too little and too much.
+        (-[KWQTextArea setFrame:]): Call _frameSizeChanged instead of trying to do the work here.
+        The old version did both too little and too much.
+
 2004-06-24  John Sullivan  <sullivan at apple.com>
 
         Darin made this change on my machine; I reviewed it.
diff --git a/WebCore/khtml/editing/visible_text.cpp b/WebCore/khtml/editing/visible_text.cpp
index 06954c9..ba2688a 100644
--- a/WebCore/khtml/editing/visible_text.cpp
+++ b/WebCore/khtml/editing/visible_text.cpp
@@ -697,19 +697,19 @@ Range findPlainText(const Range &r, const QString &s, bool forward, bool caseSen
 
     {
         CharacterIterator it(r);
-        while (!it.atEnd()) {
+        while (1) {
             // Fill the buffer.
             while (long needed = buffer.neededCharacters()) {
-                long available = it.numCharacters();
-                long runLength = kMin(needed, available);
-                buffer.append(runLength, it.characters());
-                it.advance(runLength);
                 if (it.atBreak()) {
                     if (it.atEnd()) {
                         goto done;
                     }
                     buffer.clear();
                 }
+                long available = it.numCharacters();
+                long runLength = kMin(needed, available);
+                buffer.append(runLength, it.characters());
+                it.advance(runLength);
             }
 
             // Do the search.
diff --git a/WebCore/khtml/misc/khtml_text_operations.cpp b/WebCore/khtml/misc/khtml_text_operations.cpp
index 06954c9..ba2688a 100644
--- a/WebCore/khtml/misc/khtml_text_operations.cpp
+++ b/WebCore/khtml/misc/khtml_text_operations.cpp
@@ -697,19 +697,19 @@ Range findPlainText(const Range &r, const QString &s, bool forward, bool caseSen
 
     {
         CharacterIterator it(r);
-        while (!it.atEnd()) {
+        while (1) {
             // Fill the buffer.
             while (long needed = buffer.neededCharacters()) {
-                long available = it.numCharacters();
-                long runLength = kMin(needed, available);
-                buffer.append(runLength, it.characters());
-                it.advance(runLength);
                 if (it.atBreak()) {
                     if (it.atEnd()) {
                         goto done;
                     }
                     buffer.clear();
                 }
+                long available = it.numCharacters();
+                long runLength = kMin(needed, available);
+                buffer.append(runLength, it.characters());
+                it.advance(runLength);
             }
 
             // Do the search.
diff --git a/WebCore/kwq/KWQTextArea.mm b/WebCore/kwq/KWQTextArea.mm
index 787c886..ae80dab 100644
--- a/WebCore/kwq/KWQTextArea.mm
+++ b/WebCore/kwq/KWQTextArea.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -82,51 +82,56 @@
 
 const float LargeNumberForText = 1.0e7;
 
-- (void)_createTextView
+- (void)_configureTextViewForWordWrapMode
 {
-    NSSize size = [self frame].size;
-    NSRect textFrame;
-    textFrame.origin.x = textFrame.origin.y = 0;
-    if (size.width > 0 && size.height > 0) {
-        textFrame.size = [[self class] contentSizeForFrameSize:size
-            hasHorizontalScroller:[self hasHorizontalScroller]
-            hasVerticalScroller:[self hasVerticalScroller]
-            borderType:[self borderType]];
-    } else {
-        textFrame.size.width = LargeNumberForText;
-        textFrame.size.height = LargeNumberForText;
-    }
+    [self setHasHorizontalScroller:!wrap];
 
-    textView = [[KWQTextAreaTextView alloc] initWithFrame:textFrame];
-    [textView setRichText:NO];
-    [[textView textContainer] setWidthTracksTextView:YES];
+    [textView setHorizontallyResizable:!wrap];
+    [textView setMaxSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];
 
-    // Set up attributes for default case, WRAP=SOFT|VIRTUAL or WRAP=HARD|PHYSICAL.
-    // If WRAP=OFF we reset many of these attributes.
+    [[textView textContainer] setContainerSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];
+    [[textView textContainer] setWidthTracksTextView:wrap];
+}
 
-    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
-    [style setLineBreakMode:NSLineBreakByWordWrapping];
-    [style setAlignment:NSLeftTextAlignment];
-    [textView _KWQ_setTypingParagraphStyle:style];
-    [style release];
-    
-    [textView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+- (void)_createTextView
+{
+    textView = [[KWQTextAreaTextView alloc] init];
 
+    [textView setRichText:NO];
+    [textView setMaxSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];
     [textView setDelegate:self];
-    
+
     [self setDocumentView:textView];
+
+    [self _configureTextViewForWordWrapMode];
+}
+
+- (void)_frameSizeChanged
+{
+    NSSize contentSize = [[self class] contentSizeForFrameSize:[self frame].size
+        hasHorizontalScroller:[self hasHorizontalScroller]
+        hasVerticalScroller:[self hasVerticalScroller]
+        borderType:[self borderType]];
+    NSRect textFrame = [textView frame];
+    textFrame.size.width = contentSize.width;
+    [textView setFrame:textFrame];
 }
 
 - initWithFrame:(NSRect)frame
 {
     [super initWithFrame:frame];
-    
+
+    wrap = YES;
+
     [self setHasVerticalScroller:YES];
-    [self setHasHorizontalScroller:NO];
     [self setBorderType:NSBezelBorder];
-    
+
     [self _createTextView];
-    
+    [self _frameSizeChanged];
+
+    // Do this last, because it works better if done after the scrollers are created.
+    [self setAutohidesScrollers:YES];
+
     // In WebHTMLView, we set a clip. This is not typical to do in an
     // NSView, and while correct for any one invocation of drawRect:,
     // it causes some bad problems if that clip is cached between calls.
@@ -138,7 +143,7 @@ const float LargeNumberForText = 1.0e7;
     // <rdar://problem/3310943>: REGRESSION (Panther): textareas in forms sometimes draw blank (bugreporter)
     [[self contentView] releaseGState];
     [[self documentView] releaseGState];
-    
+
     return self;
 }
 
@@ -169,45 +174,10 @@ const float LargeNumberForText = 1.0e7;
 
 - (void)setWordWrap:(BOOL)f
 {
-    if (f == wrap) {
-        return;
-    }
-    
-    // This widget may have issues toggling back and forth between WRAP=YES and WRAP=NO.
-    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
-    
-    if (f) {
-        [self setHasHorizontalScroller:NO];
-
-        [[textView textContainer] setWidthTracksTextView:NO];
-
-        // FIXME: Same as else below. Is this right?
-        [textView setMaxSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];
-        [textView setHorizontallyResizable:NO];
-
-        [style setLineBreakMode:NSLineBreakByWordWrapping];
-    } else {
-        [self setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
-        [[self contentView] setAutoresizesSubviews:YES];
-        [self setHasHorizontalScroller:YES];
-
-        [[textView textContainer] setContainerSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];
-        [[textView textContainer] setWidthTracksTextView:NO];
-        [[textView textContainer] setHeightTracksTextView:NO];
-
-        [textView setMinSize:[textView frame].size];
-        [textView setMaxSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];
-        [textView setHorizontallyResizable:YES];
-
-        [style setLineBreakMode:NSLineBreakByClipping];
+    if (f != wrap) {
+        wrap = f;
+        [self _configureTextViewForWordWrapMode];
     }
-    
-    [style setAlignment:NSLeftTextAlignment];
-    
-    [textView _KWQ_setTypingParagraphStyle:style];
-    [style release];
-    
-    wrap = f;
 }
 
 - (BOOL)wordWrap
@@ -299,20 +269,9 @@ const float LargeNumberForText = 1.0e7;
 }
 
 - (void)setFrame:(NSRect)frameRect
-{    
+{
     [super setFrame:frameRect];
-
-    if ([self wordWrap]) {
-        NSSize contentSize = [[self class] contentSizeForFrameSize:frameRect.size
-            hasHorizontalScroller:[self hasHorizontalScroller]
-            hasVerticalScroller:[self hasVerticalScroller]
-            borderType:[self borderType]];
-        NSRect textFrame = [textView frame];
-        textFrame.size.width = contentSize.width;
-        contentSize.height = LargeNumberForText;
-        [textView setFrame:textFrame];
-        [[textView textContainer] setContainerSize:contentSize];
-    }
+    [self _frameSizeChanged];
 }
 
 - (void)getCursorPositionAsIndex:(int *)index inParagraph:(int *)paragraph

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list