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

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:31:47 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 8ba89c7627739bbecb9bfb9a5264e518d83d0782
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Mar 27 01:57:47 2003 +0000

            Reviewed by Trey.
    
    	Made progress towards better handling of window operations.
    
            * khtml/ecma/kjs_window.cpp:
            (Window::get): Replace a few part->widget() calls with part->view() -- just
    	as good for the real khtml, but easier to adapt to with KWQ.
            (WindowFunc::tryCall): Likewise.
            * khtml/khtmlview.h:
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::~KWQKHTMLPart): Delete the window widget.
            (KWQKHTMLPart::topLevelWidget): Return the window widget.
            (KWQKHTMLPart::setBridge): Make a new window widget passing it the bridge.
            * kwq/KWQKHTMLView.mm:
            (KHTMLView::topLevelWidget): Moved here from KHTMLView; get the top level
    	widget from the part.
            (KHTMLView::mapToGlobal): Moved here from KHTMLView; add a needed cast.
            * kwq/KWQWidget.h:
            * kwq/KWQWidget.mm: Remove all top level widget considerations.
            * kwq/KWQWindowWidget.h:
            * kwq/KWQWindowWidget.mm:
            (KWQWindowWidget::KWQWindowWidget): Changed to work based on bridge, not window.
            (KWQWindowWidget::~KWQWindowWidget): Ditto.
            (KWQWindowWidget::frameGeometry): Ditto.
            (KWQWindowWidget::mapToGlobal): Ditto.
            (KWQWindowWidget::mapFromGlobal): Ditto.
            (KWQWindowWidget::setFrameGeometry): Ditto.
    
            Also:
    
    	* kwq/KWQKHTMLPart.cpp: Removed stuff that did not belong here.
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::selectionStartOffset): Moved here from KWQKHTMLPart.cpp
            (KWQKHTMLPart::selectionEndOffset): Likewise.
            (KWQKHTMLPart::selectionStart): Likewise.
            (KWQKHTMLPart::selectionEnd): Likewise.
            (KWQKHTMLPart::selectionRect): Likesie.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3930 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 33a98f6..1628e1e 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,44 @@
+1969-12-31  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Trey.
+
+	Made progress towards better handling of window operations.
+	
+        * khtml/ecma/kjs_window.cpp:
+        (Window::get): Replace a few part->widget() calls with part->view() -- just
+	as good for the real khtml, but easier to adapt to with KWQ.
+        (WindowFunc::tryCall): Likewise.
+        * khtml/khtmlview.h:
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::~KWQKHTMLPart): Delete the window widget.
+        (KWQKHTMLPart::topLevelWidget): Return the window widget.
+        (KWQKHTMLPart::setBridge): Make a new window widget passing it the bridge.
+        * kwq/KWQKHTMLView.mm:
+        (KHTMLView::topLevelWidget): Moved here from KHTMLView; get the top level
+	widget from the part.
+        (KHTMLView::mapToGlobal): Moved here from KHTMLView; add a needed cast.
+        * kwq/KWQWidget.h:
+        * kwq/KWQWidget.mm: Remove all top level widget considerations.
+        * kwq/KWQWindowWidget.h:
+        * kwq/KWQWindowWidget.mm:
+        (KWQWindowWidget::KWQWindowWidget): Changed to work based on bridge, not window.
+        (KWQWindowWidget::~KWQWindowWidget): Ditto.
+        (KWQWindowWidget::frameGeometry): Ditto.
+        (KWQWindowWidget::mapToGlobal): Ditto.
+        (KWQWindowWidget::mapFromGlobal): Ditto.
+        (KWQWindowWidget::setFrameGeometry): Ditto.
+
+        Also:
+
+	* kwq/KWQKHTMLPart.cpp: Removed stuff that did not belong here.
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::selectionStartOffset): Moved here from KWQKHTMLPart.cpp
+        (KWQKHTMLPart::selectionEndOffset): Likewise.
+        (KWQKHTMLPart::selectionStart): Likewise.
+        (KWQKHTMLPart::selectionEnd): Likewise.
+        (KWQKHTMLPart::selectionRect): Likesie.
+
 2003-03-26  Darin Adler  <darin at apple.com>
 
         Reviewed by Trey.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 33a98f6..1628e1e 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,44 @@
