Title: [222696] branches/safari-604-branch

Diff

Modified: branches/safari-604-branch/LayoutTests/ChangeLog (222695 => 222696)


--- branches/safari-604-branch/LayoutTests/ChangeLog	2017-10-02 03:17:18 UTC (rev 222695)
+++ branches/safari-604-branch/LayoutTests/ChangeLog	2017-10-02 03:33:49 UTC (rev 222696)
@@ -1,3 +1,18 @@
+2017-10-01  Jason Marcell  <[email protected]>
+
+        Cherry-pick r222588. rdar://problem/34717517
+
+    2017-09-27  Myles C. Maxfield  <[email protected]>
+
+            Minimum font size may cause elements to have an infinite line-height
+            https://bugs.webkit.org/show_bug.cgi?id=177573
+            <rdar://problem/34573792>
+
+            Reviewed by Dan Bernstein.
+
+            * fast/text/line-height-minimumFontSize-text-small-font-size-expected.txt: Added.
+            * fast/text/line-height-minimumFontSize-text-small-font-size.html: Added.
+
 2017-09-27  Jason Marcell  <[email protected]>
 
         Cherry-pick r222576. rdar://problem/34553953

Added: branches/safari-604-branch/LayoutTests/fast/text/line-height-minimumFontSize-text-small-font-size-expected.txt (0 => 222696)


--- branches/safari-604-branch/LayoutTests/fast/text/line-height-minimumFontSize-text-small-font-size-expected.txt	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/text/line-height-minimumFontSize-text-small-font-size-expected.txt	2017-10-02 03:33:49 UTC (rev 222696)
@@ -0,0 +1,5 @@
+PASS document.getElementById('target').offsetHeight < 100 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Hi

Added: branches/safari-604-branch/LayoutTests/fast/text/line-height-minimumFontSize-text-small-font-size.html (0 => 222696)


--- branches/safari-604-branch/LayoutTests/fast/text/line-height-minimumFontSize-text-small-font-size.html	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/text/line-height-minimumFontSize-text-small-font-size.html	2017-10-02 03:33:49 UTC (rev 222696)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals) {
+    internals.settings.setMinimumFontSize(32);
+}
+</script>
+<script src=""
+</head>
+<body style="font-size: 16px;">
+<div id="target" style="font-size: 0px; line-height: 1rem;">Hi</div>
+<script>
+shouldBeTrue("document.getElementById('target').offsetHeight < 100");
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (222695 => 222696)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-02 03:17:18 UTC (rev 222695)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-02 03:33:49 UTC (rev 222696)
@@ -1,3 +1,29 @@
+2017-10-01  Jason Marcell  <[email protected]>
+
+        Cherry-pick r222588. rdar://problem/34717517
+
+    2017-09-27  Myles C. Maxfield  <[email protected]>
+
+            Minimum font size may cause elements to have an infinite line-height
+            https://bugs.webkit.org/show_bug.cgi?id=177573
+            <rdar://problem/34573792>
+
+            Reviewed by Dan Bernstein.
+
+            When minimum font size is specified, we were trying to preserve the ratio of specified font-size
+            and specified line-height in order to boost the computed font size proportionately to the font-size
+            boost. However, this doesn't work when the specified font-size is 0, because the ratio between
+            line-height and font-size is infinite.
+
+            The most straightforward solution is just to make small font-sizes opt out of the line-height
+            adjustment because the result would be too big.
+
+            Test: fast/text/line-height-minimumFontSize-text-small-font-size.html
+
+            * css/StyleBuilderCustom.h:
+            (WebCore::computeLineHeightMultiplierDueToFontSize):
+            (WebCore::StyleBuilderCustom::applyValueLineHeight):
+
 2017-09-27  Jason Marcell  <[email protected]>
 
         Cherry-pick r222576. rdar://problem/34553953

Modified: branches/safari-604-branch/Source/WebCore/css/StyleBuilderCustom.h (222695 => 222696)


--- branches/safari-604-branch/Source/WebCore/css/StyleBuilderCustom.h	2017-10-02 03:17:18 UTC (rev 222695)
+++ branches/safari-604-branch/Source/WebCore/css/StyleBuilderCustom.h	2017-10-02 03:33:49 UTC (rev 222696)
@@ -670,7 +670,9 @@
         auto minimumFontSize = document.settings().minimumFontSize();
         if (minimumFontSize > 0) {
             auto specifiedFontSize = computeBaseSpecifiedFontSize(document, style, percentageAutosizingEnabled);
-            if (specifiedFontSize < minimumFontSize) {
+            // Small font sizes cause a preposterously large (near infinity) line-height. Add a fuzz-factor of 1px which opts out of
+            // boosted line-height.
+            if (specifiedFontSize < minimumFontSize && specifiedFontSize >= 1) {
                 // FIXME: There are two settings which are relevant here: minimum font size, and minimum logical font size (as
                 // well as things like the zoom property, text zoom on the page, and text autosizing). The minimum logical font
                 // size is nonzero by default, and already incorporated into the computed font size, so if we just use the ratio
@@ -706,11 +708,8 @@
         auto multiplier = computeLineHeightMultiplierDueToFontSize(styleResolver.document(), *styleResolver.style(), primitiveValue);
         if (multiplier == 1)
             computedLineHeight = lineHeight.value();
-        else {
-            std::optional<Length> lineHeight = StyleBuilderConverter::convertLineHeight(styleResolver, value, multiplier);
-            ASSERT(static_cast<bool>(lineHeight));
-            computedLineHeight = lineHeight.value();
-        }
+        else
+            computedLineHeight = StyleBuilderConverter::convertLineHeight(styleResolver, value, multiplier).value();
     }
 
     styleResolver.style()->setLineHeight(WTFMove(computedLineHeight));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to