Bug 80032 - [GTK] Simplify the code to adjust font sizes depending on screen DPI
Summary: [GTK] Simplify the code to adjust font sizes depending on screen DPI
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-01 09:28 PST by Carlos Garcia Campos
Modified: 2012-03-01 23:33 PST (History)
4 users (show)

See Also:


Attachments
Patch (7.53 KB, patch)
2012-03-01 09:33 PST, Carlos Garcia Campos
mrobinson: review+
Details | Formatted Diff | Diff
Updated patch (6.17 KB, patch)
2012-03-01 10:15 PST, Carlos Garcia Campos
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>