[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 07:56:55 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9718acba556c50995cd2c8ffc3b1e7ff10b8c2e1
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 22 22:09:01 2003 +0000

            Reviewed by Maciej.
    
            - fixed 3306041 -- Airborne tracking number field too narrow, tracking doesn't work (textare col property)
    
            * khtml/rendering/render_form.cpp: (RenderTextArea::calcMinMaxWidth): Call the QTextEdit
            to ask it what size, rather than trying to compute it. This is the same thing we do with
            other widgets, I just hadn't done textarea yet.
    
            * kwq/KWQTextEdit.h: Added sizeWithColumnsAndRows function.
            * kwq/KWQTextEdit.mm: (QTextEdit::sizeWithColumnsAndRows): Added. Calls through to the
            KWQTextArea object.
    
            * kwq/KWQTextArea.h: Added sizeWithColumns:rows: method.
            * kwq/KWQTextArea.mm:
            (-[KWQTextArea _createTextView]): Make consistent with other callers of the size mapping methods
            by using [self class] instead of NSScrollView, and getting hasHorizontalScroller and
            hasVerticalScroller from the view.
            (-[KWQTextArea setFrame:]): Make consistent with other callers of the size mapping methods
            by using [self class] instead of NSScrollView.
            (-[KWQTextArea sizeWithColumns:rows:]): Added. Starts by computing the width and height of the
            columns specified, using a canonical width of a "0" character. Then converts that to a container
            size by adding line fragment padding. Then converts that into the text view size by adding the
            text container inset. Then converts that into the scroll view size by calling frameSizeForContentSize:.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5032 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index c71e386..423f580 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,31 @@
 2003-09-22  Darin Adler  <darin at apple.com>
 
+        Reviewed by Maciej.
+
+        - fixed 3306041 -- Airborne tracking number field too narrow, tracking doesn't work (textare col property)
+
+        * khtml/rendering/render_form.cpp: (RenderTextArea::calcMinMaxWidth): Call the QTextEdit
+        to ask it what size, rather than trying to compute it. This is the same thing we do with
+        other widgets, I just hadn't done textarea yet.
+
+        * kwq/KWQTextEdit.h: Added sizeWithColumnsAndRows function.
+        * kwq/KWQTextEdit.mm: (QTextEdit::sizeWithColumnsAndRows): Added. Calls through to the
+        KWQTextArea object.
+
+        * kwq/KWQTextArea.h: Added sizeWithColumns:rows: method.
+        * kwq/KWQTextArea.mm:
+        (-[KWQTextArea _createTextView]): Make consistent with other callers of the size mapping methods
+        by using [self class] instead of NSScrollView, and getting hasHorizontalScroller and
+        hasVerticalScroller from the view.
+        (-[KWQTextArea setFrame:]): Make consistent with other callers of the size mapping methods
+        by using [self class] instead of NSScrollView.
+        (-[KWQTextArea sizeWithColumns:rows:]): Added. Starts by computing the width and height of the
+        columns specified, using a canonical width of a "0" character. Then converts that to a container
+        size by adding line fragment padding. Then converts that into the text view size by adding the
+        text container inset. Then converts that into the scroll view size by calling frameSizeForContentSize:.
+
+2003-09-22  Darin Adler  <darin at apple.com>
+
         * WebCore.pbproj/project.pbxproj: Rename Mixed build style to OptimizedWithSymbols.
 
 2003-09-22  Darin Adler  <darin at apple.com>
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c71e386..423f580 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,31 @@
 2003-09-22  Darin Adler  <darin at apple.com>
 
+        Reviewed by Maciej.
+
+        - fixed 3306041 -- Airborne tracking number field too narrow, tracking doesn't work (textare col property)
+
+        * khtml/rendering/render_form.cpp: (RenderTextArea::calcMinMaxWidth): Call the QTextEdit
+        to ask it what size, rather than trying to compute it. This is the same thing we do with
+        other widgets, I just hadn't done textarea yet.
+
+        * kwq/KWQTextEdit.h: Added sizeWithColumnsAndRows function.
+        * kwq/KWQTextEdit.mm: (QTextEdit::sizeWithColumnsAndRows): Added. Calls through to the
+        KWQTextArea object.
+
+        * kwq/KWQTextArea.h: Added sizeWithColumns:rows: method.
+        * kwq/KWQTextArea.mm:
+        (-[KWQTextArea _createTextView]): Make consistent with other callers of the size mapping methods
+        by using [self class] instead of NSScrollView, and getting hasHorizontalScroller and
+        hasVerticalScroller from the view.
+        (-[KWQTextArea setFrame:]): Make consistent with other callers of the size mapping methods
+        by using [self class] instead of NSScrollView.
+        (-[KWQTextArea sizeWithColumns:rows:]): Added. Starts by computing the width and height of the
+        columns specified, using a canonical width of a "0" character. Then converts that to a container
+        size by adding line fragment padding. Then converts that into the text view size by adding the
+        text container inset. Then converts that into the scroll view size by calling frameSizeForContentSize:.
+
+2003-09-22  Darin Adler  <darin at apple.com>
+
         * WebCore.pbproj/project.pbxproj: Rename Mixed build style to OptimizedWithSymbols.
 
 2003-09-22  Darin Adler  <darin at apple.com>
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index e91ba2f..2df5763 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -1348,12 +1348,7 @@ void RenderTextArea::calcMinMaxWidth()
     const QFontMetrics &m = style()->fontMetrics();
     w->setTabStopWidth(8 * m.width(" "));
 #if APPLE_CHANGES
-    QSize size( QMAX(element()->cols(), 1)*m.width('x') + w->frameWidth() +
-                w->verticalScrollBarWidth(),
-                QMAX(element()->rows(), 1)*m.height() + w->frameWidth()*2 +
-                (w->wordWrap() == QTextEdit::NoWrap ?
-                 w->horizontalScrollBarHeight() : 0)
-        );
+    QSize size(w->sizeWithColumnsAndRows(QMAX(element()->cols(), 1), QMAX(element()->rows(), 1)));
 #else
     QSize size( QMAX(element()->cols(), 1)*m.width('x') + w->frameWidth() +
                 w->verticalScrollBar()->sizeHint().width(),
diff --git a/WebCore/kwq/KWQTextArea.h b/WebCore/kwq/KWQTextArea.h
index 2b9ae67..8976c6c 100644
--- a/WebCore/kwq/KWQTextArea.h
+++ b/WebCore/kwq/KWQTextArea.h
@@ -56,6 +56,8 @@ class QTextEdit;
 
 - (void)selectAll;
 
+- (NSSize)sizeWithColumns:(int)columns rows:(int)rows;
+
 // paragraph-oriented functions for the benefit of QTextEdit
 - (void)setCursorPositionToIndex:(int)index inParagraph:(int)paragraph;
 - (void)getCursorPositionAsIndex:(int *)index inParagraph:(int *)paragraph;
diff --git a/WebCore/kwq/KWQTextArea.mm b/WebCore/kwq/KWQTextArea.mm
index 6d46be4..1a87c71 100644
--- a/WebCore/kwq/KWQTextArea.mm
+++ b/WebCore/kwq/KWQTextArea.mm
@@ -65,14 +65,16 @@ const float LargeNumberForText = 1.0e7;
     NSSize size = [self frame].size;
     NSRect textFrame;
     textFrame.origin.x = textFrame.origin.y = 0;
-    if (size.width > 0 && size.height > 0)
-        textFrame.size = [NSScrollView contentSizeForFrameSize:size
-            hasHorizontalScroller:NO hasVerticalScroller:YES borderType:[self borderType]];
-    else {
+    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;
     }
-        
+
     textView = [[KWQTextAreaTextView alloc] initWithFrame:textFrame];
     [textView setRichText:NO];
     [[textView textContainer] setWidthTracksTextView:YES];
@@ -262,7 +264,7 @@ const float LargeNumberForText = 1.0e7;
     [super setFrame:frameRect];
 
     if ([self wordWrap]) {
-        NSSize contentSize = [NSScrollView contentSizeForFrameSize:frameRect.size
+        NSSize contentSize = [[self class] contentSizeForFrameSize:frameRect.size
             hasHorizontalScroller:[self hasHorizontalScroller]
             hasVerticalScroller:[self hasVerticalScroller]
             borderType:[self borderType]];
@@ -472,6 +474,19 @@ static NSRange RangeOfParagraph(NSString *text, int paragraph)
     return NO;
 }
 
+- (NSSize)sizeWithColumns:(int)numColumns rows:(int)numRows
+{
+    NSFont *font = [textView font];
+    NSSize textSize = NSMakeSize(ceil(numColumns * [font widthOfString:@"0"]), numRows * [font defaultLineHeightForFont]);
+    NSSize textContainerSize = NSMakeSize(textSize.width + [[textView textContainer] lineFragmentPadding] * 2, textSize.height);
+    NSSize textContainerInset = [textView textContainerInset];
+    NSSize textViewSize = NSMakeSize(textContainerSize.width + textContainerInset.width, textContainerSize.height + textContainerInset.height); 
+    return [[self class] frameSizeForContentSize:textViewSize
+        hasHorizontalScroller:[self hasHorizontalScroller]
+        hasVerticalScroller:[self hasVerticalScroller]
+        borderType:[self borderType]];
+}
+
 @end
 
 @implementation KWQTextAreaTextView
diff --git a/WebCore/kwq/KWQTextEdit.h b/WebCore/kwq/KWQTextEdit.h
index 69012d7..fcc9f51 100644
--- a/WebCore/kwq/KWQTextEdit.h
+++ b/WebCore/kwq/KWQTextEdit.h
@@ -69,8 +69,7 @@ class QTextEdit : public QScrollView
 
     void selectAll();
 
-    int verticalScrollBarWidth() const;
-    int horizontalScrollBarHeight() const;
+    QSize sizeWithColumnsAndRows(int numColumns, int numRows) const;
 
     void textChanged() { _textChanged.call(); }
 
diff --git a/WebCore/kwq/KWQTextEdit.mm b/WebCore/kwq/KWQTextEdit.mm
index a5340dc..7ea8f11 100644
--- a/WebCore/kwq/KWQTextEdit.mm
+++ b/WebCore/kwq/KWQTextEdit.mm
@@ -105,18 +105,6 @@ void QTextEdit::selectAll()
     [textView selectAll];
 }
 
-int QTextEdit::verticalScrollBarWidth() const
-{
-    KWQTextArea *textView = (KWQTextArea *)getView();
-    return (int)[[textView verticalScroller] frame].size.width;
-}
-
-int QTextEdit::horizontalScrollBarHeight() const
-{
-    KWQTextArea *textView = (KWQTextArea *)getView();
-    return (int)[[textView horizontalScroller] frame].size.height;
-}
-
 void QTextEdit::setFont(const QFont &font)
 {
     QWidget::setFont(font);
@@ -140,3 +128,9 @@ void QTextEdit::setAlignment(AlignmentFlags alignment)
     KWQTextArea *textArea = getView();
     [textArea setAlignment:(alignment == AlignRight ? NSRightTextAlignment : NSLeftTextAlignment)];
 }
+
+QSize QTextEdit::sizeWithColumnsAndRows(int numColumns, int numRows) const
+{
+    KWQTextArea *textArea = getView();
+    return [textArea sizeWithColumns:numColumns rows:numRows];
+}

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list