[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:57:55 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit cecc08fd94af7cc8a55d421112242ee0e8f0e2d6
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Mar 20 04:01:26 2002 +0000

    Fixed NSPopupButton performance bottleneck.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@787 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 0fb2cd0..65b7c04 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,4 +1,15 @@
 2002-03-19  Richard Williamson  <rjw at apple.com>
+
+        Fixed NSPopupButton performance bottleneck.
+        
+	* src/kdelibs/khtml/rendering/render_form.cpp: (RenderSelect::layout):
+	* src/kwq/KWQComboBox.mm: (QComboBox::insertItem):
+	* src/kwq/KWQKComboBox.mm: (KComboBox::~KComboBox), (KComboBox::doneLoading),
+	(KComboBox::setSize):
+	* src/kwq/kdeui/kcombobox.h:
+	* src/kwq/qt/qcombobox.h:
+
+2002-03-19  Richard Williamson  <rjw at apple.com>
     
         Changed float width cache to use shorts.
 
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 0fb2cd0..65b7c04 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,4 +1,15 @@
 2002-03-19  Richard Williamson  <rjw at apple.com>
+
+        Fixed NSPopupButton performance bottleneck.
+        
+	* src/kdelibs/khtml/rendering/render_form.cpp: (RenderSelect::layout):
+	* src/kwq/KWQComboBox.mm: (QComboBox::insertItem):
+	* src/kwq/KWQKComboBox.mm: (KComboBox::~KComboBox), (KComboBox::doneLoading),
+	(KComboBox::setSize):
+	* src/kwq/kdeui/kcombobox.h:
+	* src/kwq/qt/qcombobox.h:
+
+2002-03-19  Richard Williamson  <rjw at apple.com>
     
         Changed float width cache to use shorts.
 
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 0fb2cd0..65b7c04 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,4 +1,15 @@
 2002-03-19  Richard Williamson  <rjw at apple.com>
+
+        Fixed NSPopupButton performance bottleneck.
+        
+	* src/kdelibs/khtml/rendering/render_form.cpp: (RenderSelect::layout):
+	* src/kwq/KWQComboBox.mm: (QComboBox::insertItem):
+	* src/kwq/KWQKComboBox.mm: (KComboBox::~KComboBox), (KComboBox::doneLoading),
+	(KComboBox::setSize):
+	* src/kwq/kdeui/kcombobox.h:
+	* src/kwq/qt/qcombobox.h:
+
+2002-03-19  Richard Williamson  <rjw at apple.com>
     
         Changed float width cache to use shorts.
 
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 74783f4..dc6e72a 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -964,6 +964,8 @@ void RenderSelect::layout( )
         else
             static_cast<KComboBox*>(m_widget)->clear();
 
+        if(!m_useListBox)
+            static_cast<KComboBox*>(m_widget)->setSize(listItems.size());
         for (listIndex = 0; listIndex < int(listItems.size()); listIndex++) {
             if (listItems[listIndex]->id() == ID_OPTGROUP) {
                 DOMString text = listItems[listIndex]->getAttribute(ATTR_LABEL);
@@ -998,6 +1000,8 @@ void RenderSelect::layout( )
                 assert(false);
             m_selectionChanged = true;
         }
+        if(!m_useListBox)
+            static_cast<KComboBox*>(m_widget)->doneLoading();
         m_optionsChanged = false;
     }
 
diff --git a/WebCore/kwq/KWQComboBox.h b/WebCore/kwq/KWQComboBox.h
index 98ba76b..4bdcb90 100644
--- a/WebCore/kwq/KWQComboBox.h
+++ b/WebCore/kwq/KWQComboBox.h
@@ -73,6 +73,11 @@ public:
     virtual void setCurrentItem(int);
     QSize sizeHint() const;
 
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+    NSMutableArray *items;
+#else
+    void *items;
+#endif
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
@@ -88,11 +93,6 @@ private:
 #ifdef _KWQ_
     void init(bool isEditable);
 
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
-    NSMutableArray *items;
-#else
-    void *items;
-#endif
 #endif
 
 }; // class QComboBox ==========================================================
diff --git a/WebCore/kwq/KWQComboBox.mm b/WebCore/kwq/KWQComboBox.mm
index 896e1b2..576cdac 100644
--- a/WebCore/kwq/KWQComboBox.mm
+++ b/WebCore/kwq/KWQComboBox.mm
@@ -90,6 +90,7 @@ bool QComboBox::eventFilter(QObject *object, QEvent *event)
 
 void QComboBox::insertItem(const QString &text, int index)
 {
+#ifdef SLOW_AS_POOP
     KWQNSComboBox *comboBox = (KWQNSComboBox *)getView();
     
     if (index < 0)
@@ -116,6 +117,9 @@ void QComboBox::insertItem(const QString &text, int index)
     }
     [items release];
     items = newItems;
