[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:24:16 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 4c24f4824a3681d9fec49b6c285346ae4dc3414d
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Feb 10 22:26:31 2003 +0000

            Reviewed by Richard.
    
            - fixed 3124596 -- failures handling URLs with non-ASCII characters in them
    
            * khtml/xml/dom_docimpl.h: Add an m_decoder field.
            * khtml/xml/dom_docimpl.cpp:
            (DocumentImpl::DocumentImpl): Initialize m_decoder to 0.
            (DocumentImpl::completeURL): Pass the QTextCodec from m_decoder to KURL if present.
    
            * khtml/khtml_part.cpp:
            (KHTMLPart::begin): Set the decoder on the document when we make the document if we have a decoder.
            (KHTMLPart::write): Set the decoder on the document when we make the decoder if we have a document.
            (KHTMLPart::completeURL): Remove APPLE_CHANGES; we handle the encoding in the document.
    
            * kwq/KWQKURL.h: Removed "encoding hint" parameters. Add a QTextCodec parameter to the
            relative URL constructor, which is the one used when we deal with links on a page.
            * kwq/KWQKURL.mm: (KURL::KURL): Decode the relative string based on the QTextCodec parameter.
    
            * kwq/KWQString.h: Added isAllASCII, good for detecting when it's safe to use latin1()
            or ascii() without worrying about character sets.
            * kwq/KWQString.mm: (QString::isAllASCII): Added.
    
            * WebCore-tests.exp: Updated for changes in KURL API.
            * WebCore-combined.exp: Regenerated.
    
            - other changes
    
            * khtml/rendering/render_table.cpp: (RenderTableCell::setWidth): Add an assertion that will help
            us notice future overflow issues.
    
            * khtml/ecma/kjs_window.cpp: (WindowFunc::tryCall): Rolled out the APPLE_CHANGES here that
            were intended to cope with the lack of window.history, which we now have. While KHTML's rule may
            not be the correct rule, this will now work as well in Safari as in Konqueror.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3621 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 213782c..4e46c25 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,39 @@
+2003-02-10  Darin Adler  <darin at apple.com>
+
+        Reviewed by Richard.
+
+        - fixed 3124596 -- failures handling URLs with non-ASCII characters in them
+
+        * khtml/xml/dom_docimpl.h: Add an m_decoder field.
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::DocumentImpl): Initialize m_decoder to 0.
+        (DocumentImpl::completeURL): Pass the QTextCodec from m_decoder to KURL if present.
+
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::begin): Set the decoder on the document when we make the document if we have a decoder.
+        (KHTMLPart::write): Set the decoder on the document when we make the decoder if we have a document.
+        (KHTMLPart::completeURL): Remove APPLE_CHANGES; we handle the encoding in the document.
+
+        * kwq/KWQKURL.h: Removed "encoding hint" parameters. Add a QTextCodec parameter to the
+        relative URL constructor, which is the one used when we deal with links on a page.
+        * kwq/KWQKURL.mm: (KURL::KURL): Decode the relative string based on the QTextCodec parameter.
+
+        * kwq/KWQString.h: Added isAllASCII, good for detecting when it's safe to use latin1()
+        or ascii() without worrying about character sets.
+        * kwq/KWQString.mm: (QString::isAllASCII): Added.
+
+        * WebCore-tests.exp: Updated for changes in KURL API.
+        * WebCore-combined.exp: Regenerated.
+
+        - other changes
+
+        * khtml/rendering/render_table.cpp: (RenderTableCell::setWidth): Add an assertion that will help
+        us notice future overflow issues.
+
+        * khtml/ecma/kjs_window.cpp: (WindowFunc::tryCall): Rolled out the APPLE_CHANGES here that
+        were intended to cope with the lack of window.history, which we now have. While KHTML's rule may
+        not be the correct rule, this will now work as well in Safari as in Konqueror.
+
 2003-02-07  Darin Adler  <darin at apple.com>
 
         Reviewed by Maciej.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 213782c..4e46c25 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,39 @@
