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


The following commit has been merged in the debian/unstable branch:
commit 02fa0d3eb7eb5a5f67fbc8cc7e7541952ac9a675
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Apr 22 22:14:56 2002 +0000

    	* kwq/qt/qpixmap.h:
    	* kwq/KWQPixmap.mm:
    	(QPixmap::QPixmap): Clear needsCopyOnWrite flag in all the
    	constructors other than the copy constructor. Set it in the copy
    	constructor.
    	(QPixmap::~QPixmap): Simplify.
    	(QPixmap::mask): Always return 0 rather than leaking a QBitmap each time,
    	since Qt uses 0 to mean "no mask".
    	(QPixmap::isNull): Simplify.
    	(QPixmap::resize): Do the copy here if we need it, and do the setScalesWhenResized:
    	call in here instead of trying to do it elsewhere.
    	(QPixmap::xForm): Only copy the pixmap once.
    	(QPixmap::operator=): Set the needsCopyOnWrite flag. Also change the retain/release
    	idiom around so we don't need to check for self-assignment.
    
    	* khtml/ecma/Makefile.am: Don't build kjs_debugwin any more.
    	* khtml/ecma/kjs_debugwin.cpp: Removed.
    	* khtml/ecma/kjs_debugwin.h: Removed.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1059 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 066ea45..819c792 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,24 @@
+2002-04-22  Darin Adler  <darin at apple.com>
+
+	* khtml/ecma/Makefile.am: Don't build kjs_debugwin any more.
+	* khtml/ecma/kjs_debugwin.cpp: Removed.
+	* khtml/ecma/kjs_debugwin.h: Removed.
+
+	* kwq/qt/qpixmap.h:
+	* kwq/KWQPixmap.mm:
+	(QPixmap::QPixmap): Clear needsCopyOnWrite flag in all the
+	constructors other than the copy constructor. Set it in the copy
+	constructor.
+	(QPixmap::~QPixmap): Simplify.
+	(QPixmap::mask): Always return 0 rather than leaking a QBitmap each time,
+	since Qt uses 0 to mean "no mask".
+	(QPixmap::isNull): Simplify.
+	(QPixmap::resize): Do the copy here if we need it, and do the setScalesWhenResized:
+	call in here instead of trying to do it elsewhere.
+	(QPixmap::xForm): Only copy the pixmap once.
+	(QPixmap::operator=): Set the needsCopyOnWrite flag. Also change the retain/release
+	idiom around so we don't need to check for self-assignment.
+
 2002-04-22  Chris Blumenberg  <cblu at apple.com>
 
 	Added a new method to WCPluginDatabase allHandledMIMETypes.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 066ea45..819c792 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,24 @@
+2002-04-22  Darin Adler  <darin at apple.com>
+
+	* khtml/ecma/Makefile.am: Don't build kjs_debugwin any more.
+	* khtml/ecma/kjs_debugwin.cpp: Removed.
+	* khtml/ecma/kjs_debugwin.h: Removed.
+
+	* kwq/qt/qpixmap.h:
+	* kwq/KWQPixmap.mm:
+	(QPixmap::QPixmap): Clear needsCopyOnWrite flag in all the
+	constructors other than the copy constructor. Set it in the copy
+	constructor.
+	(QPixmap::~QPixmap): Simplify.
+	(QPixmap::mask): Always return 0 rather than leaking a QBitmap each time,
+	since Qt uses 0 to mean "no mask".
+	(QPixmap::isNull): Simplify.
+	(QPixmap::resize): Do the copy here if we need it, and do the setScalesWhenResized:
+	call in here instead of trying to do it elsewhere.
+	(QPixmap::xForm): Only copy the pixmap once.
+	(QPixmap::operator=): Set the needsCopyOnWrite flag. Also change the retain/release
+	idiom around so we don't need to check for self-assignment.
+
 2002-04-22  Chris Blumenberg  <cblu at apple.com>
 
 	Added a new method to WCPluginDatabase allHandledMIMETypes.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 066ea45..819c792 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,24 @@
+2002-04-22  Darin Adler  <darin at apple.com>
+
+	* khtml/ecma/Makefile.am: Don't build kjs_debugwin any more.
+	* khtml/ecma/kjs_debugwin.cpp: Removed.
+	* khtml/ecma/kjs_debugwin.h: Removed.
+
+	* kwq/qt/qpixmap.h:
+	* kwq/KWQPixmap.mm:
+	(QPixmap::QPixmap): Clear needsCopyOnWrite flag in all the
+	constructors other than the copy constructor. Set it in the copy
+	constructor.
+	(QPixmap::~QPixmap): Simplify.
+	(QPixmap::mask): Always return 0 rather than leaking a QBitmap each time,
+	since Qt uses 0 to mean "no mask".
+	(QPixmap::isNull): Simplify.
+	(QPixmap::resize): Do the copy here if we need it, and do the setScalesWhenResized:
+	call in here instead of trying to do it elsewhere.
+	(QPixmap::xForm): Only copy the pixmap once.
+	(QPixmap::operator=): Set the needsCopyOnWrite flag. Also change the retain/release
+	idiom around so we don't need to check for self-assignment.
+
 2002-04-22  Chris Blumenberg  <cblu at apple.com>
 
 	Added a new method to WCPluginDatabase allHandledMIMETypes.
diff --git a/WebCore/khtml/ecma/Makefile.am b/WebCore/khtml/ecma/Makefile.am
index 16ab750..9005e0e 100644
--- a/WebCore/khtml/ecma/Makefile.am
+++ b/WebCore/khtml/ecma/Makefile.am
@@ -9,8 +9,6 @@ libkhtmlecma_o_SOURCES = \
 	kjs_binding.h \
 	kjs_css.cpp \
 	kjs_css.h \
