[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

tkent at chromium.org tkent at chromium.org
Wed Dec 22 13:32:25 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 269ee6289f48060e1e7b729f097cb8b5e24ce7bc
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Sep 19 12:55:50 2010 +0000

    2010-09-19  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Adam Barth.
    
            [DRT/Chromium] Fix a WebSettings handling bug
            https://bugs.webkit.org/show_bug.cgi?id=45945
    
            * platform/chromium/drt_expectations.txt:
             Remove link-opens-new-window.html, which is fixed by this revision.
    2010-09-19  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Adam Barth.
    
            [DRT/Chromium] Fix a WebSettings handling bug
            https://bugs.webkit.org/show_bug.cgi?id=45945
    
            Before this change, Chromium DRT reset WebSettings for every new
            window. It was wrong.
            If new window is not the first one, we have to apply the same
            settings as the first window.  So, we introduce WebPreference to
            store the current settings, and apply it to new windows. It's same
            as test_shell's behavior.
    
            * DumpRenderTree/DumpRenderTree.gypi:
            * DumpRenderTree/chromium/LayoutTestController.cpp:
              Use WebPreferences instead of WebSettings.
            (LayoutTestController::setUserStyleSheetEnabled):
            (LayoutTestController::setUserStyleSheetLocation):
            (LayoutTestController::setAuthorAndUserStylesEnabled):
            (LayoutTestController::setPopupBlockingEnabled):
            (LayoutTestController::disableImageLoading):
            (LayoutTestController::setJavaScriptCanAccessClipboard):
            (LayoutTestController::setXSSAuditorEnabled):
            (LayoutTestController::setAllowUniversalAccessFromFileURLs):
            (LayoutTestController::setAllowFileAccessFromFileURLs):
            (LayoutTestController::overridePreference):
            (LayoutTestController::setEditingBehavior):
            * DumpRenderTree/chromium/TestShell.cpp:
            (TestShell::resetWebSettings): Use WebPreferences.
            (TestShell::runFileTest): ditto.
            (TestShell::createNewWindow): Apply existing WebPreferences to a new WebView.
            * DumpRenderTree/chromium/TestShell.h:
            (TestShell::preferences):
            (TestShell::applyPreferences):
            * DumpRenderTree/chromium/WebPreferences.cpp: Added.
            * DumpRenderTree/chromium/WebPreferences.h: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67809 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 55350f9..5984ab8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-09-19  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        [DRT/Chromium] Fix a WebSettings handling bug
+        https://bugs.webkit.org/show_bug.cgi?id=45945
+
+        * platform/chromium/drt_expectations.txt:
+         Remove link-opens-new-window.html, which is fixed by this revision.
+
 2010-09-18  Erik Arvidsson  <arv at chromium.org>
 
         Reviewed by Nate Chapin.
diff --git a/LayoutTests/platform/chromium/drt_expectations.txt b/LayoutTests/platform/chromium/drt_expectations.txt
index b84d01a..a04f6eb 100644
--- a/LayoutTests/platform/chromium/drt_expectations.txt
+++ b/LayoutTests/platform/chromium/drt_expectations.txt
@@ -104,6 +104,7 @@ BUG_DRT MAC : fast/backgrounds/solid-color-context-restore.html = IMAGE
 BUG_DRT MAC : fast/reflections/inline-crash.html = IMAGE
 
 // Extra didFinishDocumentLoadForFrame line.
+// The first didFinishDocumentLoadForFrame line is for the previous test document.
 BUG_DRT WIN MAC LINUX : http/tests/loading/preload-img-test.html = TEXT
 
 // Font anti-aliasing issue
@@ -116,7 +117,6 @@ BUG_DRT LINUX : svg/batik/text/verticalText.svg = IMAGE+TEXT
 
 // Misc.
 BUG_DRT WIN MAC LINUX : fast/dynamic/window-resize-scrollbars-test.html = IMAGE+TEXT
-BUG_DRT WIN MAC LINUX : http/tests/security/xssAuditor/link-opens-new-window.html = TEXT
 BUG_DRT WIN MAC LINUX : storage/domstorage/quota.html = TEXT
 BUG_DRT WIN MAC LINUX : storage/indexeddb/objectstore-basics.html = TEXT
 BUG_DRT WIN MAC LINUX : userscripts/user-script-top-frame-only.html = TEXT
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 1fee8ee..e51e40e 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,41 @@
+2010-09-19  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        [DRT/Chromium] Fix a WebSettings handling bug
+        https://bugs.webkit.org/show_bug.cgi?id=45945
+
+        Before this change, Chromium DRT reset WebSettings for every new
+        window. It was wrong.
+        If new window is not the first one, we have to apply the same
+        settings as the first window.  So, we introduce WebPreference to
+        store the current settings, and apply it to new windows. It's same
+        as test_shell's behavior.
+
+        * DumpRenderTree/DumpRenderTree.gypi:
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+          Use WebPreferences instead of WebSettings.
+        (LayoutTestController::setUserStyleSheetEnabled):
+        (LayoutTestController::setUserStyleSheetLocation):
+        (LayoutTestController::setAuthorAndUserStylesEnabled):
+        (LayoutTestController::setPopupBlockingEnabled):
+        (LayoutTestController::disableImageLoading):
+        (LayoutTestController::setJavaScriptCanAccessClipboard):
+        (LayoutTestController::setXSSAuditorEnabled):
+        (LayoutTestController::setAllowUniversalAccessFromFileURLs):
+        (LayoutTestController::setAllowFileAccessFromFileURLs):
+        (LayoutTestController::overridePreference):
+        (LayoutTestController::setEditingBehavior):
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::resetWebSettings): Use WebPreferences.
+        (TestShell::runFileTest): ditto.
+        (TestShell::createNewWindow): Apply existing WebPreferences to a new WebView.
+        * DumpRenderTree/chromium/TestShell.h:
+        (TestShell::preferences):
+        (TestShell::applyPreferences):
+        * DumpRenderTree/chromium/WebPreferences.cpp: Added.
+        * DumpRenderTree/chromium/WebPreferences.h: Added.
+
 2010-09-18  Prasad Tammana  <prasadt at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.gypi b/WebKitTools/DumpRenderTree/DumpRenderTree.gypi
