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

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:28:58 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 03307b0059a22d877cbe3902e5712beb422f21f4
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Aug 3 00:45:40 2002 +0000

    	Lots of form control changes.
    	- Inputs and textareas now respond to setFont and can have their font set by the Web page
    	explicitly.  These fields emulate the WinIE behavior of defaulting to the UI system font
    	and only picking up new fonts if they are explicitly specified on the element itself.
    	- Buttons and selects use the small versions now.
    	- Stopped trying to align controls along baselines of their interior text.  Konqueror is
    	the only browser that does this, and it looks bad on many pages.  With this patch controls
    	align along their bottom borders (which extend slightly below the baseline of surrounding
    	text).  This matches Gecko, MacIE, and WinIE behavior.
    	- Stopped using monospace for textareas and inputs.
    	- Fixed a bug with inputs not calling setScrollable on their cells.
    
            * khtml/css/html4.css:
            * khtml/rendering/render_form.cpp:
            (RenderSubmitButton::calcMinMaxWidth):
            (RenderSubmitButton::baselinePosition):
            (RenderLineEdit::baselinePosition):
            (RenderSelect::baselinePosition):
            * khtml/rendering/render_form.h:
            * kwq/KWQButton.mm:
            (QButton::QButton):
            (QButton::sizeHint):
            * kwq/KWQComboBox.mm:
            (QComboBox::init):
            * kwq/KWQLineEdit.mm:
            (QLineEdit::cursorPosition):
            (QLineEdit::setFont):
            * kwq/KWQNSTextField.mm:
            (-[KWQNSTextField initWithFrame:widget:]):
            * kwq/KWQView.mm:
            (-[KWQNSButtonCell cellSizeForBounds:]):
            (+[KWQNSButton initialize]):
            * kwq/WebCoreTextRendererFactory.h:
            * kwq/WebCoreTextRendererFactory.m:
            (-[WebCoreTextRendererFactory fontWithFamily:traits:size:]):
            * kwq/qt/qbutton.h:
            * kwq/qt/qlineedit.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1726 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 760d61b..55735a0 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,43 @@
