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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2268323003: Initialize RWHV with default bounds rather than only size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed brackets Created 4 years, 3 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 void RenderWidgetHostViewAndroid::WasResized() { 379 void RenderWidgetHostViewAndroid::WasResized() {
380 if (delegated_frame_host_ && content_view_core_) 380 if (delegated_frame_host_ && content_view_core_)
381 delegated_frame_host_->UpdateContainerSizeinDIP( 381 delegated_frame_host_->UpdateContainerSizeinDIP(
382 content_view_core_->GetViewportSizeDip()); 382 content_view_core_->GetViewportSizeDip());
383 host_->WasResized(); 383 host_->WasResized();
384 } 384 }
385 385
386 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { 386 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) {
387 // Ignore the given size as only the Java code has the power to 387 // Ignore the given size as only the Java code has the power to
388 // resize the view on Android. 388 // resize the view on Android.
389 default_size_ = size; 389 default_bounds_ = gfx::Rect(default_bounds_.origin(), size);
390 } 390 }
391 391
392 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) { 392 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) {
393 SetSize(rect.size()); 393 default_bounds_ = rect;
394 } 394 }
395 395
396 void RenderWidgetHostViewAndroid::GetScaledContentBitmap( 396 void RenderWidgetHostViewAndroid::GetScaledContentBitmap(
397 float scale, 397 float scale,
398 SkColorType preferred_color_type, 398 SkColorType preferred_color_type,
399 gfx::Rect src_subrect, 399 gfx::Rect src_subrect,
400 const ReadbackRequestCallback& result_callback) { 400 const ReadbackRequestCallback& result_callback) {
401 if (!host_ || host_->is_hidden() || !IsSurfaceAvailableForCopy()) { 401 if (!host_ || host_->is_hidden() || !IsSurfaceAvailableForCopy()) {
402 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); 402 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE);
403 return; 403 return;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 return; 541 return;
542 } 542 }
543 while (locks_on_frame_count_ > 0) { 543 while (locks_on_frame_count_ > 0) {
544 UnlockCompositingSurface(); 544 UnlockCompositingSurface();
545 } 545 }
546 RunAckCallbacks(); 546 RunAckCallbacks();
547 } 547 }
548 548
549 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { 549 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const {
550 if (!content_view_core_) 550 if (!content_view_core_)
551 return gfx::Rect(default_size_); 551 return default_bounds_;
552 552
553 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 553 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
554 switches::kEnableOSKOverscroll)) 554 switches::kEnableOSKOverscroll))
555 return gfx::Rect(content_view_core_->GetViewSizeWithOSKHidden()); 555 return gfx::Rect(content_view_core_->GetViewSizeWithOSKHidden());
556 556
557 return gfx::Rect(content_view_core_->GetViewSize()); 557 return gfx::Rect(content_view_core_->GetViewSize());
558 } 558 }
559 559
560 gfx::Size RenderWidgetHostViewAndroid::GetVisibleViewportSize() const { 560 gfx::Size RenderWidgetHostViewAndroid::GetVisibleViewportSize() const {
561 if (!content_view_core_) 561 if (!content_view_core_)
562 return default_size_; 562 return default_bounds_.size();
563 563
564 return content_view_core_->GetViewSize(); 564 return content_view_core_->GetViewSize();
565 } 565 }
566 566
567 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { 567 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const {
568 if (!content_view_core_) 568 if (!content_view_core_) {
569 return gfx::Size(); 569 if (default_bounds_.IsEmpty()) return gfx::Size();
no sievers 2016/08/26 21:35:02 nit: newline before 'return'
Yusuf 2016/08/26 23:26:25 Done.
570 return gfx::Size(default_bounds_.right()
571 * ui::GetScaleFactorForNativeView(GetNativeView()),
572 default_bounds_.bottom()
573 * ui::GetScaleFactorForNativeView(GetNativeView()));
574 }
570 575
571 return content_view_core_->GetPhysicalBackingSize(); 576 return content_view_core_->GetPhysicalBackingSize();
572 } 577 }
573 578
574 bool RenderWidgetHostViewAndroid::DoTopControlsShrinkBlinkSize() const { 579 bool RenderWidgetHostViewAndroid::DoTopControlsShrinkBlinkSize() const {
575 // Whether or not Blink's viewport size should be shrunk by the height of the 580 // Whether or not Blink's viewport size should be shrunk by the height of the
576 // URL-bar. 581 // URL-bar.
577 return content_view_core_ && 582 return content_view_core_ &&
578 content_view_core_->DoTopControlsShrinkBlinkSize(); 583 content_view_core_->DoTopControlsShrinkBlinkSize();
579 } 584 }
580 585
581 float RenderWidgetHostViewAndroid::GetTopControlsHeight() const { 586 float RenderWidgetHostViewAndroid::GetTopControlsHeight() const {
582 if (!content_view_core_) 587 if (!content_view_core_)
583 return 0.f; 588 return default_bounds_.x();
584 589
585 // The height of the top controls. 590 // The height of the top controls.
586 return content_view_core_->GetTopControlsHeightDip(); 591 return content_view_core_->GetTopControlsHeightDip();
587 } 592 }
588 593
589 float RenderWidgetHostViewAndroid::GetBottomControlsHeight() const { 594 float RenderWidgetHostViewAndroid::GetBottomControlsHeight() const {
590 if (!content_view_core_) 595 if (!content_view_core_)
591 return 0.f; 596 return 0.f;
592 597
593 // The height of the top controls. 598 // The height of the top controls.
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 case ui::MotionEvent::ACTION_UP: 1867 case ui::MotionEvent::ACTION_UP:
1863 case ui::MotionEvent::ACTION_POINTER_UP: 1868 case ui::MotionEvent::ACTION_POINTER_UP:
1864 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1869 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1865 delta.InMicroseconds(), 1, 1000000, 50); 1870 delta.InMicroseconds(), 1, 1000000, 50);
1866 default: 1871 default:
1867 return; 1872 return;
1868 } 1873 }
1869 } 1874 }
1870 1875
1871 } // namespace content 1876 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698