[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 06:38:43 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 70502c3864085d52ee903d9c86064b991a260a54
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 13 03:21:00 2002 +0000

            Added "Absolute" position to the render tree view.  Useful
            to see how kthml LIES!
    
            * Debug/RenderTree.m:
            (-[RenderTreeDataSource outlineView:objectValueForTableColumn:byItem:]):
            * Debug/RenderTree.nib:
    
            Added absolute position column to render node for
            render tree view.
    
            * WebView.subproj/WebRenderNode.h:
            * WebView.subproj/WebRenderNode.m:
            (-[WebRenderNode initWithName:position:rect:view:children:]):
            (-[WebRenderNode absolutePositionString]):
            (-[WebKitRenderTreeCopier nodeWithName:position:rect:view:children:]):
    
            Rewrite of khtml selection drawing code.  Now does
            a delta between old and new selection and only
            draw those objects that have changed.  Selection
            drawing is now MUCH faster.
    
            * khtml/rendering/render_root.cpp:
            (enclosingPositionedRect):
            (RenderRoot::setSelection):
            (RenderRoot::clearSelection):
            * khtml/rendering/render_root.h:
    
            Added additional absolute position property to render node
            stuff for debug render tree view.
    
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge copyRenderNode:copier:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2055 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 786416c..ad8374a 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,23 @@
+2002-09-12  Richard Williamson (Local)  <rjw at apple.com>
+
+        Rewrite of khtml selection drawing code.  Now does
+        a delta between old and new selection and only
+        draw those objects that have changed.  Selection
+        drawing is now MUCH faster.
+        
+        * khtml/rendering/render_root.cpp:
+        (enclosingPositionedRect):
+        (RenderRoot::setSelection):
+        (RenderRoot::clearSelection):
+        * khtml/rendering/render_root.h:
+        
+        Added additional absolute position property to render node
+        stuff for debug render tree view.
+        
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge copyRenderNode:copier:]):
+
 2002-09-12  David Hyatt  <hyatt at apple.com>
 
 	KHTML was butchering the laws of background propagation from
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 786416c..ad8374a 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,23 @@
+2002-09-12  Richard Williamson (Local)  <rjw at apple.com>
+
+        Rewrite of khtml selection drawing code.  Now does
+        a delta between old and new selection and only
+        draw those objects that have changed.  Selection
+        drawing is now MUCH faster.
+        
+        * khtml/rendering/render_root.cpp:
+        (enclosingPositionedRect):
+        (RenderRoot::setSelection):
+        (RenderRoot::clearSelection):
+        * khtml/rendering/render_root.h:
+        
+        Added additional absolute position property to render node
+        stuff for debug render tree view.
+        
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge copyRenderNode:copier:]):
+
 2002-09-12  David Hyatt  <hyatt at apple.com>
 
 	KHTML was butchering the laws of background propagation from
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 786416c..ad8374a 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,23 @@
+2002-09-12  Richard Williamson (Local)  <rjw at apple.com>
+
+        Rewrite of khtml selection drawing code.  Now does
+        a delta between old and new selection and only
+        draw those objects that have changed.  Selection
+        drawing is now MUCH faster.
+        
+        * khtml/rendering/render_root.cpp:
+        (enclosingPositionedRect):
+        (RenderRoot::setSelection):
+        (RenderRoot::clearSelection):
+        * khtml/rendering/render_root.h:
+        
+        Added additional absolute position property to render node
+        stuff for debug render tree view.
+        
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge copyRenderNode:copier:]):
+
 2002-09-12  David Hyatt  <hyatt at apple.com>
 
 	KHTML was butchering the laws of background propagation from
diff --git a/WebCore/khtml/rendering/render_root.cpp b/WebCore/khtml/rendering/render_root.cpp
index 54f773e..efd24b7 100644
--- a/WebCore/khtml/rendering/render_root.cpp
+++ b/WebCore/khtml/rendering/render_root.cpp
@@ -266,6 +266,28 @@ void RenderRoot::close()
     //printTree();
 }
 
