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


The following commit has been merged in the debian/unstable branch:
commit 1795d473002182b47b86022589aa7d243a9b88d5
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 4 23:45:04 2003 +0000

            Reviewed by John.
    
            - fixed build rules for parser.cpp so we don't rebuild it every time
    
            * khtml/css/Makefile.am: Changed target to parser.cpp, not parser.
    
            - some QColor cleanup
    
            * kwq/KWQColor.h: Removed the qRgba function, the unused KWQColor constructor
            that takes a QString parameter, and made the KWQColor constructor that takes a
            const char * parameter explicit.
            * kwq/KWQColor.mm:
            (QColor::QColor): Use findColor directly so we don't create and then destroy a QString.
            (QColor::setNamedColor): Eliminated the unnecessary special case for empty string.
            Get rid of the call to lower(), which is now handled by the caller. Got rid of the
            "can't decipher this color" ERROR, which makes little sense now that non-named colors
            (like hex ones) are handled at the KHTML level. Don't use setRgb to set the color,
            since the RGB value in the gperf table is already in the correct format to just be
            stored in QColor::color.
    
            * khtml/misc/helper.h: Removed now-unused setNamedColor function. I'm sure this
            same change exists on the KHTML trunk (since the CSS parser rewrite).
            * khtml/misc/helper.cpp: More of the same.
    
            * khtml/misc/loader.cpp: #if !APPLE_CHANGES the places that use qRgba to set
            bgColor, which we don't use anyway.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3743 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 6894e0f..826af90 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,32 @@
+2003-03-04  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+        - fixed build rules for parser.cpp so we don't rebuild it every time
+
+        * khtml/css/Makefile.am: Changed target to parser.cpp, not parser.
+
+        - some QColor cleanup
+
+        * kwq/KWQColor.h: Removed the qRgba function, the unused KWQColor constructor
+        that takes a QString parameter, and made the KWQColor constructor that takes a
+        const char * parameter explicit.
+        * kwq/KWQColor.mm:
+        (QColor::QColor): Use findColor directly so we don't create and then destroy a QString.
+        (QColor::setNamedColor): Eliminated the unnecessary special case for empty string.
+        Get rid of the call to lower(), which is now handled by the caller. Got rid of the
+        "can't decipher this color" ERROR, which makes little sense now that non-named colors
+        (like hex ones) are handled at the KHTML level. Don't use setRgb to set the color,
+        since the RGB value in the gperf table is already in the correct format to just be
+        stored in QColor::color.
+
+        * khtml/misc/helper.h: Removed now-unused setNamedColor function. I'm sure this
+        same change exists on the KHTML trunk (since the CSS parser rewrite).
+        * khtml/misc/helper.cpp: More of the same.
+        
+        * khtml/misc/loader.cpp: #if !APPLE_CHANGES the places that use qRgba to set
+        bgColor, which we don't use anyway.
+
 2003-03-03  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Richard.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 6894e0f..826af90 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,32 @@
+2003-03-04  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+        - fixed build rules for parser.cpp so we don't rebuild it every time
+
+        * khtml/css/Makefile.am: Changed target to parser.cpp, not parser.
+
+        - some QColor cleanup
+
+        * kwq/KWQColor.h: Removed the qRgba function, the unused KWQColor constructor
+        that takes a QString parameter, and made the KWQColor constructor that takes a
+        const char * parameter explicit.
+        * kwq/KWQColor.mm:
+        (QColor::QColor): Use findColor directly so we don't create and then destroy a QString.
+        (QColor::setNamedColor): Eliminated the unnecessary special case for empty string.
+        Get rid of the call to lower(), which is now handled by the caller. Got rid of the
+        "can't decipher this color" ERROR, which makes little sense now that non-named colors
+        (like hex ones) are handled at the KHTML level. Don't use setRgb to set the color,
+        since the RGB value in the gperf table is already in the correct format to just be
+        stored in QColor::color.
+
+        * khtml/misc/helper.h: Removed now-unused setNamedColor function. I'm sure this
+        same change exists on the KHTML trunk (since the CSS parser rewrite).
+        * khtml/misc/helper.cpp: More of the same.
+        
+        * khtml/misc/loader.cpp: #if !APPLE_CHANGES the places that use qRgba to set
+        bgColor, which we don't use anyway.
+
 2003-03-03  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Richard.
