Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(998)

Side by Side Diff: webkit/tools/test_shell/webwidget_host_mac.mm

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "webkit/tools/test_shell/webwidget_host.h" 7 #include "webkit/tools/test_shell/webwidget_host.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "skia/ext/platform_canvas.h" 10 #include "skia/ext/platform_canvas.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 [NSGraphicsContext setCurrentContext: 183 [NSGraphicsContext setCurrentContext:
184 [NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context 184 [NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context
185 flipped:YES]]; 185 flipped:YES]];
186 186
187 webwidget_->animate(0.0); 187 webwidget_->animate(0.0);
188 188
189 // This may result in more invalidation 189 // This may result in more invalidation
190 webwidget_->layout(); 190 webwidget_->layout();
191 191
192 // Scroll the canvas if necessary 192 // Scroll the canvas if necessary
193 scroll_rect_ = client_rect.Intersect(scroll_rect_); 193 scroll_rect_.Intersect(client_rect);
194 if (!scroll_rect_.IsEmpty()) { 194 if (!scroll_rect_.IsEmpty()) {
195 // add to invalidate rect, since there's no equivalent of ScrollDC. 195 // add to invalidate rect, since there's no equivalent of ScrollDC.
196 paint_rect_ = paint_rect_.Union(scroll_rect_); 196 paint_rect_ = paint_rect_.Union(scroll_rect_);
197 } 197 }
198 ResetScrollRect(); 198 ResetScrollRect();
199 199
200 // Paint the canvas if necessary. Allow painting to generate extra rects the 200 // Paint the canvas if necessary. Allow painting to generate extra rects the
201 // first time we call it. This is necessary because some WebCore rendering 201 // first time we call it. This is necessary because some WebCore rendering
202 // objects update their layout only when painted. 202 // objects update their layout only when painted.
203 for (int i = 0; i < 2; ++i) { 203 for (int i = 0; i < 2; ++i) {
204 paint_rect_ = client_rect.Intersect(paint_rect_); 204 paint_rect_.Intersect(client_rect);
205 if (!paint_rect_.IsEmpty()) { 205 if (!paint_rect_.IsEmpty()) {
206 gfx::Rect rect(paint_rect_); 206 gfx::Rect rect(paint_rect_);
207 paint_rect_ = gfx::Rect(); 207 paint_rect_ = gfx::Rect();
208 208
209 // DLOG_IF(WARNING, i == 1) << "painting caused additional invalidations"; 209 // DLOG_IF(WARNING, i == 1) << "painting caused additional invalidations";
210 PaintRect(rect); 210 PaintRect(rect);
211 } 211 }
212 } 212 }
213 DCHECK(paint_rect_.IsEmpty()); 213 DCHECK(paint_rect_.IsEmpty());
214 214
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { 277 void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
278 #ifndef NDEBUG 278 #ifndef NDEBUG
279 DCHECK(!painting_); 279 DCHECK(!painting_);
280 #endif 280 #endif
281 DCHECK(canvas_.get()); 281 DCHECK(canvas_.get());
282 282
283 set_painting(true); 283 set_painting(true);
284 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect); 284 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect);
285 set_painting(false); 285 set_painting(false);
286 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698