+#ifdef APPLE_CHANGES
+static QRect enclosingPositionedRect (RenderObject *n)
+{
+    RenderObject *enclosingParent = (RenderObject*)n;
+    QRect rect;
+    
+    while (enclosingParent && (enclosingParent->isText() || (enclosingParent->width() == 0 && enclosingParent->height() == 0))){
+        enclosingParent = enclosingParent->parent();
+    }
+    if (enclosingParent){
+        int ox, oy;
+        
+        enclosingParent->absolutePosition(ox, oy);
+        rect.setX(ox);
+        rect.setY(oy);
+        rect.setWidth (enclosingParent->width());
+        rect.setHeight (enclosingParent->height());
+    }
+    return rect;
+}
+#endif
+
 void RenderRoot::setSelection(RenderObject *s, int sp, RenderObject *e, int ep)
 {
     // Check we got valid renderobjects. www.msnbc.com and clicking around, to find the case where this happened.
@@ -276,7 +298,46 @@ void RenderRoot::setSelection(RenderObject *s, int sp, RenderObject *e, int ep)
     }
     //kdDebug( 6040 ) << "RenderRoot::setSelection(" << s << "," << sp << "," << e << "," << ep << ")" << endl;
 
+#ifdef APPLE_CHANGES
+    // Cut out early if the selection hasn't changed.
+    if (m_selectionStart == s && m_selectionStartPos == sp &&
+        m_selectionEnd == e && m_selectionEndPos == ep){
+        return;
+    }
+
+    // Record the old selected objects.  Will be used later
+    // to delta again the selected objects.
+    
+    RenderObject *oldStart = m_selectionStart;
+    int oldStartPos = m_selectionStartPos;
+    RenderObject *oldEnd = m_selectionEnd;
+    int oldEndPos = m_selectionEndPos;
+    QPtrList<RenderObject> oldSelectedInside;
+    QPtrList<RenderObject> newSelectedInside;
+    RenderObject *os = oldStart;
+
+    while (os && os != oldEnd)
+    {
+        RenderObject* no;
+        if ( !(no = os->firstChild()) ){
+            if ( !(no = os->nextSibling()) )
+            {
+                no = os->parent();
+                while (no && !no->nextSibling())
+                    no = no->parent();
+                if (no)
+                    no = no->nextSibling();
+            }
+        }
+        if (os->selectionState() == SelectionInside && !oldSelectedInside.containsRef(os))
+            oldSelectedInside.append(os);
+            
+        os = no;
+    }
+    clearSelection(false);
+#else
     clearSelection();
+#endif
 
     while (s->firstChild())
         s = s->firstChild();
@@ -301,6 +362,7 @@ void RenderRoot::setSelection(RenderObject *s, int sp, RenderObject *e, int ep)
 
     // update selection status of all objects between m_selectionStart and m_selectionEnd
     RenderObject* o = s;
+    
     while (o && o!=e)
     {
         o->setSelectionState(SelectionInside);
@@ -315,23 +377,119 @@ void RenderRoot::setSelection(RenderObject *s, int sp, RenderObject *e, int ep)
                 if (no)
                     no = no->nextSibling();
             }
+#ifdef APPLE_CHANGES
+        if (o->selectionState() == SelectionInside && !newSelectedInside.containsRef(o))
+            newSelectedInside.append(o);
+#endif
+            
         o=no;
     }
     s->setSelectionState(SelectionStart);
     e->setSelectionState(SelectionEnd);
     if(s == e) s->setSelectionState(SelectionBoth);