+2002-08-02  David Hyatt  <hyatt at apple.com>
+
+	Lots of form control changes.
+	- Inputs and textareas now respond to setFont and can have their font set by the Web page
+	explicitly.  These fields emulate the WinIE behavior of defaulting to the UI system font
+	and only picking up new fonts if they are explicitly specified on the element itself.
+	- Buttons and selects use the small versions now.
+	- Stopped trying to align controls along baselines of their interior text.  Konqueror is
+	the only browser that does this, and it looks bad on many pages.  With this patch controls
+	align along their bottom borders (which extend slightly below the baseline of surrounding
+	text).  This matches Gecko, MacIE, and WinIE behavior.
+	- Stopped using monospace for textareas and inputs.
+	- Fixed a bug with inputs not calling setScrollable on their cells.
+	
+        * khtml/css/html4.css:
+        * khtml/rendering/render_form.cpp:
+        (RenderSubmitButton::calcMinMaxWidth):
+        (RenderSubmitButton::baselinePosition):
+        (RenderLineEdit::baselinePosition):
+        (RenderSelect::baselinePosition):
+        * khtml/rendering/render_form.h:
+        * kwq/KWQButton.mm:
+        (QButton::QButton):
+        (QButton::sizeHint):
+        * kwq/KWQComboBox.mm:
+        (QComboBox::init):
+        * kwq/KWQLineEdit.mm:
+        (QLineEdit::cursorPosition):
+        (QLineEdit::setFont):
+        * kwq/KWQNSTextField.mm:
+        (-[KWQNSTextField initWithFrame:widget:]):
+        * kwq/KWQView.mm:
+        (-[KWQNSButtonCell cellSizeForBounds:]):
+        (+[KWQNSButton initialize]):
+        * kwq/WebCoreTextRendererFactory.h:
+        * kwq/WebCoreTextRendererFactory.m:
+        (-[WebCoreTextRendererFactory fontWithFamily:traits:size:]):
+        * kwq/qt/qbutton.h:
+        * kwq/qt/qlineedit.h:
+
 2002-08-01  Darin Adler  <darin at apple.com>
 
         - fixed 2841277 -- support for charset=gb2312
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 760d61b..55735a0 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,43 @@
+2002-08-02  David Hyatt  <hyatt at apple.com>
+
+	Lots of form control changes.
+	- Inputs and textareas now respond to setFont and can have their font set by the Web page
+	explicitly.  These fields emulate the WinIE behavior of defaulting to the UI system font
+	and only picking up new fonts if they are explicitly specified on the element itself.
+	- Buttons and selects use the small versions now.
+	- Stopped trying to align controls along baselines of their interior text.  Konqueror is
+	the only browser that does this, and it looks bad on many pages.  With this patch controls
+	align along their bottom borders (which extend slightly below the baseline of surrounding
+	text).  This matches Gecko, MacIE, and WinIE behavior.
+	- Stopped using monospace for textareas and inputs.
+	- Fixed a bug with inputs not calling setScrollable on their cells.
+	
+        * khtml/css/html4.css:
+        * khtml/rendering/render_form.cpp:
+        (RenderSubmitButton::calcMinMaxWidth):
+        (RenderSubmitButton::baselinePosition):
+        (RenderLineEdit::baselinePosition):
+        (RenderSelect::baselinePosition):
+        * khtml/rendering/render_form.h:
+        * kwq/KWQButton.mm:
+        (QButton::QButton):
+        (QButton::sizeHint):
+        * kwq/KWQComboBox.mm:
+        (QComboBox::init):
+        * kwq/KWQLineEdit.mm:
+        (QLineEdit::cursorPosition):
+        (QLineEdit::setFont):
+        * kwq/KWQNSTextField.mm:
+        (-[KWQNSTextField initWithFrame:widget:]):
+        * kwq/KWQView.mm:
+        (-[KWQNSButtonCell cellSizeForBounds:]):
+        (+[KWQNSButton initialize]):
+        * kwq/WebCoreTextRendererFactory.h:
+        * kwq/WebCoreTextRendererFactory.m:
+        (-[WebCoreTextRendererFactory fontWithFamily:traits:size:]):
+        * kwq/qt/qbutton.h:
+        * kwq/qt/qlineedit.h:
+
 2002-08-01  Darin Adler  <darin at apple.com>
 
         - fixed 2841277 -- support for charset=gb2312
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 760d61b..55735a0 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,43 @@
+2002-08-02  David Hyatt  <hyatt at apple.com>
+
+	Lots of form control changes.
+	- Inputs and textareas now respond to setFont and can have their font set by the Web page
+	explicitly.  These fields emulate the WinIE behavior of defaulting to the UI system font
+	and only picking up new fonts if they are explicitly specified on the element itself.
+	- Buttons and selects use the small versions now.
+	- Stopped trying to align controls along baselines of their interior text.  Konqueror is
+	the only browser that does this, and it looks bad on many pages.  With this patch controls
+	align along their bottom borders (which extend slightly below the baseline of surrounding
+	text).  This matches Gecko, MacIE, and WinIE behavior.
+	- Stopped using monospace for textareas and inputs.
+	- Fixed a bug with inputs not calling setScrollable on their cells.
+	
+        * khtml/css/html4.css:
+        * khtml/rendering/render_form.cpp:
+        (RenderSubmitButton::calcMinMaxWidth):
+        (RenderSubmitButton::baselinePosition):
+        (RenderLineEdit::baselinePosition):
+        (RenderSelect::baselinePosition):
+        * khtml/rendering/render_form.h:
+        * kwq/KWQButton.mm:
+        (QButton::QButton):
+        (QButton::sizeHint):
+        * kwq/KWQComboBox.mm:
+        (QComboBox::init):
+        * kwq/KWQLineEdit.mm:
+        (QLineEdit::cursorPosition):
+        (QLineEdit::setFont):
+        * kwq/KWQNSTextField.mm:
+        (-[KWQNSTextField initWithFrame:widget:]):
+        * kwq/KWQView.mm:
+        (-[KWQNSButtonCell cellSizeForBounds:]):
+        (+[KWQNSButton initialize]):
+        * kwq/WebCoreTextRendererFactory.h:
+        * kwq/WebCoreTextRendererFactory.m:
+        (-[WebCoreTextRendererFactory fontWithFamily:traits:size:]):
+        * kwq/qt/qbutton.h:
+        * kwq/qt/qlineedit.h:
+
 2002-08-01  Darin Adler  <darin at apple.com>
 
         - fixed 2841277 -- support for charset=gb2312
