WebKit Bugzilla
Attachment 373140 Details for
Bug 199318
: [Text autosizing] bing.com is hard to read even with boosted text because of the line height
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199318-20190628123142.patch (text/plain), 6.59 KB, created by
zalan
on 2019-06-28 12:31:43 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-06-28 12:31:43 PDT
Size:
6.59 KB
patch
obsolete
>Subversion Revision: 246924 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0e9bd6338db5ced000d13aacc8bbc50a0e148697..5e2f16de8c9877fe17a877ca012a8334c6471dbe 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2019-06-28 Zalan Bujtas <zalan@apple.com> >+ >+ [Text autosizing][iPadOS] bing.com is hard to read even with boosted text because of the line height >+ https://bugs.webkit.org/show_bug.cgi?id=199318 >+ <rdar://problem/51826096> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Initial implementation of line height boosting on iPadOs. It enlarges line height in certain cases to improve readability when the text content feels too dense. >+ It kicks in only for relatively small text (12px) where it slightly (1.25x) changes the line height to widen the gap between lines. >+ >+ * css/StyleResolver.cpp: >+ (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing): >+ > 2019-06-28 Fujii Hironori <Hironori.Fujii@sony.com> > > [Win] unresolved external symbol "JSC::JSObject::didBecomePrototype(void)" referenced in function "JSC::Structure::create(...)" >diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp >index ad9d3bb065c601f6838d4e679ecfc16d5c24a235..15bfbe85a9e289676a20335e787774b3d7372245 100644 >--- a/Source/WebCore/css/StyleResolver.cpp >+++ b/Source/WebCore/css/StyleResolver.cpp >@@ -892,14 +892,32 @@ void StyleResolver::adjustRenderStyleForTextAutosizing(RenderStyle& style, const > if (style.textSizeAdjust().isNone()) > return; > >+ float initialScale = document().page() ? document().page()->initialScale() : 1; >+ auto adjustLineHeightIfNeeded = [&](auto computedFontSize) { >+ auto lineHeight = style.specifiedLineHeight(); >+ constexpr static unsigned eligibleFontSize = 12; >+ if (computedFontSize * initialScale >= eligibleFontSize) >+ return; >+ >+ constexpr static float boostFactor = 1.25; >+ auto minimumLineHeight = boostFactor * computedFontSize; >+ if (!lineHeight.isFixed() || lineHeight.value() >= minimumLineHeight) >+ return; >+ >+ style.setLineHeight({ minimumLineHeight, Fixed }); >+ }; >+ > if (!style.isIdempotentTextAutosizingCandidate()) >- return; >+ return adjustLineHeightIfNeeded(style.computedFontSize()); > >- float initialScale = document().page() ? document().page()->initialScale() : 1; > auto fontDescription = style.fontDescription(); >- fontDescription.setComputedSize(AutosizeStatus::idempotentTextSize(fontDescription.specifiedSize(), initialScale)); >+ auto initialComputedFontSize = fontDescription.computedSize(); >+ auto adjustedFontSize = AutosizeStatus::idempotentTextSize(fontDescription.specifiedSize(), initialScale); >+ fontDescription.setComputedSize(adjustedFontSize); > style.setFontDescription(WTFMove(fontDescription)); > style.fontCascade().update(&document().fontSelector()); >+ if (initialComputedFontSize != adjustedFontSize) >+ adjustLineHeightIfNeeded(adjustedFontSize); > } > #endif > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 039dd1f6a0151c9a91959468da1349f4e53d1109..a866316ddfed87ffb028c3043514a155a8d21d17 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-06-28 Zalan Bujtas <zalan@apple.com> >+ >+ [Text autosizing][iPadOS] bing.com is hard to read even with boosted text because of the line height >+ https://bugs.webkit.org/show_bug.cgi?id=199318 >+ <rdar://problem/51826096> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/text-autosizing/ios/idempotentmode/line-height-boosting-expected.txt: Added. >+ * fast/text-autosizing/ios/idempotentmode/line-height-boosting.html: Added. >+ > 2019-06-27 Ryosuke Niwa <rniwa@webkit.org> > > Fix the test added in r246868 on iOS debug simulator. >diff --git a/LayoutTests/fast/text-autosizing/ios/idempotentmode/line-height-boosting-expected.txt b/LayoutTests/fast/text-autosizing/ios/idempotentmode/line-height-boosting-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2ac793545a4667a85301d7784eb74a4c84af34e2 >--- /dev/null >+++ b/LayoutTests/fast/text-autosizing/ios/idempotentmode/line-height-boosting-expected.txt >@@ -0,0 +1,13 @@ >+PASS result is >= 18 >+PASS result is >= 13 >+PASS result is >= 11 >+PASS result is >= 12 >+PASS result is >= 18 >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+yes line-height boost >+yes line-height boost >+yes line-height boost >+no line-height boost >+no line-height boost >diff --git a/LayoutTests/fast/text-autosizing/ios/idempotentmode/line-height-boosting.html b/LayoutTests/fast/text-autosizing/ios/idempotentmode/line-height-boosting.html >new file mode 100644 >index 0000000000000000000000000000000000000000..bdc3fd1fa3e3938a36b4f9c3cc6db6eb4fc16e97 >--- /dev/null >+++ b/LayoutTests/fast/text-autosizing/ios/idempotentmode/line-height-boosting.html >@@ -0,0 +1,38 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] --> >+<html> >+<head> >+<meta name="viewport" content="initial-scale=0.6666"> >+<script> >+if (window.internals) { >+ window.internals.settings.setTextAutosizingEnabled(true); >+ window.internals.settings.setTextAutosizingUsesIdempotentMode(true); >+} >+</script> >+<script src="../../../../resources/js-test-pre.js"></script> >+</head> >+<body> >+<div><span id=target1 style="font-size: 12px; line-height: 10px">yes line-height boost</span></div> >+<div><span id=target2 style="font-size: 8px; line-height: 2px">yes line-height boost</span></div> >+<div><span id=target3 style="font-size: 6px; line-height: 10px">yes line-height boost</span></div> >+<div><span id=target4 style="font-size: 6px; line-height: 12px">no line-height boost</span></div> >+<div><span id=target5 style="font-size: 18px;">no line-height boost</span></div> >+<script> >+document.body.offsetHeight; >+let result = Number.parseInt(window.getComputedStyle(target1).getPropertyValue("line-height")); >+shouldBeGreaterThanOrEqual("result", "18"); >+ >+result = Number.parseInt(window.getComputedStyle(target2).getPropertyValue("line-height")); >+shouldBeGreaterThanOrEqual("result", "13"); >+ >+result = Number.parseInt(window.getComputedStyle(target3).getPropertyValue("line-height")); >+shouldBeGreaterThanOrEqual("result", "11"); >+ >+result = Number.parseInt(window.getComputedStyle(target4).getPropertyValue("line-height")); >+shouldBeGreaterThanOrEqual("result", "12"); >+ >+result = Number.parseInt(window.getComputedStyle(target5).getPropertyValue("line-height")); >+shouldBeGreaterThanOrEqual("result", "18"); >+</script> >+<script src="../../../../resources/js-test-post.js"></script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199318
:
373109
| 373140