Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(941)

Unified Diff: chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc

Issue 2499863002: Simplify content_layer attachment and viewporting logic. (Closed)
Patch Set: Fix clang error Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/compositor/layer/thumbnail_layer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc
diff --git a/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc b/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc
index e407884a7012db2d04819abbf18a4eff8fb98f45..03bc6fee789ac5c0f65c9ea635600e5899e00d1e 100644
--- a/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc
+++ b/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc
@@ -57,9 +57,6 @@ void StaticTabSceneLayer::UpdateTabLayer(
jfloat saturation,
jfloat brightness) {
background_color_ = default_background_color;
- gfx::Size content_viewport_size(content_viewport_width,
- content_viewport_height);
- gfx::Point content_viewport_offset(content_viewport_x, content_viewport_y);
if (!content_layer_.get()) {
android::TabContentManager* tab_content_manager =
android::TabContentManager::FromJavaObject(jtab_content_manager);
@@ -73,40 +70,13 @@ void StaticTabSceneLayer::UpdateTabLayer(
bool should_override_content_alpha = last_set_tab_id_ != id;
last_set_tab_id_ = id;
- // Set up the content layer and move it to the proper position.
- content_layer_->layer()->SetBounds(gfx::Size(width, height));
- content_layer_->layer()->SetPosition(gfx::PointF(x, y));
content_layer_->SetProperties(
id, can_use_live_layer, static_to_view_blend,
should_override_content_alpha, content_alpha_override, saturation,
- gfx::Rect(content_viewport_size), content_viewport_size);
-
- gfx::Size content_bounds(0, 0);
- content_bounds = content_layer_->layer()->bounds();
-
- gfx::Size actual_content_size(content_layer_->GetContentSize());
-
- bool view_and_content_have_same_orientation =
- (content_viewport_size.width() > content_viewport_size.height()) ==
- (actual_content_size.width() > actual_content_size.height()) &&
- actual_content_size.width() > 0 && actual_content_size.height() > 0 &&
- content_viewport_size.width() > 0 && content_viewport_size.height() > 0;
-
- // This may not be true for frames during rotation.
- bool content_has_consistent_width =
- actual_content_size.width() == content_bounds.width() &&
- actual_content_size.width() == content_viewport_size.width();
-
- if (view_and_content_have_same_orientation ||
- (content_has_consistent_width && content_layer_->ShowingLiveLayer())) {
- y += content_offset_y;
- } else {
- // If our orientations are off and we have a static texture, or if we have
- // a live layer of an unexpected width, move the texture in by the
- // appropriate amount.
- x += content_viewport_offset.x();
- y += content_viewport_offset.y();
- }
+ false, gfx::Rect());
+
+ x += content_viewport_x;
+ y += content_offset_y;
content_layer_->layer()->SetPosition(gfx::PointF(x, y));
content_layer_->layer()->SetIsDrawable(true);
« no previous file with comments | « chrome/browser/android/compositor/layer/thumbnail_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698