+1969-12-31  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Trey.
+
+	Made progress towards better handling of window operations.
+	
+        * khtml/ecma/kjs_window.cpp:
+        (Window::get): Replace a few part->widget() calls with part->view() -- just
+	as good for the real khtml, but easier to adapt to with KWQ.
+        (WindowFunc::tryCall): Likewise.
+        * khtml/khtmlview.h:
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::~KWQKHTMLPart): Delete the window widget.
+        (KWQKHTMLPart::topLevelWidget): Return the window widget.
+        (KWQKHTMLPart::setBridge): Make a new window widget passing it the bridge.
+        * kwq/KWQKHTMLView.mm:
+        (KHTMLView::topLevelWidget): Moved here from KHTMLView; get the top level
+	widget from the part.
+        (KHTMLView::mapToGlobal): Moved here from KHTMLView; add a needed cast.
+        * kwq/KWQWidget.h:
+        * kwq/KWQWidget.mm: Remove all top level widget considerations.
+        * kwq/KWQWindowWidget.h:
+        * kwq/KWQWindowWidget.mm:
+        (KWQWindowWidget::KWQWindowWidget): Changed to work based on bridge, not window.
+        (KWQWindowWidget::~KWQWindowWidget): Ditto.
+        (KWQWindowWidget::frameGeometry): Ditto.
+        (KWQWindowWidget::mapToGlobal): Ditto.
+        (KWQWindowWidget::mapFromGlobal): Ditto.
+        (KWQWindowWidget::setFrameGeometry): Ditto.
+
+        Also:
+
+	* kwq/KWQKHTMLPart.cpp: Removed stuff that did not belong here.
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::selectionStartOffset): Moved here from KWQKHTMLPart.cpp
+        (KWQKHTMLPart::selectionEndOffset): Likewise.
+        (KWQKHTMLPart::selectionStart): Likewise.
+        (KWQKHTMLPart::selectionEnd): Likewise.
+        (KWQKHTMLPart::selectionRect): Likesie.
+
 2003-03-26  Darin Adler  <darin at apple.com>
 
         Reviewed by Trey.
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index 983ba49..10bda87 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -475,9 +475,9 @@ Value Window::get(ExecState *exec, const Identifier &p) const
     case OuterHeight:
     case OuterWidth:
     {
-      if (!m_part->widget())
+      if (!m_part->view())
         return Number(0);
-      KWin::Info inf = KWin::info(m_part->widget()->topLevelWidget()->winId());
+      KWin::Info inf = KWin::info(m_part->view()->topLevelWidget()->winId());
       return Number(entry->value == OuterHeight ?
                     inf.geometry.height() : inf.geometry.width());
     }
@@ -1415,7 +1415,7 @@ Value WindowFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
 #if APPLE_CHANGES
            // FIXME: How are we going to handle this?
 #else
-           || KMessageBox::questionYesNo( window->part()->widget(), i18n("Close window?"), i18n("Confirmation Required") ) == KMessageBox::Yes
+           || KMessageBox::questionYesNo( window->part()->view(), i18n("Close window?"), i18n("Confirmation Required") ) == KMessageBox::Yes
 #endif
            )
         (const_cast<Window*>(window))->scheduleClose();
diff --git a/WebCore/khtml/khtmlview.h b/WebCore/khtml/khtmlview.h
index dd1859f..54b2e4d 100644
--- a/WebCore/khtml/khtmlview.h
+++ b/WebCore/khtml/khtmlview.h
@@ -185,6 +185,11 @@ public:
 
     void timerEvent ( QTimerEvent * );
 
+#if APPLE_CHANGES
+    QWidget *topLevelWidget() const;
+    QPoint mapToGlobal(const QPoint &) const;
+#endif
+    
 protected slots:
     void slotPaletteChanged();
     void slotScrollBarMoved();
@@ -247,7 +252,7 @@ private:
 
     // Returns the clipped object we will repaint when we perform our scheduled layout.
     khtml::RenderObject* layoutObject() { return m_layoutObject; }
-    
+
     // ------------------------------------- member variables ------------------------------------
  private:
     int _width;