-	kjs_debugwin.cpp \
-	kjs_debugwin.h \
 	kjs_dom.cpp \
 	kjs_dom.h \
 	kjs_events.cpp \
diff --git a/WebCore/khtml/ecma/kjs_debugwin.cpp b/WebCore/khtml/ecma/kjs_debugwin.cpp
deleted file mode 100644
index 00050f9..0000000
--- a/WebCore/khtml/ecma/kjs_debugwin.cpp
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2000-2001 Harri Porten (porten at kde.org)
- *  Copyright (C) 2001 Peter Kelly (pmk at post.com)
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "kjs_debugwin.h"
-
-#ifdef KJS_DEBUGGER
-
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qtextedit.h>
-#include <qlistbox.h>
-#include <qlineedit.h>
-#include <qapplication.h>
-#include <qsplitter.h>
-#include <qcombobox.h>
-#include <qbitmap.h>
-#include <qwidgetlist.h>
-
-#include <klocale.h>
-#include <kdebug.h>
-#include <kiconloader.h>
-#include <kmessagebox.h>
-
-#include "kjs_dom.h"
-
-using namespace KJS;
-
-static KJSDebugWin *kjs_html_debugger = 0;
-
-
-bool FakeModal::eventFilter( QObject *o, QEvent *e )
-{
-    switch (e->type()) {
-        case QEvent::MouseButtonPress:
-        case QEvent::MouseButtonRelease:
-        case QEvent::MouseButtonDblClick:
-        case QEvent::MouseMove:
-        case QEvent::KeyPress:
-        case QEvent::KeyRelease:
-        case QEvent::Destroy:
-        case QEvent::Close:
-        case QEvent::Quit:
-            while (o->parent())
-                o = o->parent();
-            if (o == modalWidget)
-                return QWidget::eventFilter( o, e );
-            else
-                return TRUE;
-            break;
-        default:
-            return QWidget::eventFilter( o, e );
-    }
-}
-
-
-void FakeModal::enable(QWidget *modal)
-{
-    QWidgetList *widgets = QApplication::allWidgets();
-    QWidgetListIt it(*widgets);
-    for (; it.current(); ++it)
-        it.current()->installEventFilter(this);
-    modalWidget = modal;
-}
-
-void FakeModal::disable()
-{
-    QWidgetList *widgets = QApplication::allWidgets();
-    QWidgetListIt it(*widgets);
-    for (; it.current(); ++it)
-        it.current()->removeEventFilter(this);
-    modalWidget = 0;
-}
-
-//-------------------------------------------------------------------------
-
-QString StackFrame::toString()
-{
-  QString str = "";
-  if (!name.isNull())
-    str.sprintf("%s() at sourceId %d, line %d",name.ascii(),sourceId,lineno);
-  else
-    str.sprintf("??? at sourceId %d, line %d",sourceId,lineno);
-  return str;
-}
-
-SourceFragment::SourceFragment(int sid, int bl, SourceFile *sf)
-{
-  sourceId = sid;
-  baseLine = bl;
-  sourceFile = sf;
-  sourceFile->ref();
-}
-
-SourceFragment::~SourceFragment()
-{
-  sourceFile->deref();
-}
-
-//-------------------------------------------------------------------------
-
-KJSDebugWin::KJSDebugWin(QWidget *parent, const char *name)
-  : QWidget(parent, name),
-    m_inSession(false),
-    m_curSourceFile(0)
-{
-  setCaption(i18n("JavaScript Debugger"));
-  QVBoxLayout *vl = new QVBoxLayout(this, 5);
-
-  // frame list & code
-  QSplitter *splitter = new QSplitter(this);
-  QFont font("courier",10);
-
-  m_frameList = new QListBox(splitter);
-  m_frameList->setFont(font);
-  m_frameList->setMinimumSize(100,200);
-  connect(m_frameList,SIGNAL(highlighted(int)),this,SLOT(showFrame(int)));
-
-  // source selection & display
-  QWidget *sourceSelDisplay = new QWidget(splitter);
-  QVBoxLayout *ssdvl = new QVBoxLayout(sourceSelDisplay);
-  
-  
-  m_sourceSel = new QComboBox(sourceSelDisplay);
-  connect(m_sourceSel,SIGNAL(activated(int)),this,SLOT(sourceSelected(int)));
-  ssdvl->addWidget(m_sourceSel);
-
-  m_sourceDisplay = new QListBox(sourceSelDisplay);
-  m_sourceDisplay->setFont(font);
-  ssdvl->addWidget(m_sourceDisplay);
-
-  vl->addWidget(splitter);
-
-  QValueList<int> splitSizes;
-  splitSizes.insert(splitSizes.end(),200);
-  splitSizes.insert(splitSizes.end(),400);
-  splitter->setSizes(splitSizes);
-
-
-  // evaluate
-  QHBoxLayout *hl1 = new QHBoxLayout(vl);
-  m_evalEdit = new QLineEdit(this);
-  m_evalButton = new QPushButton(i18n("&Evaluate"),this);
-  m_evalButton->setEnabled(false);
-  hl1->addWidget(m_evalEdit);
-  hl1->addWidget(m_evalButton);
-  connect(m_evalButton, SIGNAL(clicked()), SLOT(eval()));
-  connect(m_evalEdit, SIGNAL(returnPressed()), SLOT(eval()));
-
-  // control buttons
-  QHBoxLayout *hl2 = new QHBoxLayout(vl);
-  m_nextButton = new QPushButton(i18n("&Next"), this);
-  m_stepButton = new QPushButton(i18n("&Step"), this);
-  m_continueButton = new QPushButton(i18n("&Continue"), this);
-  m_stopButton = new QPushButton(i18n("St&op"), this);
-  hl2->addWidget(m_nextButton);
-  hl2->addWidget(m_stepButton);
-  hl2->addWidget(m_continueButton);
-  hl2->addWidget(m_stopButton);
-  hl2->addStretch();
-
-  connect(m_nextButton, SIGNAL(clicked()), SLOT(next()));
-  connect(m_stepButton, SIGNAL(clicked()), SLOT(step()));
-  connect(m_continueButton, SIGNAL(clicked()), SLOT(cont()));
-  connect(m_stopButton, SIGNAL(clicked()), SLOT(stop()));
-
-  m_nextButton->setEnabled(false);
-  m_stepButton->setEnabled(false);
-  m_continueButton->setEnabled(false);
-  m_stopButton->setEnabled(false);
-
-  // frame list
-  m_frames.setAutoDelete(true);
-  StackFrame *sf = new StackFrame(-1,-1,"Global code",false);
-  sf->next = true;
-  m_frames.append(sf);
-  //  m_frameList->insertItem(sf->toString());
-
-
-  setMinimumSize(300,200);
-  resize(600,450);
-  m_mode = Continue;
-  m_sourceBreakpoints = 0;
-
-  KIconLoader loader;
-  m_stopIcon = loader.loadIcon("stop",KIcon::Small);
-  
-  m_emptyIcon = QPixmap(m_stopIcon.width(),m_stopIcon.height());
-  QBitmap emptyMask(m_stopIcon.width(),m_stopIcon.height(),true);
-  //  m_emptyIcon.fill(m_sourceDisplay,0,0);
-  m_emptyIcon.setMask(emptyMask);
-
-  m_nextSourceBaseLine = 0;
-  m_nextSourceUrl = "";
-
-  updateFrameList();
-  m_inSession = false;
-  m_curContext = 0;
-  m_curScript = 0;
-}
-
-KJSDebugWin::~KJSDebugWin()
-{
-  //  detach();
-}
-
-
-KJSDebugWin *KJSDebugWin::createInstance()
-{
-  assert(!kjs_html_debugger);
-  kjs_html_debugger = new KJSDebugWin();
-  kjs_html_debugger->show();
-  return kjs_html_debugger;
-}
-
-void KJSDebugWin::destroyInstance()
-{
-  assert(kjs_html_debugger);
-  kjs_html_debugger->hide();
-  delete kjs_html_debugger;
-}
-
-KJSDebugWin *KJSDebugWin::instance()
-{
-  return kjs_html_debugger;
-}
-
-void KJSDebugWin::next()
-{
-  m_mode = Next;
-  leaveSession();
-}
-
-void KJSDebugWin::step()
-{
-  m_mode = Step;
-  leaveSession();
-}
-
-void KJSDebugWin::cont()
-{
-  m_mode = Continue;
-  leaveSession();
-}
-
-void KJSDebugWin::stop()
-{
-  m_mode = Stop;
-  leaveSession();
-}
-
-void KJSDebugWin::showFrame(int frameno)
-{
-  StackFrame *frame = m_frames.at(frameno);
-  if (!frame)
-    return;
-  highLight(frame->sourceId,frame->lineno);
-}
-
-void KJSDebugWin::sourceSelected(int sourceSelIndex)
-{
-  // a souce file has been selected from the drop-down list - display the file
-  // and hilight the line if it's in the current stack frame
-  if (sourceSelIndex < 0 || sourceSelIndex >= (int)m_sourceSel->count())
-    return;
-
-  SourceFile *sourceFile = m_sourceSelFiles[sourceSelIndex];
-  if (m_curSourceFile != sourceFile)
-      setCode(sourceFile->code);
-  m_curSourceFile = sourceFile;
-
-  SourceFragment *lastFragment = 0;
-  StackFrame *curFrame = m_frames.at(m_frameList->currentItem() >= 0 ? m_frameList->currentItem() : m_frames.count()-1);
-  if (curFrame)
-    lastFragment = m_sourceFragments[curFrame->sourceId];
-
-  if (lastFragment && lastFragment->sourceFile == m_curSourceFile)
-    m_sourceDisplay->setCurrentItem(lastFragment->baseLine+curFrame->lineno);
-  else
-    m_sourceDisplay->setCurrentItem(-1);
-}
-
-void KJSDebugWin::eval()
-{
-  // evaluate the js code from m_evalEdit
-
-  if (!m_inSession)
-    return;
-
-  // create function
-  KJS::Constructor constr(KJS::Global::current().get("Function").imp());
-  KJS::List args;
-  args.append(KJS::String("event"));
-  args.append(KJS::String("return "+m_evalEdit->text()+";"));
-  KJS::KJSO func = constr.construct(args);
-  // execute
-  Mode oldMode = m_mode;
-  m_mode = Continue; // prevents us from stopping during evaluation
-
-  KJSO ret = m_curContext->executeCall(m_curScript,func,func,0);
-  KMessageBox::information(this, ret.toString().value().qstring(), "JavaScript eval");
-  m_mode = oldMode;
-}
-
-void KJSDebugWin::closeEvent(QCloseEvent *e)
-{
-  if (m_inSession)
-    leaveSession();
-  return QWidget::closeEvent(e);
-}
-
-bool KJSDebugWin::sourceParsed(KJScript */*script*/, int sourceId,
-			       const UString &source, int /*errorLine*/)
-{
-  // the interpreter has parsed some js code - store it in a SourceFragment object
-  // ### report errors (errorLine >= 0)
-
-  SourceFile *sourceFile = m_sourceFiles[m_nextSourceUrl];
-  if (!sourceFile) {
-    sourceFile = new SourceFile("(unknown)",source.qstring());
-    m_sourceSelFiles[m_sourceSel->count()] = sourceFile;
-    if (m_nextSourceUrl.isNull() || m_nextSourceUrl == "")
-        m_sourceSel->insertItem("???");
-    else
-        m_sourceSel->insertItem(m_nextSourceUrl);
-  }
-
-  SourceFragment *sf = new SourceFragment(sourceId,m_nextSourceBaseLine,sourceFile);
-  m_sourceFragments[sourceId] = sf;
-
-
-  m_nextSourceBaseLine = 0;
-  m_nextSourceUrl = "";
-
-  return (m_mode != Stop);
-}
-
-bool KJSDebugWin::sourceUnused(KJScript */*script*/, int sourceId)
-{
-  // the source fragment is no longer in use, so we can free it
-
-  SourceFragment *fragment = m_sourceFragments[sourceId];
-  m_sourceFragments.erase(sourceId);
-  delete fragment;
-  return (m_mode != Stop);
-}
-
-bool KJSDebugWin::error(KJScript */*script*/, int /*sourceId*/, int /*lineno*/,
-			int /*errorType*/, const KJS::UString &errorMessage)
-{
-  // ### bring up source & hilight line
-  KMessageBox::error(this, errorMessage.qstring(), "JavaScript error");
-  return (m_mode != Stop);
-}
-
-bool KJSDebugWin::atLine(KJScript *script, int sourceId, int lineno,
-			 const ExecutionContext *execContext)
-{
-  const ExecutionContext *oldCurContext = m_curContext;
-  KJScript *oldCurScript = m_curScript;
-  m_curContext = execContext;
-  m_curScript = script;
-  /*
-  if (haveBreakpoint(sourceId,lineno)) {
-    m_mode = Next;
-    m_frames.last()->next = true;
-  }
-  */
-
-  m_frames.last()->sourceId = sourceId;
-  m_frames.last()->lineno = lineno;
-  //  highLight(sourceId,lineno);
-  if (m_mode == KJSDebugWin::Step || m_mode == KJSDebugWin::Next) {
-    if (m_frames.last()->next)
-      enterSession();
-  }
-
-  m_curContext = oldCurContext;
-  m_curScript = oldCurScript;
-  return (m_mode != Stop);
-}
-
-bool KJSDebugWin::callEvent(KJScript *script, int sourceId, int lineno,
-			    const ExecutionContext *execContext,
-			    FunctionImp *function, const List */*args*/)
-{
-  //  highLight(sourceId,lineno);
-  const ExecutionContext *oldCurContext = m_curContext;
-  KJScript *oldCurScript = m_curScript;
-  m_curContext = execContext;
-  m_curScript = script;
-  QString name = function->name().qstring();
-  StackFrame *sf = new StackFrame(sourceId,lineno,name,m_mode == Step);
-  m_frames.append(sf);
-  if (m_mode == Step)
-    enterSession();
-  m_curContext = oldCurContext;
-  m_curScript = oldCurScript;
-  return (m_mode != Stop);
-}
-
-bool KJSDebugWin::returnEvent(KJScript *script, int sourceId, int lineno,
-			      const ExecutionContext *execContext,
-			      FunctionImp */*function*/)
-{
-  //  highLight(sourceId,lineno);
-  const ExecutionContext *oldCurContext = m_curContext;
-  KJScript *oldCurScript = m_curScript;
-  m_curContext = execContext;
-  m_curScript = script;
-  m_frames.last()->sourceId = sourceId;
-  m_frames.last()->lineno = lineno;
-  if (m_frames.last()->step)
-    enterSession();
-  m_frames.removeLast();
-  //  m_frameList->removeItem(m_frameList->count()-1);
-  m_curContext = oldCurContext;
-  m_curScript = oldCurScript;
-  return (m_mode != Stop);
-}
-
-void KJSDebugWin::setCode(const QString &code)
-{
-  const QChar *chars = code.unicode();
-  uint len = code.length();
-  QChar newLine('\n');
-  uint lineStart = 0;
-  m_sourceDisplay->clear();
-  // ### support for \r\n and \n\r (?)
-  for (uint i = 0; i < len; i++) {
-    if (chars[i] == newLine) {
-      QString line;
-      if (lineStart == i)
-	line = "";
-      else
-	line = QString(chars+lineStart,i-lineStart);
-
-      QListBoxPixmap *qbp;
-      if (m_sourceDisplay->count() == 5)
-	qbp = new QListBoxPixmap(m_stopIcon,line);
-      else
-	qbp = new QListBoxPixmap(m_emptyIcon,line);
-      m_sourceDisplay->insertItem(qbp);
-
-      lineStart = i+1;
-    }
-  }
-}
-
-void KJSDebugWin::highLight(int sourceId, int line)
-{
-  if (!isVisible())
-    show();
-
-  SourceFragment *source = m_sourceFragments[sourceId];
-  if (!source)
-    return;
-
-  SourceFile *sourceFile = source->sourceFile;
-  if (m_curSourceFile != source->sourceFile)
-      setCode(sourceFile->code);
-  m_curSourceFile = source->sourceFile;
-
-  if (line >= 0)
-    m_sourceDisplay->setCurrentItem(line+source->baseLine);
-  else
-    m_sourceDisplay->setCurrentItem(-1);
-}
-
-void KJSDebugWin::setNextSourceInfo(QString url, int baseLine)
-{
-  m_nextSourceUrl = url;
-  m_nextSourceBaseLine = baseLine;
-}
-
-void KJSDebugWin::setSourceFile(QString url, QString code)
-{
-  SourceFile *existing = m_sourceFiles[url];
-  if (existing)
-    existing->deref();
-  SourceFile *newSF = new SourceFile(url,code);
-  m_sourceFiles[url] = newSF;
-}
-
-void KJSDebugWin::appendSourceFile(QString url, QString code)
-{
-  SourceFile *existing = m_sourceFiles[url];
-  if (!existing) {
-    setSourceFile(url,code);
-    return;
-  }
-  existing->code.append(code);
-}
-
-void KJSDebugWin::enterSession()
-{
-  // This "enters" a new debugging session, i.e. enables usage of the debugging window
-  // It re-enters the qt event loop here, allowing execution of other parts of the
-  // program to continue while the script is stopped. We have to be a bit careful here,
-  // i.e. make sure the user can't quite the app, and not executing more js code
-  assert(!m_inSession);
-  m_fakeModal.enable(this);
-  m_inSession = true;
-  m_mode = Continue;
-
-  m_nextButton->setEnabled(true);
-  m_stepButton->setEnabled(true);
-  m_continueButton->setEnabled(true);
-  m_stopButton->setEnabled(true);
-  m_evalButton->setEnabled(true);
-  updateFrameList();
-
-  qApp->enter_loop(); // won't return until leaveSession() is called
-  assert(!m_inSession);
-}
-
-void KJSDebugWin::leaveSession()
-{
-  // Disables debugging for this window and returns to execute the rest of the script
-  // (or aborts execution, if the user pressed stop). When this returns, the program
-  // will exit the qt event loop, i.e. return to whatever processing was being done
-  // before the debugger was stopped.
-  assert(m_inSession);
-  m_nextButton->setEnabled(false);
-  m_stepButton->setEnabled(false);
-  m_continueButton->setEnabled(false);
-  m_stopButton->setEnabled(false);
-  m_evalButton->setEnabled(false);
-  m_inSession = false;
-  qApp->exit_loop();
-  m_fakeModal.disable();
-}
-
-void KJSDebugWin::updateFrameList()
-{
-  uint frameno;
-  //  m_frameList->setUpdatesEnabled(false);
-  m_frameList->clear();
-  for (frameno = 0; frameno < m_frames.count(); frameno++) {
-    m_frameList->insertItem(m_frames.at(frameno)->toString(),frameno);
-  }
-  //  m_frameList->setUpdatesEnabled(true);
-  //  m_frameList->triggerUpdate(true);
-  highLight(m_frames.last()->sourceId,m_frames.last()->lineno);
-}
-
-bool KJSDebugWin::setBreakpoint(int sourceId, int line)
-{
-  if (haveBreakpoint(sourceId,line,line))
-    return false;
-
-  SourceBreakpoints *sbp = m_sourceBreakpoints;
-  while(sbp && sbp->sourceId != sourceId)
-    sbp = sbp->next;
-  if (!sbp) {
-    sbp = new SourceBreakpoints;
-    sbp->sourceId = sourceId;
-    sbp->breakpoints = 0;
-    sbp->next = m_sourceBreakpoints;
-    m_sourceBreakpoints = sbp;
-  }
-
-  Breakpoint *newbp = new Breakpoint;
-  newbp->lineno = line;
-  newbp->next = sbp->breakpoints;
-  sbp->breakpoints = newbp;
-
-  return true;
-}
-
-bool KJSDebugWin::deleteBreakpoint(int sourceId, int line)
-{
-  for (SourceBreakpoints *sbp = m_sourceBreakpoints; sbp; sbp = sbp->next) {
-    if (sbp->sourceId == sourceId) {
-      // found breakpoints for this sourceId
-      Breakpoint *bp = sbp->breakpoints;
-      if (bp && bp->lineno == line) {
-	// was the first breakpoint
-	Breakpoint *next = bp->next;
-	delete bp;
-	bp = next;
-	return true;
-      }
-
-      while (bp->next && bp->next->lineno != line)
-	bp = bp->next;
-      if (bp->next && bp->next->lineno == line) {
-	// found at subsequent breakpoint
-	Breakpoint *next = bp->next;
-	delete bp;
-	bp = next;
-	return true;
-      }
-      return false;
-    }
-  }
-  // no breakpoints at all for this sourceId
-  return false;
-}
-
-void KJSDebugWin::clearAllBreakpoints(int sourceId)
-{
-  SourceBreakpoints *nextsbp = 0;
-  for (SourceBreakpoints *sbp = m_sourceBreakpoints; sbp; sbp = nextsbp) {
-    nextsbp = sbp->next;
-    if (sourceId == -1 || sbp->sourceId == sourceId) {
-      Breakpoint *nextbp;
-      for (Breakpoint *bp = sbp->breakpoints; bp; bp = bp->next) {
-	nextbp = bp->next;
-	delete bp;
-      }
-      delete sbp;
-    }
-  }
-}
-
-int KJSDebugWin::breakpointLine(int sourceId, int line0, int line1)
-{
-  for (SourceBreakpoints *sbp = m_sourceBreakpoints; sbp; sbp = sbp->next) {
-    if (sbp->sourceId == sourceId) {
-      // found breakpoints for this sourceId
-      for (Breakpoint *bp = sbp->breakpoints; bp; bp = bp->next) {
-	if (bp->lineno >= 0 && bp->lineno >= line0 && bp->lineno <= line1)
-	  return bp->lineno;
-      }
-      return -1;
-    }
-  }
-  // no breakpoints at all for this sourceId
-  return -1;
-}
-
-bool KJSDebugWin::haveBreakpoint(int sourceId, int line0, int line1)
-{
-  return (breakpointLine(sourceId,line0,line1) != -1);
-}
-
-#include "kjs_debugwin.moc"
-
-#endif // KJS_DEBUGGER
diff --git a/WebCore/khtml/ecma/kjs_debugwin.h b/WebCore/khtml/ecma/kjs_debugwin.h
deleted file mode 100644
index 4654bf0..0000000
--- a/WebCore/khtml/ecma/kjs_debugwin.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2000-2001 Harri Porten (porten at kde.org)
- *  Copyright (C) 2001 Peter Kelly (pmk at post.com)
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef _KJS_DEBUGGER_H_
-#define _KJS_DEBUGGER_H_
-
-#include <qglobal.h>
-
-#include <config.h>
-
-#ifndef APPLE_CHANGES
-#ifdef __GNUC__
-#warning TODO port the debugger
-#endif
-#endif
-
-
-//#define KJS_DEBUGGER
-
-#ifdef KJS_DEBUGGER
-
-#include <qwidget.h>
-#include <qpixmap.h>
-#include <qlist.h>
-
-#include <kjs/debugger.h>
-
-#include "dom/dom_misc.h"
-
-class QListBox;
-class QComboBox;
-class QLineEdit;
-class QPushButton;
-class KJScript;
-
-namespace KJS {
-  class FunctionImp;
-  class List;
-};
-
-/**
- * @internal
- *
- * A hack to allow KJSDebugWin to act as a modal window only some of the time
- * (i.e. when it is paused, to prevent the user quitting the app during a
- * debugging session)
- */
-class FakeModal : public QWidget
-{
-    Q_OBJECT
-public:
-    FakeModal() {}
-    void enable(QWidget *modal);
-    void disable();
-
-protected:
-    bool eventFilter( QObject *obj, QEvent *evt );
-    QWidget *modalWidget;
-};
-
-
-/**
- * @internal
- *
- * Represents a frame on the execution stack. The top frame is the global code for
- * the script, and each frame below it represents a function call.
- */
-class StackFrame {
- public:
-  StackFrame(int s, int l, QString n, bool stepped)
-    : sourceId(s), lineno(l), name(n), step(stepped),
-    next(stepped) {}
-  QString toString();
-
-  int sourceId;
-  int lineno;
-  QString name;
-  bool step;
-  bool next;
-};
-
-class SourceFile : public DOM::DomShared {
- public:
-  SourceFile(QString u, QString c) : url(u), code(c) {}
-  QString url;
-  QString code;
-};
-
-/**
- * @internal
- *
- * When kjs parses some code, it generates a source code fragment (or just "source").
- * This is referenced by it's source id in future calls to functions such as atLine()
- * and callEvent(). We keep a record of all source fragments parsed in order to display
- * then to the user.
- *
- * For .js files, the source fragment will be the entire file. For js code included
- * in html files, however, there may be multiple source fragments within the one file
- * (e.g. multiple SCRIPT tags or onclick="..." attributes)
- *
- * In the case where a single file has multiple source fragments, the source objects
- * for these fragments will all point to the same SourceFile for their code.
- */
-class SourceFragment {
- public:
-  SourceFragment(int sid, int bl, SourceFile *sf);
-  ~SourceFragment();
-
-  int sourceId;
-  int baseLine;
-  SourceFile *sourceFile;
-};
-
-/**
- * @internal
- *
- * KJSDebugWin represents the debugger window that is visible to the user. It contains
- * a stack frame list, a code viewer and a source fragment selector, plus buttons
- * to control execution including next, step and continue.
- *
- * There is only one debug window per program. This can be obtained by calling #instance
- */
-class KJSDebugWin : public QWidget, public KJS::Debugger {
-  Q_OBJECT
-public:
-  KJSDebugWin(QWidget *parent=0, const char *name=0);
-  virtual ~KJSDebugWin();
-
-  static KJSDebugWin *createInstance();
-  static void destroyInstance();
-  static KJSDebugWin *instance();
-
-  enum Mode { Disabled = 0, // No break on any statements
-	      Next     = 1, // Will break on next statement in current context
-	      Step     = 2, // Will break on next statement in current or deeper context
-	      Continue = 3, // Will continue until next breakpoint
-	      Stop     = 4  // The script will stop execution completely,
-	                    // as soon as possible
-  };
-
-  void highLight(int sourceId, int line);
-  void setNextSourceInfo(QString url, int baseLine);
-  void setSourceFile(QString url, QString code);
-  void appendSourceFile(QString url, QString code);
-  bool inSession() const { return m_inSession; }
-  KJScript *currentScript() { return m_curScript; }
-  void setMode(Mode m) { m_mode = m; }
-
-public slots:
-  void next();
-  void step();
-  void cont();
-  void stop();
-  void showFrame(int frameno);
-  void sourceSelected(int sourceSelIndex);
-  void eval();
-
-protected:
-
-  virtual void closeEvent(QCloseEvent *e);
-
-  // functions overridden from KJS:Debugger
-  virtual bool sourceParsed(KJScript *script, int sourceId,
-			    const KJS::UString &source, int errorLine);
-
-  virtual bool sourceUnused(KJScript *script, int sourceId);
-
-  virtual bool error(KJScript *script, int sourceId, int lineno,
-		     int errorType, const KJS::UString &errorMessage);
-
-  virtual bool atLine(KJScript *script, int sourceId, int lineno,
-		      const KJS::ExecState *execContext);
-
-  virtual bool callEvent(KJScript *script, int sourceId, int lineno,
-			 const KJS::ExecState *execContext,
-			 KJS::FunctionImp *function, const KJS::List *args);
-
-  virtual bool returnEvent(KJScript *script, int sourceId, int lineno,
-			   const KJS::ExecState *execContext,
-			   KJS::FunctionImp *function);
-
-private:
-  void enterSession();
-  void leaveSession();
-  void setCode(const QString &code);
-  void updateFrameList();
-
-  struct Breakpoint {
-    int lineno;
-    Breakpoint *next;
-  };
-  struct SourceBreakpoints {
-    int sourceId;
-    Breakpoint *breakpoints;
-    SourceBreakpoints *next;
-  };
-  SourceBreakpoints *m_sourceBreakpoints;
-
-  bool setBreakpoint(int sourceId, int line);
-  bool deleteBreakpoint(int sourceId, int line);
-  void clearAllBreakpoints(int sourceId = -1);
-  int breakpointLine(int sourceId, int line0, int line1);
-  bool haveBreakpoint(int sourceId, int line0, int line1);
-
-  bool m_inSession;
-
-  QListBox *m_sourceDisplay;
-  QListBox *m_frameList;
-  QPushButton *m_stepButton;
-  QPushButton *m_nextButton;
-  QPushButton *m_continueButton;
-  QPushButton *m_stopButton;
-  QComboBox *m_sourceSel;
-  QPixmap m_stopIcon;
-  QPixmap m_emptyIcon;
-  QLineEdit *m_evalEdit;
-  QPushButton *m_evalButton;
-
-  SourceFile *m_curSourceFile;
-  QList<StackFrame> m_frames;
-  Mode m_mode;
-  QMap<QString,SourceFile*> m_sourceFiles;
-  QMap<int,SourceFragment*> m_sourceFragments;
-  QMap<int,SourceFile*> m_sourceSelFiles;
-
-  QString m_nextSourceUrl;
-  int m_nextSourceBaseLine;
-  FakeModal m_fakeModal;
-  //const KJS::ExecutionContext *m_curContext;
-  KJScript *m_curScript;
-};
-
-#endif // KJS_DEBUGGER
-
-#endif // _KJS_DEBUGGER_H_
diff --git a/WebCore/kwq/KWQPixmap.h b/WebCore/kwq/KWQPixmap.h
index cfcaf62..7c21ae5 100644
--- a/WebCore/kwq/KWQPixmap.h
+++ b/WebCore/kwq/KWQPixmap.h
@@ -26,10 +26,6 @@
 #ifndef QPIXMAP_H_
 #define QPIXMAP_H_
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "qpaintdevice.h"
 #include "qcolor.h"
 #include "qstring.h"
