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

Side by Side Diff: ui/views/view.cc

Issue 1566693002: Moved parent_->SchedulePaint() to Views::SetFillsBoundsOpaquely() and Views::SchedulePaint(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « ui/views/view.h ('k') | ui/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) 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 SchedulePaint(); 1762 SchedulePaint();
1763 } else if (parent_ && type == SCHEDULE_PAINT_SIZE_SAME) { 1763 } else if (parent_ && type == SCHEDULE_PAINT_SIZE_SAME) {
1764 // The compositor doesn't Draw() until something on screen changes, so 1764 // The compositor doesn't Draw() until something on screen changes, so
1765 // if our position changes but nothing is being animated on screen, then 1765 // if our position changes but nothing is being animated on screen, then
1766 // tell the compositor to redraw the scene. We know layer() exists due to 1766 // tell the compositor to redraw the scene. We know layer() exists due to
1767 // the above if clause. 1767 // the above if clause.
1768 layer()->ScheduleDraw(); 1768 layer()->ScheduleDraw();
1769 } 1769 }
1770 } 1770 }
1771 1771
1772 void View::SchedulePaintOnParent() {
1773 if (parent_) {
1774 // Translate the requested paint rect to the parent's coordinate system
1775 // then pass this notification up to the parent.
1776 parent_->SchedulePaintInRect(ConvertRectToParent(GetLocalBounds()));
1777 }
1778 }
1779
1772 // Tree operations ------------------------------------------------------------- 1780 // Tree operations -------------------------------------------------------------
1773 1781
1774 void View::DoRemoveChildView(View* view, 1782 void View::DoRemoveChildView(View* view,
1775 bool update_focus_cycle, 1783 bool update_focus_cycle,
1776 bool update_tool_tip, 1784 bool update_tool_tip,
1777 bool delete_removed_view, 1785 bool delete_removed_view,
1778 View* new_parent) { 1786 View* new_parent) {
1779 DCHECK(view); 1787 DCHECK(view);
1780 1788
1781 const Views::iterator i(std::find(children_.begin(), children_.end(), view)); 1789 const Views::iterator i(std::find(children_.begin(), children_.end(), view));
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 2083
2076 // The new layer needs to be ordered in the layer tree according 2084 // The new layer needs to be ordered in the layer tree according
2077 // to the view tree. Children of this layer were added in order 2085 // to the view tree. Children of this layer were added in order
2078 // in UpdateParentLayers(). 2086 // in UpdateParentLayers().
2079 if (parent()) 2087 if (parent())
2080 parent()->ReorderLayers(); 2088 parent()->ReorderLayers();
2081 2089
2082 Widget* widget = GetWidget(); 2090 Widget* widget = GetWidget();
2083 if (widget) 2091 if (widget)
2084 widget->UpdateRootLayers(); 2092 widget->UpdateRootLayers();
2093
2094 // Before having its own Layer, this View may have painted in to a Layer owned
2095 // by an ancestor View. Scheduling a paint on the parent View will erase this
2096 // View's painting effects on the ancestor View's Layer.
2097 // (See crbug.com/551492)
2098 SchedulePaintOnParent();
2085 } 2099 }
2086 2100
2087 void View::UpdateParentLayers() { 2101 void View::UpdateParentLayers() {
2088 // Attach all top-level un-parented layers. 2102 // Attach all top-level un-parented layers.
2089 if (layer() && !layer()->parent()) { 2103 if (layer() && !layer()->parent()) {
2090 UpdateParentLayer(); 2104 UpdateParentLayer();
2091 } else { 2105 } else {
2092 for (int i = 0, count = child_count(); i < count; ++i) 2106 for (int i = 0, count = child_count(); i < count; ++i)
2093 child_at(i)->UpdateParentLayers(); 2107 child_at(i)->UpdateParentLayers();
2094 } 2108 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 // Message the RootView to do the drag and drop. That way if we're removed 2404 // Message the RootView to do the drag and drop. That way if we're removed
2391 // the RootView can detect it and avoid calling us back. 2405 // the RootView can detect it and avoid calling us back.
2392 gfx::Point widget_location(event.location()); 2406 gfx::Point widget_location(event.location());
2393 ConvertPointToWidget(this, &widget_location); 2407 ConvertPointToWidget(this, &widget_location);
2394 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2408 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2395 // WARNING: we may have been deleted. 2409 // WARNING: we may have been deleted.
2396 return true; 2410 return true;
2397 } 2411 }
2398 2412
2399 } // namespace views 2413 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698