diff --git a/WebCore/kwq/KWQKHTMLPart.cpp b/WebCore/kwq/KWQKHTMLPart.cpp
index cf3c8f9..0299361 100644
--- a/WebCore/kwq/KWQKHTMLPart.cpp
+++ b/WebCore/kwq/KWQKHTMLPart.cpp
@@ -42,23 +42,3 @@ bool KWQKHTMLPart::isFrameSet() const
     NodeImpl *body = static_cast<HTMLDocumentImpl *>(document)->body();
     return body && body->renderer() && body->id() == ID_FRAMESET;
 }
-
-int KWQKHTMLPart::selectionStartOffset() const
-{
-    return d->m_startOffset;
-}
-
-int KWQKHTMLPart::selectionEndOffset() const
-{
-    return d->m_endOffset;
-}
-
-NodeImpl *KWQKHTMLPart::selectionStart() const
-{
-    return d->m_selectionStart.handle();
-}
-
-NodeImpl *KWQKHTMLPart::selectionEnd() const
-{
-    return d->m_selectionEnd.handle();
-}
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index e786cb1..1094e7e 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -34,6 +34,7 @@
 #include <CoreFoundation/CoreFoundation.h>
 
 class KHTMLPartPrivate;
+class KWQWindowWidget;
 
 namespace khtml {
     class RenderObject;
@@ -81,7 +82,7 @@ public:
     KWQKHTMLPart();
     ~KWQKHTMLPart();
     
-    void setBridge(WebCoreBridge *p) { _bridge = p; }
+    void setBridge(WebCoreBridge *p);
     WebCoreBridge *bridge() const { return _bridge; }
     void setView(KHTMLView *view, bool weOwnIt);
     void setOwnsView(bool weOwnIt) { _ownsView = weOwnIt; }
@@ -190,7 +191,9 @@ public:
     NSString *matchLabelsAgainstElement(NSArray *labels, DOM::ElementImpl *element);
 
     void setSettings (KHTMLSettings *s);
-    
+
+    KWQWindowWidget *topLevelWidget();
+
 private:
     virtual void khtmlMousePressEvent(khtml::MousePressEvent *);
     virtual void khtmlMouseDoubleClickEvent(khtml::MouseDoubleClickEvent *);
@@ -237,6 +240,8 @@ private:
 
     static QPtrList<KWQKHTMLPart> &mutableInstances();
 
+    KWQWindowWidget *_windowWidget;
+
     friend class KHTMLPart;
 };
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 60e3468..1c69d15 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -44,6 +44,7 @@
 #import "KWQLogging.h"
 #import "KWQPageState.h"
 #import "KWQDOMNode.h"
+#import "KWQWindowWidget.h"
 
 #import "xml/dom2_eventsimpl.h"
 
@@ -154,6 +155,7 @@ KWQKHTMLPart::~KWQKHTMLPart()
     }
     [_formValuesAboutToBeSubmitted release];
     [_formAboutToBeSubmitted release];
+    delete _windowWidget;
 }
 
 void KWQKHTMLPart::setSettings (KHTMLSettings *settings)
@@ -1669,3 +1671,37 @@ QRect KWQKHTMLPart::selectionRect() const
 
     return root->selectionRect();
 }
+
+KWQWindowWidget *KWQKHTMLPart::topLevelWidget()
+{
+    return _windowWidget;
+}
+
+int KWQKHTMLPart::selectionStartOffset() const
+{
+    return d->m_startOffset;
+}
+
+int KWQKHTMLPart::selectionEndOffset() const
+{
+    return d->m_endOffset;
+}
+
+NodeImpl *KWQKHTMLPart::selectionStart() const
+{
+    return d->m_selectionStart.handle();
+}
+
+NodeImpl *KWQKHTMLPart::selectionEnd() const
+{
+    return d->m_selectionEnd.handle();
+}
+
+void KWQKHTMLPart::setBridge(WebCoreBridge *p)
+{ 
+    if (_bridge != p) {
+	delete _windowWidget;
+    }
+    _bridge = p;
+    _windowWidget = new KWQWindowWidget(_bridge);
+}
diff --git a/WebCore/kwq/KWQKHTMLView.mm b/WebCore/kwq/KWQKHTMLView.mm
index 703d61f..6dc60b9 100644
--- a/WebCore/kwq/KWQKHTMLView.mm
+++ b/WebCore/kwq/KWQKHTMLView.mm
@@ -24,9 +24,25 @@
  */
 
 #import "khtmlview.h"