diff --git a/WebCore/khtml/css/Makefile.am b/WebCore/khtml/css/Makefile.am
index 9ea889e..4cc2560 100644
--- a/WebCore/khtml/css/Makefile.am
+++ b/WebCore/khtml/css/Makefile.am
@@ -4,9 +4,9 @@ YACC=bison
 
 EXTRA_DIST = parser.y
 
-parser: $(srcdir)/parser.y
+parser.cpp: $(srcdir)/parser.y
 	cd $(srcdir); \
-	$(YACC) -d -p cssyy parser.y && mv parser.tab.c parser.cpp; \
+	$(YACC) -d -p cssyy parser.y && mv parser.tab.c $<; \
 	if test -f parser.tab.h; then \
 	if cmp -s parser.tab.h parser.h; then rm -f parser.tab.h; \
 	else mv parser.tab.h parser.h; fi \
@@ -15,7 +15,7 @@ parser: $(srcdir)/parser.y
 noinst_HEADERS = \
 	cssproperties.c \
 	cssvalues.c \
-	parser \
+	parser.cpp \
 	$(NULL)
 
 VALUEFILES = \
diff --git a/WebCore/khtml/misc/helper.cpp b/WebCore/khtml/misc/helper.cpp
index 91a6a70..7bae657 100644
--- a/WebCore/khtml/misc/helper.cpp
+++ b/WebCore/khtml/misc/helper.cpp
@@ -20,279 +20,8 @@
  * Boston, MA 02111-1307, USA.
  *
  */