@@ -39,8 +35,10 @@
 #include "qrect.h"
 #include "qpainter.h"
 
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
-#import <Cocoa/Cocoa.h>
+#ifdef __OBJC__
+ at class NSImage;
+#else
+typedef void NSImage;
 #endif
 
 class QBitmap;
@@ -62,7 +60,7 @@ public:
     QPixmap();
     QPixmap(const QSize&);
     QPixmap(const QByteArray&);
-    QPixmap(int,int);
+    QPixmap(int, int);
     QPixmap(const QPixmap &);
     ~QPixmap();
 
@@ -78,7 +76,7 @@ public:
     int width() const;
     int height() const;
     void resize(const QSize &);
-    void resize(int,int);
+    void resize(int, int);
 
     QPixmap xForm(const QWMatrix &) const;
     QImage convertToImage() const;
@@ -87,13 +85,10 @@ public:
 
     QPixmap &operator=(const QPixmap &);
 
-#ifdef _KWQ_
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+private:
     NSImage *nsimage;
-#else
-    void *nsimage;
-#endif
-#endif
+    bool needCopyOnWrite;
+
 }; // class QPixmap ============================================================
 
 #endif
diff --git a/WebCore/kwq/KWQPixmap.mm b/WebCore/kwq/KWQPixmap.mm
index 88698da..681e405 100644
--- a/WebCore/kwq/KWQPixmap.mm
+++ b/WebCore/kwq/KWQPixmap.mm
@@ -23,169 +23,122 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <kwqdebug.h>
 #include <qpixmap.h>
