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


The following commit has been merged in the debian/unstable branch:
commit 77abd2afda4d6b3e7e06dc73ba80945fcbf6bfed
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Jan 26 05:04:57 2003 +0000

    WebCore:
    
            Reviewed by Maciej.
    
    	- fixed 3126211 -- "go back" buttons that use "history.go(-1)" doesn't work (verizonwireless.com is an example)
    	- fixed 2950618 -- JavaScript window.history object name prints blank
    
            * khtml/ecma/kjs_window.cpp:
            (FrameArray::toString): Added. Returns "[object FrameArray]".
            (History::getValueProperty): Removed #if APPLE_CHANGES to turn more code on.
            (History::toString): Added. Returns "[object History]".
    
            * kwq/KWQKPartsBrowserExtension.h: Make browserInterface a pure virtual function
    	instead of always returning 0.
            * kwq/KWQKHTMLPartBrowserExtension.h: Added browserInterface() function.
    	Also replaced m_part with a _part that is a KWQKHTMLPart to simplify code.
            * kwq/KWQKHTMLPartBrowserExtension.mm:
            (KHTMLPartBrowserExtension::KHTMLPartBrowserExtension): Create the browser
    	interface object when the browser extension object is created.
            (KHTMLPartBrowserExtension::openURLRequest): Use _part instead of KWQ(m_part).
            (KHTMLPartBrowserExtension::createNewWindow): Use _part instead of KWQ(m_part).
            (KHTMLPartBrowserExtension::setIconURL): Use _part instead of KWQ(m_part).
            (KHTMLPartBrowserExtension::setTypedIconURL): Use _part instead of KWQ(m_part).
    
            * kwq/KWQKPartsBrowserInterface.h: Add a constructor, property() function, and
    	_part data member.
            * kwq/KWQKPartsBrowserInterface.mm:
    	(BrowserInterface::property): Added. Handles historyLength property by calling
    	the historyLength method on the bridge.
    	(BrowserInterface::callMethod): Handles goHistory(int) by calling the
    	goBackOrForward: method on the bridge.
    
            * kwq/WebCoreBridge.h: Added historyLength and goBackOrForward: methods.
    
            * kwq/KWQVariant.h: Added Int to the variant enum, added int and uint contructors,
    	and added toInt() member function.
            * kwq/KWQVariant.mm:
            (QVariant::QVariant): Implemented int and uint constructors.
            (QVariant::toBool): Added Int case, sorted alphabetically.
            (QVariant::toInt): Added.
            (QVariant::toUInt): Added Int case, sorted alphabetically.
            (QVariant::asString): Added Int case, sorted alphabetically.
    
    WebKit:
    
            Reviewed by Maciej.
    
    	- fixed 3126211 -- "go back" buttons that use "history.go(-1)" doesn't work (verizonwireless.com is an example)
    
    	Implemented new bridge functions for use by the history object.
    
            * History.subproj/WebBackForwardList.h: Added backListCount and entryAtIndex:.
            * History.subproj/WebBackForwardList.m:
            (-[WebBackForwardList backListCount]): Added.
            (-[WebBackForwardList entryAtIndex:]): Added.
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge historyLength]): Added. Calls backListCount.
            (-[WebBridge goBackOrForward:]): Added. Calls entryAtIndex: and then goBackOrForwardToItem:.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3457 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 2fadbad..2a80aa1 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,46 @@
