Commit 4170f3f7 authored by Lu Chen's avatar Lu Chen Committed by Commit Bot

Add recording of the root document height.

Add recording of AnchorElementMetrics.Clicked.RatioRootHeight.

Bug: 850624
Change-Id: Ia5ff57cc729cf7d577a59967f473c50da99e1e3b
Reviewed-on: https://chromium-review.googlesource.com/1157282Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Lu Chen <chelu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579906}
parent da23ca67
......@@ -182,6 +182,8 @@ base::Optional<AnchorElementMetrics> AnchorElementMetrics::Create(
->GetScrollableArea()
->ContentsSize()
.Height();
float ratio_root_height = root_height / base_height;
int root_scrolled =
root_frame_view->LayoutViewport()->ScrollOffsetInt().Height();
float ratio_distance_root_bottom =
......@@ -199,7 +201,7 @@ base::Optional<AnchorElementMetrics> AnchorElementMetrics::Create(
return AnchorElementMetrics(
anchor_element, ratio_area, ratio_visible_area,
ratio_distance_top_to_visible_top, ratio_distance_center_to_visible_top,
ratio_distance_root_top, ratio_distance_root_bottom,
ratio_distance_root_top, ratio_distance_root_bottom, ratio_root_height,
IsInIFrame(*anchor_element), ContainsImage(*anchor_element),
IsSameHost(*anchor_element), IsUrlIncrementedByOne(*anchor_element));
}
......@@ -311,6 +313,10 @@ void AnchorElementMetrics::RecordMetricsOnClick() const {
"AnchorElementMetrics.Clicked.RatioDistanceRootBottom",
static_cast<int>(std::min(ratio_distance_root_bottom_, 100.0f) * 100));
UMA_HISTOGRAM_COUNTS_10000(
"AnchorElementMetrics.Clicked.RatioRootHeight",
static_cast<int>(std::min(ratio_root_height_, 100.0f) * 100));
UMA_HISTOGRAM_BOOLEAN("AnchorElementMetrics.Clicked.IsInIFrame",
is_in_iframe_);
......
......@@ -88,6 +88,9 @@ class CORE_EXPORT AnchorElementMetrics {
// height.
const float ratio_distance_root_bottom_;
// The hight of the root document, divided by the viewport height.
const float ratio_root_height_;
// Whether the anchor element is within an iframe.
const bool is_in_iframe_;
......@@ -108,6 +111,7 @@ class CORE_EXPORT AnchorElementMetrics {
float ratio_distance_center_to_visible_top,
float ratio_distance_root_top,
float ratio_distance_root_bottom,
float ratio_root_height,
bool is_in_iframe,
bool contains_image,
bool is_same_host,
......@@ -120,6 +124,7 @@ class CORE_EXPORT AnchorElementMetrics {
ratio_distance_center_to_visible_top),
ratio_distance_root_top_(ratio_distance_root_top),
ratio_distance_root_bottom_(ratio_distance_root_bottom),
ratio_root_height_(ratio_root_height),
is_in_iframe_(is_in_iframe),
contains_image_(contains_image),
is_same_host_(is_same_host),
......
......@@ -717,6 +717,16 @@ uploading your change for review.
</summary>
</histogram>
<histogram name="AnchorElementMetrics.Clicked.RatioRootHeight" units="%">
<owner>chelu@chromium.org</owner>
<owner>tbansal@chromium.org</owner>
<summary>
The ratio between the height of the root document and the height of the
viewport times 100. This histogram is recorded when the anchor element is
clicked.
</summary>
</histogram>
<histogram name="AnchorElementMetrics.Clicked.RatioSameHost_DiffHost" units="%">
<owner>chelu@chromium.org</owner>
<owner>tbansal@chromium.org</owner>
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