DescriptionTrigger 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
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=175562
Patch Set 1 #
Total comments: 1
Patch Set 2 : Remove use of useSVGZoomRules in FontBuilder and add a forced mode for when crossing the foreignObj… #
Total comments: 4
Patch Set 3 : Simplify patch using StateResolverState mechanisms #
Total comments: 4
Patch Set 4 : Add documentation #Patch Set 5 : Fix typo in TestExpectations #Patch Set 6 : Rebased to trunk #
Messages
Total messages: 29 (0 generated)
|