+2003-01-25  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
+	- fixed 3126211 -- "go back" buttons that use "history.go(-1)" doesn't work (verizonwireless.com is an example)
+	- fixed 2950618 -- JavaScript window.history object name prints blank
+
+        * khtml/ecma/kjs_window.cpp:
+        (FrameArray::toString): Added. Returns "[object FrameArray]".
+        (History::getValueProperty): Removed #if APPLE_CHANGES to turn more code on.
+        (History::toString): Added. Returns "[object History]".
+
+        * kwq/KWQKPartsBrowserExtension.h: Make browserInterface a pure virtual function
+	instead of always returning 0.
+        * kwq/KWQKHTMLPartBrowserExtension.h: Added browserInterface() function.
+	Also replaced m_part with a _part that is a KWQKHTMLPart to simplify code.
+        * kwq/KWQKHTMLPartBrowserExtension.mm:
+        (KHTMLPartBrowserExtension::KHTMLPartBrowserExtension): Create the browser
+	interface object when the browser extension object is created.
+        (KHTMLPartBrowserExtension::openURLRequest): Use _part instead of KWQ(m_part).
+        (KHTMLPartBrowserExtension::createNewWindow): Use _part instead of KWQ(m_part).
+        (KHTMLPartBrowserExtension::setIconURL): Use _part instead of KWQ(m_part).
+        (KHTMLPartBrowserExtension::setTypedIconURL): Use _part instead of KWQ(m_part).
+
+        * kwq/KWQKPartsBrowserInterface.h: Add a constructor, property() function, and
+	_part data member.
+        * kwq/KWQKPartsBrowserInterface.mm:
+	(BrowserInterface::property): Added. Handles historyLength property by calling
+	the historyLength method on the bridge.
+	(BrowserInterface::callMethod): Handles goHistory(int) by calling the
+	goBackOrForward: method on the bridge.
+
+        * kwq/WebCoreBridge.h: Added historyLength and goBackOrForward: methods.
+
+        * kwq/KWQVariant.h: Added Int to the variant enum, added int and uint contructors,
+	and added toInt() member function.
+        * kwq/KWQVariant.mm:
+        (QVariant::QVariant): Implemented int and uint constructors.
+        (QVariant::toBool): Added Int case, sorted alphabetically.
+        (QVariant::toInt): Added.
+        (QVariant::toUInt): Added Int case, sorted alphabetically.
+        (QVariant::asString): Added Int case, sorted alphabetically.
+
 2003-01-25  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: 3153605 - Drag image when dragging text should be the actual text
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 2fadbad..2a80aa1 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,46 @@
+2003-01-25  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
+	- fixed 3126211 -- "go back" buttons that use "history.go(-1)" doesn't work (verizonwireless.com is an example)
+	- fixed 2950618 -- JavaScript window.history object name prints blank
+
+        * khtml/ecma/kjs_window.cpp:
+        (FrameArray::toString): Added. Returns "[object FrameArray]".
+        (History::getValueProperty): Removed #if APPLE_CHANGES to turn more code on.
+        (History::toString): Added. Returns "[object History]".
+
+        * kwq/KWQKPartsBrowserExtension.h: Make browserInterface a pure virtual function
+	instead of always returning 0.
+        * kwq/KWQKHTMLPartBrowserExtension.h: Added browserInterface() function.
+	Also replaced m_part with a _part that is a KWQKHTMLPart to simplify code.
+        * kwq/KWQKHTMLPartBrowserExtension.mm:
+        (KHTMLPartBrowserExtension::KHTMLPartBrowserExtension): Create the browser
+	interface object when the browser extension object is created.
+        (KHTMLPartBrowserExtension::openURLRequest): Use _part instead of KWQ(m_part).
+        (KHTMLPartBrowserExtension::createNewWindow): Use _part instead of KWQ(m_part).
+        (KHTMLPartBrowserExtension::setIconURL): Use _part instead of KWQ(m_part).
+        (KHTMLPartBrowserExtension::setTypedIconURL): Use _part instead of KWQ(m_part).
+
+        * kwq/KWQKPartsBrowserInterface.h: Add a constructor, property() function, and
+	_part data member.
+        * kwq/KWQKPartsBrowserInterface.mm:
+	(BrowserInterface::property): Added. Handles historyLength property by calling
+	the historyLength method on the bridge.
+	(BrowserInterface::callMethod): Handles goHistory(int) by calling the
+	goBackOrForward: method on the bridge.
+
+        * kwq/WebCoreBridge.h: Added historyLength and goBackOrForward: methods.
+
+        * kwq/KWQVariant.h: Added Int to the variant enum, added int and uint contructors,
+	and added toInt() member function.
+        * kwq/KWQVariant.mm:
+        (QVariant::QVariant): Implemented int and uint constructors.
+        (QVariant::toBool): Added Int case, sorted alphabetically.
+        (QVariant::toInt): Added.
+        (QVariant::toUInt): Added Int case, sorted alphabetically.
+        (QVariant::asString): Added Int case, sorted alphabetically.
+
 2003-01-25  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: 3153605 - Drag image when dragging text should be the actual text
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index e957a49..70bf3db 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -69,6 +69,7 @@ namespace KJS {
     virtual const ClassInfo* classInfo() const { return &info; }
     static const ClassInfo info;
     enum { Back, Forward, Go, Length };
+    virtual UString toString(ExecState *exec) const;
   private:
     QGuardedPtr<KHTMLPart> part;
   };
