[BlackBerry] Default font settings are getting deleted
authorefidler@rim.com <efidler@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Jun 2012 00:07:36 +0000 (00:07 +0000)
committerefidler@rim.com <efidler@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Jun 2012 00:07:36 +0000 (00:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88670

Reviewed by Rob Buis.

Source/WebKit/blackberry:

RIM PR: 163720

WebSettings is overriding the default font settings with "", which deletes them.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::didChangeSettings):

LayoutTests:

This test crashes if -webkit-body (i.e.  WebCore::Settings::standardFontFamily())
is not a valid font family.

* fonts/valid-standard-font.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119879 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fonts/valid-standard-font-expected.txt [new file with mode: 0644]
LayoutTests/fonts/valid-standard-font.html [new file with mode: 0644]
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog

index 5e83d90..84c8c05 100644 (file)
@@ -1,3 +1,15 @@
+2012-06-08  Eli Fidler  <efidler@rim.com>
+
+        [BlackBerry] Default font settings are getting deleted
+        https://bugs.webkit.org/show_bug.cgi?id=88670
+
+        Reviewed by Rob Buis.
+
+        This test crashes if -webkit-body (i.e.  WebCore::Settings::standardFontFamily())
+        is not a valid font family.
+
+        * fonts/valid-standard-font.html: Added.
+
 2012-06-08  Ojan Vafai  <ojan@chromium.org>
 
         Final set of chromium rebaselines for skia change. See crbug.com/131829.
diff --git a/LayoutTests/fonts/valid-standard-font-expected.txt b/LayoutTests/fonts/valid-standard-font-expected.txt
new file mode 100644 (file)
index 0000000..aa44e7c
--- /dev/null
@@ -0,0 +1,2 @@
+
+PASS
diff --git a/LayoutTests/fonts/valid-standard-font.html b/LayoutTests/fonts/valid-standard-font.html
new file mode 100644 (file)
index 0000000..0edead9
--- /dev/null
@@ -0,0 +1,20 @@
+<html>
+<body style="font-family:-webkit-body">
+<!-- WebKit assumes that -webkit-body is a valid font. The font-family:inherit will crash on load if it isn't -->
+<input style="font-family:inherit"/>
+<script>
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+    window.setTimeout(runTest, 0);
+    function runTest() {
+        document.getElementById("result").innerText = "PASS";
+        if (window.layoutTestController) {
+            layoutTestController.notifyDone();
+        }
+    }
+</script>
+<div id="result">FAIL</div>
+</body>
+</html>
index c354673..bfe7d74 100644 (file)
@@ -6206,10 +6206,14 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
     coreSettings->setDefaultFixedFontSize(webSettings->defaultFixedFontSize());
     coreSettings->setDefaultFontSize(webSettings->defaultFontSize());
     coreSettings->setMinimumLogicalFontSize(webSettings->minimumFontSize());
-    coreSettings->setSerifFontFamily(webSettings->serifFontFamily().impl());
-    coreSettings->setFixedFontFamily(webSettings->fixedFontFamily().impl());
-    coreSettings->setSansSerifFontFamily(webSettings->sansSerifFontFamily().impl());
-    coreSettings->setStandardFontFamily(webSettings->standardFontFamily().impl());
+    if (!webSettings->serifFontFamily().isEmpty())
+        coreSettings->setSerifFontFamily(webSettings->serifFontFamily().impl());
+    if (!webSettings->fixedFontFamily().isEmpty())
+        coreSettings->setFixedFontFamily(webSettings->fixedFontFamily().impl());
+    if (!webSettings->sansSerifFontFamily().isEmpty())
+        coreSettings->setSansSerifFontFamily(webSettings->sansSerifFontFamily().impl());
+    if (!webSettings->standardFontFamily().isEmpty())
+        coreSettings->setStandardFontFamily(webSettings->standardFontFamily().impl());
     coreSettings->setJavaScriptCanOpenWindowsAutomatically(webSettings->canJavaScriptOpenWindowsAutomatically());
     coreSettings->setAllowScriptsToCloseWindows(webSettings->canJavaScriptOpenWindowsAutomatically()); // Why are we using the same value as setJavaScriptCanOpenWindowsAutomatically()?
     coreSettings->setPluginsEnabled(webSettings->arePluginsEnabled());
index 999e9aa..599ccff 100644 (file)
@@ -1,3 +1,17 @@
+2012-06-08  Eli Fidler  <efidler@rim.com>
+
+        [BlackBerry] Default font settings are getting deleted
+        https://bugs.webkit.org/show_bug.cgi?id=88670
+
+        Reviewed by Rob Buis.
+
+        RIM PR: 163720
+
+        WebSettings is overriding the default font settings with "", which deletes them.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::didChangeSettings):
+
 2012-06-07  Crystal Zhang  <haizhang@rim.com>
 
         [BlackBerry] Should Use the WebPage Already Created by Client, No Need to Create New One.