Title: [152315] trunk/Source/WebCore
- Revision
- 152315
- Author
- [email protected]
- Date
- 2013-07-02 12:50:24 -0700 (Tue, 02 Jul 2013)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (152314 => 152315)
--- trunk/Source/WebCore/ChangeLog 2013-07-02 19:47:53 UTC (rev 152314)
+++ trunk/Source/WebCore/ChangeLog 2013-07-02 19:50:24 UTC (rev 152315)
@@ -1,3 +1,20 @@
+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-06-26 Robert Hogan <[email protected]>
empty inlines should not affect line-wrapping
Modified: trunk/Source/WebCore/platform/mac/WidgetMac.mm (152314 => 152315)
--- trunk/Source/WebCore/platform/mac/WidgetMac.mm 2013-07-02 19:47:53 UTC (rev 152314)
+++ trunk/Source/WebCore/platform/mac/WidgetMac.mm 2013-07-02 19:50:24 UTC (rev 152315)
@@ -54,9 +54,6 @@
@interface NSView (Widget)
- (void)visibleRectDidChange;
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
-- (BOOL)_hasCanDrawSubviewsIntoLayerOrAncestor;
-#endif
@end
namespace WebCore {
@@ -211,13 +208,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]]];
@@ -249,21 +241,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