+#import "KWQKHTMLPart.h"
+#import "KWQWindowWidget.h"
 
 /*
     Currently this files just extends the kde implementation.
     See src/kdelibs/khtml/khtmlview.cpp for the complete
     implementation.
 */
+
+QWidget *KHTMLView::topLevelWidget() const 
+{
+    return KWQ(part())->topLevelWidget();
+}
+
+QPoint KHTMLView::mapToGlobal(const QPoint &p) const
+{
+    // This is only used by JavaScript to implement the getting
+    // the screenX and screen Y coordinates.
+
+    return (static_cast<KWQWindowWidget *>(topLevelWidget()))->mapToGlobal(p);
+}
+
diff --git a/WebCore/kwq/KWQWidget.h b/WebCore/kwq/KWQWidget.h
index 1b32540..6d694f4 100644
--- a/WebCore/kwq/KWQWidget.h
+++ b/WebCore/kwq/KWQWidget.h
@@ -94,9 +94,6 @@ public:
 
     virtual int baselinePosition() const; // relative to the top of the widget
 
-    virtual QWidget *topLevelWidget() const;
-
-    virtual QPoint mapToGlobal(const QPoint &) const;
     virtual QPoint mapFromGlobal(const QPoint &) const;
 
     bool hasFocus() const;
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index c59c7fa..2b6636c 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -160,32 +160,6 @@ int QWidget::baselinePosition() const
     return height();
 }
 
-QWidget *QWidget::topLevelWidget() const 
-{
-    NSWindow *window = nil;
-    NSView *view = getView();
-
-    window = [view window];
-    while (window == nil && view != nil) { 
-	view = [view superview]; 
-	window = [view window];
-    }
-
-    return window ? KWQWindowWidget::fromNSWindow(window) : NULL;
-}
-
-QPoint QWidget::mapToGlobal(const QPoint &p) const
-{
-    // This is only used by JavaScript to implement the getting
-    // the screenX and screen Y coordinates.
-
-    if (topLevelWidget() != nil) {
-	return topLevelWidget()->mapToGlobal(p);
-    } else {
-	return p;
-    }
-}
-
 bool QWidget::hasFocus() const
 {
     NSView *view = getView();
diff --git a/WebCore/kwq/KWQWindowWidget.h b/WebCore/kwq/KWQWindowWidget.h
index bee6377..efb0f56 100644
--- a/WebCore/kwq/KWQWindowWidget.h
+++ b/WebCore/kwq/KWQWindowWidget.h
@@ -29,9 +29,9 @@
 #include "KWQWidget.h"
 
 #ifdef __OBJC__
- at class NSWindow;
+ at class WebCoreBridge;
 #else
-class NSWindow;
+class WebCoreBridge;
 #endif
 
 class KWQWindowWidgetPrivate;
@@ -41,7 +41,7 @@ class KWQWindowWidget : public QWidget
  public:
     virtual ~KWQWindowWidget();
 
-    static KWQWindowWidget *fromNSWindow(NSWindow *window);
+    KWQWindowWidget(WebCoreBridge *bridge);
 
     virtual QSize sizeHint() const;
     virtual QRect frameGeometry() const;
@@ -52,7 +52,6 @@ class KWQWindowWidget : public QWidget
     virtual QPoint mapFromGlobal(const QPoint &) const;
 
  private:
-    KWQWindowWidget(NSWindow *window);
     KWQWindowWidgetPrivate *d;
 };
 
diff --git a/WebCore/kwq/KWQWindowWidget.mm b/WebCore/kwq/KWQWindowWidget.mm
index 4f1c3e1..74ff6b0 100644
--- a/WebCore/kwq/KWQWindowWidget.mm
+++ b/WebCore/kwq/KWQWindowWidget.mm
@@ -25,61 +25,28 @@
 
 #import "KWQWindowWidget.h"
 
-#import <Cocoa/Cocoa.h>
+#import "WebCoreBridge.h"
 
