[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:40:46 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 694552cba9031b2165da4d78b242689c424d2813
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed May 7 01:11:13 2003 +0000

            Reviewed by Chris.
    
    	- fixed 3211756 -- form field contents on the left instead of right on page in RtL language
    
            * khtml/rendering/render_form.cpp:
            (RenderLineEdit::updateFromElement): Call setAlignment based on the style's direction.
            (RenderTextArea::updateFromElement): Ditto.
            * kwq/KWQLineEdit.h: Added setAlignment.
            * kwq/KWQLineEdit.mm: (QLineEdit::setAlignment): Added. Calls setAlignment on KWQTextField.
            * kwq/KWQTextArea.h: Added setAlignment.
            * kwq/KWQTextArea.mm: (-[KWQTextArea setAlignment:]): Added. Calls setAlignment on NSTextView.
            * kwq/KWQTextEdit.h: Added setAlignment.
            * kwq/KWQTextEdit.mm: (QTextEdit::setAlignment): Added. Calls setAlignment on KWQTextField.
            * kwq/KWQTextField.mm: (-[KWQTextField setAlignment:]): Added. Call setAlignment on secure
            text field too.
    
    	- fixed 3250538 -- on pages labeled "US-ASCII", non-ASCII chars are not decoded as Latin-1
              as in other browsers
    
            * kwq/KWQTextCodec.mm:
            (effectiveEncoding): Added. Maps ISO Latin-1 and US-ASCII to Windows Latin-1.
            (QTextCodec::fromUnicode): Use effectiveEncoding.
            (KWQTextDecoder::convertUsingTEC): Use effectiveEncoding.
    
            - other changes
    
            * kwq/KWQCharsets.mm: (buildDictionaries): Make the first encoding in the file win for
            purposes of deciding which name is used. I thought this was happening before, but actually
            the last one was winning. Do this by using CFDictionaryAddValue, which does nothing if
            there's already a dictionary entry, instead of CFDictionarySetValue, which replaces.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4299 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index e5aa99c..c5e9ce7 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,36 @@
+2003-05-06  Darin Adler  <darin at apple.com>
+
+        Reviewed by Chris.
+
+	- fixed 3211756 -- form field contents on the left instead of right on page in RtL language
+
+        * khtml/rendering/render_form.cpp:
+        (RenderLineEdit::updateFromElement): Call setAlignment based on the style's direction.
+        (RenderTextArea::updateFromElement): Ditto.
+        * kwq/KWQLineEdit.h: Added setAlignment.
+        * kwq/KWQLineEdit.mm: (QLineEdit::setAlignment): Added. Calls setAlignment on KWQTextField.
+        * kwq/KWQTextArea.h: Added setAlignment.
+        * kwq/KWQTextArea.mm: (-[KWQTextArea setAlignment:]): Added. Calls setAlignment on NSTextView.
+        * kwq/KWQTextEdit.h: Added setAlignment.
+        * kwq/KWQTextEdit.mm: (QTextEdit::setAlignment): Added. Calls setAlignment on KWQTextField.
+        * kwq/KWQTextField.mm: (-[KWQTextField setAlignment:]): Added. Call setAlignment on secure
+        text field too.
+
+	- fixed 3250538 -- on pages labeled "US-ASCII", non-ASCII chars are not decoded as Latin-1
+          as in other browsers
+
+        * kwq/KWQTextCodec.mm:
+        (effectiveEncoding): Added. Maps ISO Latin-1 and US-ASCII to Windows Latin-1.
+        (QTextCodec::fromUnicode): Use effectiveEncoding.
+        (KWQTextDecoder::convertUsingTEC): Use effectiveEncoding.
+
+        - other changes
+
+        * kwq/KWQCharsets.mm: (buildDictionaries): Make the first encoding in the file win for
+        purposes of deciding which name is used. I thought this was happening before, but actually
+        the last one was winning. Do this by using CFDictionaryAddValue, which does nothing if
+        there's already a dictionary entry, instead of CFDictionarySetValue, which replaces.
+
 2003-05-06  David Hyatt  <hyatt at apple.com>
 
 	Make negative z-index content paint above the background of
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index e5aa99c..c5e9ce7 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,36 @@
+2003-05-06  Darin Adler  <darin at apple.com>
+
+        Reviewed by Chris.
+
+	- fixed 3211756 -- form field contents on the left instead of right on page in RtL language
+
+        * khtml/rendering/render_form.cpp:
+        (RenderLineEdit::updateFromElement): Call setAlignment based on the style's direction.
+        (RenderTextArea::updateFromElement): Ditto.
+        * kwq/KWQLineEdit.h: Added setAlignment.
+        * kwq/KWQLineEdit.mm: (QLineEdit::setAlignment): Added. Calls setAlignment on KWQTextField.
+        * kwq/KWQTextArea.h: Added setAlignment.
+        * kwq/KWQTextArea.mm: (-[KWQTextArea setAlignment:]): Added. Calls setAlignment on NSTextView.
+        * kwq/KWQTextEdit.h: Added setAlignment.
+        * kwq/KWQTextEdit.mm: (QTextEdit::setAlignment): Added. Calls setAlignment on KWQTextField.
+        * kwq/KWQTextField.mm: (-[KWQTextField setAlignment:]): Added. Call setAlignment on secure
+        text field too.
+
+	- fixed 3250538 -- on pages labeled "US-ASCII", non-ASCII chars are not decoded as Latin-1
+          as in other browsers
+
+        * kwq/KWQTextCodec.mm:
+        (effectiveEncoding): Added. Maps ISO Latin-1 and US-ASCII to Windows Latin-1.
+        (QTextCodec::fromUnicode): Use effectiveEncoding.
+        (KWQTextDecoder::convertUsingTEC): Use effectiveEncoding.
+
+        - other changes
+
+        * kwq/KWQCharsets.mm: (buildDictionaries): Make the first encoding in the file win for
+        purposes of deciding which name is used. I thought this was happening before, but actually
+        the last one was winning. Do this by using CFDictionaryAddValue, which does nothing if
+        there's already a dictionary entry, instead of CFDictionarySetValue, which replaces.
+
 2003-05-06  David Hyatt  <hyatt at apple.com>
 
 	Make negative z-index content paint above the background of
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 25e03a5..4da1d26 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -510,23 +510,27 @@ void RenderLineEdit::calcMinMaxWidth()
 
 void RenderLineEdit::updateFromElement()
 {
+    KLineEdit *w = widget();
+    
     int ml = element()->maxLength();
     if ( ml <= 0 || ml > 1024 )
         ml = 1024;
-    if ( widget()->maxLength() != ml )
-        widget()->setMaxLength( ml );
+    if ( w->maxLength() != ml )
+        w->setMaxLength( ml );
 
-    if (element()->value().string() != widget()->text()) {
-        widget()->blockSignals(true);
-        int pos = widget()->cursorPosition();
-        widget()->setText(element()->value().string());
+    if (element()->value().string() != w->text()) {
+        w->blockSignals(true);
+        int pos = w->cursorPosition();
+        w->setText(element()->value().string());
 
-        widget()->setEdited( false );
+        w->setEdited( false );
 
-        widget()->setCursorPosition(pos);
-        widget()->blockSignals(false);
+        w->setCursorPosition(pos);
+        w->blockSignals(false);
     }
-    widget()->setReadOnly(element()->readOnly());
+    w->setReadOnly(element()->readOnly());
+    
+    w->setAlignment(style()->direction() == RTL ? Qt::AlignRight : Qt::AlignLeft);
 
     RenderFormElement::updateFromElement();
 }
@@ -1181,6 +1185,7 @@ void RenderTextArea::updateFromElement()
 {
     TextAreaWidget* w = static_cast<TextAreaWidget*>(m_widget);
     w->setReadOnly(element()->readOnly());
+    w->setAlignment(style()->direction() == RTL ? Qt::AlignRight : Qt::AlignLeft);
     QString text = element()->value().string();
     if (w->text() != text) {
         w->blockSignals(true);
diff --git a/WebCore/kwq/KWQCharsets.mm b/WebCore/kwq/KWQCharsets.mm
index 99ac0a0..d1206e2 100644
--- a/WebCore/kwq/KWQCharsets.mm
+++ b/WebCore/kwq/KWQCharsets.mm
@@ -48,8 +48,8 @@ static void buildDictionaries()
     encodingToTable = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
 
     for (int i = 0; table[i].name != NULL; i++) {
-        CFDictionarySetValue(nameToTable, table[i].name, &table[i]);
-        CFDictionarySetValue(encodingToTable, reinterpret_cast<void *>(table[i].encoding), &table[i]);
+        CFDictionaryAddValue(nameToTable, table[i].name, &table[i]);
+        CFDictionaryAddValue(encodingToTable, reinterpret_cast<void *>(table[i].encoding), &table[i]);
     }
 }
 
diff --git a/WebCore/kwq/KWQLineEdit.h b/WebCore/kwq/KWQLineEdit.h
index cf9cb37..b45eed9 100644
--- a/WebCore/kwq/KWQLineEdit.h
+++ b/WebCore/kwq/KWQLineEdit.h
@@ -35,22 +35,29 @@ public:
 
     QLineEdit();
 
-    virtual void setEchoMode(EchoMode);
-    virtual void setCursorPosition(int);
-    virtual void setText(const QString &);
-    virtual QString text();
-    virtual void setMaxLength(int);
+    void setAlignment(AlignmentFlags);
 
-    bool isReadOnly() const;
-    void setReadOnly(bool);
+    void setCursorPosition(int);
     int cursorPosition() const;
-    int maxLength() const;
-    void selectAll();
-    bool edited() const;
+
+    void setEchoMode(EchoMode);
+
     void setEdited(bool);
-    
+    bool edited() const;
+
     void setFont(const QFont &font);
     
+    void setMaxLength(int);
+    int maxLength() const;
+
+    void setReadOnly(bool);
+    bool isReadOnly() const;
+
+    void setText(const QString &);
+    QString text();
+
+    void selectAll();
+    
     QSize sizeForCharacterWidth(int numCharacters) const;
     int baselinePosition() const;
     
diff --git a/WebCore/kwq/KWQLineEdit.mm b/WebCore/kwq/KWQLineEdit.mm
index 1475579..c42ddcc 100644
--- a/WebCore/kwq/KWQLineEdit.mm
+++ b/WebCore/kwq/KWQLineEdit.mm
@@ -162,3 +162,9 @@ void QLineEdit::clicked()
 {
     m_clicked.call();
 }
+
+void QLineEdit::setAlignment(AlignmentFlags alignment)
+{
+    ASSERT(alignment == AlignLeft || alignment == AlignRight);
+    [(KWQTextField *)getView() setAlignment:(alignment == AlignRight ? NSRightTextAlignment : NSLeftTextAlignment)];
+}
diff --git a/WebCore/kwq/KWQTextArea.h b/WebCore/kwq/KWQTextArea.h
index f3d6ac1..1d9d851 100644
--- a/WebCore/kwq/KWQTextArea.h
+++ b/WebCore/kwq/KWQTextArea.h
@@ -39,19 +39,24 @@ class QTextEdit;
 
 - initWithQTextEdit:(QTextEdit *)w; 
 
-// The following methods corresponds to methods required by KDE.
-- (void)setWordWrap:(BOOL)wrap;
-- (BOOL)wordWrap;
+- (void)setAlignment:(NSTextAlignment)alignment;
+
+- (void)setEditable:(BOOL)flag;
+- (BOOL)isEditable;
+
+- (void)setFont:(NSFont *)font;
+
 - (void)setText:(NSString *)text;
 - (NSString *)text;
 - (NSString *)textWithHardLineBreaks;
+
+- (void)setWordWrap:(BOOL)wrap;
+- (BOOL)wordWrap;
+
 - (void)selectAll;
-- (void)setEditable:(BOOL)flag;
-- (BOOL)isEditable;
-- (void)setFont:(NSFont *)font;
 
 // paragraph-oriented functions for the benefit of QTextEdit
-- (void)getCursorPositionAsIndex:(int *)index inParagraph:(int *)paragraph;
 - (void)setCursorPositionToIndex:(int)index inParagraph:(int)paragraph;
+- (void)getCursorPositionAsIndex:(int *)index inParagraph:(int *)paragraph;
 
 @end
diff --git a/WebCore/kwq/KWQTextArea.mm b/WebCore/kwq/KWQTextArea.mm
index 5b1e027..4449387 100644
--- a/WebCore/kwq/KWQTextArea.mm
+++ b/WebCore/kwq/KWQTextArea.mm
@@ -417,6 +417,11 @@ static NSRange RangeOfParagraph(NSString *text, int paragraph)
     return widget;
 }
 
+- (void)setAlignment:(NSTextAlignment)alignment
+{
+    [textView setAlignment:alignment];
+}
+
 @end
 
 @implementation KWQTextAreaTextView
diff --git a/WebCore/kwq/KWQTextCodec.mm b/WebCore/kwq/KWQTextCodec.mm
index 2c5c8db..51da6ac 100644
--- a/WebCore/kwq/KWQTextCodec.mm
+++ b/WebCore/kwq/KWQTextCodec.mm
@@ -127,14 +127,29 @@ QTextDecoder *QTextCodec::makeDecoder() const
     return new KWQTextDecoder(_encoding, _flags);
 }
 
+inline CFStringEncoding effectiveEncoding(CFStringEncoding e)
+{
+    switch (e) {
+        case kCFStringEncodingISOLatin1:
+        case kCFStringEncodingASCII:
+            e = kCFStringEncodingWindowsLatin1;
+            break;
+    }
+    return e;
+}
+
 QCString QTextCodec::fromUnicode(const QString &qcs) const
 {
+    // FIXME: Should really use the same API in both directions, not CF one way and TEC the other.
+    
+    CFStringEncoding encoding = effectiveEncoding(_encoding);
+
     CFStringRef cfs = qcs.getCFString();
     CFRange range = CFRangeMake(0, CFStringGetLength(cfs));
     CFIndex bufferLength;
-    CFStringGetBytes(cfs, range, _encoding, '?', false, NULL, 0x7FFFFFFF, &bufferLength);
+    CFStringGetBytes(cfs, range, encoding, '?', false, NULL, 0x7FFFFFFF, &bufferLength);
     QCString result(bufferLength + 1);
-    CFStringGetBytes(cfs, range, _encoding, '?', false, (UInt8 *)result.data(), bufferLength, &bufferLength);
+    CFStringGetBytes(cfs, range, encoding, '?', false, (UInt8 *)result.data(), bufferLength, &bufferLength);
     result[bufferLength] = 0;
     return result;
 }
@@ -296,19 +311,21 @@ QString KWQTextDecoder::convertUTF16(const unsigned char *s, int length)
 QString KWQTextDecoder::convertUsingTEC(const UInt8 *chs, int len, bool flush)
 {
     OSStatus status;
+    
+    CFStringEncoding encoding = effectiveEncoding(_encoding);
 
     // Get a converter for the passed-in encoding.
     if (!_converter) {
-        if (_cachedConverterEncoding == _encoding) {
+        if (_cachedConverterEncoding == encoding) {
             _converter = _cachedConverter;
             _cachedConverter = 0;
             _cachedConverterEncoding = kCFStringEncodingInvalidId;
             TECClearConverterContextInfo(_converter);
         } else {
-            status = TECCreateConverter(&_converter, _encoding,
+            status = TECCreateConverter(&_converter, encoding,
                 CreateTextEncoding(kTextEncodingUnicodeDefault, kTextEncodingDefaultVariant, kUnicode16BitFormat));
             if (status) {
-                ERROR("the Text Encoding Converter won't convert from text encoding 0x%X, error %d", _encoding, status);
+                ERROR("the Text Encoding Converter won't convert from text encoding 0x%X, error %d", encoding, status);
                 return QString::null;
             }
 
@@ -376,7 +393,7 @@ QString KWQTextDecoder::convertUsingTEC(const UInt8 *chs, int len, bool flush)
     // Simplified Chinese pages use the code U+A3A0 to mean "full-width space".
     // But GB18030 decodes it to U+E5E5, which is correct in theory but not in practice.
     // To work around, just change all occurences of U+E5E5 to U+3000 (ideographic space).
-    if (_encoding == kCFStringEncodingGB_18030_2000) {
+    if (encoding == kCFStringEncodingGB_18030_2000) {
         result.replace(0xE5E5, 0x3000);
     }
     
diff --git a/WebCore/kwq/KWQTextEdit.h b/WebCore/kwq/KWQTextEdit.h
index 87fad76..69012d7 100644
--- a/WebCore/kwq/KWQTextEdit.h
+++ b/WebCore/kwq/KWQTextEdit.h
@@ -44,18 +44,28 @@ class QTextEdit : public QScrollView
 
     QTextEdit(QWidget *parent);
 
-    QString text() const;
+    void setAlignment(AlignmentFlags);
+
+    void setCursorPosition(int, int);
+    void getCursorPosition(int *, int *) const;
+
+    FocusPolicy focusPolicy() const;
+
+    void setFont(const QFont &);
+
+    void setReadOnly(bool);
+    bool isReadOnly() const;
+
     void setText(const QString &);
+    QString text() const;
     QString textWithHardLineBreaks() const;
 
-    WrapStyle wordWrap() const;
-    void setWordWrap(WrapStyle);
     void setTextFormat(TextFormat);
+
+    void setWordWrap(WrapStyle);
+    WrapStyle wordWrap() const;
+
     void setTabStopWidth(int);
-    bool isReadOnly() const;
-    void setReadOnly(bool);
-    void getCursorPosition(int *, int *) const;
-    void setCursorPosition(int, int);
 
     void selectAll();
 
@@ -64,10 +74,6 @@ class QTextEdit : public QScrollView
 
     void textChanged() { _textChanged.call(); }
 
-    FocusPolicy focusPolicy() const;
-
-    void setFont(const QFont &);
-
     void clicked();
 
   private:
diff --git a/WebCore/kwq/KWQTextEdit.mm b/WebCore/kwq/KWQTextEdit.mm
index d76b529..83020e0 100644
--- a/WebCore/kwq/KWQTextEdit.mm
+++ b/WebCore/kwq/KWQTextEdit.mm
@@ -25,6 +25,7 @@
 
 #import "KWQTextEdit.h"
 
+#import "KWQAssertions.h"
 #import "KWQTextArea.h"
 
 QTextEdit::QTextEdit(QWidget *parent)
@@ -132,3 +133,9 @@ void QTextEdit::clicked()
 {
     _clicked.call();
 }
+
+void QTextEdit::setAlignment(AlignmentFlags alignment)
+{
+    ASSERT(alignment == AlignLeft || alignment == AlignRight);
+    [(KWQTextArea *)getView() setAlignment:(alignment == AlignRight ? NSRightTextAlignment : NSLeftTextAlignment)];
+}
diff --git a/WebCore/kwq/KWQTextField.mm b/WebCore/kwq/KWQTextField.mm
index b42667f..1dd6211 100644
--- a/WebCore/kwq/KWQTextField.mm
+++ b/WebCore/kwq/KWQTextField.mm
@@ -406,6 +406,12 @@
     widget->clicked();
 }
 
+- (void)setAlignment:(NSTextAlignment)alignment
+{
+    [secureField setAlignment:alignment];
+    [super setAlignment:alignment];
+}
+
 @end
 
 @implementation KWQTextFieldFormatter

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list