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

trey trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:48:21 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit a91bb15a360fdb82862ba895d71867d4513e3275
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 24 20:27:42 2004 +0000

    WebCore:
    
    	3704950	drag image in DB ConfigBar has horizontal graphics turd	WebCore JavaScript
    
    	When we generate a drag image (or a selection image too, for that matter) we
    	translate the CTM using a CG call.  Later, WebImageRenderer adjusts the pattern
    	phase based on the CTM of the focused view, which doesn't include our translate.
    	So we must inform WebKit about the additional phase adjustment.
    
            Reviewed by Richard
    
            * kwq/KWQKHTMLPart.mm:  Tell WebKit about the phase adjustment.
            (KWQKHTMLPart::imageFromRect):
            * kwq/WebCoreGraphicsBridge.h:
            * kwq/WebCoreGraphicsBridge.m:
            (-[WebCoreGraphicsBridge setAdditionalPatternPhase:]):  New routine to receive
    	the phase adjustment.
    
    WebKit:
    
    	3704950	drag image in DB ConfigBar has horizontal graphics turd	WebCore JavaScript
    
    	When we generate a drag image (or a selection image too, for that matter) we
    	translate the CTM using a CG call.  Later, WebImageRenderer adjusts the pattern
    	phase based on the CTM of the focused view, which doesn't include our translate.
    	So we must inform WebKit about the additional phase adjustment.
    
            Reviewed by Richard
    
            * WebCoreSupport.subproj/WebGraphicsBridge.h:
            * WebCoreSupport.subproj/WebGraphicsBridge.m:
            (-[WebGraphicsBridge setAdditionalPatternPhase:]):  New trivial setter.
            (-[WebGraphicsBridge additionalPatternPhase]):      ...and getter.
            * WebCoreSupport.subproj/WebImageRenderer.m:
            (-[WebImageRenderer tileInRect:fromPoint:context:]):  Take any additional phase
    	adjustment into account when setting phase.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6923 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index d6495a6..074ee6a 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,23 @@
 2004-06-24  Trey Matteson  <trey at apple.com>
 
+	3704950	drag image in DB ConfigBar has horizontal graphics turd	WebCore JavaScript
+
+	When we generate a drag image (or a selection image too, for that matter) we
+	translate the CTM using a CG call.  Later, WebImageRenderer adjusts the pattern
+	phase based on the CTM of the focused view, which doesn't include our translate.
+	So we must inform WebKit about the additional phase adjustment.
+
+        Reviewed by Richard
+
+        * kwq/KWQKHTMLPart.mm:  Tell WebKit about the phase adjustment.
+        (KWQKHTMLPart::imageFromRect):
+        * kwq/WebCoreGraphicsBridge.h:
+        * kwq/WebCoreGraphicsBridge.m:
+        (-[WebCoreGraphicsBridge setAdditionalPatternPhase:]):  New routine to receive
+	the phase adjustment.
+
+2004-06-24  Trey Matteson  <trey at apple.com>
+
 	3679986 - screenX and screenY are flipped and relative to the bottom left of the WebView, rather than the screen
 	3699510 - synthesized click events have bogus screen coords
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 8bec1b1..b27322a 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -39,6 +39,7 @@
 #import "KWQWindowWidget.h"
 #import "KWQFoundationExtras.h"
 #import "WebCoreBridge.h"
+#import "WebCoreGraphicsBridge.h"
 #import "WebCoreViewFactory.h"
 #import "csshelper.h"
 #import "dom2_eventsimpl.h"
@@ -3056,9 +3057,22 @@ NSImage *KWQKHTMLPart::imageFromRect(NSRect rect) const
     [resultImage lockFocus];
     
     [NSGraphicsContext saveGraphicsState];
-    CGContextTranslateCTM((CGContext *)[[NSGraphicsContext currentContext] graphicsPort],
-                          -(NSMinX(rect) - NSMinX(bounds)), -(NSMinY(rect) - NSMinY(bounds)));
+    NSPoint translation = { -(NSMinX(rect) - NSMinX(bounds)), -(NSMinY(rect) - NSMinY(bounds)) };
+    CGContextTranslateCTM((CGContext *)[[NSGraphicsContext currentContext] graphicsPort], translation.x, translation.y);
+    
+    // We change the coord system at the CG level, out from under the AK focus machinery, because it doesn't
+    // work to change the coord system of a focused view.  However, WebImageRenderer uses the difference
+    // between the focused view's coord system and the window's coord system to adjust the pattern phase, and
+    // that calc ignores our translation.  So we must tell it about this extra phase offset.
+
+    // Window is not flipped, we are, so y coord must be inverted when describing phase, which is a
+    // window level notion.
+    translation.y = -translation.y;
+    [[WebCoreGraphicsBridge sharedBridge] setAdditionalPatternPhase:translation];
+
     [view drawRect:rect];
+
+    [[WebCoreGraphicsBridge sharedBridge] setAdditionalPatternPhase:NSZeroPoint];
     [NSGraphicsContext restoreGraphicsState];
     
     [resultImage unlockFocus];
diff --git a/WebCore/kwq/WebCoreGraphicsBridge.h b/WebCore/kwq/WebCoreGraphicsBridge.h
index 2f33436..f7f9a5f 100644
--- a/WebCore/kwq/WebCoreGraphicsBridge.h
+++ b/WebCore/kwq/WebCoreGraphicsBridge.h
@@ -30,5 +30,5 @@
 + (WebCoreGraphicsBridge *)sharedBridge;
 - (void)setFocusRingStyle:(NSFocusRingPlacement)placement radius:(int)radius color:(NSColor *)color;
 - (void)setDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc;
