Title: [152476] branches/safari-537-branch/Source/WebCore
Revision
152476
Author
[email protected]
Date
2013-07-08 17:31:45 -0700 (Mon, 08 Jul 2013)

Log Message

Merged r152315.  <rdar://problem/13895483>

Modified Paths

Diff

Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (152475 => 152476)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-09 00:30:47 UTC (rev 152475)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-09 00:31:45 UTC (rev 152476)
@@ -1,5 +1,26 @@
 2013-07-08  Lucas Forschler  <[email protected]>
 
+        Merge r152315
+
+    2013-07-02  Anders Carlsson  <[email protected]>
+
+            Always flip the coordinate system before drawing NSViews from Widget::paint
+            https://bugs.webkit.org/show_bug.cgi?id=118318
+            <rdar://problem/13895483>
+
+            Reviewed by Beth Dakin.
+
+            Undo the change that would not flip on 10.9; turns out the bug was in AppKit. Also remove the
+            _hasCanDrawSubviewsIntoLayerOrAncestor workaround since drawing works correctly now.
+
+            Also, pass flipped:NO when creating the NSGraphicsContext to indicate that the graphics context
+            is unflipped as far as AppKit knows (since we flipped it earlier).
+
+            * platform/mac/WidgetMac.mm:
+            (WebCore::Widget::paint):
+
+2013-07-08  Lucas Forschler  <[email protected]>
+
         Merge r152303
 
     2013-07-02  Tim Horton  <[email protected]>

Modified: branches/safari-537-branch/Source/WebCore/platform/mac/WidgetMac.mm (152475 => 152476)


--- branches/safari-537-branch/Source/WebCore/platform/mac/WidgetMac.mm	2013-07-09 00:30:47 UTC (rev 152475)
+++ branches/safari-537-branch/Source/WebCore/platform/mac/WidgetMac.mm	2013-07-09 00:31:45 UTC (rev 152476)
@@ -55,9 +55,6 @@
 
 @interface NSView (Widget)
 - (void)visibleRectDidChange;
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
-- (BOOL)_hasCanDrawSubviewsIntoLayerOrAncestor;
-#endif
 @end
 
 namespace WebCore {
@@ -212,13 +209,8 @@
     // code, which can deref it.
     RefPtr<Widget> protectedThis(this);
 
-    BOOL hasCanDrawSubviewsIntoLayerOrAncestor = NO;
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
-    hasCanDrawSubviewsIntoLayerOrAncestor = [view _hasCanDrawSubviewsIntoLayerOrAncestor];
-#endif
-    
     NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
-    if (currentContext == [[view window] graphicsContext] || ![currentContext isDrawingToScreen] || hasCanDrawSubviewsIntoLayerOrAncestor) {
+    if (currentContext == [[view window] graphicsContext] || ![currentContext isDrawingToScreen]) {
         // This is the common case of drawing into a window or an inclusive layer, or printing.
         BEGIN_BLOCK_OBJC_EXCEPTIONS;
         [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]]];
@@ -250,21 +242,16 @@
 
     NSRect viewFrame = [view frame];
     NSRect viewBounds = [view bounds];
+
     // Set up the translation and (flipped) orientation of the graphics context. In normal drawing, AppKit does it as it descends down
-    // the view hierarchy.
-    bool shouldFlipContext = true;
-#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
-    shouldFlipContext = false;
-#endif
-    if (shouldFlipContext) {
-        CGContextTranslateCTM(cgContext, viewFrame.origin.x - viewBounds.origin.x, viewFrame.origin.y + viewFrame.size.height + viewBounds.origin.y);
-        CGContextScaleCTM(cgContext, 1, -1);
-    } else
-        CGContextTranslateCTM(cgContext, viewFrame.origin.x - viewBounds.origin.x, viewFrame.origin.y + viewBounds.origin.y);
+    // the view hierarchy. Since Widget::paint is always called with a context that has a flipped coordinate system, and
+    // -[NSView displayRectIgnoringOpacity:inContext:] expects an unflipped context we always flip here.
+    CGContextTranslateCTM(cgContext, viewFrame.origin.x - viewBounds.origin.x, viewFrame.origin.y + viewFrame.size.height + viewBounds.origin.y);
+    CGContextScaleCTM(cgContext, 1, -1);
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     {
-        NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES];
+        NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:NO];
         [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]] inContext:nsContext];
     }
     END_BLOCK_OBJC_EXCEPTIONS;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to