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 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 } | 1909 } |
1910 | 1910 |
1911 if (layer()) { | 1911 if (layer()) { |
1912 if (parent_) { | 1912 if (parent_) { |
1913 SetLayerBounds(GetLocalBounds() + | 1913 SetLayerBounds(GetLocalBounds() + |
1914 gfx::Vector2d(GetMirroredX(), y()) + | 1914 gfx::Vector2d(GetMirroredX(), y()) + |
1915 parent_->CalculateOffsetToAncestorWithLayer(NULL)); | 1915 parent_->CalculateOffsetToAncestorWithLayer(NULL)); |
1916 } else { | 1916 } else { |
1917 SetLayerBounds(bounds_); | 1917 SetLayerBounds(bounds_); |
1918 } | 1918 } |
| 1919 |
| 1920 // In RTL mode, if our width has changed, our children's mirrored bounds |
| 1921 // will have changed. Update the child's layer bounds, or if it is not a |
| 1922 // layer, the bounds of any layers inside the child. |
| 1923 if (base::i18n::IsRTL() && bounds_.width() != previous_bounds.width()) { |
| 1924 for (int i = 0; i < child_count(); ++i) { |
| 1925 View* child = child_at(i); |
| 1926 child->UpdateChildLayerBounds( |
| 1927 gfx::Vector2d(child->GetMirroredX(), child->y())); |
| 1928 } |
| 1929 } |
1919 } else { | 1930 } else { |
1920 // If our bounds have changed, then any descendant layer bounds may have | 1931 // If our bounds have changed, then any descendant layer bounds may have |
1921 // changed. Update them accordingly. | 1932 // changed. Update them accordingly. |
1922 UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL)); | 1933 UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL)); |
1923 } | 1934 } |
1924 | 1935 |
1925 OnBoundsChanged(previous_bounds); | 1936 OnBoundsChanged(previous_bounds); |
1926 | 1937 |
1927 if (previous_bounds.size() != size()) { | 1938 if (previous_bounds.size() != size()) { |
1928 needs_layout_ = false; | 1939 needs_layout_ = false; |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2452 // Message the RootView to do the drag and drop. That way if we're removed | 2463 // Message the RootView to do the drag and drop. That way if we're removed |
2453 // the RootView can detect it and avoid calling us back. | 2464 // the RootView can detect it and avoid calling us back. |
2454 gfx::Point widget_location(event.location()); | 2465 gfx::Point widget_location(event.location()); |
2455 ConvertPointToWidget(this, &widget_location); | 2466 ConvertPointToWidget(this, &widget_location); |
2456 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2467 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2457 // WARNING: we may have been deleted. | 2468 // WARNING: we may have been deleted. |
2458 return true; | 2469 return true; |
2459 } | 2470 } |
2460 | 2471 |
2461 } // namespace views | 2472 } // namespace views |
OLD | NEW |