+#else
+    [items insertObject: QSTRING_TO_NSSTRING (text) atIndex: index];
+#endif
 }
 
 
diff --git a/WebCore/kwq/KWQKComboBox.h b/WebCore/kwq/KWQKComboBox.h
index 406b058..ad28290 100644
--- a/WebCore/kwq/KWQKComboBox.h
+++ b/WebCore/kwq/KWQKComboBox.h
@@ -52,6 +52,11 @@ public:
     virtual ~KComboBox();
 
     // member functions --------------------------------------------------------
+#ifdef APPLE_CHANGES
+    void doneLoading();
+    void setSize(int size);
+#endif
+
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
diff --git a/WebCore/kwq/KWQKComboBox.mm b/WebCore/kwq/KWQKComboBox.mm
index 9298c4a..1090599 100644
--- a/WebCore/kwq/KWQKComboBox.mm
+++ b/WebCore/kwq/KWQKComboBox.mm
@@ -25,6 +25,8 @@
 #include <kwqdebug.h>
 #include <kcombobox.h>
 
+#include <KWQView.h>
+
 KComboBox::KComboBox(QWidget *parent=0, const char *name=0)
 {
     _logNotYetImplemented();
@@ -41,3 +43,42 @@ KComboBox::~KComboBox()
     _logNotYetImplemented();
 }
 
+void KComboBox::doneLoading()
+{
+    KWQNSComboBox *comboBox = (KWQNSComboBox *)getView();
+    NSMutableArray *numberedItems;
+    int i, _count = [items count];
+    
+    [comboBox removeAllItems];
+
+    // Hack to allow multiple items with same name.   Ugh.
+    // NSPopupButton is really stupid.  It doesn't allow
+    // entries with the same title, unless you explicitly
+    // set the title with setTitle: after all the entries
+    // have been added.
+    numberedItems = [[NSMutableArray alloc] init];
+    for (i = 0; i < _count; i++)
+        [numberedItems addObject: [NSString stringWithFormat: @"%d", i]];
+
+    [comboBox addItemsWithTitles: numberedItems];
+
+    for (i = 0; i < _count; i++){
+        [[comboBox itemAtIndex: i] setTitle: [items objectAtIndex: i]];
+    }
+    
+    [numberedItems release];
+}
+
+void KComboBox::setSize(int size)
+{
+    int i; 
+    NSMutableArray *newItems = [[NSMutableArray alloc] initWithCapacity: size];
+    
+    for (i = 0; i < size; i++){
+        [newItems addObject: @""];
+    }
+    
+    [items release];
+    items = newItems;
+}
+
diff --git a/WebCore/kwq/kdeui/kcombobox.h b/WebCore/kwq/kdeui/kcombobox.h
index 406b058..ad28290 100644
--- a/WebCore/kwq/kdeui/kcombobox.h
+++ b/WebCore/kwq/kdeui/kcombobox.h
@@ -52,6 +52,11 @@ public:
     virtual ~KComboBox();
 
     // member functions --------------------------------------------------------
+#ifdef APPLE_CHANGES
+    void doneLoading();
+    void setSize(int size);
+#endif
+
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
diff --git a/WebCore/kwq/qt/qcombobox.h b/WebCore/kwq/qt/qcombobox.h
index 98ba76b..4bdcb90 100644
--- a/WebCore/kwq/qt/qcombobox.h
+++ b/WebCore/kwq/qt/qcombobox.h
@@ -73,6 +73,11 @@ public:
     virtual void setCurrentItem(int);
     QSize sizeHint() const;
 
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+    NSMutableArray *items;
+#else
+    void *items;
+#endif
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
@@ -88,11 +93,6 @@ private:
 #ifdef _KWQ_
     void init(bool isEditable);
 
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
-    NSMutableArray *items;
-#else
-    void *items;
-#endif
 #endif
 
 }; // class QComboBox ==========================================================
diff --git a/WebCore/src/kdelibs/khtml/rendering/render_form.cpp b/WebCore/src/kdelibs/khtml/rendering/render_form.cpp
index 74783f4..dc6e72a 100644
--- a/WebCore/src/kdelibs/khtml/rendering/render_form.cpp
+++ b/WebCore/src/kdelibs/khtml/rendering/render_form.cpp
@@ -964,6 +964,8 @@ void RenderSelect::layout( )
         else
             static_cast<KComboBox*>(m_widget)->clear();
 
