Move idempotent text autosizing to StyleTreeResolver
[WebKit-https.git] / Source / WebCore / ChangeLog
index 98153c3..2f0b8ff 100644 (file)
@@ -1,3 +1,71 @@
+2019-05-28  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Move idempotent text autosizing to StyleTreeResolver
+        https://bugs.webkit.org/show_bug.cgi?id=197808
+        <rdar://problem/50283983>
+
+        Reviewed by Antti Koivisto.
+
+        This patch migrates the idempotent text autosizing code to live inside style resolution. This is almost
+        the same as the algorithm that uses the result of layout to calculate autosizing, but this version only
+        operates on style (and thus doesn't require double layouts). Because it is being run in an environment
+        with less information, autosizing is occurring in more places, so the curves have been adjusted to make
+        autosizing not boost as much as the previous implementation did. The new algorithm is modelled after
+        text-decorations-in-effect. I've claimed 4 of the unused bits in RenderStyle to contain the state of the
+        autosizing algorithm. StyleResolver::adjustRenderStyle() is where the algorithm is implemented:
+        - Look at the inherited bits
+        - Interogate the element's RenderStyle
+        - Compute new bits for the element, and set them in its RenderStyle
+        - Based on the newly computed bits, determine whether we should increase the text size
+        - If so, determine how much using the specified font size, and apply the result to the computed font size
+
+        This works because StyleBuilderCustom::applyInheritFontSize() inherits from the specified font size, not
+        the computed font size.
+
+        This patch also will disable autosizing using the other methods (so there aren't two methods of autosizing
+        fighting each other) and will honor text-size-adjust:none. However, it won't honor text-size-adjust:100%.
+        If content says text-size-adjust:100%, we will disregard it and take this code path.
+
+        Tests: fast/text-autosizing/ios/idempotentmode/css-exposure.html
+               fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html
+               fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-identity.html
+               fast/text-autosizing/ios/idempotentmode/idempotent-autosizing.html
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
+        * css/CSSProperties.json:
+        * css/StyleBuilderCustom.h:
+        (WebCore::computeBaseSpecifiedFontSize):
+        (WebCore::computeLineHeightMultiplierDueToFontSize):
+        * css/StyleResolver.cpp:
+        (WebCore::idempotentTextSize):
+        (WebCore::hasTextChildren):
+        (WebCore::StyleResolver::adjustRenderStyle):
+        (WebCore::StyleResolver::checkForTextSizeAdjust):
+        * page/FrameViewLayoutContext.cpp:
+        (WebCore::FrameViewLayoutContext::applyTextSizingIfNeeded):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::adjustComputedFontSizes):
+        (WebCore::idempotentTextSize): Deleted.
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::includeNonFixedHeight):
+        (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
+        (WebCore::RenderElement::resetTextAutosizing):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::RenderStyle):
+        (WebCore::RenderStyle::autosizeStatus const):
+        (WebCore::RenderStyle::setAutosizeStatus):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/TextSizeAdjustment.cpp: Added.
+        (WebCore::AutosizeStatus::AutosizeStatus):
+        (WebCore::AutosizeStatus::contains const):
+        (WebCore::AutosizeStatus::modifiedStatus const):
+        (WebCore::AutosizeStatus::shouldSkipSubtree const):
+        * rendering/style/TextSizeAdjustment.h:
+
 2019-05-28  Simon Fraser  <simon.fraser@apple.com>
 
         Use scroll-velocity-based tile coverage for overflow:scroll