-#include "helper.h"
-#include <khtmllayout.h>
-#include <qmap.h>
-#include <qpainter.h>
-#include <dom/dom_string.h>
-#include <xml/dom_stringimpl.h>
-#include <qptrlist.h>
-#include <kstaticdeleter.h>
-#include <kapplication.h>
-#include <kconfig.h>
-#include <qtooltip.h>
-
-using namespace DOM;
-using namespace khtml;
-
-struct HTMLColors {
-    QMap<QString,QColor> map;
-    HTMLColors();
-};
-
-struct colorMap {
-    const char * name;
-    const char * value;
-};
-
-static const colorMap cmap[] = {
-   { "black", "#000000" },
-   { "green", "#008000" },
-   { "silver", "#c0c0c0" },
-   { "lime", "#00ff00" },
-   { "gray", "#808080" },
-   { "olive", "#808000" },
-   { "white", "#ffffff" },
-   { "yellow", "#ffff00" },
-   { "maroon", "#800000" },
-   { "navy", "#000080" },
-   { "red", "#ff0000" },
-   { "blue", "#0000ff" },
-   { "purple", "#800080" },
-   { "teal", "#008080" },
-   { "fuchsia", "#ff00ff" },
-   { "aqua", "#00ffff" },
-   { "crimson", "#dc143c" },
-   { "indigo", "#4b0082" },
-   { 0, 0 }
-};
-
-struct uiColors {
-    const char * name;
-    const char * configGroup;
-    const char * configEntry;
-    QPalette::ColorGroup group;
-    QColorGroup::ColorRole role;
-};
-
-const char * const wmgroup = "WM";
-const char * const generalgroup = "General";
-
-static const uiColors uimap[] = {
-	// Active window border.
-    { "activeborder", wmgroup, "background", QPalette::Active, QColorGroup::Light },
-	// Active window caption.
-    { "activecaption", wmgroup, "background", QPalette::Active, QColorGroup::Text },
-        // Text in caption, size box, and scrollbar arrow box.
-    { "captiontext", wmgroup, "activeForeground", QPalette::Active, QColorGroup::Text },
-	// Face color for three-dimensional display elements.
-    { "buttonface", wmgroup, 0, QPalette::Inactive, QColorGroup::Button },
-	// Dark shadow for three-dimensional display elements (for edges facing away from the light source).
-    { "buttonhighlight", wmgroup, 0, QPalette::Inactive, QColorGroup::Light },
-	// Shadow color for three-dimensional display elements.
-    { "buttonshadow", wmgroup, 0, QPalette::Inactive, QColorGroup::Shadow },
-	// Text on push buttons.
-    { "buttontext", wmgroup, "buttonForeground", QPalette::Inactive, QColorGroup::ButtonText },
-	// Dark shadow for three-dimensional display elements.
-    { "threeddarkshadow", wmgroup, 0, QPalette::Inactive, QColorGroup::Dark },
-	// Face color for three-dimensional display elements.
-    { "threedface", wmgroup, 0, QPalette::Inactive, QColorGroup::Button },
-	// Highlight color for three-dimensional display elements.
-    { "threedhighlight", wmgroup, 0, QPalette::Inactive, QColorGroup::Light },
-	// Light color for three-dimensional display elements (for edges facing the light source).
-    { "threedlightshadow", wmgroup, 0, QPalette::Inactive, QColorGroup::Midlight },
-	// Dark shadow for three-dimensional display elements.
-    { "threedshadow", wmgroup, 0, QPalette::Inactive, QColorGroup::Shadow },
-
-    // Inactive window border.
-    { "inactiveborder", wmgroup, "background", QPalette::Disabled, QColorGroup::Background },
-    // Inactive window caption.
-    { "inactivecaption", wmgroup, "inactiveBackground", QPalette::Disabled, QColorGroup::Background },
-    // Color of text in an inactive caption.
-    { "inactivecaptiontext", wmgroup, "inactiveForeground", QPalette::Disabled, QColorGroup::Text },
-    { "graytext", wmgroup, 0, QPalette::Disabled, QColorGroup::Text },
-
-	// Menu background
-    { "menu", generalgroup, "background", QPalette::Inactive, QColorGroup::Background },
-	// Text in menus
-    { "menutext", generalgroup, "foreground", QPalette::Inactive, QColorGroup::Background },
-
-        // Text of item(s) selected in a control.
-    { "highlight", generalgroup, "selectBackground", QPalette::Inactive, QColorGroup::Background },
-
-    // Text of item(s) selected in a control.
-    { "highlighttext", generalgroup, "selectForeground", QPalette::Inactive, QColorGroup::Background },
-
-	// Background color of multiple document interface.
-    { "appworkspace", generalgroup, "background", QPalette::Inactive, QColorGroup::Text },
-
-	// Scroll bar gray area.
-    { "scrollbar", generalgroup, "background", QPalette::Inactive, QColorGroup::Background },
-
-	// Window background.
-    { "window", generalgroup, "windowBackground", QPalette::Inactive, QColorGroup::Background },
-	// Window frame.
-    { "windowframe", generalgroup, "windowBackground", QPalette::Inactive, QColorGroup::Background },
-        // WindowText
-    { "windowtext", generalgroup, "windowForeground", QPalette::Inactive, QColorGroup::Text },
-    { "text", generalgroup, 0, QPalette::Inactive, QColorGroup::Text },
-    { 0, 0, 0, QPalette::NColorGroups, QColorGroup::NColorRoles }
-};
-
-HTMLColors::HTMLColors()
-{
-    const colorMap *color = cmap;
-    while ( color->name ) {
-	map[color->name] = color->value;
-	++color;
-    }
-    // ### react to style changes
-    // see http://www.richinstyle.com for details
-
-    /* Mapping system settings to CSS 2
-     * Tried hard to get an appropriate mapping - schlpbch
-     */
-
-    KConfig *globalConfig = KGlobal::config();
-    const QPalette &pal = kapp->palette();
-
-    const uiColors *uicol = uimap;
-    const char *lastConfigGroup = 0;
-    while( uicol->name ) {
-	if ( lastConfigGroup != uicol->configGroup ) {
-	    lastConfigGroup = uicol->configGroup;
-	    globalConfig->setGroup( lastConfigGroup );
-	}
-	QColor c = pal.color( uicol->group, uicol->role );
-	if ( uicol->configEntry )
-	    c = globalConfig->readColorEntry( uicol->configEntry, &c );
-	map[uicol->name] = c;
-	++uicol;
-    }
 
-#ifndef QT_NO_TOOLTIP
-    // InfoBackground
-    map["infobackground"] = QToolTip::palette().inactive().background();
-    // InfoText
-    map["infotext"] = QToolTip::palette().inactive().foreground();
-#endif
-
-    KConfig bckgrConfig("kdesktoprc", true, false); // No multi-screen support
-    bckgrConfig.setGroup("Desktop0");
-        // Desktop background.
-    map["background"] = bckgrConfig.readColorEntry("Color1", &pal.disabled().background());
-};
-
-
-
-static HTMLColors *htmlColors = 0L;
-
-static KStaticDeleter<HTMLColors> hcsd;
-
-void khtml::setNamedColor(QColor &color, const QString &_name)
-{
-    if( !htmlColors )
-        htmlColors = hcsd.setObject( new HTMLColors );
-
-    int pos;
-    QString name = _name;
-    // remove white spaces for those broken websites out there :-(
-    while ( ( pos = name.find( ' ' ) ) != -1 )  name.remove( pos, 1 );
-
-    int len = name.length();
-
-    if(len == 0 || (len == 11 && name.find("transparent", 0, false) == 0) )
-    {
-        color = QColor(); // invalid color == transparent
-        return;
-    }
-
-#if !APPLE_CHANGES
-
-    // also recognize "color=ffffff"
-    if (len == 6)
-    {
-        bool ok;
-        int val = name.toInt(&ok, 16);
-        if(ok)
-        {
-            color.setRgb((0xff << 24) | val);
-            return;
-        }
-        // recognize #12345 (duplicate the last character)
-        if(name[0] == '#') {
-            bool ok;
-            int val = name.right(5).toInt(&ok, 16);
-            if(ok) {
-                color.setRgb((0xff << 24) | (val * 16 + ( val&0xf )));
-                return;
-            }
-        }
-        if ( !name[0].isLetter() ) {
-	    color = QColor();
-	    return;
-	}
-    }
-
-    // #fffffff as found on msdn.microsoft.com
-    if ( name[0] == '#' && len > 7)
-    {
-        name = name.left(7);
-    }
-
-#endif
-
-    if ( len > 4 && name[0].lower() == 'r' && name[1].lower() == 'g' &&
-         name[2].lower() == 'b' && name[3] == '(' &&
-         name[len-1] == ')')
-    {
-        // CSS like rgb(r, g, b) style
-        DOMString rgb = name.mid(4, name.length()-5);
-        int count;
-        khtml::Length* l = rgb.implementation()->toLengthArray(count);
-        if (count != 3)
-            // transparent in case of an invalid color.
-            color = QColor();
-        else {
-            int c[3];
-            for (int i = 0; i < 3; ++i) {
-                c[i] = l[i].width(255);
-                if (c[i] < 0) c[i] = 0;
-                if (c[i] > 255) c[i] = 255;
-            }
-            color.setRgb(c[0], c[1], c[2]);
-        }
-        delete [] l;
-    }
-    else
-    {
-        QColor tc = htmlColors->map[name];
-        if ( !tc.isValid() )
-            tc = htmlColors->map[name.lower()];
-
-        if (tc.isValid())
-            color = tc;
-        else {
-            color.setNamedColor(name);
-#if !APPLE_CHANGES
-            // The KWQ version of QColor::setNamedColor already has to lowercase the string.
-            // So this is wasted work, and it even shows up in profiles.
-            if ( !color.isValid() )  color.setNamedColor( name.lower() );
-#endif
-            if(!color.isValid()) {
-                bool hasalpha = false;
-                for(unsigned int i = 0; i < name.length(); i++)
-                    if(name[i].isLetterOrNumber()) {
-                        hasalpha = true;
-                        break;
-                    }
-
-                if(!hasalpha)
-                  color = Qt::black;
-            }
-        }
-    }
-}
+#include "helper.h"
 
 QPainter *khtml::printpainter = 0;
 
