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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 476113004: Replace overdraw_bottom_height with top_controls_layout_height. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // All positions and sizes are in CSS pixels. 372 // All positions and sizes are in CSS pixels.
373 // Note that viewport_width/height is a best effort based. 373 // Note that viewport_width/height is a best effort based.
374 // ContentViewCore has the actual information about the physical viewport size. 374 // ContentViewCore has the actual information about the physical viewport size.
375 void ContentViewCoreImpl::UpdateFrameInfo( 375 void ContentViewCoreImpl::UpdateFrameInfo(
376 const gfx::Vector2dF& scroll_offset, 376 const gfx::Vector2dF& scroll_offset,
377 float page_scale_factor, 377 float page_scale_factor,
378 const gfx::Vector2dF& page_scale_factor_limits, 378 const gfx::Vector2dF& page_scale_factor_limits,
379 const gfx::SizeF& content_size, 379 const gfx::SizeF& content_size,
380 const gfx::SizeF& viewport_size, 380 const gfx::SizeF& viewport_size,
381 const gfx::Vector2dF& controls_offset, 381 const gfx::Vector2dF& controls_offset,
382 const gfx::Vector2dF& content_offset, 382 const gfx::Vector2dF& content_offset) {
383 float overdraw_bottom_height) {
384 JNIEnv* env = AttachCurrentThread(); 383 JNIEnv* env = AttachCurrentThread();
385 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 384 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
386 if (obj.is_null()) 385 if (obj.is_null())
387 return; 386 return;
388 387
389 window_android_->set_content_offset( 388 window_android_->set_content_offset(
390 gfx::ScaleVector2d(content_offset, dpi_scale_)); 389 gfx::ScaleVector2d(content_offset, dpi_scale_));
391 390
392 Java_ContentViewCore_updateFrameInfo( 391 Java_ContentViewCore_updateFrameInfo(
393 env, obj.obj(), 392 env, obj.obj(),
394 scroll_offset.x(), 393 scroll_offset.x(),
395 scroll_offset.y(), 394 scroll_offset.y(),
396 page_scale_factor, 395 page_scale_factor,
397 page_scale_factor_limits.x(), 396 page_scale_factor_limits.x(),
398 page_scale_factor_limits.y(), 397 page_scale_factor_limits.y(),
399 content_size.width(), 398 content_size.width(),
400 content_size.height(), 399 content_size.height(),
401 viewport_size.width(), 400 viewport_size.width(),
402 viewport_size.height(), 401 viewport_size.height(),
403 controls_offset.y(), 402 controls_offset.y(),
404 content_offset.y(), 403 content_offset.y());
405 overdraw_bottom_height);
406 } 404 }
407 405
408 void ContentViewCoreImpl::SetTitle(const base::string16& title) { 406 void ContentViewCoreImpl::SetTitle(const base::string16& title) {
409 JNIEnv* env = AttachCurrentThread(); 407 JNIEnv* env = AttachCurrentThread();
410 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 408 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
411 if (obj.is_null()) 409 if (obj.is_null())
412 return; 410 return;
413 ScopedJavaLocalRef<jstring> jtitle = 411 ScopedJavaLocalRef<jstring> jtitle =
414 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); 412 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title));
415 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); 413 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj());
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const { 759 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const {
762 return gfx::ToCeiledSize( 760 return gfx::ToCeiledSize(
763 gfx::ScaleSize(GetViewportSizePix(), 1.0f / dpi_scale())); 761 gfx::ScaleSize(GetViewportSizePix(), 1.0f / dpi_scale()));
764 } 762 }
765 763
766 gfx::Size ContentViewCoreImpl::GetViewportSizeOffsetDip() const { 764 gfx::Size ContentViewCoreImpl::GetViewportSizeOffsetDip() const {
767 return gfx::ToCeiledSize( 765 return gfx::ToCeiledSize(
768 gfx::ScaleSize(GetViewportSizeOffsetPix(), 1.0f / dpi_scale())); 766 gfx::ScaleSize(GetViewportSizeOffsetPix(), 1.0f / dpi_scale()));
769 } 767 }
770 768
771 float ContentViewCoreImpl::GetOverdrawBottomHeightDip() const {
772 JNIEnv* env = AttachCurrentThread();
773 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
774 if (j_obj.is_null())
775 return 0.f;
776 return Java_ContentViewCore_getOverdrawBottomHeightPix(env, j_obj.obj())
777 / dpi_scale();
778 }
779
780 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { 769 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) {
781 root_layer_->InsertChild(layer, 0); 770 root_layer_->InsertChild(layer, 0);
782 root_layer_->SetIsDrawable(false); 771 root_layer_->SetIsDrawable(false);
783 } 772 }
784 773
785 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) { 774 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) {
786 layer->RemoveFromParent(); 775 layer->RemoveFromParent();
787 776
788 if (!root_layer_->children().size()) 777 if (!root_layer_->children().size())
789 root_layer_->SetIsDrawable(true); 778 root_layer_->SetIsDrawable(true);
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 reinterpret_cast<ui::WindowAndroid*>(window_android), 1512 reinterpret_cast<ui::WindowAndroid*>(window_android),
1524 retained_objects_set); 1513 retained_objects_set);
1525 return reinterpret_cast<intptr_t>(view); 1514 return reinterpret_cast<intptr_t>(view);
1526 } 1515 }
1527 1516
1528 bool RegisterContentViewCore(JNIEnv* env) { 1517 bool RegisterContentViewCore(JNIEnv* env) {
1529 return RegisterNativesImpl(env); 1518 return RegisterNativesImpl(env);
1530 } 1519 }
1531 1520
1532 } // namespace content 1521 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698