WebKit
WebKit copied to clipboard
Account for zoom when computing SVG font size
Account for zoom when computing SVG font size https://bugs.webkit.org/show_bug.cgi?id=118818 Reviewed by NOBODY (OOPS!). Merge - https://chromium.googlesource.com/chromium/blink/+/5624c6e475af92d541edc8a3394602e320d00323 & https://src.chromium.org/viewvc/blink?view=revision&revision=180995 Previously, text that was zoomed appeared larger than geometry under the same zoom value. This was caused by two bugs: 1) When setting the computed font size, we incorrectly referenced the computedTextSize instead of the specified size. 2) Text with GeometricPrecision did not set a computed size but instead relied on the text size being correct. Further, it also fixes an issue about optimization in RenderSVGInlineText::computeNewScaledFontForStyle would skip updating the font size on lowdpi devices while zooming. The computed font size calculation depends on zoom and the font scaling factor depends on the device's scaling factor. Previously, we would skip updating the font when the scaling factor was 1 which would fail to account for zoom. This patch updates the optimization to only be used when both the scaling factor and zoom are 1. This change addresses both of these issues and adds a test to prove correctness. * Source/WebCore/rendering/svg/RenderSVGInlineText.cpp: (RenderSVGInlineText::computedNewScaledFontForStyle) - Updated Scaling factor to be accounted into two buckets: 1) GeometricPrecision 2) computedTextSize being referred 3) Use DoNotUseSmartMinimumForFontSize 4) Also fix low DPI issue * LayoutTests/svg/zoom/text/zoom-text-geometry.html: Added Test Case * LayoutTests/svg/zoom/text/zoom-text-geometry-expected.html: Added Test Case Expectations * LayoutTests/svg/zoom/text/lowdpi-zoom-text.html: Added Test Case * LayoutTests/svg/texst/lowdpi-zoom-text-expected.txt: Added Test Case Expectations
https://github.com/WebKit/WebKit/commit/2dbdf5c9a40dde630ab89f1654f351af86bfdbc0
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/7a165c874ad2a497c764af7a5b17d2405b351c74)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/971ee85f81453cf05b982cd10eac6b7a7b00ce6d)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/2cbd1393ba1f59cfdb686ecee2cb1e8c2a906c1b)
@smfr & @nikolaszimmermann - Can you guide or suggest on how to fix this 'ios-wk2' failure (svg/text/font-small-enlarged-minimum-larger.svg)?
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/dd62d1720c2c37b28b9fb705fc59a6aa1ae38c95)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/e71775ab69f38b0464ee2daa6a4fc04c5e9b5d36)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/d8b31c624e26832075d8d543b4213aece320c24e)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/3a63c84e98b1a95a2d66560068509ecd85b4e3a2)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/ee073cabfa625e3f8f311373732dab0b33a08993)
Sorry for not responding at all - I'm pretty busy these days...
Thanks for tackling this -- not ready though, the LayoutTests changes seem fishy.
Replied above and would appreciate your guidance because I am able to pass all changes by adding 'font-size: 80' but only fails in iOS-wk2 and have asked for input from Simon and he referred that it might be iOS device scaling factor and I should look into hidpi test cases.
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/e6ebd1abd52232862363f878b42e6eddadff7595)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/f958ea21a216a710617d3a88b66474548e963cbd)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/ee3acf94ee495090edf8ed1f4d23ef17f0a9495a)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/6a007a4e2f27e7aabf261a4c9fd9f26d9a9a1781)
EWS run on previous version of this PR (hash https://github.com/WebKit/WebKit/commit/2dbdf5c9a40dde630ab89f1654f351af86bfdbc0)
That looks good - let's wait for EWS results. If ok, I'll r+ it. Thanks @Ahmad-S792 for your patience.
No worries - I should appreciate you to deal with noob like me. :-)
I am just learning day by day and have day job so some time response take some time. :-)
EWS run on current version of this PR (hash https://github.com/WebKit/WebKit/commit/488e2ebfd562800b5237959a981be11375ca5167)
As discussed with @nikolaszimmermann over Slack, there is another change, which we require prior to landing this. So I will work on it and then have similar to this another PR to land this in future hoping that EWS does not reflect same failures.