diff --git a/WebCore/khtml/misc/helper.h b/WebCore/khtml/misc/helper.h
index cc3b345..9796bd2 100644
--- a/WebCore/khtml/misc/helper.h
+++ b/WebCore/khtml/misc/helper.h
@@ -34,8 +34,6 @@ namespace khtml
     const QRgb invertedColor    = 0x00000002;
     const QRgb defaultTextColor = 0x00000003;
     
-    void setNamedColor(QColor &color, const QString &name);
-
     extern QPainter *printpainter;
     void setPrintPainter( QPainter *printer );
 
diff --git a/WebCore/khtml/misc/loader.cpp b/WebCore/khtml/misc/loader.cpp
index 47118af..456753d 100644
--- a/WebCore/khtml/misc/loader.cpp
+++ b/WebCore/khtml/misc/loader.cpp
@@ -517,8 +517,8 @@ CachedImage::CachedImage(DocLoader* dl, const DOMString &url, KIO::CacheControl
     p = 0;
     pixPart = 0;
     bg = 0;
-    bgColor = qRgba( 0, 0, 0, 0xFF );
 #if !APPLE_CHANGES
+    bgColor = qRgba( 0, 0, 0, 0xFF );
     typeChecked = false;
 #endif
     isFullyTransparent = false;
@@ -842,7 +842,9 @@ void CachedImage::clear()
     delete m;   m = 0;
     delete p;   p = 0;
     delete bg;  bg = 0;
+#if !APPLE_CHANGES
     bgColor = qRgba( 0, 0, 0, 0xff );
+#endif
     delete pixPart; pixPart = 0;
 
     formatType = 0;
diff --git a/WebCore/kwq/KWQColor.h b/WebCore/kwq/KWQColor.h
index 6e91dfe..9ba417d 100644
--- a/WebCore/kwq/KWQColor.h
+++ b/WebCore/kwq/KWQColor.h
@@ -37,17 +37,15 @@ class NSColor;
 typedef unsigned int QRgb;			// RGB triplet
 
 QRgb qRgb(int r, int g, int b);
-QRgb qRgba(int r, int g, int b, int a);
 
 const QRgb KWQInvalidColor = 0x40000000;
 
 class QColor {
 public:
     QColor() : color(KWQInvalidColor) { }
-    QColor(QRgb col) :color(col) {}
+    QColor(QRgb col) : color(col) { }
     QColor(int r, int g, int b) : color(qRgb(r, g, b)) { }
-    explicit QColor(const QString &);
-    QColor(const char *); // can't be explicit because of helper.cpp
+    explicit QColor(const char *);
     
     QString name() const;
     void setNamedColor(const QString&);
diff --git a/WebCore/kwq/KWQColor.mm b/WebCore/kwq/KWQColor.mm
index 2a4092f..b2f256f 100644
--- a/WebCore/kwq/KWQColor.mm
+++ b/WebCore/kwq/KWQColor.mm
@@ -49,22 +49,16 @@ const QColor Qt::yellow   (0xFF, 0xFF, 0x00);
 
 QRgb qRgb(int r, int g, int b)
 {
+    ASSERT(r >= 0 && r <= 0xFF);
+    ASSERT(g >= 0 && g <= 0xFF);
+    ASSERT(b >= 0 && b <= 0xFF);
     return r << 16 | g << 8 | b;
 }
 
-QRgb qRgba(int r, int g, int b, int a)
-{
-    return a << 24 | r << 16 | g << 8 | b;
-}
-
-QColor::QColor(const QString &name)
-{
-    setNamedColor(name);
-}
-
 QColor::QColor(const char *name)
 {
-    setNamedColor(name);
+    const Color *foundColor = findColor(name, strlen(name));
+    color = foundColor ? foundColor->RGBValue : KWQInvalidColor;
 }
 
 QString QColor::name() const
@@ -76,30 +70,8 @@ QString QColor::name() const
 
 void QColor::setNamedColor(const QString &name)
 {
-    // FIXME: The combination of this code with the code that
-    // is in khtml/misc/helper.cpp makes setting colors by
-    // name a real crock. We need to look at the process
-    // of mapping names to colors and figure out something
-    // better.
-    // 
-    // [kocienda: 2001-11-08]: I've made some improvements
-    // but it's still a crock.
-    
-    if (name.isEmpty()) {
-        color = KWQInvalidColor;
-        return;
-    } 
-    
-    QString lowerName = name.lower();
-    const Color *foundColor = findColor(name.latin1(), name.length());
-    if (foundColor) {
-        int RGBValue = foundColor->RGBValue;
-        setRgb((RGBValue >> 16) & 0xFF, (RGBValue >> 8) & 0xFF, RGBValue & 0xFF);
-        return;
-    }
-
-    ERROR("couldn't create color using name %s", name.ascii());
-    color = KWQInvalidColor;
+    const Color *foundColor = name.isAllASCII() ? findColor(name.latin1(), name.length()) : 0;
+    color = foundColor ? foundColor->RGBValue : KWQInvalidColor;
 }
 
 void QColor::hsv(int *h, int *s, int *v) const

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list