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

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:50:57 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit bcce7dc61bda41e64ea585674ec8d713b6e60e29
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 19 18:22:33 2001 +0000

    Fixes for getting WebViewTest running.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@375 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/khtml/rendering/render_body.cpp b/WebCore/khtml/rendering/render_body.cpp
index 9df08a9..c5b9f91 100644
--- a/WebCore/khtml/rendering/render_body.cpp
+++ b/WebCore/khtml/rendering/render_body.cpp
@@ -96,8 +96,8 @@ void RenderBody::layout()
     {
         if (root()->view())
         {
-            root()->view()->horizontalScrollBar()->setPalette(style()->palette());
-            root()->view()->verticalScrollBar()->setPalette(style()->palette());
+            //root()->view()->horizontalScrollBar()->setPalette(style()->palette());
+            //root()->view()->verticalScrollBar()->setPalette(style()->palette());
         }
         scrollbarsStyled=true;
     }
diff --git a/WebCore/kwq/KWQChar.mm b/WebCore/kwq/KWQChar.mm
index 36f4cb8..3f32cc0 100644
--- a/WebCore/kwq/KWQChar.mm
+++ b/WebCore/kwq/KWQChar.mm
@@ -223,6 +223,15 @@ QChar QChar::mirroredChar() const
     return *this;
 }
 
+int QChar::digitValue() const
+{
+    // ##### just latin1
+    if ( c < '0' || c > '9' )
+	return -1;
+    else
+	return c - '0';
+}
+
 // operators -------------------------------------------------------------------
 
 bool operator==(QChar qc1, QChar qc2)
diff --git a/WebCore/kwq/KWQColor.mm b/WebCore/kwq/KWQColor.mm
index 2bd88f9..c915567 100644
--- a/WebCore/kwq/KWQColor.mm
+++ b/WebCore/kwq/KWQColor.mm
@@ -36,7 +36,7 @@
 **********************************************************************/
 
 #include <qcolor.h>
-
+#include <qstring.h>
 
 QRgb qRgb(int r, int g, int b)
 {
@@ -66,13 +66,10 @@ QColor::QColor(int r, int g, int b)
 }
 
 
-QColor::QColor(const char *n)
+QColor::QColor(const char *name)
 {
- //   if ( !globals_init )
-//	initGlobalColors();
-//    NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
-    // FIXME: need to implement real construction of color based on string
-    _initialize (0,0,0);
+    color = nil;
+    setNamedColor( QString(name) );
 }
 
 
@@ -112,11 +109,58 @@ QString QColor::name() const
 }
 
 
