Changeset 152315 in webkit
- Timestamp:
- Jul 2, 2013 12:50:24 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152313 r152315 1 2013-07-02 Anders Carlsson <andersca@apple.com> 2 3 Always flip the coordinate system before drawing NSViews from Widget::paint 4 https://bugs.webkit.org/show_bug.cgi?id=118318 5 <rdar://problem/13895483> 6 7 Reviewed by Beth Dakin. 8 9 Undo the change that would not flip on 10.9; turns out the bug was in AppKit. Also remove the 10 _hasCanDrawSubviewsIntoLayerOrAncestor workaround since drawing works correctly now. 11 12 Also, pass flipped:NO when creating the NSGraphicsContext to indicate that the graphics context 13 is unflipped as far as AppKit knows (since we flipped it earlier). 14 15 * platform/mac/WidgetMac.mm: 16 (WebCore::Widget::paint): 17 1 18 2013-06-26 Robert Hogan <robert@webkit.org> 2 19 -
trunk/Source/WebCore/platform/mac/WidgetMac.mm
r151926 r152315 55 55 @interface NSView (Widget) 56 56 - (void)visibleRectDidChange; 57 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 109058 - (BOOL)_hasCanDrawSubviewsIntoLayerOrAncestor;59 #endif60 57 @end 61 58 … … 212 209 RefPtr<Widget> protectedThis(this); 213 210 214 BOOL hasCanDrawSubviewsIntoLayerOrAncestor = NO;215 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090216 hasCanDrawSubviewsIntoLayerOrAncestor = [view _hasCanDrawSubviewsIntoLayerOrAncestor];217 #endif218 219 211 NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; 220 if (currentContext == [[view window] graphicsContext] || ![currentContext isDrawingToScreen] || hasCanDrawSubviewsIntoLayerOrAncestor) {212 if (currentContext == [[view window] graphicsContext] || ![currentContext isDrawingToScreen]) { 221 213 // This is the common case of drawing into a window or an inclusive layer, or printing. 222 214 BEGIN_BLOCK_OBJC_EXCEPTIONS; … … 250 242 NSRect viewFrame = [view frame]; 251 243 NSRect viewBounds = [view bounds]; 244 252 245 // Set up the translation and (flipped) orientation of the graphics context. In normal drawing, AppKit does it as it descends down 253 // the view hierarchy. 254 bool shouldFlipContext = true; 255 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 256 shouldFlipContext = false; 257 #endif 258 if (shouldFlipContext) { 259 CGContextTranslateCTM(cgContext, viewFrame.origin.x - viewBounds.origin.x, viewFrame.origin.y + viewFrame.size.height + viewBounds.origin.y); 260 CGContextScaleCTM(cgContext, 1, -1); 261 } else 262 CGContextTranslateCTM(cgContext, viewFrame.origin.x - viewBounds.origin.x, viewFrame.origin.y + viewBounds.origin.y); 246 // the view hierarchy. Since Widget::paint is always called with a context that has a flipped coordinate system, and 247 // -[NSView displayRectIgnoringOpacity:inContext:] expects an unflipped context we always flip here. 248 CGContextTranslateCTM(cgContext, viewFrame.origin.x - viewBounds.origin.x, viewFrame.origin.y + viewFrame.size.height + viewBounds.origin.y); 249 CGContextScaleCTM(cgContext, 1, -1); 263 250 264 251 BEGIN_BLOCK_OBJC_EXCEPTIONS; 265 252 { 266 NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped: YES];253 NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:NO]; 267 254 [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]] inContext:nsContext]; 268 255 }
Note: See TracChangeset
for help on using the changeset viewer.