Bug 1592474 - Report a console warning when we disable scroll anchoring on a scroller. r=dholbert,flod

Depends on D51024

Differential Revision: https://phabricator.services.mozilla.com/D51031

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-10-31 09:19:21 +00:00
Родитель f70cc8c005
Коммит 672ef887fb
2 изменённых файлов: 25 добавлений и 7 удалений

Просмотреть файл

@ -46,3 +46,9 @@ ZoomPropertyWarning=This page uses the non standard property “zoom”. Conside
## LOCALIZATION NOTE(PrincipalWritingModePropagationWarning):
## Do not translate <html>, <body>, CSS, "writing-mode", "direction", "text-orientation", :root, and "The Principal Writing Mode" because they are technical terms.
PrincipalWritingModePropagationWarning=When rendering the <html> element, the used values of CSS properties “writing-mode”, “direction”, and “text-orientation” on the <html> element are taken from the computed values of the <body> element, not from the <html> elements own values. Consider setting these properties on the :root CSS pseudo-class. For more information see “The Principal Writing Mode” in https://www.w3.org/TR/css-writing-modes-3/#principal-flow
## LOCALIZATION NOTE(ScrollAnchoringDisabledInContainer):
## %1$S is an integer value with the total number of adjustments
## %2$S is a floating point value with the average distance adjusted
## %3$S is a floating point value with the total adjusted distance
ScrollAnchoringDisabledInContainer=Scroll anchoring was disabled in a scroll container because of too many consecutive adjustments (%1$S) with too little total distance (%2$S px average, %3$S px total).

Просмотреть файл

@ -328,14 +328,26 @@ void ScrollAnchorContainer::AdjustmentMade(nscoord aAdjustment) {
double average = double(cssPixels) / consecutiveAdjustments;
uint32_t minAverage = StaticPrefs::
layout_css_scroll_anchoring_min_average_adjustment_threshold();
if (MOZ_UNLIKELY(std::abs(average) < double(minAverage))) {
ANCHOR_LOG(
"Disabled scroll anchoring for container: "
"%f average, %f total out of %u consecutive adjustments\n",
average, float(cssPixels), mConsecutiveScrollAnchoringAdjustments);
mDisabled = true;
if (MOZ_LIKELY(std::abs(average) >= double(minAverage))) {
return;
}
mDisabled = true;
ANCHOR_LOG(
"Disabled scroll anchoring for container: "
"%f average, %f total out of %u consecutive adjustments\n",
average, float(cssPixels), consecutiveAdjustments);
AutoTArray<nsString, 3> arguments;
arguments.AppendElement()->AppendInt(consecutiveAdjustments);
arguments.AppendElement()->AppendFloat(average);
arguments.AppendElement()->AppendFloat(cssPixels);
nsContentUtils::ReportToConsole(
nsIScriptError::warningFlag, NS_LITERAL_CSTRING("Layout"),
Frame()->PresContext()->Document(), nsContentUtils::eLAYOUT_PROPERTIES,
"ScrollAnchoringDisabledInContainer", arguments);
}
void ScrollAnchorContainer::SuppressAdjustments() {