Commit e33c6c17 authored by Stefan Zager's avatar Stefan Zager Committed by Commit Bot

[RootLayerScrolls] Fix logic for computing screen distance of iframe

BUG=823365
R=skobes@chromium.org,sclittle@chromium.org

Change-Id: I400bae2f5a35075b06e42a2b2796772c3a0a687f
Reviewed-on: https://chromium-review.googlesource.com/1107164Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568878}
parent dc599fc6
...@@ -4559,20 +4559,17 @@ void LocalFrameView::RecordDeferredLoadingStats() { ...@@ -4559,20 +4559,17 @@ void LocalFrameView::RecordDeferredLoadingStats() {
return; return;
} }
IntRect parent_rect = parent->FrameRect(); IntSize parent_size(parent->Size());
// First clause: for this rough data collection we assume the user never // First clause: for this rough data collection we assume the user never
// scrolls right. // scrolls right.
if (frame_rect.X() >= parent_rect.Width() || parent_rect.Height() <= 0) if (frame_rect.X() >= parent_size.Width() || parent_size.Height() <= 0)
return; return;
int this_frame_screens_away = 0; int this_frame_screens_away = 0;
// If an frame is created above the current scoll position, this logic counts // If an frame is created above the current scoll position, this logic counts
// it as visible. // it as visible.
if (frame_rect.Y() > parent->GetScrollOffset().Height()) { if (frame_rect.Y() > 0)
this_frame_screens_away = this_frame_screens_away = frame_rect.Y() / parent_size.Height();
(frame_rect.Y() - parent->GetScrollOffset().Height()) /
parent_rect.Height();
}
DCHECK_GE(this_frame_screens_away, 0); DCHECK_GE(this_frame_screens_away, 0);
int parent_screens_away = 0; int parent_screens_away = 0;
......
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