[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:33:10 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 15d6a3d71d58430c9f7f9d5ff07ec8d4b2ecf191
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Apr 1 22:05:49 2003 +0000

    WebCore:
    
            Reviewed by John.
    
    	- fixed 3144287 -- CSS with media=print not used when printing
    
            * kwq/KWQKHTMLPart.h: Added a setMediaType function, so the bridge can access
            the KHTMLView::setMediaType function, which is private (KWQKHTMLPart is a friend).
            * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::setMediaType): Call setMediaType on the
            KHTMLView.
    
            * kwq/WebCoreBridge.h: Added a device type parameter to reapplyStyles.
            * kwq/WebCoreBridge.mm: (-[WebCoreBridge reapplyStylesForDeviceType:]):
            Call setMediaType with the appropriate media type for the passed in device type.
    
    WebKit:
    
            Reviewed by John.
    
    	- fixed 3213918 -- REGRESSION: printing Mapquest directions, screen font is used, causing exception, crashes
    	- fixed 3144287 -- CSS with media=print not used when printing
    
            * WebView.subproj/WebFramePrivate.m: (-[WebFrame _opened]): Don't call the reapplyStyles
            method directly here, use setNeedsToApplyStyles instead.
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView reapplyStyles]): Pass the appropriate device type here.
            (-[WebHTMLView drawRect:]): Don't call setUsingPrinterFonts:NO at the end of this method
            if we were already using printer fonts at the start. This was the bug fix.
            (-[WebHTMLView _setPrinting:]): Renamed from _setUsingPrinterFonts since this now controls
            the styles used too, not just the fonts.
            (-[WebHTMLView beginDocument]): Updated for _setPrinting name change.
            (-[WebHTMLView endDocument]): Ditto.
            * WebView.subproj/WebHTMLViewPrivate.h: Renamed "usingPrinterFonts" field to "printing".
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3991 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 3a00c5e..fd5b599 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,18 @@
+2003-04-01  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+	- fixed 3144287 -- CSS with media=print not used when printing
+
+        * kwq/KWQKHTMLPart.h: Added a setMediaType function, so the bridge can access
+        the KHTMLView::setMediaType function, which is private (KWQKHTMLPart is a friend).
+        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::setMediaType): Call setMediaType on the
+        KHTMLView.
+        
+        * kwq/WebCoreBridge.h: Added a device type parameter to reapplyStyles.
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge reapplyStylesForDeviceType:]):
+        Call setMediaType with the appropriate media type for the passed in device type.
+
 2003-04-01  David Hyatt  <hyatt at apple.com>
 
 	Table code fixes.  Working to try to fix excite.com.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3a00c5e..fd5b599 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2003-04-01  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+	- fixed 3144287 -- CSS with media=print not used when printing
+
+        * kwq/KWQKHTMLPart.h: Added a setMediaType function, so the bridge can access
+        the KHTMLView::setMediaType function, which is private (KWQKHTMLPart is a friend).
+        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::setMediaType): Call setMediaType on the
+        KHTMLView.
+        
+        * kwq/WebCoreBridge.h: Added a device type parameter to reapplyStyles.
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge reapplyStylesForDeviceType:]):
+        Call setMediaType with the appropriate media type for the passed in device type.
+
 2003-04-01  David Hyatt  <hyatt at apple.com>
 
 	Table code fixes.  Working to try to fix excite.com.
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index c175588..5cfd895 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -190,9 +190,11 @@ public:
     NSString *searchForLabelsBeforeElement(NSArray *labels, DOM::ElementImpl *element);
     NSString *matchLabelsAgainstElement(NSArray *labels, DOM::ElementImpl *element);
 
-    void setSettings (KHTMLSettings *s);
+    void setSettings(KHTMLSettings *);
 
     KWQWindowWidget *topLevelWidget();
+    
+    void setMediaType(const QString &);
 
 private:
     virtual void khtmlMousePressEvent(khtml::MousePressEvent *);
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 6956832..fae2824 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -1750,3 +1750,10 @@ void KWQKHTMLPart::setBridge(WebCoreBridge *p)
     _bridge = p;
     _windowWidget = new KWQWindowWidget(_bridge);
 }