+#include <kwqdebug.h>
 #include <qbitmap.h>
 
-/*
- * FIXME: This is a bad hack which really should go away.
- * Here we're using private API to get around the problem 
- * of image bytes being double freed.
- */
- at interface NSData (NSDataWebCoreExtensions)
-- (id)initWithBytes:(void *)bytes length:(unsigned)length copy:(BOOL)copy freeWhenDone:(BOOL)freeBytes bytesAreVM:(BOOL)vm;
- at end
-
-
 QPixmap::QPixmap()
 {
     nsimage = nil;
+    needCopyOnWrite = false;
 }
 
-
-QPixmap::QPixmap(const QSize&sz)
+QPixmap::QPixmap(const QSize &sz)
 {
-    nsimage = [[NSImage alloc] initWithSize: NSMakeSize ((float)sz.width(), (float)sz.height())];
+    nsimage = [[NSImage alloc] initWithSize: NSMakeSize((float)sz.width(), (float)sz.height())];
+    needCopyOnWrite = false;
 }
 
-
- at interface NSData (NSDataOpenStepExtensions)
-
-- (id)initWithBytes:(void *)bytes length:(unsigned)length copy:(BOOL)copy freeWhenDone:(BOOL)freeBytes bytesAreVM:(BOOL)vm;
-
-- (BOOL)_bytesAreVM;
-
- at end
-
-QPixmap::QPixmap(const QByteArray&bytes)
+QPixmap::QPixmap(const QByteArray &bytes)
 {
-    /*
-     * FIXME: This is a bad hack which really should go away.
-     * Here we're using private API to get around the problem 
-     * of image bytes being double freed.
-     */
-    NSData *nsdata = [[NSData alloc] initWithBytes: bytes.data() length: bytes.size() copy:NO freeWhenDone:NO bytesAreVM:NO];
-    nsimage = [[NSImage alloc] initWithData: nsdata];
+    NSData *data = [[NSData alloc] initWithBytes: bytes.data() length: bytes.size()];
+    nsimage = [[NSImage alloc] initWithData: data];
     // FIXME: Workaround for Radar 2890624 (Double free of image data in QPixmap)
     // This else if code block should be removed when we pick up changes from AppKit
     // image code that are on HEAD now, but are not in Jaguar <= 6B63
     // When we pick up the change from AppKit, uncomment the next line and release the data here
-    //[nsdata release];
+    //[data release];
     if (nsimage == nil){
         KWQDEBUG("unable to create image\n");
         // FIXME: delete next line when Radar 2890624
-        [nsdata release];
-    } 
+        [data release];
+    }
     else if ([[nsimage representations] count] == 0) {
-        KWQDEBUG("unable to create image [can't decode bytes]\n");
+        KWQDEBUG("unable to create image [can't decode bytes]");
         // leak the ns image pointer
         // note that the data is freed erroneously by AppKit
         // we're not leaking that, just the nsimage pointer
         nsimage = nil;
     }
     else {
-        KWQDEBUG("image created\n");
+        KWQDEBUG("image created");
         // FIXME: delete next line when Radar 2890624
-        [nsdata release];
+        [data release];
         [nsimage setFlipped: YES];
-        [nsimage setScalesWhenResized: YES];
     }