+
+#ifdef APPLE_CHANGES
+    if (!m_view)
+        return;
+
+    newSelectedInside.remove (s);
+    newSelectedInside.remove (e);
+    
+    QRect updateRect;
+
+    // Don't use repaint() because it will cause all rects to
+    // be united (see khtmlview::scheduleRepaint()).  Instead
+    // just draw damage rects for objects that have a change
+    // in selection state.
+    
+    // Are any of the old fully selected objects not in the new selection?
+    // If so we have to draw them.
+    // Could be faster by building list of non-intersecting rectangles rather
+    // than unioning rectangles.
+    QPtrListIterator<RenderObject> oldIterator(oldSelectedInside);
+    bool firstRect = true;
+    for (; oldIterator.current(); ++oldIterator){
+        if (!newSelectedInside.containsRef(oldIterator.current())){
+            if (firstRect){
+                updateRect = enclosingPositionedRect(oldIterator.current());
+                firstRect = false;
+            }
+            else
+                updateRect = updateRect.unite(enclosingPositionedRect(oldIterator.current()));
+        }
+    }
+    if (!firstRect){
+        m_view->updateContents( updateRect );
+    }
+
+    // Are any of the new fully selected objects not in the previous selection?
+    // If so we have to draw them.
+    // Could be faster by building list of non-intersecting rectangles rather
+    // than unioning rectangles.
+    QPtrListIterator<RenderObject> newIterator(newSelectedInside);
+    firstRect = true;
+    for (; newIterator.current(); ++newIterator){
+        if (!oldSelectedInside.containsRef(newIterator.current())){
+            if (firstRect){
+                updateRect = enclosingPositionedRect(newIterator.current());
+                firstRect = false;
+            }
+            else
+                updateRect = updateRect.unite(enclosingPositionedRect(newIterator.current()));
+        }
+    }
+    if (!firstRect) {
+        m_view->updateContents( updateRect );
+    }
+    
+    // Is the new starting object different, or did the position in the starting
+    // element change?  If so we have to draw it.
+    if (oldStart != m_selectionStart || 
+        (oldStart == oldEnd && (oldStartPos != m_selectionStartPos || oldEndPos != m_selectionEndPos)) ||
+        (oldStart == m_selectionStart && oldStartPos != m_selectionStartPos)){
+        m_view->updateContents( enclosingPositionedRect(m_selectionStart) );
+    }
+
+    // Draw the old selection start object if it's different than the new selection
+    // start object.
+    if (oldStart && oldStart != m_selectionStart){
+        m_view->updateContents( enclosingPositionedRect(oldStart) );
+    }
+    
+    // Does the selection span objects and is the new end object different, or did the position
+    // in the end element change?  If so we have to draw it.
+    if (oldStart != oldEnd && 
+        (oldEnd != m_selectionEnd ||
+        (oldEnd == m_selectionEnd && oldEndPos != m_selectionEndPos))){
+        m_view->updateContents( enclosingPositionedRect(m_selectionEnd) );
+    }
+    
+    // Draw the old selection end object if it's different than the new selection
+    // end object.
+    if (oldEnd && oldEnd != m_selectionEnd){
+        m_view->updateContents( enclosingPositionedRect(oldEnd) );
+    }
+#else
     repaint();
+#endif
 }
 
 
+#ifdef APPLE_CHANGES
+void RenderRoot::clearSelection(bool doRepaint)
+#else
 void RenderRoot::clearSelection()