diff --git a/WebCore/khtml/css/html4.css b/WebCore/khtml/css/html4.css
index 07794bf..6213cef 100644
--- a/WebCore/khtml/css/html4.css
+++ b/WebCore/khtml/css/html4.css
@@ -384,12 +384,12 @@ BUTTON:active {
         border-style: inset;
 }
 
-/* we want a fixed font for form elements (input & textarea) */
-      
-INPUT[type="text"],
-INPUT[type="password"],
-TEXTAREA { 
-	font-family: monospace;
+/* XXX Need to implement support for CSS2 system fonts, so that I don't have to hard code this.
+   -dwh */
+INPUT, TEXTAREA {
+        font-size: 13px;
+        font-face: Lucida Grande;
+        font-family: sans serif;
 }
 
 INPUT[type="hidden"] {
@@ -399,7 +399,7 @@ INPUT[type="hidden"] {
 INPUT[type="radio"], INPUT[type="checkbox"] {
         margin: 0 0.5ex;
 }
-      
+
 OPTION, 
 OPTGROUP, 
 AREA,
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 7340090..e30a0b6 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -341,6 +341,9 @@ void RenderSubmitButton::calcMinMaxWidth()
 {
     KHTMLAssert( !minMaxKnown() );
 
+#ifndef APPLE_CHANGES
+    // Don't use the CSS font metrics.  Don't rely on the button sizing quirks that they
+    // have to use because of scalable button fonts. -dwh
     QString raw = rawText();
     QPushButton* pb = static_cast<QPushButton*>(m_widget);
     pb->setText(raw);
@@ -357,6 +360,13 @@ void RenderSubmitButton::calcMinMaxWidth()
     
     setIntrinsicWidth( s.width() - margin / 2 );
     setIntrinsicHeight( s.height() - margin / 2);
+#else
+    // Instead treat a button as fully replaced.  Let it use its own system UI font
+    // and tell us exactly how big it wants to be.
+    QSize s(m_widget->sizeHint());
+    setIntrinsicWidth( s.width() );
+    setIntrinsicHeight( s.height() );
+#endif
 
     RenderButton::calcMinMaxWidth();
 }
@@ -380,9 +390,7 @@ QString RenderSubmitButton::defaultLabel() {
 short RenderSubmitButton::baselinePosition( bool f ) const
 {
 #ifdef APPLE_CHANGES
-    // FIXED: [rjw] Where does this magic number '8' come from?  It's also used above in
-    // RenderSubmitButton::calcMinMaxWidth().
-    return RenderWidget::baselinePosition( f ) - 8 - QFontMetrics( style()->font() ).descent();
+    return RenderWidget::baselinePosition( f ) - 7;
 #else
     return RenderFormElement::baselinePosition( f );
 #endif
@@ -493,6 +501,15 @@ RenderLineEdit::RenderLineEdit(HTMLInputElementImpl *element)
 #endif
 }
 
+#ifdef APPLE_CHANGES
+// We override the baseline position to get the textfield border and padding (before  we hit
+// the font descent) taken into account.
+short RenderLineEdit::baselinePosition( bool f ) const
+{
+    return RenderWidget::baselinePosition( f ) - 4;
+}
+#endif
+
 void RenderLineEdit::slotReturnPressed()
 {
     // don't submit the form when return was pressed in a completion-popup
@@ -878,6 +895,14 @@ void RenderSelect::updateFromElement()
     RenderFormElement::updateFromElement();
 }
 
+#ifdef APPLE_CHANGES
+// Override to deal with our widget.
+short RenderSelect::baselinePosition( bool f ) const
+{
+    return RenderWidget::baselinePosition( f ) - 7;
+}
+#endif
+
 void RenderSelect::calcMinMaxWidth()
 {
     KHTMLAssert( !minMaxKnown() );
diff --git a/WebCore/khtml/rendering/render_form.h b/WebCore/khtml/rendering/render_form.h
index 014af55..8040ce4 100644
--- a/WebCore/khtml/rendering/render_form.h
+++ b/WebCore/khtml/rendering/render_form.h
@@ -242,6 +242,7 @@ public:
     void select();
 #ifdef APPLE_CHANGES
     void performAction(QObject::Actions action);
+    short baselinePosition( bool f ) const;
 #endif /* APPLE_CHANGES */
 
     KLineEdit *widget() const { return static_cast<KLineEdit*>(m_widget); }
@@ -359,6 +360,10 @@ public:
 
     virtual const char *renderName() const { return "RenderSelect"; }
 
+#ifdef APPLE_CHANGES
+    short baselinePosition( bool f ) const;
+#endif
+
     virtual void calcMinMaxWidth();
     virtual void layout();
 
diff --git a/WebCore/kwq/KWQButton.h b/WebCore/kwq/KWQButton.h
index 347e2a7..57e35b4 100644
--- a/WebCore/kwq/KWQButton.h
+++ b/WebCore/kwq/KWQButton.h
@@ -35,6 +35,8 @@ public:
 
     virtual void setText(const QString &);
     QString text() const;
+    
+    QSize sizeHint() const;
 };
 
 #endif
diff --git a/WebCore/kwq/KWQButton.mm b/WebCore/kwq/KWQButton.mm
index ded8899..9e0c923 100644
--- a/WebCore/kwq/KWQButton.mm
+++ b/WebCore/kwq/KWQButton.mm
@@ -32,6 +32,19 @@ QButton::QButton(QWidget *parent)
     KWQNSButton *button = [[KWQNSButton alloc] initWithFrame:NSMakeRect (0,0,0,0) widget:this];
     setView(button);
     [button release];
+    
+     // Use the small system font.
+    [button setFont: [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+}
+
+QSize QButton::sizeHint() const 
+{
+    KWQNSButton *button = (KWQNSButton *)getView();
+    
+    [button sizeToFit];
+    
+    NSRect vFrame = [button frame];
+    return QSize((int)vFrame.size.width,(int)vFrame.size.height);
 }
 
 void QButton::setText(const QString &s)
diff --git a/WebCore/kwq/KWQComboBox.mm b/WebCore/kwq/KWQComboBox.mm
index a8f6ad8..b33b4be 100644
--- a/WebCore/kwq/KWQComboBox.mm
+++ b/WebCore/kwq/KWQComboBox.mm
@@ -52,6 +52,9 @@ void QComboBox::init(bool isEditable)
     [comboBox release];
     
     items = [[NSMutableArray alloc] init];
+
+    // Use the small system font.
+    [comboBox setFont: [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
 }
 
 
diff --git a/WebCore/kwq/KWQLineEdit.h b/WebCore/kwq/KWQLineEdit.h
index dc7586c..45f1d54 100644
--- a/WebCore/kwq/KWQLineEdit.h
+++ b/WebCore/kwq/KWQLineEdit.h
@@ -50,6 +50,8 @@ public:
     void selectAll();
     bool edited() const;
     void setEdited(bool);
+    
+    void setFont(const QFont &font);
 };
 
 #endif
diff --git a/WebCore/kwq/KWQLineEdit.mm b/WebCore/kwq/KWQLineEdit.mm
index 5b74738..61c08b5 100644
--- a/WebCore/kwq/KWQLineEdit.mm
+++ b/WebCore/kwq/KWQLineEdit.mm
@@ -27,6 +27,7 @@
 
 #import <KWQNSTextField.h>
 #import <kwqdebug.h>
+#import <WebCoreTextRendererFactory.h>
 
 QLineEdit::QLineEdit(QWidget *parent)
 {
@@ -52,6 +53,16 @@ int QLineEdit::cursorPosition() const
     return 0;
 }
 
+void QLineEdit::setFont(const QFont &font)
+{
+    QWidget::setFont(font);
+    KWQNSTextField *textField = (KWQNSTextField *)getView();
+    [textField setFont: [[WebCoreTextRendererFactory sharedFactory] 
+            fontWithFamily: font.getNSFamily()
+            traits: font.getNSTraits() 
+            size: font.getNSSize()]];
+}
+
 void QLineEdit::setText(const QString &s)
 {
     KWQNSTextField *textField = (KWQNSTextField *)getView();
diff --git a/WebCore/kwq/KWQNSTextField.mm b/WebCore/kwq/KWQNSTextField.mm
index c0b6321..792bbfe 100644
--- a/WebCore/kwq/KWQNSTextField.mm
+++ b/WebCore/kwq/KWQNSTextField.mm
@@ -41,6 +41,8 @@
 
     [self setDelegate: self];
 
+    [[self cell] setScrollable: YES];
+    
     return self;
 }
 
diff --git a/WebCore/kwq/KWQTextField.mm b/WebCore/kwq/KWQTextField.mm
index c0b6321..792bbfe 100644
--- a/WebCore/kwq/KWQTextField.mm
+++ b/WebCore/kwq/KWQTextField.mm
@@ -41,6 +41,8 @@
 
     [self setDelegate: self];
 
+    [[self cell] setScrollable: YES];
+    
     return self;
 }
 
diff --git a/WebCore/kwq/KWQView.mm b/WebCore/kwq/KWQView.mm
index ac45108..b3402f9 100644
--- a/WebCore/kwq/KWQView.mm
+++ b/WebCore/kwq/KWQView.mm
@@ -48,8 +48,41 @@
 
 @end
 
+ at interface  NSButtonCell (Whacky)
+- (NSRect)_insetRect:(NSRect)theRect;
+- (NSSize)_titleSizeWithSize:(NSSize)maxSize;
+ at end
+
+ at interface KWQNSButtonCell : NSButtonCell
+ at end
+
+ at implementation KWQNSButtonCell
+
+// cellSizeForBounds is a sizeToFit !
+- (NSSize)cellSizeForBounds:(NSRect)theRect
+{
+// XXX Find a way to get these from the system? -dwh
+#define	kPushButtonBorderSize			 4
+#define kThemePushButtonTextOffset		 4
+#define kPushButtonInset			 1
+
+    // XXX This is going to get way more complex before I'm done here. :(
+    // -dwh
+    NSSize theSize = [super cellSizeForBounds:theRect];
+    theSize.height -= (kPushButtonBorderSize)*2.0;
+    return theSize;
+}
+
+ at end
+
 @implementation KWQNSButton
 
++ (void)initialize {
+    if (self == [KWQNSButton class]) {
+        [self setCellClass:[KWQNSButtonCell class]];
+    }
+}
+
 - initWithFrame:(NSRect)r widget:(QWidget *)w 
 {
     [super initWithFrame:r];
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.h b/WebCore/kwq/WebCoreTextRendererFactory.h
index 5062af9..1e883c4 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.h
+++ b/WebCore/kwq/WebCoreTextRendererFactory.h
@@ -33,5 +33,6 @@
 
 + (WebCoreTextRendererFactory *)sharedFactory;
 - (id <WebCoreTextRenderer>)rendererWithFamily:(NSString *)family traits:(NSFontTraitMask)traits size:(float)size;
+- (NSFont *)fontWithFamily:(NSString *)family traits:(NSFontTraitMask)traits size:(float)size;
 
 @end
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.m b/WebCore/kwq/WebCoreTextRendererFactory.m
index f7ba9e4..2c7ec8f 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.m
+++ b/WebCore/kwq/WebCoreTextRendererFactory.m
@@ -50,4 +50,8 @@ static WebCoreTextRendererFactory *sharedFactory;
     return nil;
 }
 
+- (NSFont *)fontWithFamily:(NSString *)family traits:(NSFontTraitMask)traits size:(float)size
+{
+    return nil;
+}
 @end
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.mm b/WebCore/kwq/WebCoreTextRendererFactory.mm
index f7ba9e4..2c7ec8f 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.mm
+++ b/WebCore/kwq/WebCoreTextRendererFactory.mm
@@ -50,4 +50,8 @@ static WebCoreTextRendererFactory *sharedFactory;
     return nil;
 }
 
+- (NSFont *)fontWithFamily:(NSString *)family traits:(NSFontTraitMask)traits size:(float)size
+{
+    return nil;
+}
 @end
diff --git a/WebCore/kwq/qt/qbutton.h b/WebCore/kwq/qt/qbutton.h
index 347e2a7..57e35b4 100644
--- a/WebCore/kwq/qt/qbutton.h
+++ b/WebCore/kwq/qt/qbutton.h
@@ -35,6 +35,8 @@ public:
 
     virtual void setText(const QString &);
     QString text() const;
+    
+    QSize sizeHint() const;
 };
 
 #endif
diff --git a/WebCore/kwq/qt/qlineedit.h b/WebCore/kwq/qt/qlineedit.h
index dc7586c..45f1d54 100644
--- a/WebCore/kwq/qt/qlineedit.h
+++ b/WebCore/kwq/qt/qlineedit.h
@@ -50,6 +50,8 @@ public:
     void selectAll();
     bool edited() const;
     void setEdited(bool);
+    
+    void setFont(const QFont &font);
 };
 
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list