+    needCopyOnWrite = false;
 }
 
-
 QPixmap::QPixmap(int w, int h)
 {
     nsimage = [[NSImage alloc] initWithSize: NSMakeSize(w, h)];
+    needCopyOnWrite = false;
 }
 
-
 QPixmap::QPixmap(const QPixmap &copyFrom)
     : QPaintDevice()
 {
-    if (copyFrom.nsimage != nil){
-        // Do a deep copy of the image.  This is required because the image
-        // may be transformed, i.e. scaled.
-        nsimage = [copyFrom.nsimage copyWithZone: [copyFrom.nsimage zone]];    
-    }
-    else
-        nsimage = nil;
+    nsimage = [copyFrom.nsimage retain];
+    needCopyOnWrite = true;
 }
 
-
 QPixmap::~QPixmap()
 {
-    if (nsimage != nil){
-        [nsimage release];
-        nsimage = nil;
-    }
+    [nsimage release];
 }
 
-
 void QPixmap::setMask(const QBitmap &)
 {
     _logNotYetImplemented();
 }
 
-static QBitmap *theMask = NULL;
 const QBitmap *QPixmap::mask() const
 {
-    _logNotYetImplemented();
-
-    if (theMask == NULL) {
-	theMask = new QBitmap();
-    }
-
-    return theMask;
+    return 0;
 }
 
