Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Issue 308123010: Trigger computation of font size when crossing foreignObject boundary (Closed)

Created:
6 years, 6 months ago by davve
Modified:
6 years, 6 months ago
Reviewers:
pdr., fs, rune
CC:
blink-reviews, blink-reviews-css, ed+blinkwatch_opera.com, dglazkov+blink, darktears, rune+blink, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

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 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+46 lines, -25 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
A LayoutTests/svg/custom/foreignObject-font-size-on-zoom.html View 1 chunk +8 lines, -0 lines 0 comments Download
A LayoutTests/svg/custom/foreignObject-font-size-on-zoom-expected.html View 1 chunk +8 lines, -0 lines 0 comments Download
M Source/core/css/resolver/FontBuilder.h View 1 2 2 chunks +1 line, -2 lines 0 comments Download
M Source/core/css/resolver/FontBuilder.cpp View 1 2 2 chunks +5 lines, -10 lines 0 comments Download
M Source/core/css/resolver/StyleAdjuster.cpp View 1 1 chunk +0 lines, -5 lines 0 comments Download
M Source/core/css/resolver/StyleResolver.cpp View 1 2 3 4 5 8 chunks +18 lines, -7 lines 0 comments Download
M Source/core/dom/Document.cpp View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 29 (0 generated)
davve
This is probably as ugly as it gets, but can't figure out a better way ...
6 years, 6 months ago (2014-06-02 14:54:37 UTC) #1
fs
Can't think of any betters ways to achieve this, so unless has any aces up ...
6 years, 6 months ago (2014-06-02 16:07:10 UTC) #2
fs
On 2014/06/02 16:07:10, fs wrote: > Can't think of any betters ways to achieve this, ...
6 years, 6 months ago (2014-06-02 16:07:46 UTC) #3
pdr.
If we care about foreignObject working well, layering on these special cases will come back ...
6 years, 6 months ago (2014-06-02 19:43:24 UTC) #4
davve
Yes, setFontDirty is a hack. AFAICT, FontBuilder methods are supposed to be called during style ...
6 years, 6 months ago (2014-06-02 20:11:52 UTC) #5
rune
On 2014/06/02 20:11:52, David Vest wrote: > Yes, setFontDirty is a hack. AFAICT, FontBuilder methods ...
6 years, 6 months ago (2014-06-02 21:24:48 UTC) #6
rune
6 years, 6 months ago (2014-06-03 07:07:15 UTC) #7
davve
Making the zoom property work inside SVG fragments (including foreignObject) is probably outside the scope ...
6 years, 6 months ago (2014-06-03 09:29:40 UTC) #8
rune
On 2014/06/03 09:29:40, David Vest wrote: > Making the zoom property work inside SVG fragments ...
6 years, 6 months ago (2014-06-03 11:04:53 UTC) #9
davve
Current test failures: https://storage.googleapis.com/chromium-layout-test-archives/linux_blink_rel/10548/layout-test-results/results.html * svg/zoom/page/zoom-foreignObject.svg Not sure of the cause but it looks benign. ...
6 years, 6 months ago (2014-06-03 15:04:06 UTC) #10
pdr.
I like this approach, LGTM from my side (but please wait for an LGTM from ...
6 years, 6 months ago (2014-06-03 16:40:46 UTC) #11
rune
https://codereview.chromium.org/308123010/diff/20001/Source/core/css/resolver/StyleAdjuster.cpp File Source/core/css/resolver/StyleAdjuster.cpp (left): https://codereview.chromium.org/308123010/diff/20001/Source/core/css/resolver/StyleAdjuster.cpp#oldcode281 Source/core/css/resolver/StyleAdjuster.cpp:281: style->setEffectiveZoom(RenderStyle::initialZoom()); I don't understand how you can just remove ...
6 years, 6 months ago (2014-06-03 19:34:33 UTC) #12
davve
On 2014/06/03 19:34:33, rune wrote: > https://codereview.chromium.org/308123010/diff/20001/Source/core/css/resolver/StyleAdjuster.cpp > File Source/core/css/resolver/StyleAdjuster.cpp (left): > > https://codereview.chromium.org/308123010/diff/20001/Source/core/css/resolver/StyleAdjuster.cpp#oldcode281 > ...
6 years, 6 months ago (2014-06-04 07:05:10 UTC) #13
davve
https://codereview.chromium.org/308123010/diff/20001/Source/core/css/resolver/StyleResolver.cpp File Source/core/css/resolver/StyleResolver.cpp (right): https://codereview.chromium.org/308123010/diff/20001/Source/core/css/resolver/StyleResolver.cpp#newcode657 Source/core/css/resolver/StyleResolver.cpp:657: state.style()->setEffectiveZoom(RenderStyle::initialZoom()); If I use the StyleResolverState to set effective ...
6 years, 6 months ago (2014-06-04 08:04:25 UTC) #14
davve
Morning coffee made me realize I should of course go through the StyleResolverState to get ...
6 years, 6 months ago (2014-06-04 08:36:20 UTC) #15
rune
On 2014/06/04 07:05:10, David Vest wrote: > On 2014/06/03 19:34:33, rune wrote: > > > ...
6 years, 6 months ago (2014-06-04 08:44:48 UTC) #16
rune
Ah, I see now that you've put the reset after high priority properties are applied. ...
6 years, 6 months ago (2014-06-04 09:25:54 UTC) #17
rune
https://codereview.chromium.org/308123010/diff/40001/Source/core/css/resolver/StyleResolver.cpp File Source/core/css/resolver/StyleResolver.cpp (right): https://codereview.chromium.org/308123010/diff/40001/Source/core/css/resolver/StyleResolver.cpp#newcode1391 Source/core/css/resolver/StyleResolver.cpp:1391: } If kept here, we need to document that ...
6 years, 6 months ago (2014-06-04 10:05:20 UTC) #18
davve
https://codereview.chromium.org/308123010/diff/40001/Source/core/css/resolver/StyleResolver.cpp File Source/core/css/resolver/StyleResolver.cpp (right): https://codereview.chromium.org/308123010/diff/40001/Source/core/css/resolver/StyleResolver.cpp#newcode1391 Source/core/css/resolver/StyleResolver.cpp:1391: } On 2014/06/04 10:05:20, rune wrote: > > If ...
6 years, 6 months ago (2014-06-04 11:38:36 UTC) #19
davve
PTAL https://codereview.chromium.org/308123010/diff/40001/Source/core/css/resolver/StyleResolver.cpp File Source/core/css/resolver/StyleResolver.cpp (right): https://codereview.chromium.org/308123010/diff/40001/Source/core/css/resolver/StyleResolver.cpp#newcode1391 Source/core/css/resolver/StyleResolver.cpp:1391: } On 2014/06/04 11:38:36, David Vest wrote: > ...
6 years, 6 months ago (2014-06-04 13:27:19 UTC) #20
rune
https://codereview.chromium.org/308123010/diff/40001/LayoutTests/TestExpectations File LayoutTests/TestExpectations (right): https://codereview.chromium.org/308123010/diff/40001/LayoutTests/TestExpectations#newcode1056 LayoutTests/TestExpectations:1056: crbug.com/374119 svg/zoom/text/zoom-foreignObject.svg [ NeedsManualRebaseline ] Are these still failing?
6 years, 6 months ago (2014-06-04 13:46:16 UTC) #21
rune
lgtm given that the rebaselined results are ok.
6 years, 6 months ago (2014-06-04 13:56:51 UTC) #22
davve
On 2014/06/04 13:56:51, rune wrote: > lgtm given that the rebaselined results are ok. The ...
6 years, 6 months ago (2014-06-05 07:27:28 UTC) #23
davve
The CQ bit was checked by davve@opera.com
6 years, 6 months ago (2014-06-05 09:17:29 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davve@opera.com/308123010/100001
6 years, 6 months ago (2014-06-05 09:18:13 UTC) #25
davve
The CQ bit was unchecked by davve@opera.com
6 years, 6 months ago (2014-06-05 10:51:29 UTC) #26
davve
The CQ bit was checked by davve@opera.com
6 years, 6 months ago (2014-06-05 10:53:11 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davve@opera.com/308123010/100001
6 years, 6 months ago (2014-06-05 10:54:42 UTC) #28
commit-bot: I haz the power
6 years, 6 months ago (2014-06-05 12:51:16 UTC) #29
Message was sent while issue was closed.
Change committed as 175562

Powered by Google App Engine
This is Rietveld 408576698