+        if(!m_useListBox)
+            static_cast<KComboBox*>(m_widget)->setSize(listItems.size());
         for (listIndex = 0; listIndex < int(listItems.size()); listIndex++) {
             if (listItems[listIndex]->id() == ID_OPTGROUP) {
                 DOMString text = listItems[listIndex]->getAttribute(ATTR_LABEL);
@@ -998,6 +1000,8 @@ void RenderSelect::layout( )
                 assert(false);
             m_selectionChanged = true;
         }
+        if(!m_useListBox)
+            static_cast<KComboBox*>(m_widget)->doneLoading();
         m_optionsChanged = false;
     }
 
diff --git a/WebCore/src/kwq/KWQComboBox.mm b/WebCore/src/kwq/KWQComboBox.mm
index 896e1b2..576cdac 100644
--- a/WebCore/src/kwq/KWQComboBox.mm
+++ b/WebCore/src/kwq/KWQComboBox.mm
@@ -90,6 +90,7 @@ bool QComboBox::eventFilter(QObject *object, QEvent *event)
 
 void QComboBox::insertItem(const QString &text, int index)
 {
+#ifdef SLOW_AS_POOP
     KWQNSComboBox *comboBox = (KWQNSComboBox *)getView();
     
     if (index < 0)
@@ -116,6 +117,9 @@ void QComboBox::insertItem(const QString &text, int index)
     }
     [items release];
     items = newItems;
+#else
+    [items insertObject: QSTRING_TO_NSSTRING (text) atIndex: index];
+#endif
 }
 
 
diff --git a/WebCore/src/kwq/KWQKComboBox.mm b/WebCore/src/kwq/KWQKComboBox.mm
index 9298c4a..1090599 100644
--- a/WebCore/src/kwq/KWQKComboBox.mm
+++ b/WebCore/src/kwq/KWQKComboBox.mm
@@ -25,6 +25,8 @@
 #include <kwqdebug.h>
 #include <kcombobox.h>
 
+#include <KWQView.h>
+
 KComboBox::KComboBox(QWidget *parent=0, const char *name=0)
 {
     _logNotYetImplemented();
@@ -41,3 +43,42 @@ KComboBox::~KComboBox()
     _logNotYetImplemented();
 }
 
+void KComboBox::doneLoading()
+{
+    KWQNSComboBox *comboBox = (KWQNSComboBox *)getView();
+    NSMutableArray *numberedItems;
+    int i, _count = [items count];
+    
+    [comboBox removeAllItems];
+
+    // Hack to allow multiple items with same name.   Ugh.
+    // NSPopupButton is really stupid.  It doesn't allow
+    // entries with the same title, unless you explicitly
+    // set the title with setTitle: after all the entries
+    // have been added.
+    numberedItems = [[NSMutableArray alloc] init];
+    for (i = 0; i < _count; i++)
+        [numberedItems addObject: [NSString stringWithFormat: @"%d", i]];
+
+    [comboBox addItemsWithTitles: numberedItems];
+
+    for (i = 0; i < _count; i++){
+        [[comboBox itemAtIndex: i] setTitle: [items objectAtIndex: i]];
+    }
+    
+    [numberedItems release];
+}
+
+void KComboBox::setSize(int size)
+{
+    int i; 
+    NSMutableArray *newItems = [[NSMutableArray alloc] initWithCapacity: size];
+    
+    for (i = 0; i < size; i++){
+        [newItems addObject: @""];
+    }
+    
+    [items release];
+    items = newItems;
+}
+
diff --git a/WebCore/src/kwq/kdeui/kcombobox.h b/WebCore/src/kwq/kdeui/kcombobox.h
index 406b058..ad28290 100644
--- a/WebCore/src/kwq/kdeui/kcombobox.h
+++ b/WebCore/src/kwq/kdeui/kcombobox.h
@@ -52,6 +52,11 @@ public:
     virtual ~KComboBox();
 
     // member functions --------------------------------------------------------
+#ifdef APPLE_CHANGES
+    void doneLoading();
+    void setSize(int size);
+#endif
+
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
diff --git a/WebCore/src/kwq/qt/qcombobox.h b/WebCore/src/kwq/qt/qcombobox.h
index 98ba76b..4bdcb90 100644
--- a/WebCore/src/kwq/qt/qcombobox.h
+++ b/WebCore/src/kwq/qt/qcombobox.h
@@ -73,6 +73,11 @@ public:
     virtual void setCurrentItem(int);
     QSize sizeHint() const;
 
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+    NSMutableArray *items;
+#else
+    void *items;
+#endif
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
@@ -88,11 +93,6 @@ private:
 #ifdef _KWQ_
     void init(bool isEditable);
 
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
-    NSMutableArray *items;
-#else
-    void *items;
-#endif
 #endif
 
 }; // class QComboBox ==========================================================

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list