-
+- (void)setAdditionalPatternPhase:(NSPoint)phase;
 @end
diff --git a/WebCore/kwq/WebCoreGraphicsBridge.m b/WebCore/kwq/WebCoreGraphicsBridge.m
index 5cd2114..475de80 100644
--- a/WebCore/kwq/WebCoreGraphicsBridge.m
+++ b/WebCore/kwq/WebCoreGraphicsBridge.m
@@ -54,4 +54,8 @@ static WebCoreGraphicsBridge *sharedBridge;
 {
 }
 
+- (void)setAdditionalPatternPhase:(NSPoint)phase
+{
+}
+
 @end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 0d17e7c..f0c965e 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,24 @@
 2004-06-24  Trey Matteson  <trey at apple.com>
 
+	3704950	drag image in DB ConfigBar has horizontal graphics turd	WebCore JavaScript
+
+	When we generate a drag image (or a selection image too, for that matter) we
+	translate the CTM using a CG call.  Later, WebImageRenderer adjusts the pattern
+	phase based on the CTM of the focused view, which doesn't include our translate.
+	So we must inform WebKit about the additional phase adjustment.
+
+        Reviewed by Richard
+
+        * WebCoreSupport.subproj/WebGraphicsBridge.h:
+        * WebCoreSupport.subproj/WebGraphicsBridge.m:
+        (-[WebGraphicsBridge setAdditionalPatternPhase:]):  New trivial setter.
+        (-[WebGraphicsBridge additionalPatternPhase]):      ...and getter.
+        * WebCoreSupport.subproj/WebImageRenderer.m:
+        (-[WebImageRenderer tileInRect:fromPoint:context:]):  Take any additional phase
+	adjustment into account when setting phase.
+
+2004-06-24  Trey Matteson  <trey at apple.com>
+
 	3693420 - onbeforecut and onbeforepaste need real implementaion
 
         Reviewed by Chris.
diff --git a/WebKit/WebCoreSupport.subproj/WebGraphicsBridge.h b/WebKit/WebCoreSupport.subproj/WebGraphicsBridge.h
index cca0d2c..bacc541 100644
--- a/WebKit/WebCoreSupport.subproj/WebGraphicsBridge.h
+++ b/WebKit/WebCoreSupport.subproj/WebGraphicsBridge.h
@@ -28,9 +28,10 @@
 
 @interface WebGraphicsBridge : WebCoreGraphicsBridge
 {
+    NSPoint _phase;
 }
 
 + (void)createSharedBridge;
 + (WebGraphicsBridge *)sharedBridge;
-
+- (NSPoint)additionalPatternPhase;
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebGraphicsBridge.m b/WebKit/WebCoreSupport.subproj/WebGraphicsBridge.m
index b551e97..8706efd 100644
--- a/WebKit/WebCoreSupport.subproj/WebGraphicsBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebGraphicsBridge.m
@@ -196,5 +196,13 @@ static void FlipImageSpec(CoreDragImageSpec* imageSpec) {
     [NSApp postEvent:ev atStart:YES];
 }
 
+- (void)setAdditionalPatternPhase:(NSPoint)phase
+{
+    _phase = phase;
+}
+
+- (NSPoint)additionalPatternPhase {
+    return _phase;
+}
 
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
index fb578e6..31aebe0 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
@@ -7,6 +7,7 @@
 
 #import <WebKit/WebAssertions.h>
 #import <WebKit/WebImageRendererFactory.h>
+#import <WebKit/WebGraphicsBridge.h>
 #import <WebKit/WebNSObjectExtras.h>
 
 #import <WebCore/WebCoreImageRenderer.h>
@@ -728,11 +729,21 @@ static NSMutableSet *activeImageRenderers;
     NSRect oneTileRect;
     oneTileRect.origin.x = rect.origin.x + fmodf(fmodf(-point.x, size.width) - size.width, size.width);
     oneTileRect.origin.y = rect.origin.y + fmodf(fmodf(-point.y, size.height) - size.height, size.height);
+// I think this is a simpler way to say the same thing.  Also, if either point.x or point.y is negative, both
+// methods would end up with the wrong answer.  For example, fmod(-22,5) is -2, which is the correct delta to
+// the start of the pattern, but fmod(-(-23), 5) is 3.  This is the delta to the *end* of the pattern
+// instead of the start, so onTileRect will be too far right.
+//    oneTileRect.origin.x = rect.origin.x - fmodf(point.x, size.width);
+//    oneTileRect.origin.y = rect.origin.y - fmodf(point.y, size.height);
     oneTileRect.size = size;
 
     // Compute the appropriate phase relative to the top level view in the window.
     // Conveniently, the oneTileRect we computed above has the appropriate origin.
     NSPoint originInWindow = [[NSView focusView] convertPoint:oneTileRect.origin toView:nil];
+    // WebCore may translate the focus, and thus need an extra phase correction
+    NSPoint extraPhase = [[WebGraphicsBridge sharedBridge] additionalPatternPhase];
+    originInWindow.x += extraPhase.x;
+    originInWindow.y += extraPhase.y;
     CGSize phase = CGSizeMake(fmodf(originInWindow.x, size.width), fmodf(originInWindow.y, size.height));
     
     // If the single image draw covers the whole area, then just draw once.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list