Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/touch_selection/touch_handle_drawable_aura.h" | 5 #include "ui/touch_selection/touch_handle_drawable_aura.h" |
| 6 | 6 |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/aura/window_targeter.h" | 8 #include "ui/aura/window_targeter.h" |
| 9 #include "ui/aura_extra/image_window_delegate.h" | 9 #include "ui/aura_extra/image_window_delegate.h" |
| 10 #include "ui/base/cursor/cursor.h" | 10 #include "ui/base/cursor/cursor.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 window_delegate_->SetImage(*image); | 110 window_delegate_->SetImage(*image); |
| 111 | 111 |
| 112 // Calculate the relative bounds. | 112 // Calculate the relative bounds. |
| 113 gfx::Size image_size = image->Size(); | 113 gfx::Size image_size = image->Size(); |
| 114 int window_width = image_size.width() + 2 * kSelectionHandlePadding; | 114 int window_width = image_size.width() + 2 * kSelectionHandlePadding; |
| 115 int window_height = image_size.height() + 2 * kSelectionHandlePadding; | 115 int window_height = image_size.height() + 2 * kSelectionHandlePadding; |
| 116 relative_bounds_ = | 116 relative_bounds_ = |
| 117 gfx::RectF(-kSelectionHandlePadding, | 117 gfx::RectF(-kSelectionHandlePadding, |
| 118 kSelectionHandleVerticalVisualOffset - kSelectionHandlePadding, | 118 kSelectionHandleVerticalVisualOffset - kSelectionHandlePadding, |
| 119 window_width, window_height); | 119 window_width, window_height); |
| 120 gfx::Rect paint_bounds(relative_bounds_.x(), relative_bounds_.y(), | |
| 121 relative_bounds_.width(), relative_bounds_.height()); | |
|
mohsen
2015/12/21 21:05:50
I think you should've used gfx::ToEnclosingRect()
| |
| 122 window_->SchedulePaintInRect(paint_bounds); | |
| 120 UpdateBounds(); | 123 UpdateBounds(); |
| 121 } | 124 } |
| 122 | 125 |
| 123 void TouchHandleDrawableAura::SetOrigin(const gfx::PointF& position) { | 126 void TouchHandleDrawableAura::SetOrigin(const gfx::PointF& position) { |
| 124 origin_position_ = position; | 127 origin_position_ = position; |
| 125 UpdateBounds(); | 128 UpdateBounds(); |
| 126 } | 129 } |
| 127 | 130 |
| 128 void TouchHandleDrawableAura::SetAlpha(float alpha) { | 131 void TouchHandleDrawableAura::SetAlpha(float alpha) { |
| 129 if (alpha == alpha_) | 132 if (alpha == alpha_) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 145 kSelectionHandlePadding); | 148 kSelectionHandlePadding); |
| 146 return bounds; | 149 return bounds; |
| 147 } | 150 } |
| 148 | 151 |
| 149 float TouchHandleDrawableAura::GetDrawableHorizontalPaddingRatio() const { | 152 float TouchHandleDrawableAura::GetDrawableHorizontalPaddingRatio() const { |
| 150 // Aura does not have any transparent padding for its handle drawable. | 153 // Aura does not have any transparent padding for its handle drawable. |
| 151 return 0.0f; | 154 return 0.0f; |
| 152 } | 155 } |
| 153 | 156 |
| 154 } // namespace ui | 157 } // namespace ui |
| OLD | NEW |