Title: [137922] trunk/Tools
Revision
137922
Author
[email protected]
Date
2012-12-17 10:46:33 -0800 (Mon, 17 Dec 2012)

Log Message

[chromium] removed unused preferences from testRunner.overridePreference
https://bugs.webkit.org/show_bug.cgi?id=105169

Reviewed by Tony Chang.

Most notably this removes the code related to font family maps which is
now handled via window.internals.settings

* DumpRenderTree/chromium/TestRunner/public/WebPreferences.h:
(WebPreferences):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::overridePreference):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp:
(WebTestRunner::WebPreferences::applyTo):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (137921 => 137922)


--- trunk/Tools/ChangeLog	2012-12-17 18:44:44 UTC (rev 137921)
+++ trunk/Tools/ChangeLog	2012-12-17 18:46:33 UTC (rev 137922)
@@ -1,3 +1,22 @@
+2012-12-17  Jochen Eisinger  <[email protected]>
+
+        [chromium] removed unused preferences from testRunner.overridePreference
+        https://bugs.webkit.org/show_bug.cgi?id=105169
+
+        Reviewed by Tony Chang.
+
+        Most notably this removes the code related to font family maps which is
+        now handled via window.internals.settings
+
+        * DumpRenderTree/chromium/TestRunner/public/WebPreferences.h:
+        (WebPreferences):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
+        (WebTestRunner::TestRunner::overridePreference):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (TestRunner):
+        * DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp:
+        (WebTestRunner::WebPreferences::applyTo):
+
 2012-12-17  James Robinson  <[email protected]>
 
         [chromium] Move creation of WebLayerTreeView to WebWidgetClient

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebPreferences.h (137921 => 137922)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebPreferences.h	2012-12-17 18:44:44 UTC (rev 137921)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebPreferences.h	2012-12-17 18:46:33 UTC (rev 137922)
@@ -34,7 +34,6 @@
 #include "Platform/chromium/public/WebString.h"
 #include "Platform/chromium/public/WebURL.h"
 #include "WebKit/chromium/public/WebSettings.h"