- at interface KWQWindowWidgetDeleter : NSObject
-{
-    KWQWindowWidget *_widget;
-}
-- initWithWindowWidget:(KWQWindowWidget *)widget;
-- (void)deleteWindowWidget;
- at end
+#import <Cocoa/Cocoa.h>
 
 class KWQWindowWidgetPrivate
 {
 public:
-    NSWindow *window;
-    KWQWindowWidgetDeleter *deleter;
+    WebCoreBridge *bridge;
 };
 
-static CFMutableDictionaryRef windowWidgets = NULL;
-
-KWQWindowWidget::KWQWindowWidget(NSWindow *window) :
+KWQWindowWidget::KWQWindowWidget(WebCoreBridge *bridge) :
     d(new KWQWindowWidgetPrivate())
 {
-    d->window = [window retain];
-    d->deleter = [[KWQWindowWidgetDeleter alloc] initWithWindowWidget:this];
-
-    [[NSNotificationCenter defaultCenter] addObserver:d->deleter
-        selector:@selector(deleteWindowWidget) name:NSWindowWillCloseNotification object:window];
+    // intentionally not retained, since the bridge owns the window widget
+    d->bridge = bridge;
 }
 
 KWQWindowWidget::~KWQWindowWidget()
 {
-    CFDictionaryRemoveValue(windowWidgets, d->window);
-    [[NSNotificationCenter defaultCenter] removeObserver:d->deleter];
-    
-    [d->window release];
-    [d->deleter release];
-    
     delete d;
 }
 
-KWQWindowWidget *KWQWindowWidget::fromNSWindow(NSWindow *window)
-{
-    if (windowWidgets == NULL) {
-	windowWidgets = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, NULL);
-    }
-    
-    KWQWindowWidget *widget = (KWQWindowWidget *)CFDictionaryGetValue(windowWidgets, window);
-    if (widget == NULL) {
-	widget = new KWQWindowWidget(window);
-	CFDictionarySetValue(windowWidgets, window, widget);
-    }
-
-    return widget;
-}
-
 QSize KWQWindowWidget::sizeHint() const
 {
     return size();
@@ -87,7 +54,7 @@ QSize KWQWindowWidget::sizeHint() const
 
 QRect KWQWindowWidget::frameGeometry() const
 {
-    NSRect frame = [d->window frame];
+    NSRect frame = [[d->bridge window] frame];
     return QRect((int)frame.origin.x, (int)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(frame)),
 		 (int)frame.size.width, (int)frame.size.height);
 }
@@ -99,37 +66,21 @@ QWidget *KWQWindowWidget::topLevelWidget() const
 
 QPoint KWQWindowWidget::mapToGlobal(const QPoint &p) const
 {
-    NSPoint windowPoint = NSMakePoint(p.x(), [d->window frame].size.height - p.y());
-    NSPoint screenPoint = [d->window convertBaseToScreen:windowPoint];
+    NSPoint windowPoint = NSMakePoint(p.x(), [[d->bridge window] frame].size.height - p.y());
+    NSPoint screenPoint = [[d->bridge window] convertBaseToScreen:windowPoint];
     return QPoint((int)screenPoint.x, (int)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - screenPoint.y));
 }
 
 QPoint KWQWindowWidget::mapFromGlobal(const QPoint &p) const
 {
     NSPoint screenPoint = NSMakePoint(p.x(), NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - p.y());
-    NSPoint windowPoint = [d->window convertScreenToBase:screenPoint];
-    return QPoint((int)windowPoint.x, (int)([d->window frame].size.height - windowPoint.y));
+    NSPoint windowPoint = [[d->bridge window] convertScreenToBase:screenPoint];
+    return QPoint((int)windowPoint.x, (int)([[d->bridge window] frame].size.height - windowPoint.y));
 }
 
 void KWQWindowWidget::setFrameGeometry(const QRect &r)
 {
     // FIXME: Could do something to make it easy for the browser to avoid saving this change.
-    [d->window setFrame:NSMakeRect(r.x(), NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - (r.y() + r.height()),
+    [[d->bridge window] setFrame:NSMakeRect(r.x(), NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - (r.y() + r.height()),
         r.width(), r.height()) display:YES];
 }
-
- at implementation KWQWindowWidgetDeleter
-
-- initWithWindowWidget:(KWQWindowWidget *)widget
-{
-    [super init];
-    _widget = widget;
-    return self;
-}
-
-- (void)deleteWindowWidget
-{
-    delete _widget;
-}
-
- at end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list