<rdar://problem/9835028> Font loading during layout can cause layout code to be re...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jul 2011 03:21:52 +0000 (03:21 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jul 2011 03:21:52 +0000 (03:21 +0000)
commitf7b83056b7c08f21b33b67590112bb8fa34b59d0
treef0f1ff5d9944fadb502002eb094594206bd097d8
parente78f30501e09ba7ec1d67be0731c8aa4e21b6247
<rdar://problem/9835028> Font loading during layout can cause layout code to be re-entered via resource load delegate
https://bugs.webkit.org/show_bug.cgi?id=65123

Source/WebCore:

Reviewed by Anders Carlsson and Darin Adler.

Since CSSFontFaceSource::getFontData() can get called during layout, avoid calling out to loader
code from under it, and instead defer that work using a zero-delay timer.

* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::CSSFontFaceSource):
(WebCore::CSSFontFaceSource::~CSSFontFaceSource):
(WebCore::CSSFontFaceSource::getFontData): Rather than starting the font load here, schedule
a zero-delay timer to do it.
(WebCore::CSSFontFaceSource::startLoadingTimerFired): Added. Starts loading the font if needed.
* css/CSSFontFaceSource.h:

LayoutTests:

Reviewed by Darin Adler.

Updated tests that depended on fonts loading synchronously during layout.
Unfortunately, font loading does not fire any DOM events, so in most cases
a constant timeout had to be introduced.

* fast/blockflow/broken-ideograph-small-caps.html:
* fast/css/color-leakage.html:
* fast/css/custom-font-xheight.html:
* fast/css/font-face-multiple-faces.html:
* fast/css/font-face-multiple-remote-sources.html:
* fast/css/font-face-remote.html:
* fast/css/font-face-woff.html:
* svg/W3C-SVG-1.1-SE/text-intro-09-b.svg:
* svg/W3C-SVG-1.1/fonts-elem-07-b.svg:
* svg/custom/svg-fonts-fallback.xhtml:
* svg/custom/svg-fonts-in-html.html:
* svg/custom/svg-fonts-segmented.xhtml:
* svg/custom/svg-fonts-with-no-element-reference.html:
* svg/custom/svg-fonts-without-missing-glyph.xhtml:
* svg/text/text-overflow-ellipsis-svgfont.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@91738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/blockflow/broken-ideograph-small-caps.html
LayoutTests/fast/css/color-leakage.html
LayoutTests/fast/css/custom-font-xheight.html
LayoutTests/fast/css/font-face-multiple-faces.html
LayoutTests/fast/css/font-face-multiple-remote-sources.html
LayoutTests/fast/css/font-face-remote.html
LayoutTests/fast/css/font-face-woff.html
LayoutTests/svg/W3C-SVG-1.1-SE/text-intro-09-b.svg
LayoutTests/svg/W3C-SVG-1.1/fonts-elem-07-b.svg
LayoutTests/svg/custom/svg-fonts-fallback.xhtml
LayoutTests/svg/custom/svg-fonts-in-html.html
LayoutTests/svg/custom/svg-fonts-segmented.xhtml
LayoutTests/svg/custom/svg-fonts-with-no-element-reference.html
LayoutTests/svg/custom/svg-fonts-without-missing-glyph.xhtml
LayoutTests/svg/text/text-overflow-ellipsis-svgfont.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSFontFaceSource.cpp
Source/WebCore/css/CSSFontFaceSource.h