WebKit Bugzilla
Attachment 371964 Details for
Bug 198763
: [Text autosizing] [iPadOS] Revise our heuristics to determine idempotent text autosizing candidates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP patch
bug-198763-20190612085616.patch (text/plain), 11.74 KB, created by
Wenson Hsieh
on 2019-06-12 08:56:16 PDT
(
hide
)
Description:
WIP patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-06-12 08:56:16 PDT
Size:
11.74 KB
patch
obsolete
>Subversion Revision: 246352 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7d5cbac01982ba42101375ce91b6b903f6c8f0c2..9620178384d78aacbfa8afca1a97bc5a2c930e76 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2019-06-11 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [Text autosizing] google.com search results show inconsistent sizing in the footer on 10-inch iPads >+ https://bugs.webkit.org/show_bug.cgi?id=198763 >+ <rdar://problem/51324136> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html >+ >+ * css/StyleResolver.cpp: >+ (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing): >+ (WebCore::StyleResolver::adjustRenderStyle): >+ * css/StyleResolver.h: >+ * rendering/style/RenderStyle.h: >+ * rendering/style/TextSizeAdjustment.cpp: >+ (WebCore::AutosizeStatus::updateStatus): >+ (WebCore::AutosizeStatus::shouldSkipSubtree const): >+ * rendering/style/TextSizeAdjustment.h: >+ > 2019-06-12 Carlos Garcia Campos <cgarcia@igalia.com> > > [cairo][SVG] Putting multiple path elements in clippath causes rendering artifacts >diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp >index ddd9414e524cd09700d0d812ae46aea72af67984..a489d6b48e400dcd5d9574fdf021602ba581b2c8 100644 >--- a/Source/WebCore/css/StyleResolver.cpp >+++ b/Source/WebCore/css/StyleResolver.cpp >@@ -877,9 +877,9 @@ static bool hasTextChildren(const Element& element) > return false; > } > >-void StyleResolver::adjustRenderStyleForTextAutosizing(RenderStyle& style, const Element& element) >+void StyleResolver::adjustRenderStyleForTextAutosizing(RenderStyle& style, const Element& element, const RenderStyle& parentStyle) > { >- auto newAutosizeStatus = AutosizeStatus::updateStatus(style); >+ auto newAutosizeStatus = AutosizeStatus::updateStatus(style, parentStyle); > if (!settings().textAutosizingEnabled() || !settings().textAutosizingUsesIdempotentMode()) > return; > >@@ -1152,7 +1152,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& par > > if (element) { > #if ENABLE(TEXT_AUTOSIZING) >- adjustRenderStyleForTextAutosizing(style, *element); >+ adjustRenderStyleForTextAutosizing(style, *element, parentStyle); > #endif > adjustRenderStyleForSiteSpecificQuirks(style, *element); > } >diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h >index 2a34b26d71b245f613b261f351f2740cc584945e..032822961379516c75ab6920e05162b0a99df24e 100644 >--- a/Source/WebCore/css/StyleResolver.h >+++ b/Source/WebCore/css/StyleResolver.h >@@ -500,7 +500,7 @@ private: > // the last reference to a style declaration are garbage collected. > void sweepMatchedPropertiesCache(); > >- void adjustRenderStyleForTextAutosizing(RenderStyle&, const Element&); >+ void adjustRenderStyleForTextAutosizing(RenderStyle&, const Element&, const RenderStyle& parentStyle); > > typedef HashMap<unsigned, MatchedPropertiesCacheItem> MatchedPropertiesCache; > MatchedPropertiesCache m_matchedPropertiesCache; >diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h >index 2c55d012de2be8d7903908d1e641d2dc52f78afd..45aad0239a1c99a9bf8006a4e6dd75bebe0510c6 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.h >+++ b/Source/WebCore/rendering/style/RenderStyle.h >@@ -1834,9 +1834,9 @@ private: > // 48 bits > > #if ENABLE(TEXT_AUTOSIZING) >- unsigned autosizeStatus : 4; >+ unsigned autosizeStatus : 5; > #endif >- // 52 bits >+ // 53 bits > }; > > // This constructor is used to implement the replace operation. >diff --git a/Source/WebCore/rendering/style/TextSizeAdjustment.cpp b/Source/WebCore/rendering/style/TextSizeAdjustment.cpp >index 020027800f62a1c8b4305946a7f79d31b7c63a81..d749e8e453b7d1965975c0f8a1b817883f183062 100644 >--- a/Source/WebCore/rendering/style/TextSizeAdjustment.cpp >+++ b/Source/WebCore/rendering/style/TextSizeAdjustment.cpp >@@ -42,7 +42,7 @@ bool AutosizeStatus::contains(Fields fields) const > return m_fields.contains(fields); > } > >-AutosizeStatus AutosizeStatus::updateStatus(RenderStyle& style) >+AutosizeStatus AutosizeStatus::updateStatus(RenderStyle& style, const RenderStyle& parentStyle) > { > OptionSet<Fields> result = style.autosizeStatus().fields(); > if (style.hasOutOfFlowPosition()) >@@ -57,15 +57,26 @@ AutosizeStatus AutosizeStatus::updateStatus(RenderStyle& style) > default: // FIXME: Add more cases. > break; > } >- if (style.height().isFixed()) >- result.add(Fields::FoundFixedHeight); >+ if (style.height().isFixed() || parentStyle.autosizeStatus().contains(Fields::InsideFixedHeight)) >+ result.add(Fields::InsideFixedHeight); >+ if (style.width().isFixed() || parentStyle.autosizeStatus().contains(Fields::InsideFixedWidth)) >+ result.add(Fields::InsideFixedWidth); > style.setAutosizeStatus(result); > return result; > } > > bool AutosizeStatus::shouldSkipSubtree() const > { >- return m_fields.containsAny({ Fields::FoundOutOfFlowPosition, Fields::FoundInlineBlock, Fields::FoundFixedHeight, Fields::FoundDisplayNone }); >+ if (m_fields.containsAny({ Fields::FoundDisplayNone, Fields::FoundOutOfFlowPosition})) >+ return true; >+ >+ if (m_fields.containsAll({ Fields::InsideFixedWidth, Fields::InsideFixedHeight })) >+ return true; >+ >+ if (m_fields.contains(Fields::FoundInlineBlock) && m_fields.containsAny({ Fields::InsideFixedWidth, Fields::InsideFixedHeight })) >+ return true; >+ >+ return false; > } > > float AutosizeStatus::idempotentTextSize(float specifiedSize, float pageScale) >diff --git a/Source/WebCore/rendering/style/TextSizeAdjustment.h b/Source/WebCore/rendering/style/TextSizeAdjustment.h >index 9f6b3fb88b15702a2879ccf335f8f3b132462959..7d2253d415c385c9a0e667cbdeb07412dbbde578 100644 >--- a/Source/WebCore/rendering/style/TextSizeAdjustment.h >+++ b/Source/WebCore/rendering/style/TextSizeAdjustment.h >@@ -54,8 +54,9 @@ public: > enum class Fields : uint8_t { > FoundOutOfFlowPosition = 1 << 0, > FoundInlineBlock = 1 << 1, >- FoundFixedHeight = 1 << 2, >- FoundDisplayNone = 1 << 3 >+ FoundDisplayNone = 1 << 2, >+ InsideFixedWidth = 1 << 3, >+ InsideFixedHeight = 1 << 4, > // Adding new values requires giving RenderStyle::InheritedFlags::autosizeStatus additional bits. > }; > >@@ -66,7 +67,7 @@ public: > bool shouldSkipSubtree() const; > > static float idempotentTextSize(float specifiedSize, float pageScale); >- static AutosizeStatus updateStatus(RenderStyle&); >+ static AutosizeStatus updateStatus(RenderStyle&, const RenderStyle& parentStyle); > > private: > OptionSet<Fields> m_fields; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index bca917983e1985dd03195fd96cf5475206b873ea..4c8d2aeda7c35c7087f9e8323ea1b5a18b0f6b26 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-06-11 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [Text autosizing] google.com search results show inconsistent sizing in the footer on 10-inch iPads >+ https://bugs.webkit.org/show_bug.cgi?id=198763 >+ <rdar://problem/51324136> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip-expected.txt: >+ * fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html: >+ > 2019-06-12 Carlos Garcia Campos <cgarcia@igalia.com> > > [cairo][SVG] Putting multiple path elements in clippath causes rendering artifacts >diff --git a/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip-expected.txt b/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip-expected.txt >index 339d190531fc8a37b8587023f8594e3c031d4757..b19c41d1d17c7e2b752ac9a089e43be2c2802dbf 100644 >--- a/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip-expected.txt >+++ b/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip-expected.txt >@@ -1,11 +1,23 @@ >+Checking target1: > PASS result is >= 13 >+Checking target2: > PASS result is >= 13 >+Checking target3: > PASS result is 12 >+Checking target4: > PASS result is 12 >+Checking target5: > PASS result is 12 >+Checking target6: > PASS result is 12 >+Checking target7: > PASS result is >= result2 >+Checking target8: > PASS result is >= 13 >+Checking target9: >+PASS result is >= 13 >+Checking target10: >+PASS result is 12 > PASS successfullyParsed is true > > TEST COMPLETE >@@ -16,3 +28,5 @@ Test > Test > TestTestTestTest > Test >+Test >+Test >diff --git a/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html b/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html >index 90cfa6d727a4b10a14e04bd20c83c8281425d0ea..dfef4e7f77f0be04000caae6c62b2c4f8c0cd200 100644 >--- a/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html >+++ b/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html >@@ -11,32 +11,36 @@ if (window.internals) { > <script src="../../../../resources/js-test-pre.js"></script> > </head> > <body> >-<div style="background: green;"><span id="target" style="font-size: 12px;">Test</span></div> >+<div style="background: green;"><span id="target1" style="font-size: 12px;">Test</span></div> > <div style="background: green; overflow: auto;"><span id="target2" style="float: right; font-size: 12px;">Test</span></div> >-<div style="background: green;"><span id="target3" style="display: inline-block; font-size: 12px;">Test</span></div> >-<div style="background: green;"><span style="display: inline-block; font-size: 12px;"><span id="target4">Test</span></span></div> >+<div style="background: green;"><span id="target3" style="display: inline-block; font-size: 12px; width: 20px;">Test</span></div> >+<div style="background: green;"><span style="display: inline-block; height: 12px; font-size: 12px;"><span id="target4">Test</span></span></div> > <div style="background: green;"><span id="target5" style="position: absolute; left: 0px; top: 0px; font-size: 12px;">Test</span></div> > <div style="background: green;"><span id="target6" style="display: none; font-size: 12px;">Test</span></div> > <div style="background: green;"><span id="comparison" style="font-size: 12px;">Test<span>Test<span>Test<span id="target7">Test</span></span></span></span></div> > <div style="background: green;"><span id="target8" style="font-size: 12px; -webkit-text-size-adjust: 100%">Test</span></div> >+<div style="background: green;"><span id="target9" style="font-size: 12px; display: inline-block;">Test</span></div> >+<div style="background: green;"><span id="target10" style="font-size: 12px; width: 20px; height: 12px;">Test</span></div> > <script> > let result; > function check(name, shouldGetAutosized) { > let target = document.getElementById(name); > target.offsetWidth; > result = Number.parseInt(window.getComputedStyle(target).getPropertyValue("font-size")); >+ debug(`Checking ${name}:`); > if (shouldGetAutosized) > shouldBeGreaterThanOrEqual("result", "13"); > else > shouldBe("result", "12"); > } >-check("target", true); >+check("target1", true); > check("target2", true); > check("target3", false); > check("target4", false); > check("target5", false); > check("target6", false); > >+debug(`Checking target7:`); > let target = document.getElementById("target7"); > target.offsetWidth; > let comparison = document.getElementById("comparison"); >@@ -46,6 +50,8 @@ let result2 = Number.parseInt(window.getComputedStyle(comparison).getPropertyVal > shouldBeGreaterThanOrEqual("result", "result2"); > > check("target8", true); >+check("target9", true); >+check("target10", false); > </script> > <script src="../../../../resources/js-test-post.js"></script> > </body>
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 198763
:
371964
|
372807
|
372811
|
372817