index b39fd2a..58ccaae 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.gypi
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.gypi
@@ -39,6 +39,8 @@
             'chromium/TestShellWin.cpp',
             'chromium/TextInputController.cpp',
             'chromium/TextInputController.h',
+            'chromium/WebPreferences.cpp',
+            'chromium/WebPreferences.h',
             'chromium/WebViewHost.cpp',
             'chromium/WebViewHost.h',
         ],
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
index 5d38167..2c6c600 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -627,8 +627,10 @@ void LayoutTestController::setWindowIsKey(const CppArgumentList& arguments, CppV
 
 void LayoutTestController::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppVariant* result)
 {
-    if (arguments.size() > 0 && arguments[0].isBool())
-        m_shell->webView()->settings()->setUserStyleSheetLocation(arguments[0].value.boolValue ? m_userStyleSheetLocation : WebURL());
+    if (arguments.size() > 0 && arguments[0].isBool()) {
+        m_shell->preferences()->userStyleSheetLocation = arguments[0].value.boolValue ? m_userStyleSheetLocation : WebURL();
+        m_shell->applyPreferences();
+    }
     result->setNull();
 }
 
@@ -637,15 +639,18 @@ void LayoutTestController::setUserStyleSheetLocation(const CppArgumentList& argu
     if (arguments.size() > 0 && arguments[0].isString()) {
         m_userStyleSheetLocation = webkit_support::LocalFileToDataURL(
             webkit_support::RewriteLayoutTestsURL(arguments[0].toString()));
-        m_shell->webView()->settings()->setUserStyleSheetLocation(m_userStyleSheetLocation);
+        m_shell->preferences()->userStyleSheetLocation = m_userStyleSheetLocation;
+        m_shell->applyPreferences();
     }
     result->setNull();
 }
 
 void LayoutTestController::setAuthorAndUserStylesEnabled(const CppArgumentList& arguments, CppVariant* result)
 {
-    if (arguments.size() > 0 && arguments[0].isBool())
-        m_shell->webView()->settings()->setAuthorAndUserStylesEnabled(arguments[0].value.boolValue);
+    if (arguments.size() > 0 && arguments[0].isBool()) {
+        m_shell->preferences()->authorAndUserStylesEnabled = arguments[0].value.boolValue;
+        m_shell->applyPreferences();
+    }
     result->setNull();
 }
 
