AP9-163: the setting of text scaling doesn't work.

This ensures that when we change Settings->Accessibility->Text scaling,
will work on all web pages.
This commit is contained in:
Yifeng Wu 2021-11-19 16:32:01 +08:00
parent 53f5138269
commit a55b5c834f
2 changed files with 56 additions and 0 deletions

View file

@ -169,3 +169,4 @@ Force-tablet-mode.patch
Set-default-page-url.patch
change-Android-userAgent-to-deskmode-userAgent.patch
Force-desktop-mode.patch
Force-accessibility-text-scaling.patch

View file

@ -0,0 +1,55 @@
From: Yifeng <wuyifeng@nd.com.cn>
Date: Fri, 5 Nov 2021 05:53:00 +0000
Subject: Force accessibility text scaling
This ensures that when we set text scaling, it will work on all web pages.
---
third_party/blink/renderer/core/layout/text_autosizer.cc | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/third_party/blink/renderer/core/layout/text_autosizer.cc b/third_party/blink/renderer/core/layout/text_autosizer.cc
--- a/third_party/blink/renderer/core/layout/text_autosizer.cc
+++ b/third_party/blink/renderer/core/layout/text_autosizer.cc
@@ -668,14 +668,14 @@
// TODO(pdr): pageNeedsAutosizing should take into account whether
// text-size-adjust is used anywhere on the page because that also needs to
// trigger autosizing. See: crbug.com/646237.
page_info_.page_needs_autosizing_ =
!!page_info_.shared_info_.main_frame_width &&
(page_info_.accessibility_font_scale_factor_ *
page_info_.shared_info_.device_scale_adjustment *
(static_cast<float>(
page_info_.shared_info_.main_frame_layout_width) /
page_info_.shared_info_.main_frame_width) >
- 1.0f);
+ 0.0f);
}
if (page_info_.page_needs_autosizing_) {
@@ -1208,23 +1208,21 @@
void TextAutosizer::ApplyMultiplier(LayoutObject* layout_object,
float multiplier,
SubtreeLayoutScope* layouter,
RelayoutBehavior relayout_behavior) {
DCHECK(layout_object);
const ComputedStyle& current_style = layout_object->StyleRef();
if (!current_style.GetTextSizeAdjust().IsAuto()) {
// The accessibility font scale factor is applied by the autosizer so we
// need to apply that scale factor on top of the text-size-adjust
// multiplier. Only apply the accessibility factor if the autosizer has
// determined a multiplier should be applied so that text-size-adjust:none
// does not cause a multiplier to be applied when it wouldn't be otherwise.
- bool should_apply_accessibility_font_scale_factor = multiplier > 1;
multiplier = current_style.GetTextSizeAdjust().Multiplier();
- if (should_apply_accessibility_font_scale_factor)
- multiplier *= page_info_.accessibility_font_scale_factor_;
} else if (multiplier < 1) {
// Unlike text-size-adjust, the text autosizer should only inflate fonts.
multiplier = 1;
}
+ multiplier *= page_info_.accessibility_font_scale_factor_;
if (current_style.TextAutosizingMultiplier() == multiplier)
return;
2.17.1