Trigger computation of font size when crossing foreignObject boundary

When crossing the svg -> html boundary through a foreignObject, the
zoom factor is reset to its initial value. This is because SVG has a
special zoom model where the SVG fragment root puts the scale factor
on the graphics context, in contrast to non-SVG content where each
value is scaled individually.

This means the FontBuilder can't just inherit the font from parent
when crossing a foreignObject boundary. It may have to recompute the
font size because the effective zoom, included in the computed font
size, may change.

Example of behavior after this patch:

<html> <!-- computed font size: 16px. -->
  <body style="zoom: 2"> <!-- computed font size: 32px. -->
    <svg> <!-- scale(2) is applied to the graphics context; computed font size: 32px. -->
      <text>Sample svg text.</text> <!-- svg ignores computed font size to be able to support minimal font size. -->
      <foreignObject> <!-- html rendering again but scale(2) still applied to GC. computed font size must be reset to 16px. -->
        Sample html text. <!-- Text drawn with computed font size 16px but scaled to 32px by the GC -->

In this annotated test, 'Sample html text.' and 'Sample svg text.'
should both be displayed with a 32px font size.

Note: One difference is that the 'sample html text' is not sensitive
to the correct minimal font size since that happens before the scale
on the GC is applied. In order to get proper minimal font size working
on foreignObject, we would probably have to put foreignObject in a
layer separated from the graphical context of the SVG.

BUG=374119

Review URL: https://codereview.chromium.org/308123010

git-svn-id: svn://svn.chromium.org/blink/trunk@175562 bbb929c8-8fbe-4397-9dbb-9b2b20218538
8 files changed
tree: bc51d47ca71df359013eb7e8ed0d1239df9b49d4
  1. third_party/