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

Side by Side Diff: webkit/plugins/ppapi/ppb_scrollbar_impl.cc

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 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" 5 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "ppapi/c/dev/ppp_scrollbar_dev.h" 10 #include "ppapi/c/dev/ppp_scrollbar_dev.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 PP_FromBool(IsOverlay())); 204 PP_FromBool(IsOverlay()));
205 } 205 }
206 206
207 void PPB_Scrollbar_Impl::invalidateScrollbarRect( 207 void PPB_Scrollbar_Impl::invalidateScrollbarRect(
208 WebKit::WebPluginScrollbar* scrollbar, 208 WebKit::WebPluginScrollbar* scrollbar,
209 const WebKit::WebRect& rect) { 209 const WebKit::WebRect& rect) {
210 gfx::Rect gfx_rect(rect.x, 210 gfx::Rect gfx_rect(rect.x,
211 rect.y, 211 rect.y,
212 rect.width, 212 rect.width,
213 rect.height); 213 rect.height);
214 dirty_ = dirty_.Union(gfx_rect); 214 dirty_.Union(gfx_rect);
215 // Can't call into the client to tell them about the invalidate right away, 215 // Can't call into the client to tell them about the invalidate right away,
216 // since the PPB_Scrollbar_Impl code is still in the middle of updating its 216 // since the PPB_Scrollbar_Impl code is still in the middle of updating its
217 // internal state. 217 // internal state.
218 // Note: we use a WeakPtrFactory here so that a lingering callback can not 218 // Note: we use a WeakPtrFactory here so that a lingering callback can not
219 // modify the lifetime of this object. Otherwise, WebKit::WebPluginScrollbar 219 // modify the lifetime of this object. Otherwise, WebKit::WebPluginScrollbar
220 // could outlive WebKit::WebPluginContainer, which is against its contract. 220 // could outlive WebKit::WebPluginContainer, which is against its contract.
221 MessageLoop::current()->PostTask( 221 MessageLoop::current()->PostTask(
222 FROM_HERE, 222 FROM_HERE,
223 base::Bind(&PPB_Scrollbar_Impl::NotifyInvalidate, 223 base::Bind(&PPB_Scrollbar_Impl::NotifyInvalidate,
224 weak_ptr_factory_.GetWeakPtr())); 224 weak_ptr_factory_.GetWeakPtr()));
(...skipping 17 matching lines...) Expand all
242 pp_rect.point.x = dirty_.x(); 242 pp_rect.point.x = dirty_.x();
243 pp_rect.point.y = dirty_.y(); 243 pp_rect.point.y = dirty_.y();
244 pp_rect.size.width = dirty_.width(); 244 pp_rect.size.width = dirty_.width();
245 pp_rect.size.height = dirty_.height(); 245 pp_rect.size.height = dirty_.height();
246 dirty_ = gfx::Rect(); 246 dirty_ = gfx::Rect();
247 Invalidate(&pp_rect); 247 Invalidate(&pp_rect);
248 } 248 }
249 249
250 } // namespace ppapi 250 } // namespace ppapi
251 } // namespace webkit 251 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698