-
 bool QPixmap::isNull() const
 {
-    if (nsimage == nil)
-        return TRUE;
-    return false;
+    return nsimage == nil;
 }
 
-
 QSize QPixmap::size() const
 {
     NSSize sz = [nsimage size];
     return QSize((int)sz.width, (int)sz.height);
 }
 
-
 QRect QPixmap::rect() const
 {
     NSSize sz = [nsimage size];
     return QRect(0, 0, (int)sz.width, (int)sz.height);
 }
 
-
 int QPixmap::width() const
 {
     return (int)[nsimage size].width;
 }
 
-
 int QPixmap::height() const
 {
     return (int)[nsimage size].height;
 }
 
-
 void QPixmap::resize(const QSize &sz)
 {
-    resize (sz.width(), sz.height());
+    resize(sz.width(), sz.height());
 }
 
-
 void QPixmap::resize(int w, int h)
 {
+    if (needCopyOnWrite) {
+        nsimage = [nsimage copy];
+        needCopyOnWrite = false;
+    }
+    [nsimage setScalesWhenResized: YES];
     [nsimage setSize: NSMakeSize((float)w, (float)h)];
 }
 
-
-
 QPixmap QPixmap::xForm(const QWMatrix &xmatrix) const
 {
     // This function is only called when an image needs to be scaled.  
@@ -194,25 +147,20 @@ QPixmap QPixmap::xForm(const QWMatrix &xmatrix) const
     // implementation simply returns a copy of the image.  Note,
     // this implementation depends on the implementation of
     // RenderImage::printObject.   
-    QPixmap xPix = *this;
-    [xPix.nsimage setScalesWhenResized: YES];
-    return xPix;
+    return *this;
 }
 
