Commit c31527fa authored by Daniel Libby's avatar Daniel Libby Committed by Commit Bot

Add UseCounter for applied zoom values that are not 1

This will give us more insight into how frequently this happens as well
as give us more accurate sites via HTTP Archive. The current data just
shows when zoom not equal to one is parsed.

R=ikilpatrick@chromium.org

Bug: 1067747
Change-Id: Idfcc600b802e35955dc85705b7248b29f89863fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422355Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniel Libby <dlibby@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#809241}
parent 81582d4c
......@@ -2906,6 +2906,8 @@ enum WebFeature {
kIdentifiabilityStudyReserved3576 = 3576,
kIdentifiabilityStudyReserved3577 = 3577,
kCascadedCSSZoomNotEqualToOne = 3578,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
// Also, run update_use_counter_feature_enum.py in
......
......@@ -22,6 +22,7 @@
#include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h"
#include "third_party/blink/public/mojom/web_feature/web_feature.mojom-blink.h"
#include "third_party/blink/renderer/core/animation/css/css_animations.h"
#include "third_party/blink/renderer/core/css/css_light_dark_value_pair.h"
#include "third_party/blink/renderer/core/css/css_property_value_set.h"
......@@ -169,6 +170,9 @@ void StyleResolverState::SetZoom(float f) {
style_->SetZoom(f);
if (f != 1.f)
GetDocument().CountUse(WebFeature::kCascadedCSSZoomNotEqualToOne);
if (style_->SetEffectiveZoom(parent_effective_zoom * f))
font_builder_.DidChangeEffectiveZoom();
}
......
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style id="style">
* { zoom: 1; }
body { zoom: 100%; }
</style>
<body>
<script>
'use strict';
test(() => {
let kCSSZoomNotEqualToOne = 691;
let kCascadedCSSZoomNotEqualToOne = 3578;
// Force a cascade
getComputedStyle(document.body);
assert_false(internals.isUseCounted(document, kCSSZoomNotEqualToOne));
assert_false(internals.isUseCounted(document, kCascadedCSSZoomNotEqualToOne));
let style = document.getElementById('style');
style.textContent = "* { zoom: 2; }"
assert_equals(getComputedStyle(document.body).zoom, "2");
assert_true(internals.isUseCounted(document, kCSSZoomNotEqualToOne));
assert_true(internals.isUseCounted(document, kCascadedCSSZoomNotEqualToOne));
}, 'CSS `zoom` property use counted for parsing and cascade.');
</script>
......@@ -29323,6 +29323,7 @@ Called by update_use_counter_feature_enum.py.-->
<int value="3575" label="IdentifiabilityStudyReserved3575"/>
<int value="3576" label="IdentifiabilityStudyReserved3576"/>
<int value="3577" label="IdentifiabilityStudyReserved3577"/>
<int value="3578" label="CascadedCSSZoomNotEqualToOne"/>
</enum>
<enum name="FeaturePolicyAllowlistType">
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