Commit 690c84bd authored by Carlos IL's avatar Carlos IL Committed by Commit Bot

Added overrides in interstitial_page_impl

Added overrides for GetTopControlsHeight, GetBottomControlsHeight, and
DoBrowserControlsShrinkBlinkSize to
InterstitalPageImpl::InterstitialPageRVHDelegateView. The lack of those
overrides was causing hit testing errors on Android for interstitials.

Bug: 825765
Change-Id: If88506529a8eb3a8cb665edaa6416eeb4e3f8281
Reviewed-on: https://chromium-review.googlesource.com/1101397Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Carlos IL <carlosil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567439}
parent c51db4c0
...@@ -90,6 +90,9 @@ class InterstitialPageImpl::InterstitialPageRVHDelegateView ...@@ -90,6 +90,9 @@ class InterstitialPageImpl::InterstitialPageRVHDelegateView
void GotFocus(RenderWidgetHostImpl* render_widget_host) override; void GotFocus(RenderWidgetHostImpl* render_widget_host) override;
void LostFocus(RenderWidgetHostImpl* render_widget_host) override; void LostFocus(RenderWidgetHostImpl* render_widget_host) override;
void TakeFocus(bool reverse) override; void TakeFocus(bool reverse) override;
int GetTopControlsHeight() const override;
int GetBottomControlsHeight() const override;
bool DoBrowserControlsShrinkBlinkSize() const override;
virtual void OnFindReply(int request_id, virtual void OnFindReply(int request_id,
int number_of_matches, int number_of_matches,
const gfx::Rect& selection_rect, const gfx::Rect& selection_rect,
...@@ -986,6 +989,39 @@ void InterstitialPageImpl::InterstitialPageRVHDelegateView::TakeFocus( ...@@ -986,6 +989,39 @@ void InterstitialPageImpl::InterstitialPageRVHDelegateView::TakeFocus(
web_contents->GetDelegateView()->TakeFocus(reverse); web_contents->GetDelegateView()->TakeFocus(reverse);
} }
int InterstitialPageImpl::InterstitialPageRVHDelegateView::
GetTopControlsHeight() const {
if (!interstitial_page_->web_contents())
return 0;
WebContentsImpl* web_contents =
static_cast<WebContentsImpl*>(interstitial_page_->web_contents());
if (!web_contents || !web_contents->GetDelegateView())
return 0;
return web_contents->GetDelegateView()->GetTopControlsHeight();
}
int InterstitialPageImpl::InterstitialPageRVHDelegateView::
GetBottomControlsHeight() const {
if (!interstitial_page_->web_contents())
return 0;
WebContentsImpl* web_contents =
static_cast<WebContentsImpl*>(interstitial_page_->web_contents());
if (!web_contents || !web_contents->GetDelegateView())
return 0;
return web_contents->GetDelegateView()->GetBottomControlsHeight();
}
bool InterstitialPageImpl::InterstitialPageRVHDelegateView::
DoBrowserControlsShrinkBlinkSize() const {
if (!interstitial_page_->web_contents())
return false;
WebContentsImpl* web_contents =
static_cast<WebContentsImpl*>(interstitial_page_->web_contents());
if (!web_contents || !web_contents->GetDelegateView())
return false;
return web_contents->GetDelegateView()->DoBrowserControlsShrinkBlinkSize();
}
void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply(
int request_id, int number_of_matches, const gfx::Rect& selection_rect, int request_id, int number_of_matches, const gfx::Rect& selection_rect,
int active_match_ordinal, bool final_update) { int active_match_ordinal, bool final_update) {
......
...@@ -1242,16 +1242,6 @@ bool RenderWidgetHostViewAndroid::UpdateControls( ...@@ -1242,16 +1242,6 @@ bool RenderWidgetHostViewAndroid::UpdateControls(
float top_controls_shown_ratio, float top_controls_shown_ratio,
float bottom_controls_height, float bottom_controls_height,
float bottom_controls_shown_ratio) { float bottom_controls_shown_ratio) {
// TODO(carlosil, https://crbug.com/825765): Remove the IsInVR() check here,
// which is a temporary hack. Interstitial pages are not committed navigations
// and their metadata updates never leave the content layer, so Chrome and the
// content layer end up mismatched and hit testing is offset. They rely on the
// previous (erroneous) behavior of ignoring the initial control offset update
// if offset is 0. The fix is still crucial for VR as VR needs the top
// controls to be initially hidden correctly (so we don't want the offset of 0
// to get ignored. Tracking bug for the interstitial work to fix this by
// converting interstitials to committed navigations is
// https://crbug.com/755632.
float to_pix = IsUseZoomForDSFEnabled() ? 1.f : dip_scale; float to_pix = IsUseZoomForDSFEnabled() ? 1.f : dip_scale;
float top_controls_pix = top_controls_height * to_pix; float top_controls_pix = top_controls_height * to_pix;
// |top_content_offset| is in physical pixels if --use-zoom-for-dsf is // |top_content_offset| is in physical pixels if --use-zoom-for-dsf is
...@@ -1262,7 +1252,7 @@ bool RenderWidgetHostViewAndroid::UpdateControls( ...@@ -1262,7 +1252,7 @@ bool RenderWidgetHostViewAndroid::UpdateControls(
float top_shown_pix = top_content_offset * to_pix; float top_shown_pix = top_content_offset * to_pix;
float top_translate = top_shown_pix - top_controls_pix; float top_translate = top_shown_pix - top_controls_pix;
bool top_changed = !FloatEquals(top_shown_pix, prev_top_shown_pix_); bool top_changed = !FloatEquals(top_shown_pix, prev_top_shown_pix_);
if (top_changed || (!controls_initialized_ && IsInVR())) if (top_changed || !controls_initialized_)
view_.OnTopControlsChanged(top_translate, top_shown_pix); view_.OnTopControlsChanged(top_translate, top_shown_pix);
prev_top_shown_pix_ = top_shown_pix; prev_top_shown_pix_ = top_shown_pix;
prev_top_controls_translate_ = top_translate; prev_top_controls_translate_ = top_translate;
...@@ -1271,7 +1261,7 @@ bool RenderWidgetHostViewAndroid::UpdateControls( ...@@ -1271,7 +1261,7 @@ bool RenderWidgetHostViewAndroid::UpdateControls(
float bottom_shown_pix = bottom_controls_pix * bottom_controls_shown_ratio; float bottom_shown_pix = bottom_controls_pix * bottom_controls_shown_ratio;
bool bottom_changed = !FloatEquals(bottom_shown_pix, prev_bottom_shown_pix_); bool bottom_changed = !FloatEquals(bottom_shown_pix, prev_bottom_shown_pix_);
float bottom_translate = bottom_controls_pix - bottom_shown_pix; float bottom_translate = bottom_controls_pix - bottom_shown_pix;
if (bottom_changed || (!controls_initialized_ && IsInVR())) if (bottom_changed || !controls_initialized_)
view_.OnBottomControlsChanged(bottom_translate, bottom_shown_pix); view_.OnBottomControlsChanged(bottom_translate, bottom_shown_pix);
prev_bottom_shown_pix_ = bottom_shown_pix; prev_bottom_shown_pix_ = bottom_shown_pix;
prev_bottom_controls_translate_ = bottom_translate; prev_bottom_controls_translate_ = bottom_translate;
...@@ -1906,17 +1896,6 @@ void RenderWidgetHostViewAndroid::SetIsInVR(bool is_in_vr) { ...@@ -1906,17 +1896,6 @@ void RenderWidgetHostViewAndroid::SetIsInVR(bool is_in_vr) {
touch_selection_controller_ = CreateSelectionController( touch_selection_controller_ = CreateSelectionController(
touch_selection_controller_client_manager_.get(), view_.parent()); touch_selection_controller_client_manager_.get(), view_.parent());
} }
if (is_in_vr_ && controls_initialized_) {
// TODO(carlosil, https://crbug.com/825765): See the TODO in
// RenderWidgetHostViewAndroid::OnFrameMetadataUpdated. RWHVA isn't
// initialized with VR state so the initial frame metadata top controls
// height can be dropped when a new RWHVA is created.
view_.OnTopControlsChanged(prev_top_controls_translate_,
prev_top_shown_pix_);
view_.OnBottomControlsChanged(prev_bottom_controls_translate_,
prev_bottom_shown_pix_);
}
} }
bool RenderWidgetHostViewAndroid::IsInVR() const { bool RenderWidgetHostViewAndroid::IsInVR() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment