Title: [197160] trunk
Revision
197160
Author
mmaxfi...@apple.com
Date
2016-02-25 22:38:53 -0800 (Thu, 25 Feb 2016)

Log Message

Font size computed style is innaccurate
https://bugs.webkit.org/show_bug.cgi?id=154705
<rdar://problem/23474068>

Reviewed by Timothy Hatcher.

Source/WebCore:

Safari rounds the font size value reported to getComputedStyle(). Neither Firefox
nor Chrome do this.

Covered by existing tests.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword):
(WebCore::fontSizeFromStyle):

LayoutTests:

Update expected results.

* css3/calc/font-size-fractional-expected.txt:
* css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html:
* css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt:
* editing/mac/attributed-string/font-size-expected.txt:
* editing/mac/attributed-string/vertical-align-expected.txt:
* platform/mac-mavericks/editing/mac/attributed-string/font-size-expected.txt:
* platform/mac-mavericks/editing/mac/attributed-string/vertical-align-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/font-size-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/vertical-align-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197159 => 197160)


--- trunk/LayoutTests/ChangeLog	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/ChangeLog	2016-02-26 06:38:53 UTC (rev 197160)
@@ -1,5 +1,25 @@
 2016-02-25  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        Font size computed style is innaccurate
+        https://bugs.webkit.org/show_bug.cgi?id=154705
+        <rdar://problem/23474068>
+
+        Reviewed by Timothy Hatcher.
+
+        Update expected results.
+
+        * css3/calc/font-size-fractional-expected.txt:
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html:
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt:
+        * editing/mac/attributed-string/font-size-expected.txt:
+        * editing/mac/attributed-string/vertical-align-expected.txt:
+        * platform/mac-mavericks/editing/mac/attributed-string/font-size-expected.txt:
+        * platform/mac-mavericks/editing/mac/attributed-string/vertical-align-expected.txt:
+        * platform/mac-yosemite/editing/mac/attributed-string/font-size-expected.txt:
+        * platform/mac-yosemite/editing/mac/attributed-string/vertical-align-expected.txt:
+
+2016-02-25  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         REGRESSION(r195795): [WK2] fast/text/crash-complex-text-surrogate.html is flakey
         https://bugs.webkit.org/show_bug.cgi?id=154709
         <rdar://problem/24483596>

Modified: trunk/LayoutTests/css3/calc/font-size-fractional-expected.txt (197159 => 197160)


--- trunk/LayoutTests/css3/calc/font-size-fractional-expected.txt	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/css3/calc/font-size-fractional-expected.txt	2016-02-26 06:38:53 UTC (rev 197160)
@@ -4,7 +4,7 @@
 
 
 PASS getComputedStyle(document.getElementById("calc-reduce"), null).lineHeight is "24px"
-PASS getComputedStyle(document.getElementById("calc-reduce"), null).fontSize is "10px"
+PASS getComputedStyle(document.getElementById("calc-reduce"), null).fontSize is "9.600000381469727px"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt (197159 => 197160)


--- trunk/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt	2016-02-26 06:38:53 UTC (rev 197160)
@@ -15,17 +15,17 @@
 PASS innerHeight is 600
 PASS getComputedStyle(container).fontSize is "45px"
 PASS getComputedStyle(ems).fontSize is "180px"
-PASS getComputedStyle(percent).fontSize is "23px"
+PASS getComputedStyle(percent).fontSize is "22.5px"
 PASS innerWidth is 900
 PASS innerHeight is 640
 PASS getComputedStyle(container).fontSize is "45px"
 PASS getComputedStyle(ems).fontSize is "180px"
-PASS getComputedStyle(percent).fontSize is "23px"
+PASS getComputedStyle(percent).fontSize is "22.5px"
 PASS innerWidth is 500
 PASS innerHeight is 640
 PASS getComputedStyle(container).fontSize is "25px"
 PASS getComputedStyle(ems).fontSize is "100px"
-PASS getComputedStyle(percent).fontSize is "13px"
+PASS getComputedStyle(percent).fontSize is "12.5px"
 PASS innerWidth is 800
 PASS innerHeight is 600
 PASS getComputedStyle(container).fontSize is "40px"

Modified: trunk/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html (197159 => 197160)


--- trunk/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html	2016-02-26 06:38:53 UTC (rev 197160)
@@ -21,9 +21,9 @@
 <script>
 description("Test that relative font sizes work when the parent is in viewport units.");
 standardResizeTest(function () {
-    shouldBeEqualToString("getComputedStyle(container).fontSize", Math.round(innerWidth / 20) + "px");
-    shouldBeEqualToString("getComputedStyle(ems).fontSize", Math.round(innerWidth / 5) + "px");
-    shouldBeEqualToString("getComputedStyle(percent).fontSize", Math.round(innerWidth / 40) + "px");
+    shouldBeEqualToString("getComputedStyle(container).fontSize", (innerWidth / 20) + "px");
+    shouldBeEqualToString("getComputedStyle(ems).fontSize", (innerWidth / 5) + "px");
+    shouldBeEqualToString("getComputedStyle(percent).fontSize", (innerWidth / 40) + "px");
 });
 </script>
 <script src=""

Modified: trunk/LayoutTests/editing/mac/attributed-string/font-size-expected.txt (197159 => 197160)


--- trunk/LayoutTests/editing/mac/attributed-string/font-size-expected.txt	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/editing/mac/attributed-string/font-size-expected.txt	2016-02-26 06:38:53 UTC (rev 197160)
@@ -34,7 +34,7 @@
     HeaderLevel: 0
 [small element]
     NSColor: #000000 (NSDeviceRGBColorSpace)
-    NSFont: Times-Roman 13.00 pt.
+    NSFont: Times-Roman 13.33 pt.
     NSKern: 0pt
     NSStrokeColor: NSDeviceRGBColorSpace 0 0 0 1
     NSStrokeWidth: 0
@@ -385,7 +385,7 @@
     HeaderLevel: 0
 [ ]
     NSColor: #000000 (NSDeviceRGBColorSpace)
-    NSFont: Times-Roman 16.00 pt.
+    NSFont: Times-Roman 16.67 pt.
     NSKern: 0pt
     NSStrokeColor: NSDeviceRGBColorSpace 0 0 0 1
     NSStrokeWidth: 0

Modified: trunk/LayoutTests/editing/mac/attributed-string/vertical-align-expected.txt (197159 => 197160)


--- trunk/LayoutTests/editing/mac/attributed-string/vertical-align-expected.txt	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/editing/mac/attributed-string/vertical-align-expected.txt	2016-02-26 06:38:53 UTC (rev 197160)
@@ -29,7 +29,7 @@
     HeaderLevel: 0
 [sup element]
     NSColor: #000000 (NSDeviceRGBColorSpace)
-    NSFont: Times-Roman 13.00 pt.
+    NSFont: Times-Roman 13.33 pt.
     NSKern: 0pt
     NSStrokeColor: NSDeviceRGBColorSpace 0 0 0 1
     NSStrokeWidth: 0
@@ -84,7 +84,7 @@
     HeaderLevel: 0
 [sub element]
     NSColor: #000000 (NSDeviceRGBColorSpace)
-    NSFont: Times-Roman 13.00 pt.
+    NSFont: Times-Roman 13.33 pt.
     NSKern: 0pt
     NSStrokeColor: NSDeviceRGBColorSpace 0 0 0 1
     NSStrokeWidth: 0

Modified: trunk/LayoutTests/platform/mac-mavericks/editing/mac/attributed-string/font-size-expected.txt (197159 => 197160)


--- trunk/LayoutTests/platform/mac-mavericks/editing/mac/attributed-string/font-size-expected.txt	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/platform/mac-mavericks/editing/mac/attributed-string/font-size-expected.txt	2016-02-26 06:38:53 UTC (rev 197160)
@@ -31,7 +31,7 @@
     TighteningFactor: 0.05
     HeaderLevel: 0
 [small element]
-    NSFont: Times-Roman 13.00 pt.
+    NSFont: Times-Roman 13.33 pt.
 NSParagraphStyle:
 Alignment 4
     LineSpacing: 0
@@ -325,7 +325,7 @@
     TighteningFactor: 0.05
     HeaderLevel: 0
 [5pt]
-    NSFont: Times-Roman 7.00 pt.
+    NSFont: Times-Roman 6.67 pt.
 NSParagraphStyle:
 Alignment 4
     LineSpacing: 0

Modified: trunk/LayoutTests/platform/mac-mavericks/editing/mac/attributed-string/vertical-align-expected.txt (197159 => 197160)


--- trunk/LayoutTests/platform/mac-mavericks/editing/mac/attributed-string/vertical-align-expected.txt	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/platform/mac-mavericks/editing/mac/attributed-string/vertical-align-expected.txt	2016-02-26 06:38:53 UTC (rev 197160)
@@ -26,7 +26,7 @@
     TighteningFactor: 0.05
     HeaderLevel: 0
 [sup element]
-    NSFont: Times-Roman 13.00 pt.
+    NSFont: Times-Roman 13.33 pt.
     NSSuperScript: 1
 NSParagraphStyle:
 Alignment 4
