[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 07:53:23 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 4ecce99650a4ab1a15127a524bc8650f56376d19
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 22 00:45:22 2003 +0000

    WebKit:
    	Fixed 3378810.  Avoid resizing frame from drawRect: when printing.  This will corrupt the graphics context.
    
            Reviewed by Hyatt.
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView layoutToPageWidth:]):
            (-[WebHTMLView drawRect:]):
            (-[WebHTMLView _setPrinting:pageWidth:adjustViewSize:]):
            (-[WebHTMLView beginDocument]):
            (-[WebHTMLView endDocument]):
    WebCore:
    	Fixed 3378810.  Avoid resizing frame from drawRect: when printing.  This will corrupt the graphics context.
    
            Reviewed by Hyatt.
    
            * khtml/khtmlview.cpp:
            (KHTMLView::adjustViewSize):
            * khtml/khtmlview.h:
            * khtml/rendering/render_canvas.cpp:
            (RenderCanvas::layout):
            * kwq/KWQScrollView.mm:
            (QScrollView::resizeContents):
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge adjustViewSize]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4874 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index c22f0d1..c1592ee 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,20 @@
+2003-08-21  Richard Williamson   <rjw at apple.com>
+	
+	Fixed 3378810.  Avoid resizing frame from drawRect: when printing.  This will corrupt the graphics context.
+
+        Reviewed by Hyatt.
+
+        * khtml/khtmlview.cpp:
+        (KHTMLView::adjustViewSize):
+        * khtml/khtmlview.h:
+        * khtml/rendering/render_canvas.cpp:
+        (RenderCanvas::layout):
+        * kwq/KWQScrollView.mm:
+        (QScrollView::resizeContents):
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge adjustViewSize]):
+
 === Safari-94 ===
 
 2003-08-21  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c22f0d1..c1592ee 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2003-08-21  Richard Williamson   <rjw at apple.com>
+	
+	Fixed 3378810.  Avoid resizing frame from drawRect: when printing.  This will corrupt the graphics context.
+
+        Reviewed by Hyatt.
+
+        * khtml/khtmlview.cpp:
+        (KHTMLView::adjustViewSize):
+        * khtml/khtmlview.h:
+        * khtml/rendering/render_canvas.cpp:
+        (RenderCanvas::layout):
+        * kwq/KWQScrollView.mm:
+        (QScrollView::resizeContents):
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge adjustViewSize]):
+
 === Safari-94 ===
 
 2003-08-21  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 135437c..0b8faa3 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -396,6 +396,24 @@ void KHTMLView::setMarginHeight(int h)
     _marginHeight = h;
 }
 
+
+void KHTMLView::adjustViewSize()
+{
+    if( m_part->xmlDocImpl() ) {
+        DOM::DocumentImpl *document = m_part->xmlDocImpl();
+
+        khtml::RenderCanvas* root = static_cast<khtml::RenderCanvas *>(document->renderer());
+        if ( !root )
+            return;
+        
+        int docw = root->docWidth();
+        int doch = root->docHeight();
+    
+        resizeContents(docw, doch);
+    }
+}
+
+
 void KHTMLView::layout()
 {
     if( m_part->xmlDocImpl() ) {
diff --git a/WebCore/khtml/khtmlview.h b/WebCore/khtml/khtmlview.h
index ecf0f0c..0ffaa65 100644
--- a/WebCore/khtml/khtmlview.h
+++ b/WebCore/khtml/khtmlview.h
@@ -190,6 +190,7 @@ public:
 #if APPLE_CHANGES
     QWidget *topLevelWidget() const;
     QPoint mapToGlobal(const QPoint &) const;
+    void KHTMLView::adjustViewSize();
 #endif
 
     void ref() { ++_refCount; }
diff --git a/WebCore/khtml/rendering/render_canvas.cpp b/WebCore/khtml/rendering/render_canvas.cpp
index 7dfa7d4..bb4d70f 100644
--- a/WebCore/khtml/rendering/render_canvas.cpp
+++ b/WebCore/khtml/rendering/render_canvas.cpp
@@ -157,15 +157,8 @@ void RenderCanvas::layout()
     int docw = docWidth();
     int doch = docHeight();
 
-#if APPLE_CHANGES
-    // always do the resizeContents, since we need the view to change size for Cocoa builtin
-    // pagination to work
-    m_view->resizeContents(docw, doch);
-    if (!m_printingMode) {
-#else
     if (!m_printingMode) {
         m_view->resizeContents(docw, doch);
-#endif
         setWidth( m_viewportWidth = m_view->visibleWidth() );
         setHeight(  m_viewportHeight = m_view->visibleHeight() );
     }
diff --git a/WebCore/kwq/KWQScrollView.mm b/WebCore/kwq/KWQScrollView.mm
index c2fff08..32dec69 100644
--- a/WebCore/kwq/KWQScrollView.mm
+++ b/WebCore/kwq/KWQScrollView.mm
@@ -214,6 +214,7 @@ void QScrollView::resizeContents(int w, int h)
             w = 0;
         if (h < 0)
             h = 0;
+
         [view setFrameSize: NSMakeSize (w,h)];
     } else {
         resize (w, h);
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index a19b359..dfc9aa2 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -227,6 +227,8 @@ enum FrameBorderStyle {
 
 - (NSColor *)bodyBackgroundColor;
 
+- (void)adjustViewSize;
+
 @end
 
 // The WebCoreBridge protocol contains methods for use by the WebCore side of the bridge.
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 7a1c0ac..9987e3c 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -993,5 +993,12 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <WebDOMElement>element)
     return _part->bodyBackgroundColor();
 }
 
+- (void)adjustViewSize
+{
+    KHTMLView *view = _part->view();
+    if (view)
+        view->adjustViewSize();
+}
+
 
 @end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index fd1ac30..1d211bd 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,16 @@
+2003-08-21  Richard Williamson   <rjw at apple.com>
+
+	Fixed 3378810.  Avoid resizing frame from drawRect: when printing.  This will corrupt the graphics context.
+
+        Reviewed by Hyatt.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView layoutToPageWidth:]):
+        (-[WebHTMLView drawRect:]):
+        (-[WebHTMLView _setPrinting:pageWidth:adjustViewSize:]):
+        (-[WebHTMLView beginDocument]):
+        (-[WebHTMLView endDocument]):
+
 === Safari-94 ===
 
 2003-08-21  John Sullivan  <sullivan at apple.com>
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 0857653..007eb82 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -25,10 +25,11 @@
 #import <WebKit/WebViewPrivate.h>
 
 #import <AppKit/NSResponder_Private.h>
