| 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 "chrome/browser/android/compositor/layer/tab_handle_layer.h" | 5 #include "chrome/browser/android/compositor/layer/tab_handle_layer.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/layers/solid_color_layer.h" | 9 #include "cc/layers/solid_color_layer.h" |
| 10 #include "chrome/browser/android/compositor/decoration_title.h" | 10 #include "chrome/browser/android/compositor/decoration_title.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // aesthetic animations. | 83 // aesthetic animations. |
| 84 x = x - (margin_width - width); | 84 x = x - (margin_width - width); |
| 85 width = margin_width; | 85 width = margin_width; |
| 86 } | 86 } |
| 87 if (margin_height >= height) { | 87 if (margin_height >= height) { |
| 88 y = y - (margin_height - height); | 88 y = y - (margin_height - height); |
| 89 height = margin_height; | 89 height = margin_height; |
| 90 } | 90 } |
| 91 gfx::Size tab_bounds(width, height); | 91 gfx::Size tab_bounds(width, height); |
| 92 | 92 |
| 93 layer_->SetPosition(gfx::Point(x, y)); | 93 layer_->SetPosition(gfx::PointF(x, y)); |
| 94 DecorationTitle* title_layer = nullptr; | 94 DecorationTitle* title_layer = nullptr; |
| 95 if (layer_title_cache_) | 95 if (layer_title_cache_) |
| 96 title_layer = layer_title_cache_->GetTitleLayer(id); | 96 title_layer = layer_title_cache_->GetTitleLayer(id); |
| 97 | 97 |
| 98 if (title_layer) { | 98 if (title_layer) { |
| 99 title_layer->setOpacity(1.0f); | 99 title_layer->setOpacity(1.0f); |
| 100 unsigned expected_children = 3; | 100 unsigned expected_children = 3; |
| 101 if (foreground_) | 101 if (foreground_) |
| 102 expected_children += 1; | 102 expected_children += 1; |
| 103 title_layer_ = title_layer->layer(); | 103 title_layer_ = title_layer->layer(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 title_layer->size().height() / 2; | 137 title_layer->size().height() / 2; |
| 138 int title_x = is_rtl ? padding_left + close_width : padding_left; | 138 int title_x = is_rtl ? padding_left + close_width : padding_left; |
| 139 title_x += is_rtl ? 0 : content_offset_x; | 139 title_x += is_rtl ? 0 : content_offset_x; |
| 140 title_layer->setBounds(gfx::Size( | 140 title_layer->setBounds(gfx::Size( |
| 141 width - padding_right - padding_left - close_width - content_offset_x, | 141 width - padding_right - padding_left - close_width - content_offset_x, |
| 142 height)); | 142 height)); |
| 143 if (foreground_) { | 143 if (foreground_) { |
| 144 title_x += original_x; | 144 title_x += original_x; |
| 145 title_y += original_y; | 145 title_y += original_y; |
| 146 } | 146 } |
| 147 title_layer->layer()->SetPosition(gfx::Point(title_x, title_y)); | 147 title_layer->layer()->SetPosition(gfx::PointF(title_x, title_y)); |
| 148 if (is_loading) { | 148 if (is_loading) { |
| 149 title_layer->SetIsLoading(true); | 149 title_layer->SetIsLoading(true); |
| 150 title_layer->SetSpinnerRotation(spinner_rotation); | 150 title_layer->SetSpinnerRotation(spinner_rotation); |
| 151 } else { | 151 } else { |
| 152 title_layer->SetIsLoading(false); | 152 title_layer->SetIsLoading(false); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 if (close_button_alpha == 0.f) { | 156 if (close_button_alpha == 0.f) { |
| 157 close_button_->SetIsDrawable(false); | 157 close_button_->SetIsDrawable(false); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 decoration_tab_->SetIsDrawable(true); | 190 decoration_tab_->SetIsDrawable(true); |
| 191 layer_->AddChild(decoration_tab_); | 191 layer_->AddChild(decoration_tab_); |
| 192 layer_->AddChild(close_button_); | 192 layer_->AddChild(close_button_); |
| 193 } | 193 } |
| 194 | 194 |
| 195 TabHandleLayer::~TabHandleLayer() { | 195 TabHandleLayer::~TabHandleLayer() { |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace android | 198 } // namespace android |
| 199 } // namespace chrome | 199 } // namespace chrome |
| OLD | NEW |