OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/mac/sdk_forward_declarations.h" | 5 #include "base/mac/sdk_forward_declarations.h" |
6 #import "ui/base/cocoa/nsview_additions.h" | 6 #import "ui/base/cocoa/nsview_additions.h" |
7 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 7 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } else { | 84 } else { |
85 [transform translateXBy:-NSMinX(frame) yBy:NSMaxY(frame)]; | 85 [transform translateXBy:-NSMinX(frame) yBy:NSMaxY(frame)]; |
86 [transform scaleXBy:1.0 yBy:-1.0]; | 86 [transform scaleXBy:1.0 yBy:-1.0]; |
87 } | 87 } |
88 [transform concat]; | 88 [transform concat]; |
89 | 89 |
90 // This can be made robust to recursive calls, but is as of yet unneeded. | 90 // This can be made robust to recursive calls, but is as of yet unneeded. |
91 DCHECK(!g_ancestorBeingDrawnFrom && !g_childBeingDrawnTo); | 91 DCHECK(!g_ancestorBeingDrawnFrom && !g_childBeingDrawnTo); |
92 g_ancestorBeingDrawnFrom = ancestorView; | 92 g_ancestorBeingDrawnFrom = ancestorView; |
93 g_childBeingDrawnTo = self; | 93 g_childBeingDrawnTo = self; |
94 [ancestorView drawRect:[self convertRect:dirtyRect toView:ancestorView]]; | 94 [ancestorView drawRect:NSIntersectionRect( |
| 95 [ancestorView bounds], |
| 96 [self convertRect:dirtyRect toView:ancestorView])]; |
95 g_childBeingDrawnTo = nil; | 97 g_childBeingDrawnTo = nil; |
96 g_ancestorBeingDrawnFrom = nil; | 98 g_ancestorBeingDrawnFrom = nil; |
97 } | 99 } |
98 | 100 |
99 - (NSView*)cr_viewBeingDrawnTo { | 101 - (NSView*)cr_viewBeingDrawnTo { |
100 if (!g_ancestorBeingDrawnFrom) | 102 if (!g_ancestorBeingDrawnFrom) |
101 return self; | 103 return self; |
102 DCHECK(g_ancestorBeingDrawnFrom == self); | 104 DCHECK(g_ancestorBeingDrawnFrom == self); |
103 return g_childBeingDrawnTo; | 105 return g_childBeingDrawnTo; |
104 } | 106 } |
105 | 107 |
106 @end | 108 @end |
OLD | NEW |