@@ -682,7 +687,8 @@ void LayoutTestController::setPopupBlockingEnabled(const CppArgumentList& argume
 {
     if (arguments.size() > 0 && arguments[0].isBool()) {
         bool blockPopups = arguments[0].toBoolean();
-        m_shell->webView()->settings()->setJavaScriptCanOpenWindowsAutomatically(!blockPopups);
+        m_shell->preferences()->javaScriptCanOpenWindowsAutomatically = !blockPopups;
+        m_shell->applyPreferences();
     }
     result->setNull();
 }
@@ -955,7 +961,8 @@ void LayoutTestController::resumeAnimations(const CppArgumentList&, CppVariant*
 
 void LayoutTestController::disableImageLoading(const CppArgumentList&, CppVariant* result)
 {
-    m_shell->webView()->settings()->setLoadsImagesAutomatically(false);
+    m_shell->preferences()->loadsImagesAutomatically = false;
+    m_shell->applyPreferences();
     result->setNull();
 }
 
@@ -1090,15 +1097,19 @@ void LayoutTestController::setPrivateBrowsingEnabled(const CppArgumentList& argu
 
 void LayoutTestController::setJavaScriptCanAccessClipboard(const CppArgumentList& arguments, CppVariant* result)
 {
-    if (arguments.size() > 0 && arguments[0].isBool())
-        m_shell->webView()->settings()->setJavaScriptCanAccessClipboard(arguments[0].value.boolValue);
+    if (arguments.size() > 0 && arguments[0].isBool()) {
+        m_shell->preferences()->javaScriptCanAccessClipboard = arguments[0].value.boolValue;
+        m_shell->applyPreferences();
+    }
     result->setNull();
 }
 
 void LayoutTestController::setXSSAuditorEnabled(const CppArgumentList& arguments, CppVariant* result)
 {
-    if (arguments.size() > 0 && arguments[0].isBool())
-        m_shell->webView()->settings()->setXSSAuditorEnabled(arguments[0].value.boolValue);
+    if (arguments.size() > 0 && arguments[0].isBool()) {
+        m_shell->preferences()->XSSAuditorEnabled = arguments[0].value.boolValue;
+        m_shell->applyPreferences();
+    }
     result->setNull();
 }
 
@@ -1115,15 +1126,19 @@ void LayoutTestController::evaluateScriptInIsolatedWorld(const CppArgumentList&
 
 void LayoutTestController::setAllowUniversalAccessFromFileURLs(const CppArgumentList& arguments, CppVariant* result)
 {
-    if (arguments.size() > 0 && arguments[0].isBool())
-        m_shell->webView()->settings()->setAllowUniversalAccessFromFileURLs(arguments[0].value.boolValue);
+    if (arguments.size() > 0 && arguments[0].isBool()) {
+        m_shell->preferences()->allowUniversalAccessFromFileURLs = arguments[0].value.boolValue;
+        m_shell->applyPreferences();
+    }
     result->setNull();
 }
 
 void LayoutTestController::setAllowFileAccessFromFileURLs(const CppArgumentList& arguments, CppVariant* result)
 {
-    if (arguments.size() > 0 && arguments[0].isBool())
-        m_shell->webView()->settings()->setAllowFileAccessFromFileURLs(arguments[0].value.boolValue);
+    if (arguments.size() > 0 && arguments[0].isBool()) {
+        m_shell->preferences()->allowFileAccessFromFileURLs = arguments[0].value.boolValue;
+        m_shell->applyPreferences();
+    }
     result->setNull();
 }
 
@@ -1179,68 +1194,69 @@ void LayoutTestController::overridePreference(const CppArgumentList& arguments,
 
     string key = arguments[0].toString();
     CppVariant value = arguments[1];
-    WebSettings* settings = m_shell->webView()->settings();
+    WebPreferences* prefs = m_shell->preferences();
     if (key == "WebKitStandardFont")
-        settings->setStandardFontFamily(cppVariantToWebString(value));
+        prefs->standardFontFamily = cppVariantToWebString(value);
     else if (key == "WebKitFixedFont")
-        settings->setFixedFontFamily(cppVariantToWebString(value));
+        prefs->fixedFontFamily = cppVariantToWebString(value);
     else if (key == "WebKitSerifFont")
-        settings->setSerifFontFamily(cppVariantToWebString(value));
+        prefs->serifFontFamily = cppVariantToWebString(value);
     else if (key == "WebKitSansSerifFont")
-        settings->setSansSerifFontFamily(cppVariantToWebString(value));
+        prefs->sansSerifFontFamily = cppVariantToWebString(value);
     else if (key == "WebKitCursiveFont")
-        settings->setCursiveFontFamily(cppVariantToWebString(value));
+        prefs->cursiveFontFamily = cppVariantToWebString(value);
     else if (key == "WebKitFantasyFont")
-        settings->setFantasyFontFamily(cppVariantToWebString(value));
+        prefs->fantasyFontFamily = cppVariantToWebString(value);
     else if (key == "WebKitDefaultFontSize")
-        settings->setDefaultFontSize(cppVariantToInt32(value));
+        prefs->defaultFontSize = cppVariantToInt32(value);
     else if (key == "WebKitDefaultFixedFontSize")
-        settings->setDefaultFixedFontSize(cppVariantToInt32(value));
+        prefs->defaultFixedFontSize = cppVariantToInt32(value);
     else if (key == "WebKitMinimumFontSize")
-        settings->setMinimumFontSize(cppVariantToInt32(value));
+        prefs->minimumFontSize = cppVariantToInt32(value);
     else if (key == "WebKitMinimumLogicalFontSize")
-        settings->setMinimumLogicalFontSize(cppVariantToInt32(value));
+        prefs->minimumLogicalFontSize = cppVariantToInt32(value);
     else if (key == "WebKitDefaultTextEncodingName")
-        settings->setDefaultTextEncodingName(cppVariantToWebString(value));
+        prefs->defaultTextEncodingName = cppVariantToWebString(value);
     else if (key == "WebKitJavaScriptEnabled")
-        settings->setJavaScriptEnabled(cppVariantToBool(value));
+        prefs->javaScriptEnabled = cppVariantToBool(value);
     else if (key == "WebKitWebSecurityEnabled")
-        settings->setWebSecurityEnabled(cppVariantToBool(value));
+        prefs->webSecurityEnabled = cppVariantToBool(value);
     else if (key == "WebKitJavaScriptCanOpenWindowsAutomatically")
-        settings->setJavaScriptCanOpenWindowsAutomatically(cppVariantToBool(value));
+        prefs->javaScriptCanOpenWindowsAutomatically = cppVariantToBool(value);
     else if (key == "WebKitDisplayImagesKey")
-        settings->setLoadsImagesAutomatically(cppVariantToBool(value));
+        prefs->loadsImagesAutomatically = cppVariantToBool(value);
     else if (key == "WebKitPluginsEnabled")
-        settings->setPluginsEnabled(cppVariantToBool(value));
+        prefs->pluginsEnabled = cppVariantToBool(value);
     else if (key == "WebKitDOMPasteAllowedPreferenceKey")
-        settings->setDOMPasteAllowed(cppVariantToBool(value));
+        prefs->DOMPasteAllowed = cppVariantToBool(value);
     else if (key == "WebKitDeveloperExtrasEnabledPreferenceKey")
-        settings->setDeveloperExtrasEnabled(cppVariantToBool(value));
+        prefs->developerExtrasEnabled = cppVariantToBool(value);
     else if (key == "WebKitShrinksStandaloneImagesToFit")
-        settings->setShrinksStandaloneImagesToFit(cppVariantToBool(value));
+        prefs->shrinksStandaloneImagesToFit = cppVariantToBool(value);
     else if (key == "WebKitTextAreasAreResizable")
-        settings->setTextAreasAreResizable(cppVariantToBool(value));
+        prefs->textAreasAreResizable = cppVariantToBool(value);
     else if (key == "WebKitJavaEnabled")
-        settings->setJavaEnabled(cppVariantToBool(value));
+        prefs->javaEnabled = cppVariantToBool(value);
     else if (key == "WebKitUsesPageCachePreferenceKey")
-        settings->setUsesPageCache(cppVariantToBool(value));
+        prefs->usesPageCache = cppVariantToBool(value);
     else if (key == "WebKitJavaScriptCanAccessClipboard")
-        settings->setJavaScriptCanAccessClipboard(cppVariantToBool(value));
+        prefs->javaScriptCanAccessClipboard = cppVariantToBool(value);
     else if (key == "WebKitXSSAuditorEnabled")
-        settings->setXSSAuditorEnabled(cppVariantToBool(value));
+        prefs->XSSAuditorEnabled = cppVariantToBool(value);
     else if (key == "WebKitLocalStorageEnabledPreferenceKey")
-        settings->setLocalStorageEnabled(cppVariantToBool(value));
+        prefs->localStorageEnabled = cppVariantToBool(value);
     else if (key == "WebKitOfflineWebApplicationCacheEnabled")
-        settings->setOfflineWebApplicationCacheEnabled(cppVariantToBool(value));
+        prefs->offlineWebApplicationCacheEnabled = cppVariantToBool(value);
     else if (key == "WebKitTabToLinksPreferenceKey")
-        m_shell->webView()->setTabsToLinks(cppVariantToBool(value));
+        prefs->tabsToLinks = cppVariantToBool(value);
     else if (key == "WebKitWebGLEnabled")
-        settings->setExperimentalWebGLEnabled(cppVariantToBool(value));
+        prefs->experimentalWebGLEnabled = cppVariantToBool(value);
     else {
         string message("Invalid name for preference: ");
         message.append(key);
         logErrorToConsole(message);
     }
+    m_shell->applyPreferences();
 }
 
 void LayoutTestController::fallbackMethod(const CppArgumentList&, CppVariant* result)
@@ -1432,13 +1448,14 @@ void LayoutTestController::addUserStyleSheet(const CppArgumentList& arguments, C
 
 void LayoutTestController::setEditingBehavior(const CppArgumentList& arguments, CppVariant* results)
 {
-    WebSettings* settings = m_shell->webView()->settings();
     string key = arguments[0].toString();
-    if (key == "mac")
-        settings->setEditingBehavior(WebSettings::EditingBehaviorMac);
-    else if (key == "win")
-        settings->setEditingBehavior(WebSettings::EditingBehaviorWin);
-    else
+    if (key == "mac") {
+        m_shell->preferences()->editingBehavior = WebSettings::EditingBehaviorMac;
+        m_shell->applyPreferences();
+    } else if (key == "win") {
+        m_shell->preferences()->editingBehavior = WebSettings::EditingBehaviorWin;
+        m_shell->applyPreferences();
+    } else
         logErrorToConsole("Passed invalid editing behavior. Should be 'mac' or 'win'.");
 }
 
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
index 4c8a567..15d6dee 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
@@ -154,84 +154,8 @@ void TestShell::closeDevTools()
 
 void TestShell::resetWebSettings(WebView& webView)
 {
-    // Match the settings used by Mac DumpRenderTree, with the exception of
-    // fonts.
-    WebSettings* settings = webView.settings();
-#if OS(MAC_OS_X)
-    WebString serif = WebString::fromUTF8("Times");
-    settings->setCursiveFontFamily(WebString::fromUTF8("Apple Chancery"));
-    settings->setFantasyFontFamily(WebString::fromUTF8("Papyrus"));
-#else
-    // NOTE: case matters here, this must be 'times new roman', else
-    // some layout tests fail.
-    WebString serif = WebString::fromUTF8("times new roman");
-
-    // These two fonts are picked from the intersection of
-    // Win XP font list and Vista font list :
-    //   http://www.microsoft.com/typography/fonts/winxp.htm
-    //   http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx
-    // Some of them are installed only with CJK and complex script
-    // support enabled on Windows XP and are out of consideration here.
-    // (although we enabled both on our buildbots.)
-    // They (especially Impact for fantasy) are not typical cursive
-    // and fantasy fonts, but it should not matter for layout tests
-    // as long as they're available.
-    settings->setCursiveFontFamily(WebString::fromUTF8("Comic Sans MS"));
-    settings->setFantasyFontFamily(WebString::fromUTF8("Impact"));
-#endif
-    settings->setSerifFontFamily(serif);
-    settings->setStandardFontFamily(serif);
-    settings->setFixedFontFamily(WebString::fromUTF8("Courier"));
-    settings->setSansSerifFontFamily(WebString::fromUTF8("Helvetica"));
-
-    settings->setDefaultTextEncodingName(WebString::fromUTF8("ISO-8859-1"));
-    settings->setDefaultFontSize(16);
-    settings->setDefaultFixedFontSize(13);
-    settings->setMinimumFontSize(1);
-    settings->setMinimumLogicalFontSize(9);
-    settings->setJavaScriptCanOpenWindowsAutomatically(true);
-    settings->setJavaScriptCanAccessClipboard(true);
-    settings->setDOMPasteAllowed(true);
-    settings->setDeveloperExtrasEnabled(false);
-    settings->setNeedsSiteSpecificQuirks(true);
-    settings->setShrinksStandaloneImagesToFit(false);
-    settings->setUsesEncodingDetector(false);
-    settings->setTextAreasAreResizable(false);
-    settings->setJavaEnabled(false);
-    settings->setAllowScriptsToCloseWindows(false);
-    settings->setXSSAuditorEnabled(false);
-    settings->setDownloadableBinaryFontsEnabled(true);
-    settings->setLocalStorageEnabled(true);
-    settings->setOfflineWebApplicationCacheEnabled(true);
-    settings->setAllowFileAccessFromFileURLs(true);
-    settings->setUserStyleSheetLocation(WebURL());
-
-    // LayoutTests were written with Safari Mac in mind which does not allow
-    // tabbing to links by default.
-    webView.setTabsToLinks(false);
-
-    // Allow those layout tests running as local files, i.e. under
-    // LayoutTests/http/tests/local, to access http server.
-    settings->setAllowUniversalAccessFromFileURLs(true);
-
-    settings->setJavaScriptEnabled(true);
-    settings->setPluginsEnabled(true);
-    settings->setWebSecurityEnabled(true);
-    settings->setEditableLinkBehaviorNeverLive();
-    settings->setFontRenderingModeNormal();
-    settings->setShouldPaintCustomScrollbars(true);
-    settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded();
-
-    settings->setLoadsImagesAutomatically(true);
-    settings->setImagesEnabled(true);
-
-#if OS(DARWIN)
-    settings->setEditingBehavior(WebSettings::EditingBehaviorMac);
-#else
-    settings->setEditingBehavior(WebSettings::EditingBehaviorWin);
-#endif
-    // FIXME: crbug.com/51879
-    settings->setAcceleratedCompositingEnabled(false);
+    m_prefs.reset();
+    m_prefs.applyTo(&webView);
 }
 
 void TestShell::runFileTest(const TestParams& params)
@@ -243,7 +167,8 @@ void TestShell::runFileTest(const TestParams& params)
 
     bool inspectorTestMode = testUrl.find("/inspector/") != string::npos
         || testUrl.find("\\inspector\\") != string::npos;
-    m_webView->settings()->setDeveloperExtrasEnabled(inspectorTestMode);
+    m_prefs.developerExtrasEnabled = inspectorTestMode;
+    applyPreferences();
 
     if (testUrl.find("loading/") != string::npos
         || testUrl.find("loading\\") != string::npos)
@@ -639,7 +564,7 @@ WebViewHost* TestShell::createNewWindow(const WebURL& url)
     WebViewHost* host = new WebViewHost(this);
     WebView* view = WebView::create(host, m_drtDevToolsAgent.get());
     host->setWebWidget(view);
-    resetWebSettings(*view);
+    m_prefs.applyTo(view);
     view->initializeMainFrame(host);
     m_windowList.append(host);
     host->loadURLForFrame(url, WebString());
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.h b/WebKitTools/DumpRenderTree/chromium/TestShell.h
index d3ed5fa..6d93d4a 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.h
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.h
@@ -38,6 +38,7 @@
 #include "PlainTextController.h"
 #include "TestEventPrinter.h"
 #include "TextInputController.h"
+#include "WebPreferences.h"
 #include "WebViewHost.h"
 #include <string>
 #include <wtf/OwnPtr.h>
@@ -50,7 +51,6 @@ namespace WebKit {
 class WebDevToolsAgentClient;
 class WebFrame;
 class WebNotificationPresenter;
-class WebPreferences;
 class WebView;
 class WebURL;
 }
@@ -92,6 +92,9 @@ public:
     NotificationPresenter* notificationPresenter() const { return m_notificationPresenter.get(); }
     TestEventPrinter* printer() const { return m_printer.get(); }
 
+    WebPreferences* preferences() { return &m_prefs; }
+    void applyPreferences() { m_prefs.applyTo(m_webView); }
+
     void bindJSObjectsToWindow(WebKit::WebFrame*);
     void runFileTest(const TestParams&);
     void callJSGC();
@@ -148,7 +151,7 @@ public:
 private:
     void createDRTDevToolsClient(DRTDevToolsAgent*);
 
-    static void resetWebSettings(WebKit::WebView&);
+    void resetWebSettings(WebKit::WebView&);
     void dump();
     std::string dumpAllBackForwardLists();
     void dumpImage(skia::PlatformCanvas*) const;
@@ -173,6 +176,7 @@ private:
     TestParams m_params;
     int m_timeout; // timeout value in millisecond
     bool m_allowExternalPages;
+    WebPreferences m_prefs;
 
     // List of all windows in this process.
     // The main window should be put into windowList[0].
diff --git a/WebKitTools/DumpRenderTree/chromium/WebPreferences.cpp b/WebKitTools/DumpRenderTree/chromium/WebPreferences.cpp
new file mode 100644
index 0000000..6d4e45a
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/chromium/WebPreferences.cpp
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebPreferences.h"
+
+#include "public/WebView.h"
+
+using namespace WebKit;
+
+void WebPreferences::reset()
+{
+#if OS(MAC_OS_X)
+    cursiveFontFamily = WebString::fromUTF8("Apple Chancery");
+    fantasyFontFamily = WebString::fromUTF8("Papyrus");
+    WebString serif = WebString::fromUTF8("Times");
+#else
+    // These two fonts are picked from the intersection of
+    // Win XP font list and Vista font list :
+    //   http://www.microsoft.com/typography/fonts/winxp.htm
+    //   http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx
+    // Some of them are installed only with CJK and complex script
+    // support enabled on Windows XP and are out of consideration here.
+    // (although we enabled both on our buildbots.)
+    // They (especially Impact for fantasy) are not typical cursive
+    // and fantasy fonts, but it should not matter for layout tests
+    // as long as they're available.
+    cursiveFontFamily = WebString::fromUTF8("Comic Sans MS");
+    fantasyFontFamily = WebString::fromUTF8("Impact");
+    // NOTE: case matters here, this must be 'times new roman', else
+    // some layout tests fail.
+    WebString serif = WebString::fromUTF8("times new roman");
+#endif
+    serifFontFamily = serif;
+    standardFontFamily = serif;
+    fixedFontFamily = WebString::fromUTF8("Courier");
+    sansSerifFontFamily = WebString::fromUTF8("Helvetica");
+
+    defaultFontSize = 16;
+    defaultFixedFontSize = 13;
+    minimumFontSize = 1;
+    minimumLogicalFontSize = 9;
+
+    DOMPasteAllowed = true;
+    XSSAuditorEnabled = false;
+    allowFileAccessFromFileURLs = true;
+    authorAndUserStylesEnabled = true;
+    defaultTextEncodingName = WebString::fromUTF8("ISO-8859-1");
+    developerExtrasEnabled = false;
+    experimentalWebGLEnabled = false;
+    javaEnabled = false;
+    javaScriptCanAccessClipboard = true;
+    javaScriptCanOpenWindowsAutomatically = true;
+    javaScriptEnabled = true;
+    loadsImagesAutomatically = true;
+    localStorageEnabled = true;
+    offlineWebApplicationCacheEnabled = true;
+    pluginsEnabled = true;
+    shrinksStandaloneImagesToFit = false;
+    textAreasAreResizable = false;
+    userStyleSheetLocation = WebURL();
+    usesPageCache = false;
+    webSecurityEnabled = true;
+
+    // Allow those layout tests running as local files, i.e. under
+    // LayoutTests/http/tests/local, to access http server.
+    allowUniversalAccessFromFileURLs = true;
+
+#if OS(DARWIN)
+    editingBehavior = WebSettings::EditingBehaviorMac;
+#else
+    editingBehavior = WebSettings::EditingBehaviorWin;
+#endif
+
+    tabsToLinks = false;
+}
+
+void WebPreferences::applyTo(WebView* webView)
+{
+    WebSettings* settings = webView->settings();
+    settings->setCursiveFontFamily(cursiveFontFamily);
+    settings->setFantasyFontFamily(fantasyFontFamily);
+    settings->setSerifFontFamily(serifFontFamily);
+    settings->setStandardFontFamily(standardFontFamily);
+    settings->setFixedFontFamily(fixedFontFamily);
+    settings->setSansSerifFontFamily(sansSerifFontFamily);
+
+    settings->setDefaultFontSize(defaultFontSize);
+    settings->setDefaultFixedFontSize(defaultFixedFontSize);
+    settings->setMinimumFontSize(minimumFontSize);
+    settings->setMinimumLogicalFontSize(minimumLogicalFontSize);
+
+    settings->setDOMPasteAllowed(DOMPasteAllowed);
+    settings->setXSSAuditorEnabled(XSSAuditorEnabled);
+    settings->setAllowFileAccessFromFileURLs(allowFileAccessFromFileURLs);
+    settings->setAuthorAndUserStylesEnabled(authorAndUserStylesEnabled);
+    settings->setDefaultTextEncodingName(defaultTextEncodingName);
+    settings->setDeveloperExtrasEnabled(developerExtrasEnabled);
+    settings->setJavaEnabled(javaEnabled);
+    settings->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard);
+    settings->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically);
+    settings->setJavaScriptEnabled(javaScriptEnabled);
+    settings->setLoadsImagesAutomatically(loadsImagesAutomatically);
+    settings->setLocalStorageEnabled(localStorageEnabled);
+    settings->setOfflineWebApplicationCacheEnabled(offlineWebApplicationCacheEnabled);
+    settings->setPluginsEnabled(pluginsEnabled);
+    settings->setShrinksStandaloneImagesToFit(shrinksStandaloneImagesToFit);
+    settings->setTextAreasAreResizable(textAreasAreResizable);
+    settings->setUserStyleSheetLocation(userStyleSheetLocation);
+    settings->setUsesPageCache(usesPageCache);
+    settings->setWebSecurityEnabled(webSecurityEnabled);
+    settings->setAllowUniversalAccessFromFileURLs(allowUniversalAccessFromFileURLs);
+    settings->setEditingBehavior(editingBehavior);
+    // LayoutTests were written with Safari Mac in mind which does not allow
+    // tabbing to links by default.
+    webView->setTabsToLinks(tabsToLinks);
+
+    // Fixed values.
+    settings->setShouldPaintCustomScrollbars(true);
+    settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded();
+    settings->setDownloadableBinaryFontsEnabled(true);
+    settings->setAllowScriptsToCloseWindows(false);
+    settings->setNeedsSiteSpecificQuirks(true);
+    settings->setEditableLinkBehaviorNeverLive();
+    settings->setFontRenderingModeNormal();
+    settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded();
+    settings->setUsesEncodingDetector(false);
+    settings->setImagesEnabled(true);
+
+    // FIXME: crbug.com/51879
+    settings->setAcceleratedCompositingEnabled(false);
+}
+
diff --git a/WebKitTools/DumpRenderTree/chromium/WebPreferences.h b/WebKitTools/DumpRenderTree/chromium/WebPreferences.h
new file mode 100644
index 0000000..f197c16
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/chromium/WebPreferences.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebPreferences_h
+#define WebPerferences_h
+
+#include "public/WebSettings.h"
+#include "public/WebString.h"
+#include "public/WebURL.h"
+
+namespace WebKit {
+class WebView;
+}
+
+struct WebPreferences {
+    WebKit::WebString cursiveFontFamily;
+    WebKit::WebString fantasyFontFamily;
+    WebKit::WebString serifFontFamily;
+    WebKit::WebString standardFontFamily;
+    WebKit::WebString fixedFontFamily;
+    WebKit::WebString sansSerifFontFamily;
+
+    int defaultFontSize;
+    int defaultFixedFontSize;
+    int minimumFontSize;
+    int minimumLogicalFontSize;
+
+    bool DOMPasteAllowed;
+    bool XSSAuditorEnabled;
+    bool allowFileAccessFromFileURLs;
+    bool authorAndUserStylesEnabled;
+    WebKit::WebString defaultTextEncodingName;
+    bool developerExtrasEnabled;
+    bool experimentalWebGLEnabled;
+    bool javaEnabled;
+    bool javaScriptCanAccessClipboard;
+    bool javaScriptCanOpenWindowsAutomatically;
+    bool javaScriptEnabled;
+    bool loadsImagesAutomatically;
+    bool localStorageEnabled;
+    bool offlineWebApplicationCacheEnabled;
+    bool pluginsEnabled;
+    bool shrinksStandaloneImagesToFit;
+    bool textAreasAreResizable;
+    WebKit::WebURL userStyleSheetLocation;
+    bool usesPageCache;
+    bool webSecurityEnabled;
+    bool allowUniversalAccessFromFileURLs;
+    WebKit::WebSettings::EditingBehavior editingBehavior;
+    bool tabsToLinks;
+
+    WebPreferences() { reset(); }
+    void reset();
+    void applyTo(WebKit::WebView*);
+};
+
+#endif // WebPreferences_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list