| OLD | NEW |
| 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/controls/tree/tree_view.h" | 5 #include "views/controls/tree/tree_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 // flickering during resize. | 748 // flickering during resize. |
| 749 switch (message) { | 749 switch (message) { |
| 750 case WM_ERASEBKGND: | 750 case WM_ERASEBKGND: |
| 751 return 1; | 751 return 1; |
| 752 | 752 |
| 753 case WM_PAINT: { | 753 case WM_PAINT: { |
| 754 gfx::CanvasSkiaPaint canvas(window); | 754 gfx::CanvasSkiaPaint canvas(window); |
| 755 if (canvas.isEmpty()) | 755 if (canvas.isEmpty()) |
| 756 return 0; | 756 return 0; |
| 757 | 757 |
| 758 HDC dc = canvas.beginPlatformPaint(); | 758 HDC dc = skia::BeginPlatformPaint(&canvas); |
| 759 if (base::i18n::IsRTL()) { | 759 if (base::i18n::IsRTL()) { |
| 760 // gfx::CanvasSkia ends up configuring the DC with a mode of | 760 // gfx::CanvasSkia ends up configuring the DC with a mode of |
| 761 // GM_ADVANCED. For some reason a graphics mode of ADVANCED triggers | 761 // GM_ADVANCED. For some reason a graphics mode of ADVANCED triggers |
| 762 // all the text to be mirrored when RTL. Set the mode back to COMPATIBLE | 762 // all the text to be mirrored when RTL. Set the mode back to COMPATIBLE |
| 763 // and explicitly set the layout. Additionally SetWorldTransform and | 763 // and explicitly set the layout. Additionally SetWorldTransform and |
| 764 // COMPATIBLE don't play nicely together. We need to use | 764 // COMPATIBLE don't play nicely together. We need to use |
| 765 // SetViewportOrgEx when using a mode of COMPATIBLE. | 765 // SetViewportOrgEx when using a mode of COMPATIBLE. |
| 766 // | 766 // |
| 767 // Reset the transform to the identify transform. Even though | 767 // Reset the transform to the identify transform. Even though |
| 768 // SetWorldTransform and COMPATIBLE don't play nicely, bits of the | 768 // SetWorldTransform and COMPATIBLE don't play nicely, bits of the |
| (...skipping 13 matching lines...) Expand all Loading... |
| 782 // copying the upper-left corner to the redraw region. | 782 // copying the upper-left corner to the redraw region. |
| 783 SetViewportOrgEx(dc, -canvas.paintStruct().rcPaint.left, | 783 SetViewportOrgEx(dc, -canvas.paintStruct().rcPaint.left, |
| 784 -canvas.paintStruct().rcPaint.top, NULL); | 784 -canvas.paintStruct().rcPaint.top, NULL); |
| 785 } | 785 } |
| 786 SendMessage(window, WM_PRINTCLIENT, reinterpret_cast<WPARAM>(dc), 0); | 786 SendMessage(window, WM_PRINTCLIENT, reinterpret_cast<WPARAM>(dc), 0); |
| 787 if (base::i18n::IsRTL()) { | 787 if (base::i18n::IsRTL()) { |
| 788 // Reset the origin of the dc back to 0. This way when we copy the bits | 788 // Reset the origin of the dc back to 0. This way when we copy the bits |
| 789 // over we copy the right bits. | 789 // over we copy the right bits. |
| 790 SetViewportOrgEx(dc, 0, 0, NULL); | 790 SetViewportOrgEx(dc, 0, 0, NULL); |
| 791 } | 791 } |
| 792 canvas.endPlatformPaint(); | 792 skia::EndPlatformPaint(&canvas); |
| 793 return 0; | 793 return 0; |
| 794 } | 794 } |
| 795 | 795 |
| 796 case WM_RBUTTONDOWN: | 796 case WM_RBUTTONDOWN: |
| 797 if (tree->select_on_right_mouse_down_) { | 797 if (tree->select_on_right_mouse_down_) { |
| 798 TVHITTESTINFO hit_info; | 798 TVHITTESTINFO hit_info; |
| 799 hit_info.pt = gfx::Point(l_param).ToPOINT(); | 799 hit_info.pt = gfx::Point(l_param).ToPOINT(); |
| 800 HTREEITEM hit_item = TreeView_HitTest(window, &hit_info); | 800 HTREEITEM hit_item = TreeView_HitTest(window, &hit_info); |
| 801 if (hit_item && (hit_info.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT | | 801 if (hit_item && (hit_info.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT | |
| 802 TVHT_ONITEMINDENT)) != 0) | 802 TVHT_ONITEMINDENT)) != 0) |
| 803 TreeView_SelectItem(tree->tree_view_, hit_item); | 803 TreeView_SelectItem(tree->tree_view_, hit_item); |
| 804 } | 804 } |
| 805 // Fall through and let the default handler process as well. | 805 // Fall through and let the default handler process as well. |
| 806 break; | 806 break; |
| 807 } | 807 } |
| 808 WNDPROC handler = tree->original_handler_; | 808 WNDPROC handler = tree->original_handler_; |
| 809 DCHECK(handler); | 809 DCHECK(handler); |
| 810 return CallWindowProc(handler, window, message, w_param, l_param); | 810 return CallWindowProc(handler, window, message, w_param, l_param); |
| 811 } | 811 } |
| 812 | 812 |
| 813 } // namespace views | 813 } // namespace views |
| OLD | NEW |