[webkit-changes] cvs commit: WebCore/kwq KWQTextArea.h KWQTextArea.mm KWQTextField.h KWQTextField.mm KWQWidget.h KWQWidget.mm

Darin darin at opensource.apple.com
Mon Oct 10 19:49:38 PDT 2005


darin       05/10/10 19:49:37

  Modified:    .        ChangeLog
               kwq      KWQTextArea.h KWQTextArea.mm KWQTextField.h
                        KWQTextField.mm KWQWidget.h KWQWidget.mm
  Log:
          Reviewed by Maciej.
  
          - finished fixing http://bugzilla.opendarwin.org/show_bug.cgi?id=5195
            Would like API to flush rendering of pending DOM changes
  
          The first half of the fix alone broke DumpRenderTree. Better now.
  
          * kwq/KWQWidget.h: Made paint non-virtual (it had no reason to be virtual in KWQ) and
          added an isPainting function.
          * kwq/KWQWidget.mm:
          (QWidget::QWidget): Added painting boolean (actually a count).
          (QWidget::~QWidget): Check that painting is 0 when the widget is destroyed.
          (QWidget::paint): Use SPI to draw in a way that works no matter what context we are in.
          (QWidget::isPainting): Return true if inside the paint function.
  
          * kwq/KWQTextArea.h: Remove inDrawingMachinery field since we can use isPainting now.
          * kwq/KWQTextArea.mm:
          (-[KWQTextAreaTextView textView:shouldDrawInsertionPointInRect:color:turnedOn:]):
          Use isPainting() instead of inDrawingMachinery. inDrawingMachinery required that we
          use displayRectIgnoringOpacity: to paint, which we no longer do.
          * kwq/KWQTextField.h: More of the same.
          * kwq/KWQTextField.mm:
          (-[KWQTextFieldController textView:shouldDrawInsertionPointInRect:color:turnedOn:]):
          Ditto.
  
  Revision  Changes    Path
  1.228     +27 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.227
  retrieving revision 1.228
  diff -u -r1.227 -r1.228
  --- ChangeLog	10 Oct 2005 23:48:48 -0000	1.227
  +++ ChangeLog	11 Oct 2005 02:49:30 -0000	1.228
  @@ -1,5 +1,32 @@
   2005-10-10  Darin Adler  <darin at apple.com>
   
  +        Reviewed by Maciej.
  +
  +        - finished fixing http://bugzilla.opendarwin.org/show_bug.cgi?id=5195
  +          Would like API to flush rendering of pending DOM changes
  +
  +        The first half of the fix alone broke DumpRenderTree. Better now.
  +
  +        * kwq/KWQWidget.h: Made paint non-virtual (it had no reason to be virtual in KWQ) and
  +        added an isPainting function.
  +        * kwq/KWQWidget.mm:
  +        (QWidget::QWidget): Added painting boolean (actually a count).
  +        (QWidget::~QWidget): Check that painting is 0 when the widget is destroyed.
  +        (QWidget::paint): Use SPI to draw in a way that works no matter what context we are in.
  +        (QWidget::isPainting): Return true if inside the paint function.
  +
  +        * kwq/KWQTextArea.h: Remove inDrawingMachinery field since we can use isPainting now.
  +        * kwq/KWQTextArea.mm:
  +        (-[KWQTextAreaTextView textView:shouldDrawInsertionPointInRect:color:turnedOn:]):
  +        Use isPainting() instead of inDrawingMachinery. inDrawingMachinery required that we
  +        use displayRectIgnoringOpacity: to paint, which we no longer do.
  +        * kwq/KWQTextField.h: More of the same.
  +        * kwq/KWQTextField.mm:
  +        (-[KWQTextFieldController textView:shouldDrawInsertionPointInRect:color:turnedOn:]):
  +        Ditto.
  +
  +2005-10-10  Darin Adler  <darin at apple.com>
  +
           Reviewed by eseidel.
   
           Mem leak fixes in xslt code.
  
  
  
  1.24      +0 -1      WebCore/kwq/KWQTextArea.h
  
  Index: KWQTextArea.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQTextArea.h,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- KWQTextArea.h	3 Oct 2005 20:55:03 -0000	1.23
  +++ KWQTextArea.h	11 Oct 2005 02:49:34 -0000	1.24
  @@ -37,7 +37,6 @@
       float _lineHeight;
       BOOL wrap;
       BOOL inNextValidKeyView;
  -    BOOL inDrawingMachinery;
       BOOL inInitWithFrame;
       BOOL resizableByUser;
       BOOL resizableByUserComputed;
  
  
  
  1.94      +1 -12     WebCore/kwq/KWQTextArea.mm
  
  Index: KWQTextArea.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQTextArea.mm,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- KWQTextArea.mm	6 Oct 2005 22:06:49 -0000	1.93
  +++ KWQTextArea.mm	11 Oct 2005 02:49:34 -0000	1.94
  @@ -818,24 +818,13 @@
       [textView setNeedsDisplay:YES];
   }
   
  -// This is the only one of the display family of calls that we use, and the way we do
  -// displaying in WebCore means this is called on this NSView explicitly, so this catches
  -// all cases where we are inside the normal display machinery. (Used only by the insertion
  -// point method below.)
  -- (void)displayRectIgnoringOpacity:(NSRect)rect
  -{
  -    inDrawingMachinery = YES;
  -    [super displayRectIgnoringOpacity:rect];
  -    inDrawingMachinery = NO;
  -}
  -
   // Use the "needs display" mechanism to do all insertion point drawing in the web view.
   - (BOOL)textView:(NSTextView *)view shouldDrawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)drawInsteadOfErase
   {
       // We only need to take control of the cases where we are being asked to draw by something
       // outside the normal display machinery, and when we are being asked to draw the insertion
       // point, not erase it.
  -    if (inDrawingMachinery || !drawInsteadOfErase) {
  +    if ((widget && widget->isPainting()) || !drawInsteadOfErase) {
           return YES;
       }
   
  
  
  
  1.23      +0 -1      WebCore/kwq/KWQTextField.h
  
  Index: KWQTextField.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQTextField.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- KWQTextField.h	24 Jun 2005 05:53:29 -0000	1.22
  +++ KWQTextField.h	11 Oct 2005 02:49:35 -0000	1.23
  @@ -39,7 +39,6 @@
       BOOL hasFocusAndSelectionSet;
       BOOL edited;
       NSRange lastSelectedRange;
  -    BOOL inDrawingMachinery;
       NSWritingDirection baseWritingDirection;
   }
   
  
  
  
  1.91      +1 -40     WebCore/kwq/KWQTextField.mm
  
  Index: KWQTextField.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQTextField.mm,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- KWQTextField.mm	3 Oct 2005 21:13:10 -0000	1.90
  +++ KWQTextField.mm	11 Oct 2005 02:49:35 -0000	1.91
  @@ -72,7 +72,6 @@
   - (id)initWithTextField:(NSTextField *)f QLineEdit:(QLineEdit *)w;
   - (QWidget *)widget;
   - (void)textChanged;
  -- (void)setInDrawingMachinery:(BOOL)inDrawing;
   - (BOOL)textView:(NSTextView *)view shouldDrawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)drawInsteadOfErase;
   - (BOOL)textView:(NSTextView *)view shouldHandleEvent:(NSEvent *)event;
   - (void)textView:(NSTextView *)view didHandleEvent:(NSEvent *)event;
  @@ -242,18 +241,13 @@
           widget->textChanged();
   }
   
  -- (void)setInDrawingMachinery:(BOOL)inDrawing
  -{
  -    inDrawingMachinery = inDrawing;
  -}
  -
   // Use the "needs display" mechanism to do all insertion point drawing in the web view.
   - (BOOL)textView:(NSTextView *)view shouldDrawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)drawInsteadOfErase
   {
       // We only need to take control of the cases where we are being asked to draw by something
       // outside the normal display machinery, and when we are being asked to draw the insertion
       // point, not erase it.
  -    if (inDrawingMachinery || !drawInsteadOfErase)
  +    if ((widget && widget->isPainting()) || !drawInsteadOfErase)
           return YES;
   
       // NSTextView's insertion-point drawing code sets the rect width to 1.
  @@ -581,17 +575,6 @@
       [self setNeedsDisplay:YES];
   }
   
  -// This is the only one of the display family of calls that we use, and the way we do
  -// displaying in WebCore means this is called on this NSView explicitly, so this catches
  -// all cases where we are inside the normal display machinery. (Used only by the insertion
  -// point method below.)
  -- (void)displayRectIgnoringOpacity:(NSRect)rect
  -{
  -    [controller setInDrawingMachinery:YES];
  -    [super displayRectIgnoringOpacity:rect];
  -    [controller setInDrawingMachinery:NO];
  -}
  -
   - (BOOL)textView:(NSTextView *)view shouldDrawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)drawInsteadOfErase
   {
       return [controller textView:view shouldDrawInsertionPointInRect:rect color:color turnedOn:drawInsteadOfErase];
  @@ -747,17 +730,6 @@
       [self setNeedsDisplay:YES];
   }
   
  -// This is the only one of the display family of calls that we use, and the way we do
  -// displaying in WebCore means this is called on this NSView explicitly, so this catches
  -// all cases where we are inside the normal display machinery. (Used only by the insertion
  -// point method below.)
  -- (void)displayRectIgnoringOpacity:(NSRect)rect
  -{
  -    [controller setInDrawingMachinery:YES];
  -    [super displayRectIgnoringOpacity:rect];
  -    [controller setInDrawingMachinery:NO];
  -}
  -
   - (BOOL)textView:(NSTextView *)view shouldDrawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)drawInsteadOfErase
   {
       return [controller textView:view shouldDrawInsertionPointInRect:rect color:color turnedOn:drawInsteadOfErase];
  @@ -975,17 +947,6 @@
       [self setNeedsDisplay:YES];
   }
   
  -// This is the only one of the display family of calls that we use, and the way we do
  -// displaying in WebCore means this is called on this NSView explicitly, so this catches
  -// all cases where we are inside the normal display machinery. (Used only by the insertion
  -// point method below.)
  -- (void)displayRectIgnoringOpacity:(NSRect)rect
  -{
  -    [controller setInDrawingMachinery:YES];
  -    [super displayRectIgnoringOpacity:rect];
  -    [controller setInDrawingMachinery:NO];
  -}
  -
   - (BOOL)textView:(NSTextView *)view shouldDrawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)drawInsteadOfErase
   {
       return [controller textView:view shouldDrawInsertionPointInRect:rect color:color turnedOn:drawInsteadOfErase];
  
  
  
  1.67      +2 -1      WebCore/kwq/KWQWidget.h
  
  Index: KWQWidget.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQWidget.h,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- KWQWidget.h	30 Aug 2005 09:30:25 -0000	1.66
  +++ KWQWidget.h	11 Oct 2005 02:49:35 -0000	1.67
  @@ -87,7 +87,8 @@
       void move(int, int);
       void move(const QPoint &);
   
  -    virtual void paint(QPainter *, const QRect &);
  +    void paint(QPainter *, const QRect &);
  +    bool isPainting() const;
       
       virtual QRect frameGeometry() const;
       virtual void setFrameGeometry(const QRect &);
  
  
  
  1.112     +25 -3     WebCore/kwq/KWQWidget.mm
  
  Index: KWQWidget.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQWidget.mm,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- KWQWidget.mm	3 Oct 2005 21:13:11 -0000	1.111
  +++ KWQWidget.mm	11 Oct 2005 02:49:35 -0000	1.112
  @@ -41,6 +41,15 @@
   #import "render_replaced.h"
   #import "render_style.h"
   
  + at interface NSWindow (KWQWidgetAppKitSecrets)
  +- (void)_lockViewHierarchyForModification;
  +- (void)_unlockViewHierarchyForModification;
  + at end
  +
  + at interface NSView (KWQWidgetAppKitSecrets)
  +- (void)_recursiveDisplayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context topView:(BOOL)topView;
  + at end
  +
   using khtml::RenderWidget;
   
   static bool deferFirstResponderChanges;
  @@ -62,6 +71,7 @@
       bool visible;
       bool mustStayInWindow;
       bool removeFromSuperviewSoon;
  +    unsigned painting;
   };
   
   QWidget::QWidget() : data(new KWQWidgetPrivate)
  @@ -72,6 +82,7 @@
       data->visible = true;
       data->mustStayInWindow = false;
       data->removeFromSuperviewSoon = false;
  +    data->painting = 0;
   }
   
   QWidget::QWidget(NSView *view) : data(new KWQWidgetPrivate)
  @@ -82,10 +93,13 @@
       data->visible = true;
       data->mustStayInWindow = false;
       data->removeFromSuperviewSoon = false;
  +    data->painting = 0;
   }
   
   QWidget::~QWidget() 
   {
  +    ASSERT(data->painting == 0);
  +
       KWQ_BLOCK_EXCEPTIONS;
       KWQRelease(data->view);
       KWQ_UNBLOCK_EXCEPTIONS;
  @@ -528,11 +542,14 @@
           return;
       }
       NSView *view = getOuterView();
  -    // KWQTextArea and KWQTextField both rely on the fact that we use this particular
  -    // NSView display method. If you change this, be sure to update them as well.
  +    ++data->painting;
       KWQ_BLOCK_EXCEPTIONS;
  -    [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]]];
  +    NSWindow *window = [view window];
  +    [window _lockViewHierarchyForModification];
  +    [view _recursiveDisplayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]] inContext:[NSGraphicsContext currentContext] topView:NO];
  +    [window _unlockViewHierarchyForModification];
       KWQ_UNBLOCK_EXCEPTIONS;
  +    --data->painting;
   }
   
   void QWidget::sendConsumedMouseUp()
  @@ -614,3 +631,8 @@
           }
       }
   }
  +
  +bool QWidget::isPainting() const
  +{
  +    return data->painting;
  +}
  
  
  



More information about the webkit-changes mailing list