+2003-02-10  Darin Adler  <darin at apple.com>
+
+        Reviewed by Richard.
+
+        - fixed 3124596 -- failures handling URLs with non-ASCII characters in them
+
+        * khtml/xml/dom_docimpl.h: Add an m_decoder field.
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::DocumentImpl): Initialize m_decoder to 0.
+        (DocumentImpl::completeURL): Pass the QTextCodec from m_decoder to KURL if present.
+
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::begin): Set the decoder on the document when we make the document if we have a decoder.
+        (KHTMLPart::write): Set the decoder on the document when we make the decoder if we have a document.
+        (KHTMLPart::completeURL): Remove APPLE_CHANGES; we handle the encoding in the document.
+
+        * kwq/KWQKURL.h: Removed "encoding hint" parameters. Add a QTextCodec parameter to the
+        relative URL constructor, which is the one used when we deal with links on a page.
+        * kwq/KWQKURL.mm: (KURL::KURL): Decode the relative string based on the QTextCodec parameter.
+
+        * kwq/KWQString.h: Added isAllASCII, good for detecting when it's safe to use latin1()
+        or ascii() without worrying about character sets.
+        * kwq/KWQString.mm: (QString::isAllASCII): Added.
+
+        * WebCore-tests.exp: Updated for changes in KURL API.
+        * WebCore-combined.exp: Regenerated.
+
+        - other changes
+
+        * khtml/rendering/render_table.cpp: (RenderTableCell::setWidth): Add an assertion that will help
+        us notice future overflow issues.
+
+        * khtml/ecma/kjs_window.cpp: (WindowFunc::tryCall): Rolled out the APPLE_CHANGES here that
+        were intended to cope with the lack of window.history, which we now have. While KHTML's rule may
+        not be the correct rule, this will now work as well in Safari as in Konqueror.
+
 2003-02-07  Darin Adler  <darin at apple.com>
 
         Reviewed by Maciej.
diff --git a/WebCore/WebCore-combined.exp b/WebCore/WebCore-combined.exp
index 5352757..37a3f4c 100644
--- a/WebCore/WebCore-combined.exp
+++ b/WebCore/WebCore-combined.exp
@@ -127,10 +127,10 @@ __ZN4KURL7setHostERK7QString
 __ZN4KURL7setPathERK7QString
 __ZN4KURL7setPortEt
 __ZN4KURL8setQueryERK7QStringi
-__ZN4KURLC1EPKci
-__ZN4KURLC1ERK7QStringi
+__ZN4KURLC1EPKc
+__ZN4KURLC1ERK7QString
 __ZN4KURLC1ERKS_
-__ZN4KURLC1ERKS_RK7QString
+__ZN4KURLC1ERKS_RK7QStringPK10QTextCodec
 __ZN4KURLC1Ev
 __ZN4KURLD1Ev
 __ZN5QDateC1Eiii
diff --git a/WebCore/WebCore-tests.exp b/WebCore/WebCore-tests.exp
index c47e18c..ccc2f4f 100644
--- a/WebCore/WebCore-tests.exp
+++ b/WebCore/WebCore-tests.exp
@@ -106,10 +106,10 @@ __ZN4KURL7setHostERK7QString
 __ZN4KURL7setPathERK7QString
 __ZN4KURL7setPortEt
 __ZN4KURL8setQueryERK7QStringi
-__ZN4KURLC1EPKci
-__ZN4KURLC1ERK7QStringi
+__ZN4KURLC1EPKc
+__ZN4KURLC1ERK7QString
 __ZN4KURLC1ERKS_
-__ZN4KURLC1ERKS_RK7QString
+__ZN4KURLC1ERKS_RK7QStringPK10QTextCodec
 __ZN4KURLC1Ev
 __ZN4KURLD1Ev
 __ZN5QDateC1Eiii
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index 3606daa..d87b806 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -1422,13 +1422,7 @@ Value WindowFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
            || KMessageBox::questionYesNo( window->part()->widget(), i18n("Close window?"), i18n("Confirmation Required") ) == KMessageBox::Yes
 #endif
            )
-	// FIXME: we can't ever close a non-JS window until we fix the
-	// history object to really work.
-#if APPLE_CHANGES
-	;
-#else
         (const_cast<Window*>(window))->scheduleClose();
-#endif
     }
     else
     {
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index ebfe59a..ca4dec3 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -1417,6 +1417,10 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
   // We prefer m_baseURL over m_url because m_url changes when we are
   // about to load a new page.
   d->m_doc->setBaseURL( baseurl.url() );
+#if APPLE_CHANGES
+  if (d->m_decoder)
+    d->m_doc->setDecoder(d->m_decoder);
+#endif
 #if !APPLE_CHANGES
   d->m_doc->docLoader()->setShowAnimations( KHTMLFactory::defaultHTMLSettings()->showAnimations() );
 #else
@@ -1469,6 +1473,10 @@ void KHTMLPart::write( const char *str, int len )
             d->m_decoder->setEncoding(d->m_encoding.latin1(), d->m_haveEncoding);
         else
             d->m_decoder->setEncoding(settings()->encoding().latin1(), d->m_haveEncoding);
+#if APPLE_CHANGES
+        if (d->m_doc)
+            d->m_doc->setDecoder(d->m_decoder);
+#endif
     }
   if ( len == 0 )
     return;
