Title: [136074] trunk
Revision
136074
Author
[email protected]
Date
2012-11-28 16:14:52 -0800 (Wed, 28 Nov 2012)

Log Message

StyleResolver should not set NaN to font size
https://bugs.webkit.org/show_bug.cgi?id=99506

Reviewed by Abhishek Arya.

Source/WebCore:

fixedScaleFactor could be NaN since settings->defaultFixedFontSize()
and settings->defaultFontSize() are zero in some case. This turns
out setting NaN to font size. Add a zero checks so that
fixedScaleFactor won't be NaN.

Test: fast/css/font-size-nan.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::checkForGenericFamilyChange):

LayoutTests:

* fast/css/font-size-nan-expected.txt: Added.
* fast/css/font-size-nan.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136073 => 136074)


--- trunk/LayoutTests/ChangeLog	2012-11-29 00:13:19 UTC (rev 136073)
+++ trunk/LayoutTests/ChangeLog	2012-11-29 00:14:52 UTC (rev 136074)
@@ -1,3 +1,13 @@
+2012-11-28  Kenichi Ishibashi  <[email protected]>
+
+        StyleResolver should not set NaN to font size
+        https://bugs.webkit.org/show_bug.cgi?id=99506
+
+        Reviewed by Abhishek Arya.
+
+        * fast/css/font-size-nan-expected.txt: Added.
+        * fast/css/font-size-nan.svg: Added.
+
 2012-11-23  Dirk Schulze  <[email protected]>
 
         CSS parser does not support -webkit-mask-size for -webkit-mask shorthand

Added: trunk/LayoutTests/fast/css/font-size-nan-expected.txt (0 => 136074)


--- trunk/LayoutTests/fast/css/font-size-nan-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/font-size-nan-expected.txt	2012-11-29 00:14:52 UTC (rev 136074)
@@ -0,0 +1,2 @@
+PASS: WebKit doesn't crash.
+

Added: trunk/LayoutTests/fast/css/font-size-nan.svg (0 => 136074)


--- trunk/LayoutTests/fast/css/font-size-nan.svg	                        (rev 0)
+++ trunk/LayoutTests/fast/css/font-size-nan.svg	2012-11-29 00:14:52 UTC (rev 136074)
@@ -0,0 +1,11 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<samp style="-webkit-line-clamp: 69; font: 27160em Ahem;"><emptycustomtag><foobar style="-webkit-box-shadow: 1662977863 125px 111px mediumorchid, 112 130px 6px royalblue; zoom: 183.924360629; "><acronym style="-webkit-hyphenate-limit-lines: 207; -webkit-text-size-adjust: none;"><code><highlight></highlight><href></href></code></acronym></foobar>
+<div>PASS: WebKit doesn't crash.</div>
+<textarea style="border-image: url() 212 57 14584936043161189249 63/75px stretch stretch; "></textarea></emptycustomtag></samp>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (136073 => 136074)


--- trunk/Source/WebCore/ChangeLog	2012-11-29 00:13:19 UTC (rev 136073)
+++ trunk/Source/WebCore/ChangeLog	2012-11-29 00:14:52 UTC (rev 136074)
@@ -1,3 +1,20 @@
+2012-11-28  Kenichi Ishibashi  <[email protected]>
+
+        StyleResolver should not set NaN to font size
+        https://bugs.webkit.org/show_bug.cgi?id=99506
+
+        Reviewed by Abhishek Arya.
+
+        fixedScaleFactor could be NaN since settings->defaultFixedFontSize()
+        and settings->defaultFontSize() are zero in some case. This turns
+        out setting NaN to font size. Add a zero checks so that
+        fixedScaleFactor won't be NaN.
+
+        Test: fast/css/font-size-nan.html
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::checkForGenericFamilyChange):
+
 2012-11-28  Tim Horton  <[email protected]>
 
         [mac] WebHTMLConverter should maintain font size even when there is no related NSFont

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (136073 => 136074)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-29 00:13:19 UTC (rev 136073)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-29 00:14:52 UTC (rev 136074)
@@ -3958,7 +3958,7 @@
         size = fontSizeForKeyword(m_checker.document(), CSSValueXxSmall + childFont.keywordSize() - 1, childFont.useFixedDefaultSize());
     else {
         Settings* settings = documentSettings();
-        float fixedScaleFactor = settings
+        float fixedScaleFactor = (settings && settings->defaultFixedFontSize() && settings->defaultFontSize())
             ? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize()
             : 1;
         size = parentFont.useFixedDefaultSize() ?
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to