Changeset 184719 in webkit


Ignore:
Timestamp:
May 21, 2015 10:36:32 AM (9 years ago)
Author:
commit-queue@webkit.org
Message:

SVG as image uses very tiny default font-size
https://bugs.webkit.org/show_bug.cgi?id=68090

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-05-21
Reviewed by Darin Adler.

Source/WebCore:

When loading a document, WebKit creates a Page object and then changes its setting
from the browser's preferences. This is true for interactive resources also, such as a
stand-alone SVG or an SVG embedded in an <object> tag for example. For non-interactive
resources, like an SVG embedded in an <img> tag for example, this function is called
after loading the resource is finished. This function creates an artificial page and
fabricates a scoped settings for it. This turns out to be problematic for cases like
the default font size because its initial value is zero. We cannot go from WebCore to
WebKit to ask for the global settings. But we can inherit the global settings from the
the master page. This is not the best solution because of two reasons. (1) Once the
resource is cached and the styles for the text elements are calculated, nothing can
change the values of styles except removing the resource itself from the cache if the
browser's preferences change. Also there is no mechanism to notify this artificial
page if the browser's preferences change. (2) An image like a non-interactive SVG,
should be displayed the same way regardless of the browser's preferences. A user may
be able to change the default font size for other text. But this should not affect
images even if they are vector images like SVG. An easy and more agreeable solution
is to hard-code the default font size for this case and do not depend on the global
settings at all.

Test: svg/text/text-default-font-size.html

  • page/Settings.in: Set the initial value of the setting defaultFontSize to be 16.

LayoutTests:

  • svg/text/text-default-font-size-expected.html: Added.
  • svg/text/text-default-font-size.html: Added.

Ensure the default font size for non-interactive SVG images is not zero.

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r184715 r184719  
     12015-05-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        SVG as image uses very tiny default font-size
     4        https://bugs.webkit.org/show_bug.cgi?id=68090
     5
     6        Reviewed by Darin Adler.
     7
     8        * svg/text/text-default-font-size-expected.html: Added.
     9        * svg/text/text-default-font-size.html: Added.
     10        Ensure the default font size for non-interactive SVG images is not zero.
     11
    1122015-05-21  Youenn Fablet  <youenn.fablet@crf.canon.fr>
    213
  • trunk/Source/WebCore/ChangeLog

    r184718 r184719  
     12015-05-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        SVG as image uses very tiny default font-size
     4        https://bugs.webkit.org/show_bug.cgi?id=68090
     5
     6        Reviewed by Darin Adler.
     7
     8        When loading a document, WebKit creates a Page object and then changes its setting
     9        from the browser's preferences. This is true for interactive resources also, such as a
     10        stand-alone SVG or an SVG embedded in an <object> tag for example. For non-interactive
     11        resources, like an SVG embedded in an <img> tag for example, this function is called
     12        after loading the resource is finished. This function creates an artificial page and
     13        fabricates a scoped settings for it. This turns out to be problematic for cases like
     14        the default font size because its initial value is zero. We cannot go from WebCore to
     15        WebKit to ask for the global settings. But we can inherit the global settings from the
     16        the master page. This is not the best solution because of two reasons. (1) Once the
     17        resource is cached and the styles for the text elements are calculated, nothing can
     18        change the values of styles except removing the resource itself from the cache if the
     19        browser's preferences change. Also there is no mechanism to notify this artificial
     20        page if the browser's preferences change. (2) An image like a non-interactive SVG,
     21        should be displayed the same way regardless of the browser's preferences. A user may
     22        be able to change the default font size for other text. But this should not affect
     23        images even if they are vector images like SVG. An easy and more agreeable solution
     24        is to hard-code the default font size for this case and do not depend on the global
     25        settings at all.
     26
     27        Test: svg/text/text-default-font-size.html
     28
     29        * page/Settings.in: Set the initial value of the setting defaultFontSize to be 16.
     30       
    1312015-05-21  Hunseop Jeong  <hs85.jeong@samsung.com>
    232
  • trunk/Source/WebCore/page/Settings.in

    r183682 r184719  
    3535minimumFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
    3636minimumLogicalFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
    37 defaultFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
     37defaultFontSize type=int, initial=16, setNeedsStyleRecalcInAllFrames=1
    3838defaultFixedFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
    3939
Note: See TracChangeset for help on using the changeset viewer.