@@ -78,6 +79,7 @@ namespace KJS {
     FrameArray(ExecState *exec, KHTMLPart *p)
       : ObjectImp(exec->interpreter()->builtinObjectPrototype()), part(p) { }
     virtual Value get(ExecState *exec, const Identifier &propertyName) const;
+    virtual UString toString(ExecState *exec) const;
   private:
     QGuardedPtr<KHTMLPart> part;
   };
@@ -1669,6 +1671,11 @@ Value FrameArray::get(ExecState *exec, const Identifier &p) const
   return ObjectImp::get(exec, p);
 }
 
+UString FrameArray::toString(ExecState *) const
+{
+  return "[object FrameArray]";
+}
+
 ////////////////////// Location Object ////////////////////////
 
 const ClassInfo Location::info = { "Location", 0, 0, 0 };
@@ -1877,7 +1884,6 @@ Value History::get(ExecState *exec, const Identifier &p) const
 Value History::getValueProperty(ExecState *, int token) const
 {
   switch (token) {
-#if !APPLE_CHANGES
   case Length:
   {
     KParts::BrowserExtension *ext = part->browserExtension();
@@ -1895,13 +1901,17 @@ Value History::getValueProperty(ExecState *, int token) const
 
     return Number( length.toUInt() );
   }
-#endif
   default:
     kdWarning() << "Unhandled token in History::getValueProperty : " << token << endl;
     return Undefined();
   }
 }
 