-#include <map>
 
 namespace WebKit {
 class WebView;
@@ -50,15 +49,6 @@
     WebKit::WebString cursiveFontFamily;
     WebKit::WebString fantasyFontFamily;
 
-    // Map of UScriptCode to font such as USCRIPT_ARABIC to "My Arabic Font".
-    typedef std::map<int, WebKit::WebString> ScriptFontFamilyMap;
-    ScriptFontFamilyMap standardFontMap;
-    ScriptFontFamilyMap fixedFontMap;
-    ScriptFontFamilyMap serifFontMap;
-    ScriptFontFamilyMap sansSerifFontMap;
-    ScriptFontFamilyMap cursiveFontMap;
-    ScriptFontFamilyMap fantasyFontMap;
-
     int defaultFontSize;
     int defaultFixedFontSize;
     int minimumFontSize;

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp (137921 => 137922)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2012-12-17 18:44:44 UTC (rev 137921)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2012-12-17 18:46:33 UTC (rev 137922)
@@ -60,27 +60,6 @@
 
 namespace WebTestRunner {
 
-namespace {
-
-// Sets map based on scriptFontPairs, a collapsed vector of pairs of ISO 15924
-// four-letter script code and font such as:
-// { "Arab", "My Arabic Font", "Grek", "My Greek Font" }
-static void setFontMap(WebPreferences::ScriptFontFamilyMap& map, const Vector<WebString>& scriptFontPairs)
-{
-    map.clear();
-    size_t i = 0;
-    while (i + 1 < scriptFontPairs.size()) {
-        const WebString& script = scriptFontPairs[i++];
-        const WebString& font = scriptFontPairs[i++];
-
-        int32_t code = u_getPropertyValueEnum(UCHAR_SCRIPT, script.utf8().data());
-        if (code >= 0 && code < USCRIPT_CODE_LIMIT)
-            map[static_cast<int>(code)] = font;
-    }
-}
-
-}
-
 TestRunner::TestRunner()
     : m_delegate(0)
     , m_webView(0)
@@ -794,72 +773,26 @@
     string key = arguments[0].toString();
     CppVariant value = arguments[1];
     WebPreferences* prefs = m_delegate->preferences();
-    if (key == "WebKitStandardFont")
-        prefs->standardFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitFixedFont")
-        prefs->fixedFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitSerifFont")
-        prefs->serifFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitSansSerifFont")
-        prefs->sansSerifFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitCursiveFont")
-        prefs->cursiveFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitFantasyFont")
-        prefs->fantasyFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitStandardFontMap")
-        setFontMap(prefs->standardFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitFixedFontMap")
-        setFontMap(prefs->fixedFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitSerifFontMap")
-        setFontMap(prefs->serifFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitSansSerifFontMap")
-        setFontMap(prefs->sansSerifFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitCursiveFontMap")
-        setFontMap(prefs->cursiveFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitFantasyFontMap")
-        setFontMap(prefs->fantasyFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitDefaultFontSize")
+    if (key == "WebKitDefaultFontSize")
         prefs->defaultFontSize = cppVariantToInt32(value);
-    else if (key == "WebKitDefaultFixedFontSize")
-        prefs->defaultFixedFontSize = cppVariantToInt32(value);
     else if (key == "WebKitMinimumFontSize")
         prefs->minimumFontSize = cppVariantToInt32(value);
-    else if (key == "WebKitMinimumLogicalFontSize")
-        prefs->minimumLogicalFontSize = cppVariantToInt32(value);
     else if (key == "WebKitDefaultTextEncodingName")
         prefs->defaultTextEncodingName = cppVariantToWebString(value);
     else if (key == "WebKitJavaScriptEnabled")
         prefs->_javascript_Enabled = cppVariantToBool(value);
-    else if (key == "WebKitWebSecurityEnabled")
-        prefs->webSecurityEnabled = cppVariantToBool(value);
-    else if (key == "WebKitJavaScriptCanOpenWindowsAutomatically")
-        prefs->_javascript_CanOpenWindowsAutomatically = cppVariantToBool(value);
     else if (key == "WebKitSupportsMultipleWindows")
         prefs->supportsMultipleWindows = cppVariantToBool(value);
     else if (key == "WebKitDisplayImagesKey")
         prefs->loadsImagesAutomatically = cppVariantToBool(value);
     else if (key == "WebKitPluginsEnabled")
         prefs->pluginsEnabled = cppVariantToBool(value);
-    else if (key == "WebKitDOMPasteAllowedPreferenceKey")
-        prefs->DOMPasteAllowed = cppVariantToBool(value);
-    else if (key == "WebKitDeveloperExtrasEnabledPreferenceKey")
-        prefs->developerExtrasEnabled = cppVariantToBool(value);
-    else if (key == "WebKitShrinksStandaloneImagesToFit")
-        prefs->shrinksStandaloneImagesToFit = cppVariantToBool(value);
-    else if (key == "WebKitTextAreasAreResizable")
-        prefs->textAreasAreResizable = cppVariantToBool(value);
     else if (key == "WebKitJavaEnabled")
         prefs->javaEnabled = cppVariantToBool(value);
     else if (key == "WebKitUsesPageCachePreferenceKey")
         prefs->usesPageCache = cppVariantToBool(value);
     else if (key == "WebKitPageCacheSupportsPluginsPreferenceKey")
         prefs->pageCacheSupportsPlugins = cppVariantToBool(value);
-    else if (key == "WebKitJavaScriptCanAccessClipboard")
-        prefs->_javascript_CanAccessClipboard = cppVariantToBool(value);
-    else if (key == "WebKitXSSAuditorEnabled")
-        prefs->XSSAuditorEnabled = cppVariantToBool(value);
-    else if (key == "WebKitLocalStorageEnabledPreferenceKey")
-        prefs->localStorageEnabled = cppVariantToBool(value);
     else if (key == "WebKitOfflineWebApplicationCacheEnabled")
         prefs->offlineWebApplicationCacheEnabled = cppVariantToBool(value);
     else if (key == "WebKitTabToLinksPreferenceKey")
@@ -950,19 +883,6 @@
     return WebString::fromUTF8(value.toString());
 }
 
-Vector<WebString> TestRunner::cppVariantToWebStringArray(const CppVariant& value)
-{
-    if (!value.isObject()) {
-        printErrorMessage("Invalid value for preference. Expected object value.");
-        return Vector<WebString>();
-    }
-    Vector<WebString> resultVector;
-    Vector<string> stringVector = value.toStringVector();
-    for (size_t i = 0; i < stringVector.size(); ++i)
-        resultVector.append(WebString::fromUTF8(stringVector[i].c_str()));
-    return resultVector;
-}
-
 void TestRunner::printErrorMessage(const string& text)
 {
     m_delegate->printMessage(string("CONSOLE MESSAGE: ") + text + "\n");

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h (137921 => 137922)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2012-12-17 18:44:44 UTC (rev 137921)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2012-12-17 18:46:33 UTC (rev 137922)
@@ -60,7 +60,6 @@
     bool cppVariantToBool(const CppVariant&);
     int32_t cppVariantToInt32(const CppVariant&);
     WebKit::WebString cppVariantToWebString(const CppVariant&);
-    Vector<WebKit::WebString> cppVariantToWebStringArray(const CppVariant&);
 
     void printErrorMessage(const std::string&);
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp (137921 => 137922)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp	2012-12-17 18:44:44 UTC (rev 137921)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp	2012-12-17 18:46:33 UTC (rev 137922)
@@ -38,51 +38,6 @@
 
 namespace WebTestRunner {
 
-namespace {
-
-void setStandardFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setStandardFontFamily(font, script);
-}
-
-void setFixedFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setFixedFontFamily(font, script);
-}
-
-void setSerifFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setSerifFontFamily(font, script);
-}
-
-void setSansSerifFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setSansSerifFontFamily(font, script);
-}
-
-void setCursiveFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setCursiveFontFamily(font, script);
-}
-
-void setFantasyFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setFantasyFontFamily(font, script);
-}
-
-typedef void (*SetFontFamilyWrapper)(WebSettings*, const WebString&, UScriptCode);
-
-void applyFontMap(WebSettings* settings, const WebPreferences::ScriptFontFamilyMap& map, SetFontFamilyWrapper setter)
-{
-    for (WebPreferences::ScriptFontFamilyMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) {
-        const WebString& font = iter->second;
-        if (!font.isNull() && !font.isEmpty())
-            (*setter)(settings, font, static_cast<UScriptCode>(iter->first));
-    }
-}
-
-}
-
 void WebPreferences::reset()
 {
 #if OS(MAC_OS_X)
@@ -186,13 +141,6 @@
     settings->setCursiveFontFamily(cursiveFontFamily);
     settings->setFantasyFontFamily(fantasyFontFamily);
 
-    applyFontMap(settings, standardFontMap, setStandardFontFamilyWrapper);
-    applyFontMap(settings, fixedFontMap, setFixedFontFamilyWrapper);
-    applyFontMap(settings, serifFontMap, setSerifFontFamilyWrapper);
-    applyFontMap(settings, sansSerifFontMap, setSansSerifFontFamilyWrapper);
-    applyFontMap(settings, cursiveFontMap, setCursiveFontFamilyWrapper);
-    applyFontMap(settings, fantasyFontMap, setFantasyFontFamilyWrapper);
-
     settings->setDefaultFontSize(defaultFontSize);
     settings->setDefaultFixedFontSize(defaultFixedFontSize);
     settings->setMinimumFontSize(minimumFontSize);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to