Bug 80032

Summary: [GTK] Simplify the code to adjust font sizes depending on screen DPI
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: gustavo, mrobinson, pnormand, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch
mrobinson: review+
Updated patch mrobinson: review+

Description Carlos Garcia Campos 2012-03-01 09:28:14 PST
So that it can be used by both WebKit1 and WebKit2
Comment 1 Martin Robinson 2012-03-01 09:31:06 PST
I don't believe that WebKit2 needs to use this code.
Comment 2 Carlos Garcia Campos 2012-03-01 09:33:56 PST
Created attachment 129715 [details]
Patch
Comment 3 WebKit Review Bot 2012-03-01 09:39:37 PST
Attachment 129715 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'ChangeLog', u'LayoutTests/ChangeLog', u'La..." exit_code: 1
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h"
Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:71:  Use 0 instead of NULL.  [readability/null] [5]
Total errors found: 1 in 193 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Carlos Garcia Campos 2012-03-01 09:50:45 PST
Ok, I didn't know we didn't wat to use the screen dpi in wk2, the patch still makes the wk1 code a lot simpler and cleaner IMO.
Comment 5 Martin Robinson 2012-03-01 09:57:11 PST
Comment on attachment 129715 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=129715&action=review

> Source/WebCore/platform/gtk/GtkUtilities.cpp:65
> +    static const double kMillimetresPerInch = 25.4;
> +    double diagonalSizeInPixels = hypot(gdk_screen_get_width(screen), gdk_screen_get_height(screen));
> +    double diagonalSizeInInches = hypot(gdk_screen_get_width_mm(screen), gdk_screen_get_height_mm(screen)) / kMillimetresPerInch;
> +    return diagonalSizeInPixels / diagonalSizeInInches;

I like the way you're falling back here.
Comment 6 Carlos Garcia Campos 2012-03-01 10:15:49 PST
Created attachment 129723 [details]
Updated patch

Moved the code from web core back to webkit but leaving the cleaner code.
Comment 7 Carlos Garcia Campos 2012-03-01 23:33:48 PST
Committed r109517: <http://trac.webkit.org/changeset/109517>