+UString History::toString(ExecState *exec) const
+{
+  return "[object History]";
+}
+
 Value HistoryFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
 {
   if (!thisObj.inherits(&History::info)) {
diff --git a/WebCore/kwq/KWQKHTMLPartBrowserExtension.h b/WebCore/kwq/KWQKHTMLPartBrowserExtension.h
index 84062de..372ef33 100644
--- a/WebCore/kwq/KWQKHTMLPartBrowserExtension.h
+++ b/WebCore/kwq/KWQKHTMLPartBrowserExtension.h
@@ -25,6 +25,8 @@
 
 #include "KWQKPartsBrowserExtension.h"
 
+#include "KWQKPartsBrowserInterface.h"
+
 class QWidget;
 class KHTMLPart;
 
@@ -35,6 +37,8 @@ public:
     void editableWidgetBlurred(QWidget *) { }
     void setLocationBarURL(const QString &) { }
     
+    virtual KParts::BrowserInterface *browserInterface() { return &_browserInterface; }
+
     virtual void openURLRequest(const KURL &, 
 				const KParts::URLArgs &args = KParts::URLArgs());
     virtual void openURLNotify();
@@ -55,7 +59,8 @@ private:
 			  const KParts::WindowArgs &winArgs, 
 			  KParts::ReadOnlyPart **part);
 
-     KHTMLPart *m_part;
+     KWQKHTMLPart *_part;
+     KParts::BrowserInterface _browserInterface;
 };
 
 class KHTMLPartBrowserHostExtension {
diff --git a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
index 9c51395..d40977e 100644
--- a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
+++ b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
@@ -28,8 +28,8 @@
 #import "WebCoreBridge.h"
 
 KHTMLPartBrowserExtension::KHTMLPartBrowserExtension(KHTMLPart *part)
+    : _part(KWQ(part)), _browserInterface(_part)
 {
-    m_part = part;
 }
 
 void KHTMLPartBrowserExtension::openURLRequest(const KURL &url, 
@@ -37,21 +37,21 @@ void KHTMLPartBrowserExtension::openURLRequest(const KURL &url,
 {
     if (url.protocol().lower() == "javascript") {
 	QString string = url.url();
-	KWQ(m_part)->createEmptyDocument();
+	_part->createEmptyDocument();
 	QString script = KURL::decode_string(string.mid(strlen("javascript:")));
-	QVariant ret = KWQ(m_part)->executeScript(script);
+	QVariant ret = _part->executeScript(script);
 
 	// some sites open windows with a javascript: URL that
 	// evaluates to an HTML string which they want placed in the
 	// window - should executing a script always do this?
 	if (ret.type() == QVariant::String) {
-	    m_part->begin();
-	    m_part->write(ret.asString());
-	    m_part->end();
+	    _part->begin();
+	    _part->write(ret.asString());
+	    _part->end();
 	}
 
      } else {
-	KWQ(m_part)->openURLRequest(url, args);
+	_part->openURLRequest(url, args);
     }
 }
 
@@ -83,7 +83,7 @@ void KHTMLPartBrowserExtension::createNewWindow(const KURL &url,
     WebCoreBridge *bridge;
 
     if (frameName != nil) {
-	bridge = [KWQ(m_part)->bridge() findFramedNamed:frameName];
+	bridge = [_part->bridge() findFramedNamed:frameName];
 	if (bridge != nil) {
 	    if (!url.isEmpty()) {
 		[bridge loadURL:url.url().getNSString() reload:urlArgs.reload triggeringEvent:nil isFormSubmission:NO];
@@ -93,7 +93,7 @@ void KHTMLPartBrowserExtension::createNewWindow(const KURL &url,
 	}
     }
 
-    bridge = [KWQ(m_part)->bridge() createWindowWithURL:url.url().getNSString() frameName:frameName];
+    bridge = [_part->bridge() createWindowWithURL:url.url().getNSString() frameName:frameName];
     
     if (!winArgs.toolBarsVisible) {
 	[bridge setToolbarsVisible:NO];
@@ -145,10 +145,10 @@ void KHTMLPartBrowserExtension::createNewWindow(const KURL &url,
 
 void KHTMLPartBrowserExtension::setIconURL(const KURL &url)
 {
-    [KWQ(m_part)->bridge() setIconURL:url.url().getNSString()];
+    [_part->bridge() setIconURL:url.url().getNSString()];
 }
 
 void KHTMLPartBrowserExtension::setTypedIconURL(const KURL &url, const QString &type)
 {
-    [KWQ(m_part)->bridge() setIconURL:url.url().getNSString() withType:type.getNSString()];
+    [_part->bridge() setIconURL:url.url().getNSString() withType:type.getNSString()];
 }
diff --git a/WebCore/kwq/KWQKPartsBrowserExtension.h b/WebCore/kwq/KWQKPartsBrowserExtension.h
index 8ceadae..2eff886 100644
--- a/WebCore/kwq/KWQKPartsBrowserExtension.h
+++ b/WebCore/kwq/KWQKPartsBrowserExtension.h
@@ -93,28 +93,28 @@ struct WindowArgs {
 
 class BrowserExtension : public QObject {
 public:
-     BrowserExtension() { }
-     BrowserInterface *browserInterface() const { return 0; }
-     
-     virtual void openURLRequest(const KURL &, const KParts::URLArgs &args = KParts::URLArgs()) = 0;
-     virtual void openURLNotify() = 0;
-     
-     virtual void createNewWindow(const KURL &url, 
-				  const KParts::URLArgs &urlArgs = KParts::URLArgs()) = 0;
-
-     virtual void createNewWindow(const KURL &url, 
-				  const KParts::URLArgs &urlArgs, 
-				  const KParts::WindowArgs &winArgs, 
-				  KParts::ReadOnlyPart *&part) = 0;
-
-     virtual void setIconURL(const KURL &url) = 0;
-     virtual void setTypedIconURL(const KURL &url, const QString &type) = 0;
-     
-     void setURLArgs(const KParts::URLArgs &args) { m_args = args; }
-     KParts::URLArgs urlArgs() const { return m_args; }
+    BrowserExtension() { }
+    virtual BrowserInterface *browserInterface() = 0;
+    
+    virtual void openURLRequest(const KURL &, const URLArgs &args = URLArgs()) = 0;
+    virtual void openURLNotify() = 0;
+    
+    virtual void createNewWindow(const KURL &url, 
+                                 const URLArgs &urlArgs = URLArgs()) = 0;
+    
+    virtual void createNewWindow(const KURL &url, 
+                                 const URLArgs &urlArgs, 
+                                 const WindowArgs &winArgs, 
+                                 ReadOnlyPart *&part) = 0;
+    
+    virtual void setIconURL(const KURL &url) = 0;
+    virtual void setTypedIconURL(const KURL &url, const QString &type) = 0;
+    
+    void setURLArgs(const URLArgs &args) { m_args = args; }
+    URLArgs urlArgs() const { return m_args; }
 
 private:
-    KParts::URLArgs m_args;
+    URLArgs m_args;
 };
 
 class BrowserHostExtension : public QObject { };
diff --git a/WebCore/kwq/KWQKPartsBrowserInterface.h b/WebCore/kwq/KWQKPartsBrowserInterface.h
index a20477d..4b5ed30 100644
--- a/WebCore/kwq/KWQKPartsBrowserInterface.h
+++ b/WebCore/kwq/KWQKPartsBrowserInterface.h
@@ -29,11 +29,19 @@
 #include "KWQObject.h"
 #include "KWQVariant.h"
 
+class KWQKHTMLPart;
+
 namespace KParts {
 
 class BrowserInterface : public QObject {
 public:
+    BrowserInterface(KWQKHTMLPart *part) : _part(part) { }
+    
+    QVariant property(const char *name) const;
     void callMethod(const char *name, const QVariant &argument);
+
+private:
+    KWQKHTMLPart *_part;
 };
 
 } // namespace KParts
diff --git a/WebCore/kwq/KWQKPartsBrowserInterface.mm b/WebCore/kwq/KWQKPartsBrowserInterface.mm
index 1475926..c515b07 100644
--- a/WebCore/kwq/KWQKPartsBrowserInterface.mm
+++ b/WebCore/kwq/KWQKPartsBrowserInterface.mm
@@ -25,13 +25,29 @@
 
 #import "KWQKPartsBrowserInterface.h"
 
-#import "KWQLogging.h"
+#import "KWQAssertions.h"
+#import "KWQKHTMLPart.h"
+#import "WebCoreBridge.h"
 
 namespace KParts {
 
+QVariant BrowserInterface::property(const char *name) const
+{
+    if (strcmp(name, "historyLength") == 0) {
+        return QVariant([_part->bridge() historyLength]);
+    }
+    ERROR("property %s not implemented", name);
+    return QVariant();
+}
+
 void BrowserInterface::callMethod(const char *name, const QVariant &argument)
 {
-    ERROR("not yet implemented");
+    if (strcmp(name, "goHistory(int)") == 0) {
+        int distance = argument.toInt();
+        [_part->bridge() goBackOrForward:distance];
+        return;
+    }
+    ERROR("method %s not implemented", name);
 }
 
 } // namespace KParts
diff --git a/WebCore/kwq/KWQVariant.h b/WebCore/kwq/KWQVariant.h
index 2f09f62..056a8e2 100644
--- a/WebCore/kwq/KWQVariant.h
+++ b/WebCore/kwq/KWQVariant.h
@@ -39,11 +39,14 @@ public:
         String,
         UInt,
         Double,
-        Bool
+        Bool,
+        Int
     };
 
     QVariant();
     QVariant(bool, int);
+    QVariant(int);
+    QVariant(uint);
     QVariant(double);
     QVariant(const QString &);
     ~QVariant();
@@ -54,6 +57,7 @@ public:
     Type type() const;
     
     bool toBool() const;
+    int toInt() const;
     uint toUInt() const;
     
     QString asString() const;
diff --git a/WebCore/kwq/KWQVariant.mm b/WebCore/kwq/KWQVariant.mm
index 1136836..158483d 100644
--- a/WebCore/kwq/KWQVariant.mm
+++ b/WebCore/kwq/KWQVariant.mm
@@ -39,6 +39,7 @@ public:
         uint u;
         double d;
         void *p;
+        int i;
     } value;
 
     int refCount;
@@ -59,11 +60,21 @@ QVariant::QVariant() : d(new QVariantPrivate)
 {
 }
 
-QVariant::QVariant(bool val, int i) : d(new QVariantPrivate(Bool))
+QVariant::QVariant(bool val, int) : d(new QVariantPrivate(Bool))
 {
     d->value.d = val;
 }
 
+QVariant::QVariant(int val) : d(new QVariantPrivate(Int))
+{
+    d->value.i = val;
+}
+
+QVariant::QVariant(uint val) : d(new QVariantPrivate(UInt))
+{
+    d->value.u = val;
+}
+
 QVariant::QVariant(double val) : d(new QVariantPrivate(Double))
 {
     d->value.d = val;
@@ -99,10 +110,12 @@ bool QVariant::toBool() const
     switch (d->t) {
     case Bool:
         return d->value.b;
-    case UInt:
-        return d->value.u;
     case Double:
         return d->value.d != 0.0;
+    case Int:
+        return d->value.i;
+    case UInt:
+        return d->value.u;
     case Invalid:
     case String:
         break;
@@ -110,15 +123,35 @@ bool QVariant::toBool() const
     return false;
 }
 
-uint QVariant::toUInt() const
+int QVariant::toInt() const
 {
     switch (d->t) {
     case Bool:
         return d->value.b;
+    case Double:
+        return (int)d->value.d;
+    case Int:
+        return d->value.i;
     case UInt:
-        return d->value.u;
+        return d->value.u > INT_MAX ? 0 : d->value.u;
+    case Invalid:
+    case String:
+        break;
+    }
+    return 0;
+}
+
+uint QVariant::toUInt() const
+{
+    switch (d->t) {
+    case Bool:
+        return d->value.b;
     case Double:
         return (uint)d->value.d;
+    case Int:
+        return d->value.i < 0 ? 0 : d->value.i;
+    case UInt:
+        return d->value.u;
     case Invalid:
     case String:
         break;
@@ -129,14 +162,16 @@ uint QVariant::toUInt() const
 QString QVariant::asString() const
 {
     switch (d->t) {
-    case String:
-        return *(QString *)d->value.p;
     case Bool:
         return QString(d->value.b ? "true" : "false");
-    case UInt:
-        return QString().setNum(d->value.u);
     case Double:
         return QString().setNum(d->value.d);
+    case Int:
+        return QString().setNum(d->value.i);
+    case String:
+        return *(QString *)d->value.p;
+    case UInt:
+        return QString().setNum(d->value.u);
     case Invalid:
         break;
     }
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index c1b11bb..b730b81 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -267,6 +267,9 @@ enum FrameBorderStyle {
 - (void)handleAutoscrollForMouseDragged:(NSEvent *)event;
 - (BOOL)mayStartDragWithMouseDragged:(NSEvent *)event;
 
+- (int)historyLength;
+- (void)goBackOrForward:(int)distance;
+
 @end
 
 // This interface definition allows those who hold a WebCoreBridge * to call all the methods
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d6cd28d..17032ce 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,19 @@
+2003-01-25  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
+	- fixed 3126211 -- "go back" buttons that use "history.go(-1)" doesn't work (verizonwireless.com is an example)
+
+	Implemented new bridge functions for use by the history object.
+
+        * History.subproj/WebBackForwardList.h: Added backListCount and entryAtIndex:.
+        * History.subproj/WebBackForwardList.m:
+        (-[WebBackForwardList backListCount]): Added.
+        (-[WebBackForwardList entryAtIndex:]): Added.
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge historyLength]): Added. Calls backListCount.
+        (-[WebBridge goBackOrForward:]): Added. Calls entryAtIndex: and then goBackOrForwardToItem:.
+
 2003-01-25  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: 3153605 - Drag image when dragging text should be the actual text
diff --git a/WebKit/History.subproj/WebBackForwardList.h b/WebKit/History.subproj/WebBackForwardList.h
index 7041cfc..b216d6b 100644
--- a/WebKit/History.subproj/WebBackForwardList.h
+++ b/WebKit/History.subproj/WebBackForwardList.h
@@ -134,4 +134,17 @@
 */
 - (void)setMaximumSize:(int)size;
 
+/*!
+    @method backListCount
+    @result Returns the back list's current count.
+*/
+- (int)backListCount;
+
+/*!
+    @method entryAtIndex:
+    @param index Index of the back/forward list item; 0 is current item, -1 is back item, 1 is forward item, etc.
+    @result Returns an entry the given distance from the current entry, or the furthest in that direction if there is none.
+*/
+- (WebHistoryItem *)entryAtIndex:(int)index;
+
 @end
diff --git a/WebKit/History.subproj/WebBackForwardList.m b/WebKit/History.subproj/WebBackForwardList.m
index b39693d..1937906 100644
--- a/WebKit/History.subproj/WebBackForwardList.m
+++ b/WebKit/History.subproj/WebBackForwardList.m
@@ -248,5 +248,21 @@ static BOOL usesPageCache = YES;
     return usesPageCache;
 }
 
+- (int)backListCount
+{
+    return _current;
+}
+
+- (WebHistoryItem *)entryAtIndex:(int)index
+{
+    // Do range checks without doing math on index to avoid overflow.
+    if (index < -_current) {
+        return [_entries objectAtIndex:0];
+    }
+    if (index >= (int)[_entries count] - _current) {
+        return [_entries lastObject];
+    }
+    return [_entries objectAtIndex:index + _current];
+}
 
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 1a45b62..1c6d0fc 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -625,5 +625,18 @@ static BOOL loggedObjectCacheSize = NO;
     return [docView _mayStartDragWithMouseDragged:event];
 }
 
+- (int)historyLength
+{
+    return [[[frame controller] backForwardList] backListCount];
+}
+
+- (void)goBackOrForward:(int)distance
+{
+    WebController *controller = [frame controller];
+    WebHistoryItem *item = [[controller backForwardList] entryAtIndex:distance];
+    if (item) {
+        [controller goBackOrForwardToItem:item];
+    }
+}
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list