-void QColor::setNamedColor(const QString&n)
+static int hex2int( QChar hexchar )
 {
-    //NSLog (@"WARNING %s:%s %d (NOT YET IMPLEMENTED) color = %s\n", __FILE__, __FUNCTION__, __LINE__, n.ascii());
-    NSLog (@"WARNING %s:%s %d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
-    // Do something better here.
+    int v;
+    if ( hexchar.isDigit() )
+	v = hexchar.digitValue();
+    else if ( hexchar >= 'A' && hexchar <= 'F' )
+	v = hexchar.cell() - 'A' + 10;
+    else if ( hexchar >= 'a' && hexchar <= 'f' )
+	v = hexchar.cell() - 'a' + 10;
+    else
+	v = 0;
+    return v;
+}
+
+
+void QColor::setNamedColor(const QString&name)
+{
+    if ( name.isEmpty() ) {
+	setRgb( 0 );
+    } else if ( name[0] == '#' ) {
+	const QChar *p = name.unicode()+1;
+	int len = name.length()-1;
+	int r, g, b;
+	if ( len == 12 ) {
+	    r = (hex2int(p[0]) << 4) + hex2int(p[1]);
+	    g = (hex2int(p[4]) << 4) + hex2int(p[5]);
+	    b = (hex2int(p[8]) << 4) + hex2int(p[9]);
+	} else if ( len == 9 ) {
+	    r = (hex2int(p[0]) << 4) + hex2int(p[1]);
+	    g = (hex2int(p[3]) << 4) + hex2int(p[4]);
+	    b = (hex2int(p[6]) << 4) + hex2int(p[7]);
+	} else if ( len == 6 ) {
+	    r = (hex2int(p[0]) << 4) + hex2int(p[1]);
+	    g = (hex2int(p[2]) << 4) + hex2int(p[3]);
+	    b = (hex2int(p[4]) << 4) + hex2int(p[5]);
+	} else if ( len == 3 ) {
+	    r = (hex2int(p[0]) << 4) + hex2int(p[0]);
+	    g = (hex2int(p[1]) << 4) + hex2int(p[1]);
+	    b = (hex2int(p[2]) << 4) + hex2int(p[2]);
+	} else {
+	    r = g = b = 0;
+	}
+	setRgb( r, g, b );
+    } else {
+	if (color != nil)
+            [color release];
+        color = [NSColor colorWithCatalogName: @"Apple" colorName: QSTRING_TO_NSSTRING(name)];
+        if (color == nil) {
+            NSLog (@"WARNING %s:%d %s couldn't create color using name %s\n", __FILE__, __LINE__, __FUNCTION__, name.ascii());
+            color = [NSColor blackColor];
+        }
+    }
 }
 
 
@@ -187,12 +231,14 @@ void QColor::hsv(int *, int *, int *) const
 QColor QColor::light(int f = 150) const
 {
     NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    return *this;
 }
 
 
 QColor QColor::dark(int f = 200) const
 {
     NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    return *this;
 }
 
 
diff --git a/WebCore/kwq/KWQScrollView.mm b/WebCore/kwq/KWQScrollView.mm
index d16c89a..082bbb9 100644
--- a/WebCore/kwq/KWQScrollView.mm
+++ b/WebCore/kwq/KWQScrollView.mm
@@ -57,28 +57,28 @@ QWidget* QScrollView::viewport() const
 int QScrollView::visibleWidth() const
 {
     //_logNeverImplemented();
-    return 0;
+    return 200;
 }
 
 
 int QScrollView::visibleHeight() const
 {
     //_logNeverImplemented();
-    return 0;
+    return 200;
 }
 
 
 int QScrollView::contentsWidth() const
 {
     _logNeverImplemented();
-    return 0;
+    return 200;
 }
 
 
 int QScrollView::contentsHeight() const
 {
     _logNeverImplemented();
-    return 0;
+    return 200;
 }
 
 
diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index cb2c8aa..4c02532 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -119,6 +119,7 @@ public:
     bool isNumber() const;
     bool isLetterOrNumber() const;
     bool isPunct() const;
+    int digitValue() const;
     QChar lower() const;
     QChar upper() const;
     Direction direction() const;
diff --git a/WebCore/kwq/qt/qstring.h b/WebCore/kwq/qt/qstring.h
index cb2c8aa..4c02532 100644
--- a/WebCore/kwq/qt/qstring.h
+++ b/WebCore/kwq/qt/qstring.h
@@ -119,6 +119,7 @@ public:
     bool isNumber() const;
     bool isLetterOrNumber() const;
     bool isPunct() const;
+    int digitValue() const;
     QChar lower() const;
     QChar upper() const;
     Direction direction() const;
diff --git a/WebCore/src/kdelibs/khtml/rendering/render_body.cpp b/WebCore/src/kdelibs/khtml/rendering/render_body.cpp
index 9df08a9..c5b9f91 100644
--- a/WebCore/src/kdelibs/khtml/rendering/render_body.cpp
+++ b/WebCore/src/kdelibs/khtml/rendering/render_body.cpp
@@ -96,8 +96,8 @@ void RenderBody::layout()
     {
         if (root()->view())
         {
-            root()->view()->horizontalScrollBar()->setPalette(style()->palette());
-            root()->view()->verticalScrollBar()->setPalette(style()->palette());
+            //root()->view()->horizontalScrollBar()->setPalette(style()->palette());
+            //root()->view()->verticalScrollBar()->setPalette(style()->palette());
         }
         scrollbarsStyled=true;
     }
diff --git a/WebCore/src/kwq/KWQChar.mm b/WebCore/src/kwq/KWQChar.mm
index 36f4cb8..3f32cc0 100644
--- a/WebCore/src/kwq/KWQChar.mm
+++ b/WebCore/src/kwq/KWQChar.mm
@@ -223,6 +223,15 @@ QChar QChar::mirroredChar() const
     return *this;
 }
 
+int QChar::digitValue() const
+{
+    // ##### just latin1
+    if ( c < '0' || c > '9' )
+	return -1;
+    else
+	return c - '0';
+}
+
 // operators -------------------------------------------------------------------
 
 bool operator==(QChar qc1, QChar qc2)
diff --git a/WebCore/src/kwq/KWQColor.mm b/WebCore/src/kwq/KWQColor.mm
index 2bd88f9..c915567 100644
--- a/WebCore/src/kwq/KWQColor.mm
+++ b/WebCore/src/kwq/KWQColor.mm
@@ -36,7 +36,7 @@
 **********************************************************************/
 
 #include <qcolor.h>
-
+#include <qstring.h>
 
 QRgb qRgb(int r, int g, int b)
 {
@@ -66,13 +66,10 @@ QColor::QColor(int r, int g, int b)
 }
 
 