-
 QImage QPixmap::convertToImage() const
 {
     _logNotYetImplemented();
     return QImage();
 }
 
-
 QPixmap &QPixmap::operator=(const QPixmap &assignFrom)
 {
-    if (assignFrom.nsimage == nsimage)
-        return *this;
+    [assignFrom.nsimage retain];
     [nsimage release];
-    nsimage = [assignFrom.nsimage retain];
+    nsimage = assignFrom.nsimage;
+    needCopyOnWrite = true;
     return *this;
 }
-
diff --git a/WebCore/kwq/qt/qpixmap.h b/WebCore/kwq/qt/qpixmap.h
index cfcaf62..7c21ae5 100644
--- a/WebCore/kwq/qt/qpixmap.h
+++ b/WebCore/kwq/qt/qpixmap.h
@@ -26,10 +26,6 @@
 #ifndef QPIXMAP_H_
 #define QPIXMAP_H_
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "qpaintdevice.h"
 #include "qcolor.h"
 #include "qstring.h"
@@ -39,8 +35,10 @@
 #include "qrect.h"
 #include "qpainter.h"
 
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
-#import <Cocoa/Cocoa.h>
+#ifdef __OBJC__
+ at class NSImage;
+#else
+typedef void NSImage;
 #endif
 
 class QBitmap;
@@ -62,7 +60,7 @@ public:
     QPixmap();
     QPixmap(const QSize&);
     QPixmap(const QByteArray&);
-    QPixmap(int,int);
+    QPixmap(int, int);
     QPixmap(const QPixmap &);
     ~QPixmap();
 
@@ -78,7 +76,7 @@ public:
     int width() const;
     int height() const;
     void resize(const QSize &);
-    void resize(int,int);
+    void resize(int, int);
 
     QPixmap xForm(const QWMatrix &) const;
     QImage convertToImage() const;
@@ -87,13 +85,10 @@ public:
 
     QPixmap &operator=(const QPixmap &);
 
-#ifdef _KWQ_
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+private:
     NSImage *nsimage;
-#else
-    void *nsimage;
-#endif
-#endif
+    bool needCopyOnWrite;
+
 }; // class QPixmap ============================================================
 
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list