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

Side by Side Diff: ui/views/widget/root_view.cc

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 1 month 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 | Annotate | Revision Log
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 "ui/views/widget/root_view.h" 5 #include "ui/views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 std::string RootView::GetClassName() const { 185 std::string RootView::GetClassName() const {
186 return kViewClassName; 186 return kViewClassName;
187 } 187 }
188 188
189 void RootView::SchedulePaintInRect(const gfx::Rect& rect) { 189 void RootView::SchedulePaintInRect(const gfx::Rect& rect) {
190 if (layer()) { 190 if (layer()) {
191 layer()->SchedulePaint(rect); 191 layer()->SchedulePaint(rect);
192 } else { 192 } else {
193 gfx::Rect xrect = ConvertRectToParent(rect); 193 gfx::Rect xrect = ConvertRectToParent(rect);
194 gfx::Rect invalid_rect = GetLocalBounds(); 194 gfx::Rect invalid_rect = gfx::IntersectRects(GetLocalBounds(), xrect);
195 invalid_rect.Intersect(xrect);
196 if (!invalid_rect.IsEmpty()) 195 if (!invalid_rect.IsEmpty())
197 widget_->SchedulePaintInRect(invalid_rect); 196 widget_->SchedulePaintInRect(invalid_rect);
198 } 197 }
199 } 198 }
200 199
201 bool RootView::OnMousePressed(const ui::MouseEvent& event) { 200 bool RootView::OnMousePressed(const ui::MouseEvent& event) {
202 UpdateCursor(event); 201 UpdateCursor(event);
203 SetMouseLocationAndFlags(event); 202 SetMouseLocationAndFlags(event);
204 203
205 // If mouse_pressed_handler_ is non null, we are currently processing 204 // If mouse_pressed_handler_ is non null, we are currently processing
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 } 613 }
615 614
616 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { 615 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) {
617 last_mouse_event_flags_ = event.flags(); 616 last_mouse_event_flags_ = event.flags();
618 last_mouse_event_x_ = event.x(); 617 last_mouse_event_x_ = event.x();
619 last_mouse_event_y_ = event.y(); 618 last_mouse_event_y_ = event.y();
620 } 619 }
621 620
622 } // namespace internal 621 } // namespace internal
623 } // namespace views 622 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/bounds_animator_unittest.cc ('k') | webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698