-QColor::QColor(const char *n)
+QColor::QColor(const char *name)
 {
- //   if ( !globals_init )
-//	initGlobalColors();
-//    NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
-    // FIXME: need to implement real construction of color based on string
-    _initialize (0,0,0);
+    color = nil;
+    setNamedColor( QString(name) );
 }
 
 
@@ -112,11 +109,58 @@ QString QColor::name() const
 }
 
 
-void QColor::setNamedColor(const QString&n)
+static int hex2int( QChar hexchar )
 {
-    //NSLog (@"WARNING %s:%s %d (NOT YET IMPLEMENTED) color = %s\n", __FILE__, __FUNCTION__, __LINE__, n.ascii());
-    NSLog (@"WARNING %s:%s %d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
-    // Do something better here.
+    int v;
+    if ( hexchar.isDigit() )
+	v = hexchar.digitValue();
+    else if ( hexchar >= 'A' && hexchar <= 'F' )
+	v = hexchar.cell() - 'A' + 10;
+    else if ( hexchar >= 'a' && hexchar <= 'f' )
+	v = hexchar.cell() - 'a' + 10;
+    else
+	v = 0;
+    return v;
+}
+
+
+void QColor::setNamedColor(const QString&name)
+{
+    if ( name.isEmpty() ) {
+	setRgb( 0 );
+    } else if ( name[0] == '#' ) {
+	const QChar *p = name.unicode()+1;
+	int len = name.length()-1;
+	int r, g, b;
+	if ( len == 12 ) {
+	    r = (hex2int(p[0]) << 4) + hex2int(p[1]);
+	    g = (hex2int(p[4]) << 4) + hex2int(p[5]);
+	    b = (hex2int(p[8]) << 4) + hex2int(p[9]);
+	} else if ( len == 9 ) {
+	    r = (hex2int(p[0]) << 4) + hex2int(p[1]);
+	    g = (hex2int(p[3]) << 4) + hex2int(p[4]);
+	    b = (hex2int(p[6]) << 4) + hex2int(p[7]);
+	} else if ( len == 6 ) {
+	    r = (hex2int(p[0]) << 4) + hex2int(p[1]);
+	    g = (hex2int(p[2]) << 4) + hex2int(p[3]);
+	    b = (hex2int(p[4]) << 4) + hex2int(p[5]);
+	} else if ( len == 3 ) {
+	    r = (hex2int(p[0]) << 4) + hex2int(p[0]);
+	    g = (hex2int(p[1]) << 4) + hex2int(p[1]);
+	    b = (hex2int(p[2]) << 4) + hex2int(p[2]);
+	} else {
+	    r = g = b = 0;
+	}
+	setRgb( r, g, b );
+    } else {
+	if (color != nil)
+            [color release];
+        color = [NSColor colorWithCatalogName: @"Apple" colorName: QSTRING_TO_NSSTRING(name)];
+        if (color == nil) {
+            NSLog (@"WARNING %s:%d %s couldn't create color using name %s\n", __FILE__, __LINE__, __FUNCTION__, name.ascii());
+            color = [NSColor blackColor];
+        }
+    }
 }
 
 
@@ -187,12 +231,14 @@ void QColor::hsv(int *, int *, int *) const
 QColor QColor::light(int f = 150) const
 {
     NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    return *this;
 }
 
 
 QColor QColor::dark(int f = 200) const
 {
     NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    return *this;
 }
 
 
diff --git a/WebCore/src/kwq/KWQScrollView.mm b/WebCore/src/kwq/KWQScrollView.mm
index d16c89a..082bbb9 100644
--- a/WebCore/src/kwq/KWQScrollView.mm
+++ b/WebCore/src/kwq/KWQScrollView.mm
@@ -57,28 +57,28 @@ QWidget* QScrollView::viewport() const
 int QScrollView::visibleWidth() const
 {
     //_logNeverImplemented();
-    return 0;
+    return 200;
 }
 
 
 int QScrollView::visibleHeight() const
 {
     //_logNeverImplemented();
-    return 0;
+    return 200;
 }
 
 
 int QScrollView::contentsWidth() const
 {
     _logNeverImplemented();
-    return 0;
+    return 200;
 }
 
 
 int QScrollView::contentsHeight() const
 {
     _logNeverImplemented();
-    return 0;
+    return 200;
 }
 
 
diff --git a/WebCore/src/kwq/qt/qstring.h b/WebCore/src/kwq/qt/qstring.h
index cb2c8aa..4c02532 100644
--- a/WebCore/src/kwq/qt/qstring.h
+++ b/WebCore/src/kwq/qt/qstring.h
@@ -119,6 +119,7 @@ public:
     bool isNumber() const;
     bool isLetterOrNumber() const;
     bool isPunct() const;
+    int digitValue() const;
     QChar lower() const;
     QChar upper() const;
     Direction direction() const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list