Changeset 246348 in webkit
- Timestamp:
- Jun 11, 2019 9:51:10 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r246347 r246348 1 2019-06-11 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Idempotent text autosizing needs to react properly to viewport changes 4 https://bugs.webkit.org/show_bug.cgi?id=198736 5 <rdar://problem/50591911> 6 7 Reviewed by Zalan Bujtas. 8 9 Add a new layout test that programmatically adjusts the meta viewport initial scale, and dumps the resulting 10 computed sizes of several paragraphs of text, after adjusting for text autosizing. 11 12 * fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-after-changing-initial-scale-expected.txt: Added. 13 * fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-after-changing-initial-scale.html: Added. 14 1 15 2019-06-11 Zalan Bujtas <zalan@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r246343 r246348 1 2019-06-11 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Idempotent text autosizing needs to react properly to viewport changes 4 https://bugs.webkit.org/show_bug.cgi?id=198736 5 <rdar://problem/50591911> 6 7 Reviewed by Zalan Bujtas. 8 9 Minor refactoring and some adjustments around StyleResolver::adjustRenderStyleForTextAutosizing. See below for 10 more details, as well as the WebKit ChangeLog. 11 12 Test: fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-after-changing-initial-scale.html 13 14 * css/StyleResolver.cpp: 15 (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing): 16 17 Rewrite this using early return statements, to make it easier to debug why elements fall out of text autosizing. 18 Additionally, this function currently bails if the initial scale is exactly 1, whereas we can really avoid text 19 autosizing in the case where the initial scale is at least 1; handle this by making idempotentTextSize return 20 immediately with the specified size, in the case where the scale is at least 1. 21 22 Lastly, remove the null check for element by making this method take an Element&, and only call this from 23 adjustRenderStyle if the element is nonnull (which matches adjustRenderStyleForSiteSpecificQuirks). 24 25 (WebCore::StyleResolver::adjustRenderStyle): 26 * css/StyleResolver.h: 27 * rendering/style/TextSizeAdjustment.cpp: 28 (WebCore::AutosizeStatus::idempotentTextSize): 29 1 30 2019-06-11 Timothy Hatcher <timothy@apple.com> 2 31 -
trunk/Source/WebCore/css/StyleResolver.cpp
r246285 r246348 878 878 } 879 879 880 void StyleResolver::adjustRenderStyleForTextAutosizing(RenderStyle& style, const Element *element)880 void StyleResolver::adjustRenderStyleForTextAutosizing(RenderStyle& style, const Element& element) 881 881 { 882 882 auto newAutosizeStatus = AutosizeStatus::updateStatus(style); 883 auto pageScale = document().page() ? document().page()->initialScale() : 1.0f; 884 if (settings().textAutosizingEnabled() && settings().textAutosizingUsesIdempotentMode() && element && !newAutosizeStatus.shouldSkipSubtree() && !style.textSizeAdjust().isNone() && hasTextChildren(*element) && pageScale != 1.0f) { 885 auto fontDescription = style.fontDescription(); 886 fontDescription.setComputedSize(AutosizeStatus::idempotentTextSize(fontDescription.specifiedSize(), pageScale)); 887 style.setFontDescription(WTFMove(fontDescription)); 888 style.fontCascade().update(&document().fontSelector()); 889 } 883 if (!settings().textAutosizingEnabled() || !settings().textAutosizingUsesIdempotentMode()) 884 return; 885 886 if (!hasTextChildren(element)) 887 return; 888 889 if (style.textSizeAdjust().isNone()) 890 return; 891 892 if (newAutosizeStatus.shouldSkipSubtree()) 893 return; 894 895 float initialScale = document().page() ? document().page()->initialScale() : 1; 896 auto fontDescription = style.fontDescription(); 897 fontDescription.setComputedSize(AutosizeStatus::idempotentTextSize(fontDescription.specifiedSize(), initialScale)); 898 style.setFontDescription(WTFMove(fontDescription)); 899 style.fontCascade().update(&document().fontSelector()); 890 900 } 891 901 #endif … … 1141 1151 #endif 1142 1152 1153 if (element) { 1143 1154 #if ENABLE(TEXT_AUTOSIZING) 1144 adjustRenderStyleForTextAutosizing(style,element);1155 adjustRenderStyleForTextAutosizing(style, *element); 1145 1156 #endif 1146 1147 if (element)1148 1157 adjustRenderStyleForSiteSpecificQuirks(style, *element); 1158 } 1149 1159 } 1150 1160 -
trunk/Source/WebCore/css/StyleResolver.h
r245838 r246348 501 501 void sweepMatchedPropertiesCache(); 502 502 503 void adjustRenderStyleForTextAutosizing(RenderStyle&, const Element *);503 void adjustRenderStyleForTextAutosizing(RenderStyle&, const Element&); 504 504 505 505 typedef HashMap<unsigned, MatchedPropertiesCacheItem> MatchedPropertiesCache; -
trunk/Source/WebCore/rendering/style/TextSizeAdjustment.cpp
r245838 r246348 71 71 float AutosizeStatus::idempotentTextSize(float specifiedSize, float pageScale) 72 72 { 73 if (pageScale >= 1) 74 return specifiedSize; 75 73 76 // This describes a piecewise curve when the page scale is 2/3. 74 77 FloatPoint points[] = { {0.0f, 0.0f}, {6.0f, 9.0f}, {14.0f, 17.0f} }; -
trunk/Source/WebKit/ChangeLog
r246347 r246348 1 2019-06-11 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Idempotent text autosizing needs to react properly to viewport changes 4 https://bugs.webkit.org/show_bug.cgi?id=198736 5 <rdar://problem/50591911> 6 7 Reviewed by Zalan Bujtas. 8 9 If idempotent text autosizing is enabled, respond to viewport initial scale changes by forcing a style recalc, 10 since the amount by which idempotent text autosizing boosts font sizes depends on the Page's initial scale. 11 12 * WebProcess/WebPage/WebPage.h: 13 * WebProcess/WebPage/ios/WebPageIOS.mm: 14 (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded): 15 (WebKit::WebPage::viewportConfigurationChanged): 16 1 17 2019-06-11 Zalan Bujtas <zalan@apple.com> 2 18 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r246347 r246348 1245 1245 void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*); 1246 1246 void resetTextAutosizing(); 1247 void resetIdempotentTextAutosizingIfNeeded(double previousInitialScale); 1247 1248 WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement); 1248 1249 RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement); -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r246347 r246348 3334 3334 } 3335 3335 3336 void WebPage::resetIdempotentTextAutosizingIfNeeded(double previousInitialScale) 3337 { 3338 if (!m_page->settings().textAutosizingUsesIdempotentMode()) 3339 return; 3340 3341 const float minimumScaleChangeBeforeRecomputingTextAutosizing = 0.01; 3342 if (std::abs(previousInitialScale - m_page->initialScale()) < minimumScaleChangeBeforeRecomputingTextAutosizing) 3343 return; 3344 3345 if (m_page->initialScale() >= 1 && previousInitialScale >= 1) 3346 return; 3347 3348 m_page->setNeedsRecalcStyleInAllFrames(); 3349 } 3350 3336 3351 void WebPage::viewportConfigurationChanged(ZoomToInitialScale zoomToInitialScale) 3337 3352 { 3353 double previousInitialScale = m_page->initialScale(); 3338 3354 double initialScale = m_viewportConfiguration.initialScale(); 3339 3355 m_page->setInitialScale(initialScale); 3356 resetIdempotentTextAutosizingIfNeeded(previousInitialScale); 3340 3357 3341 3358 if (setFixedLayoutSize(m_viewportConfiguration.layoutSize()))
Note: See TracChangeset
for help on using the changeset viewer.