Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 void View::SchedulePaint() { | 718 void View::SchedulePaint() { |
| 719 SchedulePaintInRect(GetLocalBounds()); | 719 SchedulePaintInRect(GetLocalBounds()); |
| 720 } | 720 } |
| 721 | 721 |
| 722 void View::SchedulePaintInRect(const gfx::Rect& rect) { | 722 void View::SchedulePaintInRect(const gfx::Rect& rect) { |
| 723 if (!visible_) | 723 if (!visible_) |
| 724 return; | 724 return; |
| 725 | 725 |
| 726 if (layer()) { | 726 if (layer()) { |
| 727 layer()->SchedulePaint(rect); | 727 layer()->SchedulePaint(rect); |
| 728 } else if (parent_) { | 728 } |
| 729 | |
| 730 if (parent_ && (!layer() || !layer()->fills_bounds_opaquely())) { | |
|
jonross
2015/11/18 16:55:45
This will trigger for all schedule paints on a non
bruthig
2015/11/18 17:02:48
Agreed, I just want to make sure the following sce
bruthig
2015/11/18 17:46:42
Discussed offline.
| |
| 729 // Translate the requested paint rect to the parent's coordinate system | 731 // Translate the requested paint rect to the parent's coordinate system |
| 730 // then pass this notification up to the parent. | 732 // then pass this notification up to the parent. |
| 731 parent_->SchedulePaintInRect(ConvertRectToParent(rect)); | 733 parent_->SchedulePaintInRect(ConvertRectToParent(rect)); |
| 732 } | 734 } |
| 733 } | 735 } |
| 734 | 736 |
| 735 void View::Paint(const ui::PaintContext& parent_context) { | 737 void View::Paint(const ui::PaintContext& parent_context) { |
| 736 if (!visible_) | 738 if (!visible_) |
| 737 return; | 739 return; |
| 738 if (size().IsEmpty()) | 740 if (size().IsEmpty()) |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1377 "width", canvas->sk_canvas()->getDevice()->width(), | 1379 "width", canvas->sk_canvas()->getDevice()->width(), |
| 1378 "height", canvas->sk_canvas()->getDevice()->height()); | 1380 "height", canvas->sk_canvas()->getDevice()->height()); |
| 1379 border_->Paint(*this, canvas); | 1381 border_->Paint(*this, canvas); |
| 1380 } | 1382 } |
| 1381 } | 1383 } |
| 1382 | 1384 |
| 1383 // Accelerated Painting -------------------------------------------------------- | 1385 // Accelerated Painting -------------------------------------------------------- |
| 1384 | 1386 |
| 1385 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { | 1387 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { |
| 1386 // This method should not have the side-effect of creating the layer. | 1388 // This method should not have the side-effect of creating the layer. |
| 1387 if (layer()) | 1389 if (layer()) { |
| 1388 layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); | 1390 layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); |
| 1391 if (!fills_bounds_opaquely && parent_) { | |
| 1392 // Translate the requested paint rect to the parent's coordinate system | |
| 1393 // then pass this notification up to the parent. | |
| 1394 parent_->SchedulePaintInRect(ConvertRectToParent(bounds_)); | |
| 1395 } | |
| 1396 } | |
| 1389 } | 1397 } |
| 1390 | 1398 |
| 1391 gfx::Vector2d View::CalculateOffsetToAncestorWithLayer( | 1399 gfx::Vector2d View::CalculateOffsetToAncestorWithLayer( |
| 1392 ui::Layer** layer_parent) { | 1400 ui::Layer** layer_parent) { |
| 1393 if (layer()) { | 1401 if (layer()) { |
| 1394 if (layer_parent) | 1402 if (layer_parent) |
| 1395 *layer_parent = layer(); | 1403 *layer_parent = layer(); |
| 1396 return gfx::Vector2d(); | 1404 return gfx::Vector2d(); |
| 1397 } | 1405 } |
| 1398 if (!parent_) | 1406 if (!parent_) |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2354 // Message the RootView to do the drag and drop. That way if we're removed | 2362 // Message the RootView to do the drag and drop. That way if we're removed |
| 2355 // the RootView can detect it and avoid calling us back. | 2363 // the RootView can detect it and avoid calling us back. |
| 2356 gfx::Point widget_location(event.location()); | 2364 gfx::Point widget_location(event.location()); |
| 2357 ConvertPointToWidget(this, &widget_location); | 2365 ConvertPointToWidget(this, &widget_location); |
| 2358 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2366 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2359 // WARNING: we may have been deleted. | 2367 // WARNING: we may have been deleted. |
| 2360 return true; | 2368 return true; |
| 2361 } | 2369 } |
| 2362 | 2370 |
| 2363 } // namespace views | 2371 } // namespace views |
| OLD | NEW |