@@ -69,7 +69,7 @@
     TighteningFactor: 0.05
     HeaderLevel: 0
 [sub element]
-    NSFont: Times-Roman 13.00 pt.
+    NSFont: Times-Roman 13.33 pt.
     NSSuperScript: -1
 NSParagraphStyle:
 Alignment 4

Modified: trunk/LayoutTests/platform/mac-yosemite/editing/mac/attributed-string/font-size-expected.txt (197159 => 197160)


--- trunk/LayoutTests/platform/mac-yosemite/editing/mac/attributed-string/font-size-expected.txt	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/platform/mac-yosemite/editing/mac/attributed-string/font-size-expected.txt	2016-02-26 06:38:53 UTC (rev 197160)
@@ -32,7 +32,7 @@
     HeaderLevel: 0
 [small element]
     NSColor: #000000 (NSDeviceRGBColorSpace)
-    NSFont: Times-Roman 13.00 pt.
+    NSFont: Times-Roman 13.33 pt.
     NSKern: 0pt
     NSStrokeColor: NSDeviceRGBColorSpace 0 0 0 1
     NSStrokeWidth: 0
@@ -382,7 +382,7 @@
     HeaderLevel: 0
 [5pt]
     NSColor: #000000 (NSDeviceRGBColorSpace)
-    NSFont: Times-Roman 7.00 pt.
+    NSFont: Times-Roman 6.67 pt.
     NSKern: 0pt
     NSStrokeColor: NSDeviceRGBColorSpace 0 0 0 1
     NSStrokeWidth: 0

Modified: trunk/LayoutTests/platform/mac-yosemite/editing/mac/attributed-string/vertical-align-expected.txt (197159 => 197160)


--- trunk/LayoutTests/platform/mac-yosemite/editing/mac/attributed-string/vertical-align-expected.txt	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/LayoutTests/platform/mac-yosemite/editing/mac/attributed-string/vertical-align-expected.txt	2016-02-26 06:38:53 UTC (rev 197160)
@@ -27,7 +27,7 @@
     HeaderLevel: 0
 [sup element]
     NSColor: #000000 (NSDeviceRGBColorSpace)
-    NSFont: Times-Roman 13.00 pt.
+    NSFont: Times-Roman 13.33 pt.
     NSKern: 0pt
     NSStrokeColor: NSDeviceRGBColorSpace 0 0 0 1
     NSStrokeWidth: 0
@@ -78,7 +78,7 @@
     HeaderLevel: 0
 [sub element]
     NSColor: #000000 (NSDeviceRGBColorSpace)
-    NSFont: Times-Roman 13.00 pt.
+    NSFont: Times-Roman 13.33 pt.
     NSKern: 0pt
     NSStrokeColor: NSDeviceRGBColorSpace 0 0 0 1
     NSStrokeWidth: 0

Modified: trunk/Source/WebCore/ChangeLog (197159 => 197160)


--- trunk/Source/WebCore/ChangeLog	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/Source/WebCore/ChangeLog	2016-02-26 06:38:53 UTC (rev 197160)
@@ -1,3 +1,20 @@
+2016-02-25  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Font size computed style is innaccurate
+        https://bugs.webkit.org/show_bug.cgi?id=154705
+        <rdar://problem/23474068>
+
+        Reviewed by Timothy Hatcher.
+
+        Safari rounds the font size value reported to getComputedStyle(). Neither Firefox
+        nor Chrome do this.
+
+        Covered by existing tests.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword):
+        (WebCore::fontSizeFromStyle):
+
 2016-02-25  Chris Dumez  <cdu...@apple.com>
 
         [Web IDL] Mark DOMString parameters as nullable when they should be

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (197159 => 197160)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2016-02-26 05:59:48 UTC (rev 197159)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2016-02-26 06:38:53 UTC (rev 197160)
@@ -1578,7 +1578,7 @@
     if (CSSValueID sizeIdentifier = style->fontDescription().keywordSizeAsIdentifier())
         return CSSValuePool::singleton().createIdentifierValue(sizeIdentifier);
 
-    return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), *style);
+    return zoomAdjustedPixelValue(style->fontDescription().computedSize(), *style);
 }
 
 bool ComputedStyleExtractor::useFixedFontDefaultSize() const
@@ -1830,7 +1830,7 @@
 
 static Ref<CSSPrimitiveValue> fontSizeFromStyle(RenderStyle& style)
 {
-    return zoomAdjustedPixelValue(style.fontDescription().computedPixelSize(), style);
+    return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style);
 }
 
 static Ref<CSSPrimitiveValue> fontStyleFromStyle(RenderStyle* style)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to