diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree/gtk')
4 files changed, 144 insertions, 6 deletions
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp index 521a0e1..e115683 100644 --- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -131,9 +131,29 @@ static void appendString(gchar*& target, gchar* string) g_free(oldString); } -static void initializeFonts() +static void initializeGtkFontSettings(const char* testURL) +{ + GtkSettings* settings = gtk_settings_get_default(); + if (!settings) + return; + g_object_set(settings, "gtk-xft-antialias", 1, NULL); + g_object_set(settings, "gtk-xft-hinting", 1, NULL); + g_object_set(settings, "gtk-xft-hintstyle", "hintfull", NULL); + g_object_set(settings, "gtk-font-name", "Liberation Sans 16", NULL); + + // One test needs subpixel anti-aliasing turned on, but generally we + // want all text in other tests to use to grayscale anti-aliasing. + if (testURL && strstr(testURL, "xsettings_antialias_settings.html")) + g_object_set(settings, "gtk-xft-rgba", "rgb", NULL); + else + g_object_set(settings, "gtk-xft-rgba", "none", NULL); +} + +static void initializeFonts(const char* testURL = 0) { #if PLATFORM(X11) + initializeGtkFontSettings(testURL); + FcInit(); // If a test resulted a font being added or removed via the @font-face rule, then @@ -177,6 +197,8 @@ static void initializeFonts() "/usr/share/fonts/liberation/LiberationSerif-Regular.ttf", }, { "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", "/usr/share/fonts/dejavu/DejaVuSans.ttf", }, + { "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf", + "/usr/share/fonts/dejavu/DejaVuSerif.ttf", }, }; // TODO: Some tests use Lucida. We should load these as well, once it becomes @@ -363,6 +385,7 @@ static void resetDefaultsToConsistentValues() "enable-html5-local-storage", TRUE, "enable-xss-auditor", FALSE, "enable-spatial-navigation", FALSE, + "enable-frame-flattening", FALSE, "javascript-can-access-clipboard", TRUE, "javascript-can-open-windows-automatically", TRUE, "enable-offline-web-application-cache", TRUE, @@ -373,6 +396,8 @@ static void resetDefaultsToConsistentValues() "monospace-font-family", "Courier", "serif-font-family", "Times", "sans-serif-font-family", "Helvetica", + "cursive-font-family", "cursive", + "fantasy-font-family", "fantasy", "default-font-size", 16, "default-monospace-font-size", 13, "minimum-font-size", 1, @@ -394,6 +419,9 @@ static void resetDefaultsToConsistentValues() webkit_reset_origin_access_white_lists(); + WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView); + webkit_web_back_forward_list_clear(list); + #ifdef HAVE_LIBSOUP_2_29_90 SoupSession* session = webkit_get_default_session(); SoupCookieJar* jar = reinterpret_cast<SoupCookieJar*>(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR)); @@ -610,7 +638,7 @@ static void runTest(const string& testPathOrURL) if (prevTestBFItem) g_object_ref(prevTestBFItem); - initializeFonts(); + initializeFonts(testURL.c_str()); // Focus the web view before loading the test to avoid focusing problems gtk_widget_grab_focus(GTK_WIDGET(webView)); diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index d831076..181ef9f 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -183,8 +183,16 @@ JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pa size_t LayoutTestController::webHistoryItemCount() { - // FIXME: implement - return 0; + WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); + WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView); + + if (!list) + return -1; + + // We do not add the current page to the total count as it's not + // considered in DRT tests + return webkit_web_back_forward_list_get_back_length(list) + + webkit_web_back_forward_list_get_forward_length(list); } unsigned LayoutTestController::workerThreadCount() const @@ -423,7 +431,11 @@ void LayoutTestController::setXSSAuditorEnabled(bool flag) void LayoutTestController::setFrameFlatteningEnabled(bool flag) { - // FIXME: implement + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + ASSERT(view); + + WebKitWebSettings* settings = webkit_web_view_get_settings(view); + g_object_set(G_OBJECT(settings), "enable-frame-flattening", flag, NULL); } void LayoutTestController::setSpatialNavigationEnabled(bool flag) @@ -804,3 +816,9 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior) void LayoutTestController::abortModal() { } + +bool LayoutTestController::hasSpellingMarker(int, int) +{ + // FIXME: Implement this. + return false; +} diff --git a/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp b/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp index f0f461c..4073403 100644 --- a/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp @@ -36,15 +36,24 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool) { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - GdkPixmap* pixmap = gtk_widget_get_snapshot(GTK_WIDGET(view), 0); gint width, height; +#ifdef GTK_API_VERSION_2 + GdkPixmap* pixmap = gtk_widget_get_snapshot(GTK_WIDGET(view), 0); gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &width, &height); +#else + width = gtk_widget_get_allocated_width(GTK_WIDGET(view)); + height = gtk_widget_get_allocated_height(GTK_WIDGET(view)); +#endif cairo_surface_t* imageSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); cairo_t* context = cairo_create(imageSurface); +#ifdef GTK_API_VERSION_2 gdk_cairo_set_source_pixmap(context, pixmap, 0, 0); cairo_paint(context); g_object_unref(pixmap); +#else + gtk_widget_draw(GTK_WIDGET(view), context); +#endif return BitmapContext::createByAdoptingBitmapAndContext(0, context); } diff --git a/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf b/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf index 520f96e..6eb057e 100644 --- a/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf +++ b/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf @@ -28,6 +28,25 @@ </edit> </match> + <!-- Until we find good fonts to use for cursive and fantasy + just use our serif font. --> + <match target="pattern"> + <test qual="any" name="family"> + <string>cursive</string> + </test> + <edit name="family" mode="assign"> + <string>Liberation Serif</string> + </edit> + </match> + <match target="pattern"> + <test qual="any" name="family"> + <string>fantasy</string> + </test> + <edit name="family" mode="assign"> + <string>Liberation Serif</string> + </edit> + </match> + <!-- The sans-serif font should be Liberation Sans --> <match target="pattern"> <test qual="any" name="family"> @@ -55,6 +74,22 @@ <string>Liberation Sans</string> </edit> </match> + <match target="pattern"> + <test qual="any" name="family"> + <string>Arial</string> + </test> + <edit name="family" mode="assign"> + <string>Liberation Sans</string> + </edit> + </match> + <match target="pattern"> + <test qual="any" name="family"> + <string>Lucida Grande</string> + </test> + <edit name="family" mode="assign"> + <string>Liberation Sans</string> + </edit> + </match> <!-- The Monospace font should be Liberation Mono --> <match target="pattern"> @@ -214,6 +249,54 @@ </edit> </match> + <!-- We need to enable simulated bold to for DejaVu Serif to ensure that we interpret + this property correctly in: platform/gtk/fonts/fontconfig-synthetic-bold.html --> + <match target="font"> + <test qual="any" name="family"> + <string>DejaVu Serif</string> + </test> + <test name="weight" compare="less_eq"> + <const>medium</const> + </test> + <test target="pattern" name="weight" compare="more"> + <const>medium</const> + </test> + <edit name="embolden" mode="assign"> + <bool>true</bool> + </edit> + <edit name="weight" mode="assign"> + <const>bold</const> + </edit> + </match> + + <!-- We need to enable simulated oblique to for DejaVu Serif to ensure that we interpret + this property correctly in: platform/gtk/fonts/fontconfig-synthetic-oblique.html --> + <match target="font"> + <test qual="any" name="family"> + <string>DejaVu Serif</string> + </test> + <test name="slant"> + <const>roman</const> + </test> + <test target="pattern" name="slant" compare="not_eq"> + <const>roman</const> + </test> + <edit name="matrix" mode="assign"> + <times> + <name>matrix</name> + <matrix><double>1</double><double>0.2</double> + <double>0</double><double>1</double> + </matrix> + </times> + </edit> + <edit name="slant" mode="assign"> + <const>oblique</const> + </edit> + <edit name="embeddedbitmap" mode="assign"> + <bool>false</bool> + </edit> + </match> + <config> <!-- These are the default Unicode chars that are expected to be blank in fonts. All other blank chars are assumed to be broken and won't |