Diff
Modified: trunk/LayoutTests/ChangeLog (158713 => 158714)
--- trunk/LayoutTests/ChangeLog 2013-11-06 03:50:51 UTC (rev 158713)
+++ trunk/LayoutTests/ChangeLog 2013-11-06 03:55:02 UTC (rev 158714)
@@ -1,3 +1,16 @@
+2013-11-05 Ryosuke Niwa <[email protected]>
+
+ getComputedStyle(x).lineHeight is affected by zooming
+ https://bugs.webkit.org/show_bug.cgi?id=123847
+
+ Reviewed by Benjamin Poulain.
+
+ Cleaned up the test.
+
+ * fast/css/line-height-zoom-get-computed-style-expected.txt: Added.
+ * fast/css/line-height-zoom-get-computed-style.html: Added.
+ * platform/mac-mountainlion/fast/forms/textAreaLineHeight-expected.txt: Rebaselined.
+
2013-11-05 James Craig <[email protected]>
AX: media controls accessibility needs more work
Added: trunk/LayoutTests/fast/css/line-height-zoom-get-computed-style-expected.txt (0 => 158714)
--- trunk/LayoutTests/fast/css/line-height-zoom-get-computed-style-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/line-height-zoom-get-computed-style-expected.txt 2013-11-06 03:55:02 UTC (rev 158714)
@@ -0,0 +1,12 @@
+This tests that page zoom and getComputedStyle of line-height works well together. To test manually, open this page in a browser window, and zoom-in and reload repeatedly. This text should get bigger at each step proportionately but the line-height value should stay constant.On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS 12.00 is 12.00
+PASS 12.00 is 12.00
+PASS 12.00 is 12.00
+PASS 12.00 is 12.00
+PASS 12.00 is 12.00
+PASS 12.00 is 12.00
+PASS 12.00 is 12.00
+PASS 12.00 is 12.00
+PASS 12.00 is 12.00
+PASS 12.00 is 12.00
+text of font-size 10px with 120% line height.
Added: trunk/LayoutTests/fast/css/line-height-zoom-get-computed-style.html (0 => 158714)
--- trunk/LayoutTests/fast/css/line-height-zoom-get-computed-style.html (rev 0)
+++ trunk/LayoutTests/fast/css/line-height-zoom-get-computed-style.html 2013-11-06 03:55:02 UTC (rev 158714)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+p {
+ display: inline-block;
+ background-color: #000;
+ color: #fff;
+ font-family: Ahem;
+ font-size: 10px;
+ line-height: 120%;
+}
+</style>
+</head>
+<body _onload_="runTest()">
+<p id="test">text of font-size 10px with 120% line height.</p>
+<script src=""
+<script>
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+description('This tests that page zoom and getComputedStyle of line-height works well together.\n'
+ + 'To test manually, open this page in a browser window, and zoom-in and reload repeatedly.\n'
+ + 'This text should get bigger at each step proportionately but the line-height value should stay constant.');
+
+function runTest()
+{
+ var testElement = document.getElementById('test');
+
+ if (!window.eventSender) {
+ log("Line height is" + " : " + parseFloat(document.defaultView.getComputedStyle(testElement, null).lineHeight).toFixed(2));
+ return;
+ }
+
+ for (var i = 0; i < 10; i++) {
+ eventSender.zoomPageIn();
+ var lineHeight = parseFloat(document.defaultView.getComputedStyle(testElement, null).lineHeight).toFixed(2);
+ shouldBe(lineHeight, '12.00');
+ }
+}
+
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac-mountainlion/fast/forms/textAreaLineHeight-expected.txt (158713 => 158714)
--- trunk/LayoutTests/platform/mac-mountainlion/fast/forms/textAreaLineHeight-expected.txt 2013-11-06 03:50:51 UTC (rev 158713)
+++ trunk/LayoutTests/platform/mac-mountainlion/fast/forms/textAreaLineHeight-expected.txt 2013-11-06 03:55:02 UTC (rev 158714)
@@ -18,18 +18,18 @@
RenderText {#text} at (0,246) size 152x18
text run at (0,246) width 152: "PARAGRAPH - works"
RenderBlock {P} at (0,314) size 402x202 [border: (1px dotted #C0C0C0)]
- RenderText {#text} at (1,19) size 382x68
+ RenderText {#text} at (1,19) size 382x69
text run at (1,19) width 382: "Demo text here that wraps a bit and should demonstrate"
- text run at (1,71) width 182: "the goodness of line-height"
+ text run at (1,72) width 182: "the goodness of line-height"
RenderBlock (anonymous) at (0,529) size 769x36
RenderBR {BR} at (0,0) size 0x18
RenderText {#text} at (0,18) size 81x18
text run at (0,18) width 81: "DIV - works"
RenderBR {BR} at (81,18) size 0x18
RenderBlock {DIV} at (0,565) size 402x202 [border: (1px dotted #C0C0C0)]
- RenderText {#text} at (1,19) size 382x68
+ RenderText {#text} at (1,19) size 382x69
text run at (1,19) width 382: "Demo text here that wraps a bit and should demonstrate"
- text run at (1,71) width 182: "the goodness of line-height"
+ text run at (1,72) width 182: "the goodness of line-height"
RenderBlock (anonymous) at (0,767) size 769x416
RenderBR {BR} at (0,0) size 0x18
RenderBR {BR} at (0,18) size 0x18
@@ -54,11 +54,11 @@
RenderBlock {P} at (0,1199) size 769x0
layer at (8,60) size 406x206 clip at (9,61) size 404x204
RenderTextControl {TEXTAREA} at (0,18) size 406x206 [bgcolor=#FFFFFF] [border: (1px dotted #C0C0C0)]
- RenderBlock {DIV} at (3,3) size 400x104
- RenderText {#text} at (0,18) size 387x68
+ RenderBlock {DIV} at (3,3) size 400x106
+ RenderText {#text} at (0,18) size 387x69
text run at (0,18) width 382: "Demo text here that wraps a bit and should demonstrate"
text run at (382,18) width 5: " "
- text run at (0,70) width 182: "the goodness of line-height"
+ text run at (0,71) width 182: "the goodness of line-height"
layer at (10,831) size 161x32 clip at (11,832) size 144x30 scrollHeight 56
RenderTextControl {TEXTAREA} at (2,56) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 140x52
@@ -75,4 +75,4 @@
RenderBlock {DIV} at (3,3) size 155x13
layer at (8,981) size 406x206 clip at (9,982) size 404x204
RenderTextControl {TEXTAREA} at (0,206) size 406x206 [bgcolor=#FFFFFF] [border: (1px dotted #C0C0C0)]
- RenderBlock {DIV} at (3,3) size 400x52
+ RenderBlock {DIV} at (3,3) size 400x53
Modified: trunk/Source/WebCore/ChangeLog (158713 => 158714)
--- trunk/Source/WebCore/ChangeLog 2013-11-06 03:50:51 UTC (rev 158713)
+++ trunk/Source/WebCore/ChangeLog 2013-11-06 03:55:02 UTC (rev 158714)
@@ -1,3 +1,19 @@
+2013-11-05 Ryosuke Niwa <[email protected]>
+
+ getComputedStyle(x).lineHeight is affected by zooming
+ https://bugs.webkit.org/show_bug.cgi?id=123847
+
+ Reviewed by Benjamin Poulain.
+
+ Merge https://chromium.googlesource.com/chromium/blink/+/7957097afbab2899ababd0d9c8acbf6e3eddb870
+
+ Test: fast/css/line-height-zoom-get-computed-style.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::lineHeightFromStyle): Don't round line-height values.
+ * css/DeprecatedStyleBuilder.cpp:
+ (WebCore::ApplyPropertyLineHeight::applyValue): Use the computed value instead of the used value.
+
2013-11-05 James Craig <[email protected]>
AX: media controls accessibility needs more work
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (158713 => 158714)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2013-11-06 03:50:51 UTC (rev 158713)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2013-11-06 03:55:02 UTC (rev 158714)
@@ -1563,7 +1563,7 @@
// 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(valueForLength(length, 0, renderView), style);
+ return zoomAdjustedPixelValue(floatValueForLength(length, 0, renderView), style);
}
static PassRefPtr<CSSPrimitiveValue> fontSizeFromStyle(RenderStyle* style)
Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (158713 => 158714)
--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2013-11-06 03:50:51 UTC (rev 158713)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2013-11-06 03:55:02 UTC (rev 158714)
@@ -1444,7 +1444,7 @@
lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
} else if (primitiveValue->isPercentage()) {
// FIXME: percentage should not be restricted to an integer here.
- lineHeight = Length((styleResolver->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
+ lineHeight = Length((styleResolver->style()->computedFontSize() * primitiveValue->getIntValue()) / 100, Fixed);
} else if (primitiveValue->isNumber()) {
// FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);