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

Side by Side Diff: views/view.cc

Issue 6529037: Rename ProcessPaint to Paint() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « views/view.h ('k') | views/view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/view.h" 5 #include "views/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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 622
623 if (parent_) { 623 if (parent_) {
624 // Translate the requested paint rect to the parent's coordinate system 624 // Translate the requested paint rect to the parent's coordinate system
625 // then pass this notification up to the parent. 625 // then pass this notification up to the parent.
626 gfx::Rect paint_rect = ConvertRectToParent(r); 626 gfx::Rect paint_rect = ConvertRectToParent(r);
627 paint_rect.Offset(GetMirroredPosition()); 627 paint_rect.Offset(GetMirroredPosition());
628 parent_->SchedulePaintInRect(paint_rect, urgent); 628 parent_->SchedulePaintInRect(paint_rect, urgent);
629 } 629 }
630 } 630 }
631 631
632 void View::PaintChildren(gfx::Canvas* canvas) {
633 for (int i = 0, count = child_count(); i < count; ++i) {
634 View* child = GetChildViewAt(i);
635 if (!child) {
636 NOTREACHED() << "Should not have a NULL child View for index in bounds";
637 continue;
638 }
639 child->Paint(canvas);
640 }
641 }
642
632 void View::OnPaint(gfx::Canvas* canvas) { 643 void View::OnPaint(gfx::Canvas* canvas) {
633 OnPaintBackground(canvas); 644 OnPaintBackground(canvas);
634 OnPaintFocusBorder(canvas); 645 OnPaintFocusBorder(canvas);
635 OnPaintBorder(canvas); 646 OnPaintBorder(canvas);
636 } 647 }
637 648
638 void View::OnPaintBackground(gfx::Canvas* canvas) { 649 void View::OnPaintBackground(gfx::Canvas* canvas) {
639 if (background_.get()) 650 if (background_.get())
640 background_->Paint(canvas, this); 651 background_->Paint(canvas, this);
641 } 652 }
642 653
643 void View::OnPaintBorder(gfx::Canvas* canvas) { 654 void View::OnPaintBorder(gfx::Canvas* canvas) {
644 if (border_.get()) 655 if (border_.get())
645 border_->Paint(*this, canvas); 656 border_->Paint(*this, canvas);
646 } 657 }
647 658
648 void View::OnPaintFocusBorder(gfx::Canvas* canvas) { 659 void View::OnPaintFocusBorder(gfx::Canvas* canvas) {
649 if (HasFocus() && (IsFocusable() || IsAccessibilityFocusableInRootView())) 660 if (HasFocus() && (IsFocusable() || IsAccessibilityFocusableInRootView()))
650 canvas->DrawFocusRect(0, 0, width(), height()); 661 canvas->DrawFocusRect(0, 0, width(), height());
651 } 662 }
652 663
653 void View::PaintNow() { 664 void View::PaintNow() {
654 if (!IsVisible()) 665 if (!IsVisible())
655 return; 666 return;
656 667
657 if (parent()) 668 if (parent())
658 parent()->PaintNow(); 669 parent()->PaintNow();
659 } 670 }
660 671
661 void View::ProcessPaint(gfx::Canvas* canvas) { 672 void View::Paint(gfx::Canvas* canvas) {
662 if (!IsVisible()) 673 if (!IsVisible())
663 return; 674 return;
664 675
665 // We're going to modify the canvas, save it's state first. 676 // We're going to modify the canvas, save it's state first.
666 canvas->Save(); 677 canvas->Save();
667 678
668 // Paint this View and its children, setting the clip rect to the bounds 679 // Paint this View and its children, setting the clip rect to the bounds
669 // of this View and translating the origin to the local bounds' top left 680 // of this View and translating the origin to the local bounds' top left
670 // point. 681 // point.
671 // 682 //
(...skipping 24 matching lines...) Expand all
696 // didn't request the canvas to be flipped. 707 // didn't request the canvas to be flipped.
697 canvas->Restore(); 708 canvas->Restore();
698 709
699 PaintChildren(canvas); 710 PaintChildren(canvas);
700 } 711 }
701 712
702 // Restore the canvas's original transform. 713 // Restore the canvas's original transform.
703 canvas->Restore(); 714 canvas->Restore();
704 } 715 }
705 716
706 void View::PaintChildren(gfx::Canvas* canvas) {
707 for (int i = 0, count = child_count(); i < count; ++i) {
708 View* child = GetChildViewAt(i);
709 if (!child) {
710 NOTREACHED() << "Should not have a NULL child View for index in bounds";
711 continue;
712 }
713 child->ProcessPaint(canvas);
714 }
715 }
716
717 ThemeProvider* View::GetThemeProvider() const { 717 ThemeProvider* View::GetThemeProvider() const {
718 const Widget* widget = GetWidget(); 718 const Widget* widget = GetWidget();
719 return widget ? widget->GetThemeProvider() : NULL; 719 return widget ? widget->GetThemeProvider() : NULL;
720 } 720 }
721 721
722 // Input ----------------------------------------------------------------------- 722 // Input -----------------------------------------------------------------------
723 723
724 View* View::GetViewForPoint(const gfx::Point& point) { 724 View* View::GetViewForPoint(const gfx::Point& point) {
725 // Walk the child Views recursively looking for the View that most 725 // Walk the child Views recursively looking for the View that most
726 // tightly encloses the specified point. 726 // tightly encloses the specified point.
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 OSExchangeData data; 1584 OSExchangeData data;
1585 WriteDragData(press_pt, &data); 1585 WriteDragData(press_pt, &data);
1586 1586
1587 // Message the RootView to do the drag and drop. That way if we're removed 1587 // Message the RootView to do the drag and drop. That way if we're removed
1588 // the RootView can detect it and avoid calling us back. 1588 // the RootView can detect it and avoid calling us back.
1589 RootView* root_view = GetRootView(); 1589 RootView* root_view = GetRootView();
1590 root_view->StartDragForViewFromMouseEvent(this, data, drag_operations); 1590 root_view->StartDragForViewFromMouseEvent(this, data, drag_operations);
1591 } 1591 }
1592 1592
1593 } // namespace views 1593 } // namespace views
OLDNEW
« no previous file with comments | « views/view.h ('k') | views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698