+
+void KWQKHTMLPart::setMediaType(const QString &type)
+{
+    if (d->m_view) {
+        d->m_view->setMediaType(type);
+    }
+}
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index f956995..ba1c4bd 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -71,6 +71,11 @@ extern NSString *WebCoreElementLinkTargetFrameKey;
 extern NSString *WebCoreElementLinkLabelKey;
 extern NSString *WebCoreElementLinkTitleKey;
 
+typedef enum {
+    WebCoreDeviceScreen,
+    WebCoreDevicePrinter
+} WebCoreDeviceType;
+
 // WebCoreBridge objects are used by WebCore to abstract away operations that need
 // to be implemented by library clients, for example WebKit. The objects are also
 // used in the opposite direction, for simple access to WebCore functions without dealing
@@ -136,7 +141,7 @@ enum FrameBorderStyle {
 
 - (BOOL)isFrameSet;
 
-- (void)reapplyStyles;
+- (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType;
 - (void)forceLayout;
 - (BOOL)needsLayout;
 - (void)adjustFrames:(NSRect)rect;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 2a08cce..7e73a8d 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -313,8 +313,9 @@ static bool initializedObjectCacheSize = FALSE;
     return _part->isFrameSet();
 }
 
-- (void)reapplyStyles
+- (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType
 {
+    _part->setMediaType(deviceType == WebCoreDeviceScreen ? "screen" : "print");
     return _part->reparseConfiguration();
 }
 
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 786132c..2a2c925 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,22 @@
+2003-04-01  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+	- fixed 3213918 -- REGRESSION: printing Mapquest directions, screen font is used, causing exception, crashes
+	- fixed 3144287 -- CSS with media=print not used when printing
+
+        * WebView.subproj/WebFramePrivate.m: (-[WebFrame _opened]): Don't call the reapplyStyles
+        method directly here, use setNeedsToApplyStyles instead.
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView reapplyStyles]): Pass the appropriate device type here.
+        (-[WebHTMLView drawRect:]): Don't call setUsingPrinterFonts:NO at the end of this method
+        if we were already using printer fonts at the start. This was the bug fix.
+        (-[WebHTMLView _setPrinting:]): Renamed from _setUsingPrinterFonts since this now controls
+        the styles used too, not just the fonts.
+        (-[WebHTMLView beginDocument]): Updated for _setPrinting name change.
+        (-[WebHTMLView endDocument]): Ditto.
+        * WebView.subproj/WebHTMLViewPrivate.h: Renamed "usingPrinterFonts" field to "printing".
+
 2003-04-01  Richard Williamson  <rjw at apple.com>
 
         Fixed ~2% performance regression problem.  The regression
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 25ca5fc..a99f55b 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -823,11 +823,13 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 - (void)_opened
 {
     if ([[self dataSource] _loadingFromPageCache]){
-        // Force a layout to update view size and thereby
-        // update scrollbars.
-        [_private->bridge reapplyStyles];
-        [[[self frameView] documentView] setNeedsLayout: YES];
-        [[[self frameView] documentView] layout];
+        // Force a layout to update view size and thereby update scrollbars.
+        NSView <WebDocumentView> *view = [[self frameView] documentView];
+        if ([view isKindOfClass:[WebHTMLView class]]) {
+            [(WebHTMLView *)view setNeedsToApplyStyles:YES];
+        }
+        [view setNeedsLayout: YES];
+        [view layout];
         [self _restoreScrollPosition];
         
         NSArray *responses = [[self dataSource] _responses];
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 50836d5..9d704ba 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -279,7 +279,8 @@
     double start = CFAbsoluteTimeGetCurrent();
 #endif
 
-    [[self _bridge] reapplyStyles];
+    [[self _bridge] reapplyStylesForDeviceType:
+        _private->printing ? WebCoreDevicePrinter : WebCoreDeviceScreen];
     
 #ifdef _KWQ_TIMING        
     double thisTime = CFAbsoluteTimeGetCurrent() - start;
@@ -463,9 +464,10 @@
 {
     LOG(View, "%@ drawing", self);
     
-    if (_private->usingPrinterFonts) {
-        [[WebTextRendererFactory sharedFactory] setUsingPrinterFonts:YES];
-    }
+    WebTextRendererFactory *textRendererFactory = [WebTextRendererFactory sharedFactory];
+    
+    BOOL wasUsingPrinterFonts = [textRendererFactory usingPrinterFonts];
+    [textRendererFactory setUsingPrinterFonts:_private->printing];
 
     BOOL subviewsWereSetAside = _private->subviewsSetAside;
     if (subviewsWereSetAside) {
@@ -509,14 +511,14 @@
     
     NSView *focusView = [NSView focusView];
     if ([WebTextRenderer shouldBufferTextDrawing] && focusView)
-        [[WebTextRendererFactory sharedFactory] startCoalesceTextDrawing];
+        [textRendererFactory startCoalesceTextDrawing];
 
     //double start = CFAbsoluteTimeGetCurrent();
     [[self _bridge] drawRect:rect];
     //LOG(Timing, "draw time %e", CFAbsoluteTimeGetCurrent() - start);
 
     if ([WebTextRenderer shouldBufferTextDrawing] && focusView)
-        [[WebTextRendererFactory sharedFactory] endCoalesceTextDrawing];
+        [textRendererFactory endCoalesceTextDrawing];
 
     [(WebClipView *)[self superview] resetAdditionalClip];
     
@@ -551,9 +553,7 @@
         [self _setAsideSubviews];
     }
 
-    if (_private->usingPrinterFonts) {
-        [[WebTextRendererFactory sharedFactory] setUsingPrinterFonts:NO];
-    }
+    [textRendererFactory setUsingPrinterFonts:wasUsingPrinterFonts];
 }
 
 // Turn off the additional clip while computing our visibleRect.
@@ -759,7 +759,7 @@
 }
 
 // Does setNeedsDisplay:NO as a side effect. Useful for begin/endDocument.
-- (void)_setUsingPrinterFonts:(BOOL)usingPrinterFonts
+- (void)_setPrinting:(BOOL)printing
 {
     WebFrame *frame = [self _frame];
     NSArray *subframes = [frame children];
@@ -769,17 +769,23 @@
         WebFrame *subframe = [subframes objectAtIndex:i];
         WebFrameView *frameView = [subframe frameView];
         if ([frameView isDocumentHTML]) {
-            [(WebHTMLView *)[frameView documentView] _setUsingPrinterFonts:usingPrinterFonts];
+            [(WebHTMLView *)[frameView documentView] _setPrinting:printing];
         }
     }
 
-    if (usingPrinterFonts != _private->usingPrinterFonts) {
-        _private->usingPrinterFonts = usingPrinterFonts;
-        [[WebTextRendererFactory sharedFactory] setUsingPrinterFonts:usingPrinterFonts];
+    if (printing != _private->printing) {
+        _private->printing = printing;
+        
+        // For now, the text renderer factory is never in printer font mode
+        // except when you are actually inside [WebHTMLView drawRect:].
+        ASSERT(![[WebTextRendererFactory sharedFactory] usingPrinterFonts]);
+        [[WebTextRendererFactory sharedFactory] setUsingPrinterFonts:printing];
+        
         [self setNeedsToApplyStyles:YES];
         [self setNeedsLayout:YES];
         [self layout];
         [self setNeedsDisplay:NO];
+        
         [[WebTextRendererFactory sharedFactory] setUsingPrinterFonts:NO];
     }
 }
@@ -789,7 +795,7 @@
     // Must do this explicit display here, because otherwise the view might redisplay while the print
     // sheet was up, using printer fonts (and looking different).
     [self displayIfNeeded];
-    [self _setUsingPrinterFonts:YES];
+    [self _setPrinting:YES];
     [super beginDocument];
     // There is a theoretical chance that someone could do some drawing between here and endDocument,
     // if something caused setNeedsDisplay after this point. If so, it's not a big tragedy, because
@@ -799,7 +805,7 @@
 - (void)endDocument
 {
     [super endDocument];
-    [self _setUsingPrinterFonts:NO];
+    [self _setPrinting:NO];
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index 1f680c5..009cb48 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -21,7 +21,7 @@
     BOOL inWindow;
     BOOL inNextValidKeyView;
     BOOL ignoringMouseDraggedEvents;
-    BOOL usingPrinterFonts;
+    BOOL printing;
     
     id savedSubviews;
     BOOL subviewsSetAside;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list