+#endif
 {
     // update selection status of all objects between m_selectionStart and m_selectionEnd
     RenderObject* o = m_selectionStart;
     while (o && o!=m_selectionEnd)
     {
         if (o->selectionState()!=SelectionNone)
-            o->repaint();
+#ifdef APPLE_CHANGES
+            if (doRepaint)
+#endif
+                o->repaint();
         o->setSelectionState(SelectionNone);
         RenderObject* no;
         if ( !(no = o->firstChild()) )
@@ -348,7 +506,10 @@ void RenderRoot::clearSelection()
     if (m_selectionEnd)
     {
         m_selectionEnd->setSelectionState(SelectionNone);
-        m_selectionEnd->repaint();
+#ifdef APPLE_CHANGES
+        if (doRepaint)
+#endif
+            m_selectionEnd->repaint();
     }
 
     // set selection start & end to 0
diff --git a/WebCore/khtml/rendering/render_root.h b/WebCore/khtml/rendering/render_root.h
index 0535011..c84ef84 100644
--- a/WebCore/khtml/rendering/render_root.h
+++ b/WebCore/khtml/rendering/render_root.h
@@ -59,7 +59,7 @@ public:
                      int _w, int _h, int _tx, int _ty);
 
     virtual void setSelection(RenderObject *s, int sp, RenderObject *e, int ep);
-    virtual void clearSelection();
+    virtual void clearSelection(bool doRepaint=true);
     virtual RenderObject *selectionStart() const { return m_selectionStart; }
     virtual RenderObject *selectionEnd() const { return m_selectionEnd; }
 
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index b97036b..d47f1f2 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -205,5 +205,5 @@ typedef khtml::RenderPart KHTMLRenderPart;
 @end
 
 @protocol WebCoreRenderTreeCopier <NSObject>
-- (NSObject *)nodeWithName:(NSString *)name rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children;
+- (NSObject *)nodeWithName:(NSString *)name position:(NSPoint)p rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children;
 @end
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index c9d0998..a9b15dc 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -279,7 +279,10 @@ using khtml::RenderPart;
     QWidget *widget = nodeRenderPart ? nodeRenderPart->widget() : 0;
     NSView *view = widget ? widget->getView() : nil;
     
+    int nx, ny;
+    node->absolutePosition(nx,ny);
     NSObject *copiedNode = [copier nodeWithName:name
+                                           position:NSMakePoint(nx,ny)
                                            rect:NSMakeRect(node->xPos(), node->yPos(), node->width(), node->height())
                                            view:view
                                        children:children];
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 72ccc20..b480dc3 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2002-09-12  Richard Williamson (Local)  <rjw at apple.com>
+
+        Added absolute position column to render node for 
+        render tree view.
+        
+        * WebView.subproj/WebRenderNode.h:
+        * WebView.subproj/WebRenderNode.m:
+        (-[WebRenderNode initWithName:position:rect:view:children:]):
+        (-[WebRenderNode absolutePositionString]):
+        (-[WebKitRenderTreeCopier nodeWithName:position:rect:view:children:]):
+
 2002-09-12  David Hyatt  <hyatt at apple.com>
 
 	Add text/xml to our list of MIME types that should use the
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 72ccc20..b480dc3 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,14 @@
+2002-09-12  Richard Williamson (Local)  <rjw at apple.com>
+
+        Added absolute position column to render node for 
+        render tree view.
+        
+        * WebView.subproj/WebRenderNode.h:
+        * WebView.subproj/WebRenderNode.m:
+        (-[WebRenderNode initWithName:position:rect:view:children:]):
+        (-[WebRenderNode absolutePositionString]):
+        (-[WebKitRenderTreeCopier nodeWithName:position:rect:view:children:]):
+
 2002-09-12  David Hyatt  <hyatt at apple.com>
 
 	Add text/xml to our list of MIME types that should use the
diff --git a/WebKit/WebView.subproj/WebRenderNode.h b/WebKit/WebView.subproj/WebRenderNode.h
index b620288..63b82ae 100644
--- a/WebKit/WebView.subproj/WebRenderNode.h
+++ b/WebKit/WebView.subproj/WebRenderNode.h
@@ -15,6 +15,7 @@
     NSArray *children;
     NSString *name;
     NSRect rect;
+    NSPoint absolutePosition;
 }
 
 - initWithWebView:(WebView *)view;
@@ -23,6 +24,7 @@
 
 - (NSString *)name;
 - (NSString *)positionString;
+- (NSString *)absolutePositionString;
 - (NSString *)widthString;
 - (NSString *)heightString;
 
diff --git a/WebKit/WebView.subproj/WebRenderNode.m b/WebKit/WebView.subproj/WebRenderNode.m
index 124574a..bf8c272 100644
--- a/WebKit/WebView.subproj/WebRenderNode.m
+++ b/WebKit/WebView.subproj/WebRenderNode.m
@@ -17,7 +17,7 @@
 
 @implementation WebRenderNode
 
-- initWithName:(NSString *)n rect:(NSRect)r view:(NSView *)view children:(NSArray *)c
+- initWithName:(NSString *)n position: (NSPoint)p rect:(NSRect)r view:(NSView *)view children:(NSArray *)c
 {
     NSMutableArray *collectChildren;
     
@@ -27,6 +27,7 @@
 
     name = [n retain];
     rect = r;
+    absolutePosition = p;
 
     if ([view isKindOfClass:[NSScrollView class]]) {
         NSScrollView *scrollView = (NSScrollView *)view;
@@ -80,6 +81,11 @@
     return name;
 }
 
+- (NSString *)absolutePositionString
+{
+    return [NSString stringWithFormat:@"(%.0f, %.0f)", absolutePosition.x, absolutePosition.y];
+}
+
 - (NSString *)positionString
 {
     return [NSString stringWithFormat:@"(%.0f, %.0f)", rect.origin.x, rect.origin.y];
@@ -99,9 +105,9 @@
 
 @implementation WebKitRenderTreeCopier
 
-- (NSObject *)nodeWithName:(NSString *)name rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children
+- (NSObject *)nodeWithName:(NSString *)name position: (NSPoint)p rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children
 {
-    return [[[WebRenderNode alloc] initWithName:name rect:rect view:view children:children] autorelease];
+    return [[[WebRenderNode alloc] initWithName:name position: p rect:rect view:view children:children] autorelease];
 }
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list