 Chromium Code Reviews
 Chromium Code Reviews Issue 1217893013:
  Don't preload rarely seen large images  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1217893013:
  Don't preload rarely seen large images  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_layer.h" | 5 #include "chrome/browser/android/compositor/layer/tab_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/layer_lists.h" | 9 #include "cc/layers/layer_lists.h" | 
| 10 #include "cc/layers/nine_patch_layer.h" | 10 #include "cc/layers/nine_patch_layer.h" | 
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 shadow_resource_id); | 117 shadow_resource_id); | 
| 118 ui::ResourceManager::Resource* contour_resource = | 118 ui::ResourceManager::Resource* contour_resource = | 
| 119 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, | 119 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, | 
| 120 contour_resource_id); | 120 contour_resource_id); | 
| 121 ui::ResourceManager::Resource* toolbar_resource = | 121 ui::ResourceManager::Resource* toolbar_resource = | 
| 122 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_DYNAMIC, | 122 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_DYNAMIC, | 
| 123 toolbar_resource_id); | 123 toolbar_resource_id); | 
| 124 ui::ResourceManager::Resource* close_btn_resource = | 124 ui::ResourceManager::Resource* close_btn_resource = | 
| 125 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, | 125 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, | 
| 126 close_button_resource_id); | 126 close_button_resource_id); | 
| 127 ui::ResourceManager::Resource* back_logo_resource = | 127 ui::ResourceManager::Resource* back_logo_resource = nullptr; | 
| 128 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, | |
| 129 back_logo_resource_id); | |
| 130 | 128 | 
| 131 DecorationTitle* title_layer = nullptr; | 129 DecorationTitle* title_layer = nullptr; | 
| 132 | 130 | 
| 133 //---------------------------------------------------------------------------- | 131 //---------------------------------------------------------------------------- | 
| 134 // Handle Border Scaling (Upscale/Downscale everything until final scaling) | 132 // Handle Border Scaling (Upscale/Downscale everything until final scaling) | 
| 135 //---------------------------------------------------------------------------- | 133 //---------------------------------------------------------------------------- | 
| 136 width /= border_scale; | 134 width /= border_scale; | 
| 137 height /= border_scale; | 135 height /= border_scale; | 
| 138 shadow_x /= border_scale; | 136 shadow_x /= border_scale; | 
| 139 shadow_y /= border_scale; | 137 shadow_y /= border_scale; | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 height + shadow_padding_size.height()); | 208 height + shadow_padding_size.height()); | 
| 211 gfx::Size border_size(width + border_padding_size.width() * side_border_scale, | 209 gfx::Size border_size(width + border_padding_size.width() * side_border_scale, | 
| 212 height + border_padding_size.height()); | 210 height + border_padding_size.height()); | 
| 213 gfx::Size contour_size( | 211 gfx::Size contour_size( | 
| 214 width + contour_padding_size.width() * side_border_scale, | 212 width + contour_padding_size.width() * side_border_scale, | 
| 215 height + contour_padding_size.height()); | 213 height + contour_padding_size.height()); | 
| 216 gfx::Size close_button_size(close_btn_width, border_padding.y()); | 214 gfx::Size close_button_size(close_btn_width, border_padding.y()); | 
| 217 gfx::Size title_size(width - close_btn_effective_width, border_padding.y()); | 215 gfx::Size title_size(width - close_btn_effective_width, border_padding.y()); | 
| 218 gfx::Size back_logo_size; | 216 gfx::Size back_logo_size; | 
| 219 // TODO(clholgat): Figure out why the back logo is null sometimes. | 217 // TODO(clholgat): Figure out why the back logo is null sometimes. | 
| 220 if (back_logo_resource) | 218 if (back_visible) { | 
| 221 back_logo_size = back_logo_resource->size; | 219 back_logo_resource = | 
| 220 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, | |
| 
Maria
2015/07/01 21:46:24
indent + 2
 
zbowling_chromium
2015/07/01 22:21:29
Done.
 | |
| 221 back_logo_resource_id); | |
| 222 if (back_logo_resource) | |
| 223 back_logo_size = back_logo_resource->size; | |
| 224 } | |
| 222 | 225 | 
| 223 // Store this size at a point as it might go negative during the inset | 226 // Store this size at a point as it might go negative during the inset | 
| 224 // calculations. | 227 // calculations. | 
| 225 gfx::Point desired_content_size_pt( | 228 gfx::Point desired_content_size_pt( | 
| 226 descaled_local_content_area.width(), | 229 descaled_local_content_area.width(), | 
| 227 descaled_local_content_area.height() - toolbar_impact_height); | 230 descaled_local_content_area.height() - toolbar_impact_height); | 
| 228 | 231 | 
| 229 // Shrink the toolbar layer so we properly clip if it's offset. | 232 // Shrink the toolbar layer so we properly clip if it's offset. | 
| 230 gfx::Size toolbar_size( | 233 gfx::Size toolbar_size( | 
| 231 toolbar_layer_->layer()->bounds().width(), | 234 toolbar_layer_->layer()->bounds().width(), | 
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 title_->AddChild(layer); | 582 title_->AddChild(layer); | 
| 580 } | 583 } | 
| 581 } | 584 } | 
| 582 | 585 | 
| 583 if (title) | 586 if (title) | 
| 584 title->SetUIResourceIds(); | 587 title->SetUIResourceIds(); | 
| 585 } | 588 } | 
| 586 | 589 | 
| 587 } // namespace android | 590 } // namespace android | 
| 588 } // namespace chrome | 591 } // namespace chrome | 
| OLD | NEW |