+#import <CoreGraphics/CGContextPrivate.h>
 #import <CoreGraphics/CGContextGState.h>
 
 @interface WebHTMLView (WebHTMLViewPrivate)
-- (void)_setPrinting:(BOOL)printing pageWidth:(float)pageWidth;
+- (void)_setPrinting:(BOOL)printing pageWidth:(float)pageWidth adjustViewSize:(BOOL)adjustViewSize;
 @end
 
 @interface NSArray (WebHTMLView)
@@ -347,6 +348,7 @@
 #endif
 
     LOG(View, "%@ doing layout", self);
+
     if (pageWidth > 0.0) {
         [[self _bridge] forceLayoutForPageWidth:pageWidth];
     } else {
@@ -528,13 +530,13 @@
     if (subviewsWereSetAside) {
         [self _restoreSubviews];
     }
-    
+
     // This helps when we print as part of a larger print process.
     // If the WebHTMLView itself is what we're printing, then we will never have to do this.
     BOOL wasInPrintingMode = _private->printing;
     BOOL isPrinting = ![NSGraphicsContext currentContextDrawingToScreen];
     if (wasInPrintingMode != isPrinting) {
-        [self _setPrinting:isPrinting pageWidth:0];
+        [self _setPrinting:isPrinting pageWidth:0 adjustViewSize:NO];
     }
     
     if ([[self _bridge] needsLayout]) {
@@ -568,8 +570,9 @@
 
     [NSGraphicsContext saveGraphicsState];
     NSRectClip(rect);
-    
+        
     ASSERT([[self superview] isKindOfClass:[WebClipView class]]);
+
     [(WebClipView *)[self superview] setAdditionalClip:rect];
 
     NS_DURING {
@@ -623,7 +626,7 @@
 #endif
 
     if (wasInPrintingMode != isPrinting) {
-        [self _setPrinting:wasInPrintingMode pageWidth:0];
+        [self _setPrinting:wasInPrintingMode pageWidth:0 adjustViewSize:NO];
     }
 
     if (subviewsWereSetAside) {
@@ -873,7 +876,7 @@
 
 // Does setNeedsDisplay:NO as a side effect. Useful for begin/endDocument.
 // pageWidth != 0 implies we will relayout to a new width
-- (void)_setPrinting:(BOOL)printing pageWidth:(float)pageWidth
+- (void)_setPrinting:(BOOL)printing pageWidth:(float)pageWidth adjustViewSize:(BOOL)adjustViewSize
 {
     WebFrame *frame = [self _frame];
     NSArray *subframes = [frame childFrames];
@@ -883,10 +886,14 @@
         WebFrame *subframe = [subframes objectAtIndex:i];
         WebFrameView *frameView = [subframe frameView];
         if ([[subframe dataSource] _isDocumentHTML]) {
-            [(WebHTMLView *)[frameView documentView] _setPrinting:printing pageWidth:0];
+            [(WebHTMLView *)[frameView documentView] _setPrinting:printing pageWidth:0 adjustViewSize:adjustViewSize];
         }
     }
 
+    if (adjustViewSize){
+        [[self _bridge] adjustViewSize];
+    }
+    
     if (printing != _private->printing) {
         _private->printing = printing;
         [self setNeedsToApplyStyles:YES];
@@ -915,7 +922,7 @@
         NSPrintInfo *printInfo = [[NSPrintOperation currentOperation] printInfo];
         pageWidth = [printInfo paperSize].width - [printInfo leftMargin] - [printInfo rightMargin];
     }
-    [self _setPrinting:YES pageWidth:pageWidth];	// will relayout
+    [self _setPrinting:YES pageWidth:pageWidth adjustViewSize:YES];	// will relayout
 
     [super beginDocument];
     // There is a theoretical chance that someone could do some drawing between here and endDocument,
@@ -927,7 +934,7 @@
 {
     [super endDocument];
     // Note sadly at this point [NSGraphicsContext currentContextDrawingToScreen] is still NO 
-    [self _setPrinting:NO pageWidth:0.0];
+    [self _setPrinting:NO pageWidth:0.0 adjustViewSize:YES];
     [[self window] setAutodisplay:YES];
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list