@@ -1794,10 +1802,7 @@ KURL KHTMLPart::completeURL( const QString &url )
 {
   if ( !d->m_doc ) return url;
 
-#if APPLE_CHANGES
-  // FIXME: We probably want to pass the encoding to the KURL constructor
-  // that's inside m_doc->completeURL().
-#else
+#if !APPLE_CHANGES
   if (d->m_decoder)
     return KURL(d->m_doc->completeURL(url), d->m_decoder->codec()->mibEnum());
 #endif
diff --git a/WebCore/khtml/rendering/render_table.cpp b/WebCore/khtml/rendering/render_table.cpp
index fe91346..f06f78d 100644
--- a/WebCore/khtml/rendering/render_table.cpp
+++ b/WebCore/khtml/rendering/render_table.cpp
@@ -1416,6 +1416,7 @@ void RenderTableCell::calcWidth()
 
 void RenderTableCell::setWidth( int width )
 {
+    assert(width <= SHRT_MAX);
     if ( width != m_width ) {
 	m_width = width;
 	m_widthChanged = true;
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index aaa58d7..450a2d6 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -230,7 +230,9 @@ DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
     : NodeBaseImpl( new DocumentPtr() )
     , m_imageLoadEventTimer(0)
 #if APPLE_CHANGES
-    , m_finishedParsing(this, SIGNAL(finishedParsing())), m_inPageCache(0), m_passwordFields(0), m_secureForms(0)
+    , m_finishedParsing(this, SIGNAL(finishedParsing()))
+    , m_inPageCache(0), m_passwordFields(0), m_secureForms(0)
+    , m_decoder(0)
 #endif
 {
     document->doc = this;
@@ -2188,6 +2190,11 @@ void DocumentImpl::timerEvent(QTimerEvent *)
 
 #if APPLE_CHANGES
 
+QString DocumentImpl::completeURL(const QString &URL)
+{
+    return KURL(baseURL(), URL, m_decoder ? m_decoder->codec() : 0).url();
+}
+
 bool DocumentImpl::inPageCache()
 {
     return m_inPageCache;
diff --git a/WebCore/khtml/xml/dom_docimpl.h b/WebCore/khtml/xml/dom_docimpl.h
index d083412..553bbff 100644
--- a/WebCore/khtml/xml/dom_docimpl.h
+++ b/WebCore/khtml/xml/dom_docimpl.h
@@ -39,6 +39,7 @@
 
 #if APPLE_CHANGES
 #include "KWQSignal.h"
+#include "decoder.h"
 #endif
 
 class QPaintDevice;
@@ -258,7 +259,12 @@ public:
     QString baseTarget() const { return m_baseTarget; }
     void setBaseTarget(const QString& baseTarget) { m_baseTarget = baseTarget; }
 
+#if APPLE_CHANGES
+    void setDecoder(khtml::Decoder *d) { m_decoder = d; }
+    QString completeURL(const QString &);
+#else
     QString completeURL(const QString& url) { return KURL(baseURL(),url).url(); };
+#endif
 
     // from cachedObjectClient
     virtual void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheetStr);
@@ -518,6 +524,8 @@ private:
     bool m_inPageCache;
     int m_passwordFields;
     int m_secureForms;
+    
+    khtml::Decoder *m_decoder;
 #endif
 };
 
diff --git a/WebCore/kwq/KWQKURL.h b/WebCore/kwq/KWQKURL.h
index c758358..c9f19b5 100644
--- a/WebCore/kwq/KWQKURL.h
+++ b/WebCore/kwq/KWQKURL.h
@@ -30,12 +30,14 @@
 #include "KWQValueList.h"
 #include "KWQRefPtr.h"
 
+class QTextCodec;
+
 class KURL {
 public:
     KURL();
-    KURL(const char *, int encoding_hint=0);
-    KURL(const KURL &, const QString &);
-    KURL(const QString &, int encoding_hint=0);
+    KURL(const char *);
+    KURL(const KURL &, const QString &, const QTextCodec * = 0);
+    KURL(const QString &);
     
     bool isEmpty() const { return urlString.isEmpty(); } 
     bool isMalformed() const { return !m_isValid; }
diff --git a/WebCore/kwq/KWQKURL.mm b/WebCore/kwq/KWQKURL.mm
index beaad2f..59faf3d 100644
--- a/WebCore/kwq/KWQKURL.mm
+++ b/WebCore/kwq/KWQKURL.mm
@@ -26,6 +26,7 @@
 #import "KWQKURL.h"
 
 #import "KWQAssertions.h"
+#import "KWQTextCodec.h"
 
 typedef enum {
     // alpha 
@@ -208,7 +209,7 @@ KURL::KURL() :
 {
 }
 
-KURL::KURL(const char *url, int encoding_hint) :
+KURL::KURL(const char *url) :
     m_isValid(true)
 {
     if (url != NULL && url[0] == '/') {
@@ -219,7 +220,7 @@ KURL::KURL(const char *url, int encoding_hint) :
     }
 }
 
-KURL::KURL(const QString &url, int encoding_hint) :
+KURL::KURL(const QString &url) :
     m_isValid(true)
 
 {
@@ -231,7 +232,7 @@ KURL::KURL(const QString &url, int encoding_hint) :
     }
 }
 
-KURL::KURL(const KURL &base, const QString &relative)
+KURL::KURL(const KURL &base, const QString &relative, const QTextCodec *codec)
 {
     // Allow at lest absolute URLs to resolve against an empty URL.
     if (!base.m_isValid && !base.isEmpty()) {
@@ -240,7 +241,19 @@ KURL::KURL(const KURL &base, const QString &relative)
     }
     
     bool absolute = false;
-    const char *str = relative.ascii();
+    
+    bool allASCII = relative.isAllASCII();
+    char *strBuffer;
+    const char *str;
+    if (allASCII) {
+        strBuffer = 0;
+        str = relative.ascii();
+    } else {
+        QCString decoded = codec ? codec->fromUnicode(relative)
+            : QTextCodec(kCFStringEncodingUTF8).fromUnicode(relative);
+        strBuffer = strdup(decoded);
+        str = strBuffer;
+    }
     
     // According to the RFC, the reference should be interpreted as an
     // absolute URI if possible, using the "leftmost, longest"
@@ -259,7 +272,7 @@ KURL::KURL(const KURL &base, const QString &relative)
     }
     
     if (absolute) {
-	parse(str, &relative);
+	parse(str, allASCII ? &relative : 0);
     } else {
 	// workaround for sites that put leading whitespace on relative URLs
 	while (*str == ' ') {
@@ -267,9 +280,9 @@ KURL::KURL(const KURL &base, const QString &relative)
 	}
 
 	// if the base is invalid, just append the relative
-	// portion. The RFC does not specify what to do in this case.q
+	// portion. The RFC does not specify what to do in this case.
 	if (!base.m_isValid) {
-	    QString newURL = base.urlString + relative;
+	    QString newURL = base.urlString + str;
 	    parse(newURL.ascii(), &newURL);
 	}
 
@@ -284,7 +297,7 @@ KURL::KURL(const KURL &base, const QString &relative)
 	case '#':
 	    // must be fragment-only reference
 	    {
-		QString newURL = base.urlString.left(base.queryEndPos) + relative;
+		QString newURL = base.urlString.left(base.queryEndPos) + str;
 		parse(newURL.ascii(), &newURL);
 		break;
 	    }
@@ -309,7 +322,7 @@ KURL::KURL(const KURL &base, const QString &relative)
 		char static_buffer[2048];
 		char *buffer;
 		
-		size_t bufferLength = base.pathEndPos + relative.length() + 1;
+		size_t bufferLength = base.pathEndPos + strlen(str) + 1;
 
 		if (bufferLength > sizeof(static_buffer)) {
 		    buffer = (char *)malloc(bufferLength);
@@ -338,7 +351,7 @@ KURL::KURL(const KURL &base, const QString &relative)
 		
                 bufferPos += copyPathRemovingDots(bufferPos, baseStringStart, 0, baseStringEnd - baseStringStart);
 
-		const char *relStringStart = relative.ascii();
+		const char *relStringStart = str;
 		const char *relStringPos = relStringStart;
 		
 		while (*relStringPos != '\0' && *relStringPos != '?' && *relStringPos != '#') {
@@ -390,6 +403,10 @@ KURL::KURL(const KURL &base, const QString &relative)
 	    }
 	}
     }
+    
+    if (strBuffer) {
+        free(strBuffer);
+    }
 }
 
 bool KURL::hasPath() const
diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index a03af37..2f76c19 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -350,6 +350,7 @@ public:
     const QChar *unicode() const;
     const char *latin1() const;
     const char *ascii() const;
+    bool isAllASCII() const;
     QCString utf8() const;
     QCString local8Bit() const;
 
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 74e53fa..6ca39ba 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -1412,6 +1412,30 @@ int QString::contains(const QString &str, bool caseSensitive) const
     return count;
 }
 
+bool QString::isAllASCII() const
+{
+    if (dataHandle[0]->_isAsciiValid) {
+        const char *p = ascii();
+        int n = dataHandle[0]->_length;
+        while (n--) {
+            unsigned char c = *p++;
+            if (c > 0x7F) {
+                return false;
+            }
+        }
+    }
+    else if (dataHandle[0]->_isUnicodeValid) {
+        const QChar *p = unicode();
+        int n = dataHandle[0]->_length;
+        while (n--) {
+            if ((*p++).unicode() > 0x7F) {
+                return false;
+            }
+        }
+    }
+    return true;
+}
+
 short QString::toShort(bool *ok, int base) const
 {
     long v = toLong( ok, base );

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list