Title: [219543] trunk
- Revision
- 219543
- Author
- mmaxfi...@apple.com
- Date
- 2017-07-15 22:52:30 -0700 (Sat, 15 Jul 2017)
Log Message
line-height: <number> gets visually applied twice when text autosizing is in effect
https://bugs.webkit.org/show_bug.cgi?id=174536
<rdar://problem/33338259>
Reviewed by Simon Fraser.
Source/WebCore:
StyleBuilderConverter::convertLineHeight() converts line-height: <number> into a
"percentage" length. Then, when layout needs to know what the computed value of
line-height is, RenderStyle::computedLineHeight() multiplies this percentage by
the computed font size.
With autosizing, the computed font size already incorporates the autosizing
multiplier, so we shouldn't also incorporate this multiplier into the percentage
value itself. getComputedStyle()'s lineHeightFromStyle() was compensating for
this double application by multiplying the percentage by the font-size's specified
value instead of its computed value, which is incorrect.
Test: fast/text-autosizing/line-height-number.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::lineHeightFromStyle):
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertLineHeight):
LayoutTests:
* fast/text-autosizing/line-height-number-expected.html: Added.
* fast/text-autosizing/line-height-number.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (219542 => 219543)
--- trunk/LayoutTests/ChangeLog 2017-07-16 04:47:03 UTC (rev 219542)
+++ trunk/LayoutTests/ChangeLog 2017-07-16 05:52:30 UTC (rev 219543)
@@ -1,3 +1,14 @@
+2017-07-15 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ line-height: <number> gets visually applied twice when text autosizing is in effect
+ https://bugs.webkit.org/show_bug.cgi?id=174536
+ <rdar://problem/33338259>
+
+ Reviewed by Simon Fraser.
+
+ * fast/text-autosizing/line-height-number-expected.html: Added.
+ * fast/text-autosizing/line-height-number.html: Added.
+
2017-07-14 Zan Dobersek <zdober...@igalia.com>
[GCrypt] Implement CryptoKeyRSA PKCS#8 exports
Added: trunk/LayoutTests/fast/text-autosizing/line-height-number-expected.html (0 => 219543)
--- trunk/LayoutTests/fast/text-autosizing/line-height-number-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text-autosizing/line-height-number-expected.html 2017-07-16 05:52:30 UTC (rev 219543)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that text-size-adjust only gets applied once to line-height.
+<div style="font-size: 75px; line-height: 1.20; width: 1px; border: 3px solid green;">asdf asdf</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text-autosizing/line-height-number.html (0 => 219543)
--- trunk/LayoutTests/fast/text-autosizing/line-height-number.html (rev 0)
+++ trunk/LayoutTests/fast/text-autosizing/line-height-number.html 2017-07-16 05:52:30 UTC (rev 219543)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals) {
+ internals.settings.setTextAutosizingEnabled(true);
+ internals.settings.setTextAutosizingWindowSizeOverride(320, 480);
+}
+</script>
+</head>
+<body>
+This test makes sure that text-size-adjust only gets applied once to line-height.
+<div style="font-size: 50px; -webkit-text-size-adjust: 150%; line-height: 1.20; width: 1px; border: 3px solid green;">asdf asdf</div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (219542 => 219543)
--- trunk/Source/WebCore/ChangeLog 2017-07-16 04:47:03 UTC (rev 219542)
+++ trunk/Source/WebCore/ChangeLog 2017-07-16 05:52:30 UTC (rev 219543)
@@ -1,3 +1,29 @@
+2017-07-15 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ line-height: <number> gets visually applied twice when text autosizing is in effect
+ https://bugs.webkit.org/show_bug.cgi?id=174536
+ <rdar://problem/33338259>
+
+ Reviewed by Simon Fraser.
+
+ StyleBuilderConverter::convertLineHeight() converts line-height: <number> into a
+ "percentage" length. Then, when layout needs to know what the computed value of
+ line-height is, RenderStyle::computedLineHeight() multiplies this percentage by
+ the computed font size.
+
+ With autosizing, the computed font size already incorporates the autosizing
+ multiplier, so we shouldn't also incorporate this multiplier into the percentage
+ value itself. getComputedStyle()'s lineHeightFromStyle() was compensating for
+ this double application by multiplying the percentage by the font-size's specified
+ value instead of its computed value, which is incorrect.
+
+ Test: fast/text-autosizing/line-height-number.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::lineHeightFromStyle):
+ * css/StyleBuilderConverter.h:
+ (WebCore::StyleBuilderConverter::convertLineHeight):
+
2017-07-15 Wenson Hsieh <wenson_hs...@apple.com>
[iOS WK2] Presenting an action sheet on an image map prevents selection UI from updating
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (219542 => 219543)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2017-07-16 04:47:03 UTC (rev 219542)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2017-07-16 05:52:30 UTC (rev 219543)
@@ -1971,7 +1971,7 @@
// for how high to be in pixels does include things like minimum font size and the zoom factor.
// On the other hand, since font-size doesn't include the zoom factor, we really can't do
// that here either.
- return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style.fontDescription().specifiedSize()) / 100, style);
+ return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style.fontDescription().computedSize()) / 100, style);
}
return zoomAdjustedPixelValue(floatValueForLength(length, 0), style);
}
Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (219542 => 219543)
--- trunk/Source/WebCore/css/StyleBuilderConverter.h 2017-07-16 04:47:03 UTC (rev 219542)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h 2017-07-16 05:52:30 UTC (rev 219543)
@@ -1446,7 +1446,7 @@
return Length((styleResolver.style()->computedFontSize() * primitiveValue.intValue()) / 100, Fixed);
}
if (primitiveValue.isNumber())
- return Length(primitiveValue.doubleValue() * multiplier * 100.0, Percent);
+ return Length(primitiveValue.doubleValue() * 100.0, Percent);
// FIXME: The parser should only emit the above types, so this should never be reached. We should change the
// type of this function to return just a Length (and not an Optional).
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes